@Override public Optional<OClass> getSchemaType() { return Optional.ofNullable(getSchemaClass()); }
@Override public Optional<OClass> getSchemaType() { if (element == null) { return Optional.ofNullable(lightweightEdgeType); } return Optional.ofNullable(element.getSchemaClass()); }
@Override public OClass getOClass() { ODocument doc = ODocumentPage.this.getModelObject(); return doc!=null?doc.getSchemaClass() : null; } });
@Override protected ODocument lookupDashboardDocument(String domain, String tab, IModel<ODocument> model) { return dashboardManager.getExistingDashboard(domain, tab, model, model.getObject().getSchemaClass()); }
@Override public boolean isVertex() { if (this instanceof OVertex) return true; OClass type = this.getSchemaClass(); if (type == null) { return false; } return type.isVertexType(); }
@Override public RequiredOrientResource[] getRequiredResources() { return OSecurityHelper.requireOClass(documentmodel.getObject().getSchemaClass(), OrientPermission.UPDATE); }
@Override public boolean isEdge() { if (this instanceof OEdge) return true; OClass type = this.getSchemaClass(); if (type == null) { return false; } return type.isEdgeType(); }
@Override public boolean isSupportedMethod(IMethodContext dataObject) { IModel<?> model = dataObject.getDisplayObjectModel(); if (model!=null && model.getObject()!=null && model.getObject() instanceof ODocument){ return ((ODocument) (model.getObject())).getSchemaClass().isSubClassOf(this.filterData); } return false; }
private static void deleteEdgeIfAny(final OIdentifiable iRecord) { if (iRecord != null) { final ODocument doc = iRecord.getRecord(); if (doc != null && doc.getSchemaClass() != null && doc.getSchemaClass().isSubClassOf(OrientEdge.CLASS_NAME)) // DELETE THE EDGE RECORD TOO doc.delete(); } }
@Override public List<String> getTabs() { List<String> tabs = oClassIntrospector.listTabs(getModelObject().getSchemaClass()); List<String> widgetsTabs = super.getTabs(); if(widgetsTabs!=null) { for(String widgetTab: widgetsTabs) { if(!tabs.contains(widgetTab)) tabs.add(widgetTab); } } return tabs; }
public <T> T getProperty(final String key) { if (key == null) return null; if (key.equals("_class")) return (T) getRecord().getSchemaClass().getName(); else if (key.equals("_version")) return (T) new Integer(getRecord().getVersion()); else if (key.equals("_rid")) return (T) rawElement.getIdentity().toString(); return getRecord().field(key); }
/** * (Blueprints Extension) Returns the Vertex type as OrientVertexType object. */ @Override public OrientVertexType getType() { final OrientBaseGraph graph = getGraph(); return new OrientVertexType(graph, getRecord().getSchemaClass()); }
public ORole getRole(final OIdentifiable iRole) { final ODocument doc = iRole.getRecord(); if (doc != null) { OClass clazz = doc.getSchemaClass(); if (clazz != null && clazz.isSubClassOf("ORole")) { return new ORole(doc); } } return null; }
protected void checkClass() { // FORCE EARLY UNMARSHALLING final ODocument doc = getRecord(); doc.deserializeFields(); final OClass cls = doc.getSchemaClass(); if (cls == null || !cls.isSubClassOf(getBaseClassName())) throw new IllegalArgumentException("The document received is not a " + getElementType() + ". Found class '" + cls + "'"); }
@Override protected List<OProperty> load() { return oClassIntrospector.listProperties(getModelObject().getSchemaClass(), getDashboardPanel().getTab(), false); } };
@Override public RecordId getId() { session.checkOpen(); checkPersistent(); return session.getRecordId(document.getSchemaClass(), document.getIdentity()); }
@Override public ODocument storeDashboard() { ODocument doc = super.storeDashboard(); doc.field(OWidgetsModule.OPROPERTY_CLASS, getModelObject().getSchemaClass().getName()); doc.save(); return doc; } };
private OScheduledEvent createRestorePasswordSchedulerEvent(ODatabaseDocument db, OrienteerUser user, String eventName) { OProperty property = user.getDocument().getSchemaClass().getProperty(OrienteerUser.PROP_RESTORE_ID); OFunction fun = db.getMetadata().getFunctionLibrary().getFunction(OrienteerUsersModule.FUN_REMOVE_RESTORE_ID); long timeout = Long.parseLong(OrienteerUsersModule.REMOVE_SCHEDULE_START_TIMEOUT.getValue(property)); return new OScheduledEventBuilder() .setName(eventName) .setFunction(fun) .setArguments(createFunArguments(user, timeout, eventName)) .setRule(OrienteerUsersModule.REMOVE_CRON_RULE.getValue(property)) .setStartTime(new Date(System.currentTimeMillis() + timeout)).build(); }
@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 void buildDashboard() { super.buildDashboard(); //addWidget(ODocumentPropertiesWidget.WIDGET_TYPE_ID); //It will be added automatically! List<? extends OProperty> properties = oClassIntrospector.listProperties(getModelObject().getSchemaClass(), getTab(), true); ODocument widgetDoc; for (OProperty oProperty : properties) { widgetDoc = dashboardManager.createWidgetDocument(ExtendedVisualizerWidget.class); widgetDoc.field("property", oProperty.getName()); addWidget(ExtendedVisualizerWidget.WIDGET_TYPE_ID, widgetDoc); } }