public String getMax() { acquireSchemaReadLock(); try { return max; } finally { releaseSchemaReadLock(); } }
@Override public int hashCode() { int sh = hashCode; if (sh != 0) return sh; acquireSchemaReadLock(); try { sh = hashCode; if (sh != 0) return sh; calculateHashCode(); return hashCode; } finally { releaseSchemaReadLock(); } }
/** * Remove the index on property * * @deprecated by {@link #dropIndexes()} */ @Deprecated public void dropIndexesInternal() { dropIndexes(); }
return getLinkedClass(); case LINKEDTYPE: return getLinkedType(); case MIN: return getMin(); case MANDATORY: return isMandatory(); case READONLY: return isReadonly(); case MAX: return getMax(); case DEFAULT: return getDefaultValue(); case NAME: return getName(); case NOTNULL: return isNotNull(); case REGEXP: return getRegexp(); case TYPE: return getType(); case COLLATE: return getCollate(); case DESCRIPTION: return getDescription();
setLinkedClass(getDatabase().getMetadata().getSchema().getClass(stringValue)); break; case LINKEDTYPE: if (stringValue == null) setLinkedType(null); else setLinkedType(OType.valueOf(stringValue)); break; case MIN: setMin(stringValue); break; case MANDATORY: setMandatory(Boolean.parseBoolean(stringValue)); break; case READONLY: setReadonly(Boolean.parseBoolean(stringValue)); break; case MAX: setMax(stringValue); break; case DEFAULT: setDefaultValue(stringValue); break; case NAME: setName(stringValue); break; case NOTNULL: setNotNull(Boolean.parseBoolean(stringValue)); break;
@Override public OIndex<?> createIndex(String iType, ODocument metadata) { acquireSchemaReadLock(); try { return owner.createIndex(getFullName(), iType, null, metadata, new String[] { globalRef.getName() }); } finally { releaseSchemaReadLock(); } }
@Override public boolean equals(final Object obj) { acquireSchemaReadLock(); try { if (this == obj) return true; if (obj == null || !OProperty.class.isAssignableFrom(obj.getClass())) return false; OProperty other = (OProperty) obj; if (owner == null) { if (other.getOwnerClass() != null) return false; } else if (!owner.equals(other.getOwnerClass())) return false; return this.getName().equals(other.getName()); } finally { releaseSchemaReadLock(); } }
/** * Remove the index on property * * @deprecated Use {@link OIndexManager#dropIndex(String)} instead. */ @Deprecated public OPropertyImpl dropIndexes() { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_DELETE); acquireSchemaReadLock(); try { final OIndexManager indexManager = getDatabase().getMetadata().getIndexManager(); final ArrayList<OIndex<?>> relatedIndexes = new ArrayList<OIndex<?>>(); for (final OIndex<?> index : indexManager.getClassIndexes(owner.getName())) { final OIndexDefinition definition = index.getDefinition(); if (OCollections.indexOf(definition.getFields(), globalRef.getName(), new OCaseInsentiveComparator()) > -1) { if (definition instanceof OPropertyIndexDefinition) { relatedIndexes.add(index); } else { throw new IllegalArgumentException( "This operation applicable only for property indexes. " + index.getName() + " is " + index.getDefinition()); } } } for (final OIndex<?> index : relatedIndexes) getDatabase().getMetadata().getIndexManager().dropIndex(index.getName()); return this; } finally { releaseSchemaReadLock(); } }
OPropertyImpl.checkLinkTypeSupport(type); OPropertyImpl.checkSupportLinkedClass(type);
prop.fromStream(p); } else { prop = createPropertyInstance(p); prop.fromStream(); newProperties.put(prop.getName(), prop);
protected boolean isDistributedCommand() { return getDatabase().getStorage() instanceof OAutoshardedStorage && !((OAutoshardedStorage) getDatabase().getStorage()) .isLocalEnv(); }
@Override public OIndex<?> createIndex(OClass.INDEX_TYPE iType, ODocument metadata) { return createIndex(iType.name(), metadata); }
public void releaseSchemaWriteLock() { calculateHashCode(); owner.releaseSchemaWriteLock(); }
/** * Creates an index on this property. Indexes speed up queries but slow down insert and update operations. For massive inserts we * suggest to remove the index, make the massive insert and recreate it. * * @param iType * * @return * * @see {@link OClass#createIndex(String, OClass.INDEX_TYPE, String...)} instead. */ public OIndex<?> createIndex(final String iType) { acquireSchemaReadLock(); try { return owner.createIndex(getFullName(), iType, globalRef.getName()); } finally { releaseSchemaReadLock(); } }
OPropertyImpl.checkLinkTypeSupport(type); OPropertyImpl.checkSupportLinkedClass(type);
public void checkEmbedded() { if (!(getDatabase().getStorage().getUnderlying() instanceof OAbstractPaginatedStorage)) throw new OSchemaException("'Internal' schema modification methods can be used only inside of embedded database"); }
/** * Creates an index on this property. Indexes speed up queries but slow down insert and update operations. For massive inserts we * suggest to remove the index, make the massive insert and recreate it. * * @param iType One of types supported. <ul> <li>UNIQUE: Doesn't allow duplicates</li> <li>NOTUNIQUE: Allow duplicates</li> * <li>FULLTEXT: Indexes single word for full text search</li> </ul> * * @return * * @see {@link OClass#createIndex(String, OClass.INDEX_TYPE, String...)} instead. */ public OIndex<?> createIndex(final OClass.INDEX_TYPE iType) { return createIndex(iType.toString()); }
public String getRegexp() { acquireSchemaReadLock(); try { return regexp; } finally { releaseSchemaReadLock(); } }
protected void checkForDateFormat(final String iDateAsString) { if (iDateAsString != null) if (globalRef.getType() == OType.DATE) { try { getDatabase().getStorage().getConfiguration().getDateFormatInstance().parse(iDateAsString); } catch (ParseException e) { throw OException .wrapException(new OSchemaException("Invalid date format while formatting date '" + iDateAsString + "'"), e); } } else if (globalRef.getType() == OType.DATETIME) { try { getDatabase().getStorage().getConfiguration().getDateTimeFormatInstance().parse(iDateAsString); } catch (ParseException e) { throw OException .wrapException(new OSchemaException("Invalid datetime format while formatting date '" + iDateAsString + "'"), e); } } }
public OCollate getCollate() { acquireSchemaReadLock(); try { return collate; } finally { releaseSchemaReadLock(); } }