protected void setCustomInternal(final String iName, final String iValue) { acquireSchemaWriteLock(); try { checkEmbedded(); if (customFields == null) customFields = new HashMap<String, String>(); if (iValue == null || "null".equalsIgnoreCase(iValue)) customFields.remove(iName); else customFields.put(iName, iValue); } finally { releaseSchemaWriteLock(); } }
protected void clearCustomInternal() { acquireSchemaWriteLock(); try { checkEmbedded(); customFields = null; } finally { releaseSchemaWriteLock(); } }
protected void setRegexpInternal(final String regexp) { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE); acquireSchemaWriteLock(); try { this.regexp = regexp; } finally { releaseSchemaWriteLock(); } }
protected void setNotNullInternal(final boolean isNotNull) { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE); acquireSchemaWriteLock(); try { notNull = isNotNull; } finally { releaseSchemaWriteLock(); } }
protected void setLinkedClassInternal(final OClass iLinkedClass) { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE); acquireSchemaWriteLock(); try { checkEmbedded(); this.linkedClass = iLinkedClass; } finally { releaseSchemaWriteLock(); } }
protected void setDescriptionInternal(final String iDescription) { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE); acquireSchemaWriteLock(); try { checkEmbedded(); this.description = iDescription; } finally { releaseSchemaWriteLock(); } }
protected void setLinkedTypeInternal(final OType iLinkedType) { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE); acquireSchemaWriteLock(); try { checkEmbedded(); this.linkedType = iLinkedType; } finally { releaseSchemaWriteLock(); } }
protected void setDefaultValueInternal(final String defaultValue) { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE); acquireSchemaWriteLock(); try { checkEmbedded(); this.defaultValue = defaultValue; } finally { releaseSchemaWriteLock(); } }
protected void setReadonlyInternal(final boolean isReadonly) { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE); acquireSchemaWriteLock(); try { checkEmbedded(); this.readonly = isReadonly; } finally { releaseSchemaWriteLock(); } }
protected void setMandatoryInternal(final boolean isMandatory) { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE); acquireSchemaWriteLock(); try { checkEmbedded(); this.mandatory = isMandatory; } finally { releaseSchemaWriteLock(); } }
protected void setMinInternal(final String min) { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE); acquireSchemaWriteLock(); try { checkEmbedded(); checkForDateFormat(min); this.min = min; } finally { releaseSchemaWriteLock(); } }
protected void setMaxInternal(final String max) { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE); acquireSchemaWriteLock(); try { checkEmbedded(); checkForDateFormat(max); this.max = max; } finally { releaseSchemaWriteLock(); } }
/** * Change the type. It checks for compatibility between the change of type. * * @param iType */ protected void setTypeInternal(final OType iType) { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE); acquireSchemaWriteLock(); try { if (iType == globalRef.getType()) // NO CHANGES return; if (!iType.getCastable().contains(globalRef.getType())) throw new IllegalArgumentException("Cannot change property type from " + globalRef.getType() + " to " + iType); this.globalRef = owner.owner.findOrCreateGlobalProperty(this.globalRef.getName(), iType); } finally { releaseSchemaWriteLock(); } }
protected void setNameInternal(final String name) { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE); String oldName = this.globalRef.getName(); acquireSchemaWriteLock(); try { checkEmbedded(); owner.renameProperty(oldName, name); this.globalRef = owner.owner.findOrCreateGlobalProperty(name, this.globalRef.getType()); } finally { releaseSchemaWriteLock(); } owner.firePropertyNameMigration(getDatabase(), oldName, name, this.globalRef.getType()); }
public void clearCustom() { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE); acquireSchemaWriteLock(); try { final ODatabaseDocumentInternal database = getDatabase(); final OStorage storage = database.getStorage(); final String cmd = String.format("alter property %s custom clear", getFullNameQuoted()); if (isDistributedCommand()) { final OCommandSQL commandSQL = new OCommandSQL(cmd); commandSQL.addExcludedNode(((OAutoshardedStorage) storage).getNodeId()); database.command(commandSQL).execute(); clearCustomInternal(); } else clearCustomInternal(); } finally { releaseSchemaWriteLock(); } }
public OPropertyImpl setNotNull(final boolean isNotNull) { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE); acquireSchemaWriteLock(); try { final ODatabaseDocumentInternal database = getDatabase(); final OStorage storage = database.getStorage(); if (isDistributedCommand()) { final String cmd = String.format("alter property %s notnull %s", getFullNameQuoted(), isNotNull); final OCommandSQL commandSQL = new OCommandSQL(cmd); commandSQL.addExcludedNode(((OAutoshardedStorage) storage).getNodeId()); database.command(commandSQL).execute(); setNotNullInternal(isNotNull); } else setNotNullInternal(isNotNull); } finally { releaseSchemaWriteLock(); } return this; }
public OPropertyImpl setReadonly(final boolean isReadonly) { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE); acquireSchemaWriteLock(); try { final ODatabaseDocumentInternal database = getDatabase(); final OStorage storage = database.getStorage(); if (isDistributedCommand()) { final String cmd = String.format("alter property %s readonly %s", getFullNameQuoted(), isReadonly); final OCommandSQL commandSQL = new OCommandSQL(cmd); commandSQL.addExcludedNode(((OAutoshardedStorage) storage).getNodeId()); database.command(commandSQL).execute(); setReadonlyInternal(isReadonly); } else setReadonlyInternal(isReadonly); } finally { releaseSchemaWriteLock(); } return this; }
public OPropertyImpl setCustom(final String name, final String value) { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE); acquireSchemaWriteLock(); try { final String cmd = String.format("alter property %s custom `%s`=%s", getFullNameQuoted(), name, quoteString(value)); final ODatabaseDocumentInternal database = getDatabase(); final OStorage storage = database.getStorage(); if (isDistributedCommand()) { final OCommandSQL commandSQL = new OCommandSQL(cmd); commandSQL.addExcludedNode(((OAutoshardedStorage) storage).getNodeId()); database.command(commandSQL).execute(); setCustomInternal(name, value); } else setCustomInternal(name, value); } finally { releaseSchemaWriteLock(); } return this; }
public OPropertyImpl setMax(final String max) { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE); acquireSchemaWriteLock(); try { final ODatabaseDocumentInternal database = getDatabase(); final OStorage storage = database.getStorage(); if (isDistributedCommand()) { final String cmd = String.format("alter property %s max %s", getFullNameQuoted(), quoteString(max)); final OCommandSQL commandSQL = new OCommandSQL(cmd); commandSQL.addExcludedNode(((OAutoshardedStorage) storage).getNodeId()); database.command(commandSQL).execute(); setMaxInternal(max); } else setMaxInternal(max); } finally { releaseSchemaWriteLock(); } return this; }
public OPropertyImpl setMin(final String min) { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE); acquireSchemaWriteLock(); try { final ODatabaseDocumentInternal database = getDatabase(); final OStorage storage = database.getStorage(); if (isDistributedCommand()) { final String cmd = String.format("alter property %s min %s", getFullNameQuoted(), quoteString(min)); final OCommandSQL commandSQL = new OCommandSQL(cmd); commandSQL.addExcludedNode(((OAutoshardedStorage) storage).getNodeId()); database.command(commandSQL).execute(); setMinInternal(min); } else setMinInternal(min); } finally { releaseSchemaWriteLock(); } return this; }