@Override public OType getLinkedType() { return delegate.getLinkedType(); }
protected OType getLinkedType(ODocument document, OType type, String key) { if (type != OType.EMBEDDEDLIST && type != OType.EMBEDDEDSET && type != OType.EMBEDDEDMAP) return null; OClass immutableClass = ODocumentInternal.getImmutableSchemaClass(document); if (immutableClass != null) { OProperty prop = immutableClass.getProperty(key); if (prop != null) { return prop.getLinkedType(); } } return null; }
private OType getLinkedType(ODocument document, OType type, String key) { if (type != OType.EMBEDDEDLIST && type != OType.EMBEDDEDSET && type != OType.EMBEDDEDMAP) return null; OClass immutableClass = ODocumentInternal.getImmutableSchemaClass(document); if (immutableClass != null) { OProperty prop = immutableClass.getProperty(key); if (prop != null) { return prop.getLinkedType(); } } return null; }
private OType getLinkedType(ODocument document, OType type, String key) { if (type != OType.EMBEDDEDLIST && type != OType.EMBEDDEDSET && type != OType.EMBEDDEDMAP) return null; OClass immutableClass = ODocumentInternal.getImmutableSchemaClass(document); if (immutableClass != null) { OProperty prop = immutableClass.getProperty(key); if (prop != null) { return prop.getLinkedType(); } } return null; }
protected void validateType(final IValidatable<T> validatable, final OProperty p, final Object value) { if (value != null) if (OType.convert(value, p.getLinkedType().getDefaultJavaType()) == null) validatable.error(newValidationError("wrongtype", "expectedType", p.getLinkedType().toString())); }
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); }
protected void validateType(final IValidatable<T> validatable, final OProperty p, final Object value) { if (value != null) if (OType.convert(value, p.getLinkedType().getDefaultJavaType()) == null) validatable.error(newValidationError("wrongtype", "expectedType", p.getLinkedType().toString())); }
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); } } }
@Override protected void createFilterPanels(List<AbstractFilterPanel> filterPanels) { OProperty prop = propertyModel.getObject(); if (prop != null) { if (prop.getLinkedType() != null) { filterPanels.add(new EmbeddedCollectionContainsFilterPanel(AbstractFilterOPropertyPanel.PANEL_ID, Model.of(), id, propertyModel, DefaultVisualizer.this, manager)); } else { filterPanels.add(new EmbeddedCollectionFilterPanel(AbstractFilterOPropertyPanel.PANEL_ID, new CollectionModel<String>(), id, propertyModel, DefaultVisualizer.this, manager, true)); } } } };
/** * Set linked type to a current property * @param linkedType {@link OType} to set as a linked type * @return this helper */ public OSchemaHelper linkedType(OType linkedType) { checkOProperty(); if(!Objects.equal(linkedType, lastProperty.getLinkedType())) { lastProperty.setLinkedType(linkedType); } return this; }
public EmbeddedCollectionViewPanel(String id, final IModel<ODocument> documentModel, final IModel<OProperty> propertyModel) { super(id, new DynamicPropertyValueModel<M>(documentModel, propertyModel)); final DefaultVisualizer visualizer = DefaultVisualizer.INSTANCE; OProperty property = propertyModel.getObject(); final OType oType = property.getLinkedType()!=null?property.getLinkedType():OType.EMBEDDED; ListView<T> listView = new ListView<T>("items", new CollectionAdapterModel<T, M>(getModel())) { @Override protected void populateItem(ListItem<T> item) { item.add(visualizer.createComponent("item", DisplayMode.VIEW, documentModel, propertyModel, oType, item.getModel())); } @Override protected ListItem<T> newItem(int index, IModel<T> itemModel) { return new ListItem<T>(index, itemModel) { @Override public IMarkupFragment getMarkup(Component child) { if(child==null || !child.getId().equals("item")) return super.getMarkup(child); IMarkupFragment ret = markupProvider.provideMarkup(child); return ret!=null?ret:super.getMarkup(child); } }; } }; add(listView); }
/** * Set linked type to a current property * @param linkedType {@link OType} to set as a linked type * @return this helper */ public OSchemaHelper linkedType(OType linkedType) { checkOProperty(); if(!Objects.equal(linkedType, lastProperty.getLinkedType())) { lastProperty.setLinkedType(linkedType); } return this; }
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); } } }
@Override @SuppressWarnings("unchecked") public FormComponent<?> createFilterComponent(IModel<?> model) { OProperty property = getPropertyModel().getObject(); FormComponent<?> component; switch (property.getLinkedType()) { case BOOLEAN: component = new BooleanFilterPanel(getFilterId(), (IModel<Boolean>) model); break; case DATE: component = new BooleanFilterPanel(getFilterId(), (IModel<Boolean>) model); break; case DATETIME: component = new ODateField(getFilterId(), (IModel<Date>) model); break; default: component = new TextField<>(getFilterId(), model); } return component; }
OProperty property = propertyModel.getObject(); final DefaultVisualizer visualizer = DefaultVisualizer.INSTANCE; final OType linkedType = property.getLinkedType(); final OType oType = linkedType != null ? linkedType : (OType.LINKMAP.equals(property.getType()) ? OType.LINK :OType.ANY); IModel<Set<Map.Entry<String, V>>> entriesModel = new PropertyModel<>(getModel(), "entrySet()");
message("\nCollate..............: " + prop.getCollate()); message("\nLinked class.........: " + prop.getLinkedClass()); message("\nLinked type..........: " + prop.getLinkedType());
OProperty property = propertyModel.getObject(); final DefaultVisualizer visualizer = DefaultVisualizer.INSTANCE; final OType linkedType = property.getLinkedType(); final OType oType = linkedType != null ? linkedType : (OType.LINKMAP.equals(property.getType()) ? OType.LINK :OType.ANY); listView = new ListView<Pair<V>>("items", new PropertyModel<List<Pair<V>>>(this, "data")) {
indexType = OType.LINK; else { indexType = propertyToIndex.getLinkedType(); if (indexType == null) throw new OIndexException("Linked type was not provided." indexType = OType.LINK; } else { indexType = propertyToIndex.getLinkedType(); if (indexType == null) throw new OIndexException("Linked type was not provided."
if (property != null) { fieldType = property.getType(); linkedType = property.getLinkedType();