public OProperty getProperty(String propertyName) { acquireSchemaReadLock(); try { OProperty p = properties.get(propertyName); if (p != null) return p; for (int i = 0; i < superClasses.size() && p == null; i++) { p = superClasses.get(i).getProperty(propertyName); } return p; } finally { releaseSchemaReadLock(); } }
public List<OType> extractFieldTypes(final String[] fieldNames) { final List<OType> types = new ArrayList<OType>(fieldNames.length); for (String fieldName : fieldNames) { if (!fieldName.equals("@rid")) types.add(getProperty(decodeClassName(OIndexDefinitionFactory.extractFieldName(fieldName))).getType()); else types.add(OType.LINK); } return types; }
protected void checkParametersConflict(final OClass baseClass) { final Collection<OProperty> baseClassProperties = baseClass.properties(); for (OProperty property : baseClassProperties) { OProperty thisProperty = getProperty(property.getName()); if (thisProperty != null && !thisProperty.getType().equals(property.getType())) { throw new OSchemaException( "Cannot add base class '" + baseClass.getName() + "', because of property conflict: '" + thisProperty + "' vs '" + property + "'"); } } }
/** * Execute the ALTER PROPERTY. */ public Object execute(final Map<Object, Object> iArgs) { if (attribute == null) throw new OCommandExecutionException("Cannot execute the command because it has not yet been parsed"); final OClassImpl sourceClass = (OClassImpl) getDatabase().getMetadata().getSchema().getClass(className); if (sourceClass == null) throw new OCommandExecutionException("Source class '" + className + "' not found"); final OPropertyImpl prop = (OPropertyImpl) sourceClass.getProperty(fieldName); if (prop == null) throw new OCommandExecutionException("Property '" + className + "." + fieldName + "' not exists"); if ("null".equalsIgnoreCase(value)) prop.set(attribute, null); else prop.set(attribute, value); return null; }
throw new OCommandExecutionException("Source class '" + className + "' not found"); if (sourceClass.getProperty(propertyName.getStringValue()) == null) { if(ifExists){ return rs;