private OType getFieldType(final ODocumentEntry entry) { OType type = entry.type; if (type == null) { final OProperty prop = entry.property; if (prop != null) type = prop.getType(); } if (type == null || OType.ANY == type) type = OType.getTypeByValue(entry.value); return type; }
@Override public boolean apply(OProperty input) { return input!=null?input.getType().isLink():false; } };
@SuppressWarnings("unchecked") @Override public <V> Component createComponent(String id, DisplayMode mode, IModel<ODocument> documentModel, IModel<OProperty> propertyModel, IModel<V> valueModel) { return createComponent(id, mode, documentModel, propertyModel, propertyModel.getObject().getType(), valueModel); }
@Override public boolean apply(OProperty input) { return input.getType().isLink(); } };
@Override protected List<OType> load() { OProperty property = propertyModel.getObject(); return property==null || property instanceof IPrototype? findAvailableOTypes(null) : findAvailableOTypes(property.getType()); }
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; }
@Override public FilterCriteriaType getFilterCriteriaType() { OProperty property = getPropertyModel().getObject(); if (property != null) { OType type = property.getType(); return type.equals(OType.LINKSET) ? FilterCriteriaType.LINKSET : FilterCriteriaType.LINKLIST; } return FilterCriteriaType.LINKLIST; }
private OType determineType(ODocument doc, String fieldName) { OType type = null; final OClass cls = ODocumentInternal.getImmutableSchemaClass(doc); if (cls != null) { final OProperty prop = cls.getProperty(fieldName); if (prop != null) type = prop.getType(); } return type; }
private void updateFieldToStore(OIndexDefinition indexDefinition) { List<String> fields = indexDefinition.getFields(); for (String field : fields) { OProperty property = indexClass.getProperty(field); if (property.getType().isEmbedded() && property.getLinkedType() != null) { fieldsToStore.put(field, true); } else { fieldsToStore.put(field, false); } } }
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 + "'"); } } }
@Override @SuppressWarnings("unchecked") public FormComponent<?> createFilterComponent(IModel<?> model) { if (getPropertyModel().getObject().getType() == OType.BOOLEAN) { return new BooleanFilterPanel(getFilterId(), (IModel<Boolean>) model); } return super.createFilterComponent(model); }
public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException { database.activateOnCurrentThread(); OClass aClass = database.getMetadata().getSchema().getClass(table); aClass.declaredProperties().stream().forEach(p -> p.getType()); return getEmptyResultSet(); }
protected ValidationError newValidationError(String variation, Object... params) { ValidationError error = new ValidationError(this, variation); error.setVariable("property", getProperty().getFullName()); error.setVariable("type", getProperty().getType()); for (int i = 0; i < params.length; i += 2) { error.setVariable(params[i].toString(), params[i + 1]); } return error; }
private void checkCollectionIndex(OIndexDefinition indexDefinition) { List<String> fields = indexDefinition.getFields(); OClass aClass = getDatabase().getMetadata().getSchema().getClass(indexDefinition.getClassName()); for (String field : fields) { OProperty property = aClass.getProperty(field); if (property.getType().isEmbedded() && property.getLinkedType() != null) { collectionFields.put(field, true); } else { collectionFields.put(field, false); } } }
private void checkCollectionIndex(OIndexDefinition indexDefinition) { List<String> fields = indexDefinition.getFields(); OClass aClass = getDatabase().getMetadata().getSchema().getClass(indexDefinition.getClassName()); for (String field : fields) { OProperty property = aClass.getProperty(field); if (property.getType().isEmbedded() && property.getLinkedType() != null) { collectionFields.put(field, true); } else { collectionFields.put(field, false); } } }
protected static void validateType(final OProperty p, final Object value) { if (value != null) if (OType.convert(value, p.getLinkedType().getDefaultJavaType()) == null) throw new OValidationException( "The field '" + p.getFullName() + "' has been declared as " + p.getType() + " of type '" + p.getLinkedType() + "' but the value is " + value); }
@Override public void setValue(Object object, Object value, PropertyResolverConverter converter) { ODocument doc = toODocument(object); if(value!=null && ! OType.isSimpleType(value)) { //Try to convert if type is not simple OClass schemaClass = doc.getSchemaClass(); OProperty property = schemaClass.getProperty(exp); if(property!=null) { value = converter.convert(value, property.getType().getDefaultJavaType()); } } doc.field(exp, value); }
@Override protected OProperty createInstance(OProperty proxy) { OSchema schema = OrientDbWebSession.get().getDatabase().getMetadata().getSchema(); OClass oClass = schema.getClass(className); return oClass.createProperty(proxy.getName(), proxy.getType()); }
@Override protected OProperty createInstance(OProperty proxy) { OSchema schema = OrientDbWebSession.get().getDatabase().getMetadata().getSchema(); OClass oClass = schema.getClass(className); return oClass.createProperty(proxy.getName(), proxy.getType()); }