private void createSignatureType(OSchema schema) { OClass signatures = schema.createClass("Signatures"); signatures.createProperty(String.valueOf(DocumentAttributes.SHA1), OType.STRING).setNotNull(true); signatures.createIndex("sha1Idx", OClass.INDEX_TYPE.UNIQUE, DocumentAttributes.SHA1.toString()); }
private void createDocType(final OSchema schema, final String docType) { logger.debug("Create document class '{}'", docType); OClass page = schema.createClass(docType); // Primary key String attribName = DocumentAttributes.SOURCE_URI.toString(); page.createProperty(attribName, OType.STRING).setNotNull(true); page.createIndex(docType + "sourceUriIndex", OClass.INDEX_TYPE.UNIQUE, attribName); attribName = DocumentAttributes.SHA1.toString(); page.createProperty(attribName, OType.STRING).setNotNull(true); page.createIndex(docType + "sha1Index", OClass.INDEX_TYPE.NOTUNIQUE, attribName); attribName = DocumentAttributes.CACHED.toString(); page.createProperty(attribName, OType.BOOLEAN).setNotNull(true); page.createIndex(docType + "cachedIndex", OClass.INDEX_TYPE.NOTUNIQUE, attribName); attribName = DocumentAttributes.RENDERED.toString(); page.createProperty(attribName, OType.BOOLEAN).setNotNull(true); page.createIndex(docType + "renderedIndex", OClass.INDEX_TYPE.NOTUNIQUE, attribName); attribName = DocumentAttributes.STATUS.toString(); page.createProperty(attribName, OType.STRING).setNotNull(true); page.createIndex(docType + "statusIndex", OClass.INDEX_TYPE.NOTUNIQUE, attribName); }
@Override public OProperty setNotNull(final boolean iNotNull) { delegate.setNotNull(iNotNull); return this; }
/** * Mark last property not null flag * @param value value of not null flag * @return this helper */ public OSchemaHelper notNull(boolean value) { checkOProperty(); lastProperty.setNotNull(value); return this; }
/** * Mark last property not null flag * @param value value of not null flag * @return this helper */ public OSchemaHelper notNull(boolean value) { checkOProperty(); lastProperty.setNotNull(value); return this; }
@Override protected void defineType(final OClass type) { type.createProperty(P_NAME, OType.STRING).setNotNull(true); type.createProperty(P_TYPE, OType.STRING).setNotNull(true); type.createProperty(P_CONTENT, OType.STRING).setNotNull(true); //ensure name is unique as it serves as the ID for a script type.createIndex(I_NAME, INDEX_TYPE.UNIQUE, P_NAME); }
@Override protected void defineType(final OClass type) { type.createProperty(P_ENABLED, OType.BOOLEAN) .setMandatory(true) .setNotNull(true); type.createProperty(P_USER_ID, OType.STRING) .setNotNull(true); type.createProperty(P_REALM_NAME, OType.STRING) .setNotNull(true); }
@Override protected void defineType(final OClass type) { type.createProperty(P_USER_ID, OType.STRING) .setNotNull(true); type.createProperty(P_SOURCE, OType.STRING) .setNotNull(true); type.createProperty(P_ROLES, OType.EMBEDDEDSET); type.createIndex(I_USER_ID_SOURCE, INDEX_TYPE.UNIQUE, P_USER_ID, P_SOURCE); }
@Override protected void defineType(final OClass type) { type.createProperty(P_REPOSITORY_NAME, OType.STRING) .setMandatory(true) .setNotNull(true); type.createProperty(P_ATTRIBUTES, OType.EMBEDDEDMAP) .setNotNull(true); type.createIndex(I_REPOSITORY_NAME, INDEX_TYPE.UNIQUE, P_REPOSITORY_NAME); }
@Override protected void defineType(final OClass type) { type.createProperty(P_ID, OType.STRING) .setMandatory(true) .setNotNull(true); type.createProperty(P_ALIAS, OType.STRING) .setMandatory(false) .setNotNull(false); }
@Override protected void defineType(final OClass type) { type.createProperty(P_NAME, OType.STRING).setMandatory(true).setMax(MAX_NAME_LENGTH).setNotNull(true); type.createProperty(P_NOTES, OType.STRING).setMandatory(false).setNotNull(false); type.createProperty(P_FORMAT, OType.STRING).setMandatory(true).setNotNull(true); type.createProperty(P_MODE, OType.STRING).setMandatory(true).setNotNull(true); type.createProperty(P_CRITERIA, OType.EMBEDDEDMAP).setMandatory(true).setNotNull(true); type.createIndex(I_NAME, INDEX_TYPE.UNIQUE, P_NAME); type.createIndex(I_FORMAT, INDEX_TYPE.NOTUNIQUE, P_FORMAT); }
private void createSignatureType(OSchema schema) { OClass signatures = schema.createClass("Signatures"); signatures.createProperty(String.valueOf(DocumentAttributes.SHA1), OType.STRING).setNotNull(true); signatures.createIndex("sha1Idx", OClass.INDEX_TYPE.UNIQUE, DocumentAttributes.SHA1.toString()); }
@Override protected void defineType(final OClass type) { type.createProperty(P_ID, OType.STRING) .setNotNull(true); type.createProperty(P_NAME, OType.STRING) .setNotNull(true); type.createProperty(P_DESCRIPTION, OType.STRING); type.createProperty(P_PRIVILEGES, OType.EMBEDDEDSET); type.createProperty(P_ROLES, OType.EMBEDDEDSET); type.createIndex(I_ID, INDEX_TYPE.UNIQUE, P_ID); }
private void modifyCaseInsensitiveNameField(final OClass type) { log.info("Modifying case-insensitive name field on component"); OProperty ciNameProperty = type.getProperty(P_CI_NAME); if (!ciNameProperty.isMandatory()) { ciNameProperty.setMandatory(true); } if (!ciNameProperty.isNotNull()) { ciNameProperty.setNotNull(true); } }
@Override protected void defineType(final OClass type) { type.createProperty(P_NODE_ID, OType.STRING) .setCollate(new OCaseInsensitiveCollate()) .setMandatory(true) .setNotNull(true); type.createProperty(P_LAST_HEALTHCHECK, OType.DATETIME) .setMandatory(true) .setNotNull(true); type.createIndex(I_NODE_ID, INDEX_TYPE.UNIQUE, P_NODE_ID); }
private void createCaseInsensitiveNameField(final OClass type) { log.info("Creating case-insensitive name field on component"); if (!type.existsProperty(P_CI_NAME)) { type.createProperty(P_CI_NAME, OType.STRING) .setCollate(new OCaseInsensitiveCollate()) .setMandatory(false) .setNotNull(false); } }
@Override protected void defineType(final OClass type) { type.createProperty(P_BUCKET, OType.LINK, bucketEntityAdapter.getSchemaType()).setMandatory(true).setNotNull(true); type.createProperty(P_FORMAT, OType.STRING).setMandatory(true).setNotNull(true); type.createProperty(P_LAST_UPDATED, OType.DATETIME); type.createProperty(P_ATTRIBUTES, OType.EMBEDDEDMAP); }
@Override protected void defineType(final OClass type) { type.createProperty(P_REPOSITORY_NAME, OType.STRING).setMandatory(true).setNotNull(true); type.createProperty(P_PARENT_PATH, OType.STRING).setMandatory(true).setNotNull(true); type.createProperty(P_NAME, OType.STRING).setMandatory(true).setNotNull(true); type.createProperty(P_COMPONENT_ID, OType.LINK, componentEntityAdapter.getSchemaType()); type.createProperty(P_ASSET_ID, OType.LINK, assetEntityAdapter.getSchemaType()); type.createProperty(P_ASSET_NAME_LOWERCASE, OType.STRING); }
public void create(ODatabaseDocumentInternal database) { if (database.getMetadata().getSchema().existsClass(OScheduledEvent.CLASS_NAME)) return; final OClass f = database.getMetadata().getSchema().createClass(OScheduledEvent.CLASS_NAME); f.createProperty(OScheduledEvent.PROP_NAME, OType.STRING, (OType) null, true).setMandatory(true).setNotNull(true); f.createProperty(OScheduledEvent.PROP_RULE, OType.STRING, (OType) null, true).setMandatory(true).setNotNull(true); f.createProperty(OScheduledEvent.PROP_ARGUMENTS, OType.EMBEDDEDMAP, (OType) null, true); f.createProperty(OScheduledEvent.PROP_STATUS, OType.STRING, (OType) null, true); f.createProperty(OScheduledEvent.PROP_FUNC, OType.LINK, database.getMetadata().getSchema().getClass(OFunction.CLASS_NAME), true) .setMandatory(true).setNotNull(true); f.createProperty(OScheduledEvent.PROP_STARTTIME, OType.DATETIME, (OType) null, true); }
private void createProperty(OClass oClass, FieldDefinition field) { OProperty oProperty = oClass.createProperty(field.getName(), OTYPES.get(field.getType())); if (field.isNotNull()) { oProperty.setNotNull(true); oProperty.setMandatory(true); } if (field.isIndexed()) { final String indexName = String.format("%s.%s", oClass.getName(), field.getName()); oClass.createIndex(indexName, field.isUnique() ? INDEX_TYPE.UNIQUE : INDEX_TYPE.NOTUNIQUE, field.getName()); } }