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 OIndex<?> createIndex(final String iName, final INDEX_TYPE iType, final OProgressListener iProgressListener, final String... fields) { return delegate.createIndex(iName, iType, iProgressListener, fields); }
@Override public OIndex<?> createIndex(final String iName, final String iType, final OProgressListener iProgressListener, final ODocument metadata, String algorithm, String... fields) { return delegate.createIndex(iName, iType, iProgressListener, metadata, algorithm, fields); }
@Override public OIndex<?> createIndex(final String iName, final String iType, final OProgressListener iProgressListener, final ODocument metadata, String... fields) { return delegate.createIndex(iName, iType, iProgressListener, metadata, fields); }
@Override public OIndex<?> createIndex(final String iName, final INDEX_TYPE iType, final String... fields) { return delegate.createIndex(iName, iType, fields); }
@Override public OIndex<?> createIndex(final String iName, final String iType, final String... fields) { return delegate.createIndex(iName, iType, fields); }
@Override protected void defineType(final ODatabaseDocumentTx db, final OClass type) { defineType(type); // primary index that guarantees path uniqueness for nodes in a given repository type.createIndex(I_REPOSITORY_NAME_PARENT_PATH_NAME, INDEX_TYPE.UNIQUE, P_REPOSITORY_NAME, P_PARENT_PATH, P_NAME); // save space and ignore nulls because we'll never query on a null component/asset id ODocument ignoreNullValues = db.newInstance().field("ignoreNullValues", true); type.createIndex(I_COMPONENT_ID, INDEX_TYPE.NOTUNIQUE.name(), null, ignoreNullValues, new String[] { P_COMPONENT_ID }); type.createIndex(I_ASSET_ID, INDEX_TYPE.UNIQUE.name(), null, ignoreNullValues, new String[] { P_ASSET_ID }); }
@Override protected void init(OObjectDatabaseTx db, OSchema schema) { if (schema.getClass("Filter") == null) { OClass filterClass = schema.createClass("Filter"); filterClass.createProperty("type", OType.STRING); filterClass.createProperty("value", OType.STRING); filterClass.createIndex("filter.type.indices", OClass.INDEX_TYPE.FULLTEXT_HASH_INDEX, "type"); filterClass.createIndex("filter.value.indices", OClass.INDEX_TYPE.FULLTEXT_HASH_INDEX, "value"); } }
private void createComponentIndex(final ODatabaseDocumentTx db, final OClass type) { if (db.getMetadata().getIndexManager().getIndex(I_COMPONENT) == null) { type.createIndex(I_COMPONENT, INDEX_TYPE.NOTUNIQUE, AssetEntityAdapter.P_COMPONENT); } }
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_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); }
private void createBucketNameIndex() { try (ODatabaseDocumentTx db = componentDatabaseInstance.get().connect()) { if (db.getMetadata().getIndexManager().getIndex(I_BUCKET_NAME_VERSION) == null) { OSchema schema = db.getMetadata().getSchema(); OClass type = schema.getClass(COMPONENT_CLASS); if (type != null) { type.createIndex(I_BUCKET_NAME_VERSION, INDEX_TYPE.NOTUNIQUE, new String[] { P_BUCKET, P_NAME, P_VERSION }); } } } } }
@Override protected OIndex<?> createInstance(OIndex proxy) { OSchema schema = OrientDbWebSession.get().getDatabase().getMetadata().getSchema(); OClass oClass = schema.getClass(proxy.getDefinition().getClassName()); String name = proxy.getName(); List<String> fields = proxy.getDefinition().getFields(); String type = proxy.getType(); if(name==null) name=oClass.getName()+"."+fields.get(0); ODocument metadata = proxy.getMetadata(); String algorithm = proxy.getAlgorithm(); values.keySet().retainAll(RW_ATTRS); return oClass.createIndex(name, type, null, metadata, algorithm, fields.toArray(new String[0])); }
@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); }
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()); } }
@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); }
@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); }
@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); }