@Override public boolean isSubClassOf(final OClass iClass) { return delegate.isSubClassOf(iClass); }
/** * Returns true if the passed schema class (iClass) extends the current instance. * * @param clazz to check * * @return Returns true if the passed schema class extends the current instance * * @see #isSubClassOf(OClass) */ public boolean isSuperClassOf(final OClass clazz) { return clazz != null && clazz.isSubClassOf(this); }
protected final void checkVertexType(final OClass iType) { if (iType == null) throw new IllegalArgumentException("Vertex class is null"); if (!iType.isSubClassOf(OrientVertex.CLASS_NAME)) throw new IllegalArgumentException("Type error. The class " + iType + " does not extend class '" + OrientVertex.CLASS_NAME + "' and therefore cannot be considered a Vertex"); }
protected final void checkEdgeType(final OClass iType) { if (iType == null) throw new IllegalArgumentException("Edge class is null"); if (!iType.isSubClassOf(OrientEdge.CLASS_NAME)) throw new IllegalArgumentException("Type error. The class " + iType + " does not extend class '" + OrientEdge.CLASS_NAME + "' and therefore cannot be considered an Edge"); }
private static void validateGraphTypes(final String modelClass, final OClass existing, final String target) { final boolean isVertex = V.equals(target); if (isVertex || E.equals(target)) { Preconditions.checkState(!existing.isSubClassOf(isVertex ? E : V), "Model class %s can't be registered as %s type, because its already %s type", modelClass, isVertex ? VERTEX : EDGE, isVertex ? EDGE : VERTEX); } } }
protected static void checkType(final OClass iType) { if (iType == null) throw new IllegalArgumentException("Edge class is null"); if (((iType instanceof OImmutableClass) && !((OImmutableClass) iType).isEdgeType()) || !iType.isSubClassOf(CLASS_NAME)) throw new IllegalArgumentException("Type error. The class " + iType + " does not extend class '" + CLASS_NAME + "' and therefore cannot be considered an Edge"); }
protected static void checkType(final OClass iType) { if (iType == null) throw new IllegalArgumentException("Vertex class is null"); if (((iType instanceof OImmutableClass) && !((OImmutableClass) iType).isVertexType()) || !iType.isSubClassOf(CLASS_NAME)) throw new IllegalArgumentException("Type error. The class '" + iType + "' does not extend class '" + CLASS_NAME + "' and therefore cannot be considered a Vertex"); }
@Override public boolean isSupportedMethod(IMethodContext dataObject) { IModel<?> model = dataObject.getDisplayObjectModel(); if (model!=null && model.getObject()!=null && model.getObject() instanceof OClass){ return ((OClass) (model.getObject())).isSubClassOf(this.filterData); } return false; } }
@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 boolean matchesClass(OEdge edge) { if (targetClass == null) { return true; } return edge.getSchemaType().get().isSubClassOf(targetClass.getStringValue()); }
public List<ODocument> getItems(ODocument doc) { List<ODocument> items = null; if(doc!=null) { if(doc.getSchemaClass().isSubClassOf(PerspectivesModule.OCLASS_PERSPECTIVE)) { items = (List<ODocument>)doc.field("menu"); } else if(doc.getSchemaClass().isSubClassOf(PerspectivesModule.OCLASS_ITEM)) { items = (List<ODocument>)doc.field("subItems"); } } if(items!=null) items.remove(null); //Remove deleted records return items; }
@Override public boolean isSupportedMethod(IMethodContext dataObject) { OClass oclass = getOClass(dataObject); if (oclass!=null){ for (OClass oClass : getOClasses()) { if (oclass.isSubClassOf(oClass)){ return true; } } } return false; }
private boolean filterClass(String klass) { ODatabaseDocument database = getDatabase(); OSchema schema = database.getMetadata().getSchema(); OClass schemaClass = schema.getClass(klass); if (vertexStep) { return schemaClass.isSubClassOf("V"); } else { return schemaClass.isSubClassOf("E"); } }
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; }
public Set<String> getVertexIndexedKeys(final String label) { String className = labelToClassName(label, OClass.VERTEX_CLASS_NAME); OClass cls = getSchema().getClass(className); if (cls != null && cls.isSubClassOf(OClass.VERTEX_CLASS_NAME)) { return getIndexedKeys(className); } return new HashSet<String>(); }
public Set<String> getEdgeIndexedKeys(final String label) { String className = labelToClassName(label, OClass.EDGE_CLASS_NAME); OClass cls = getSchema().getClass(className); if (cls != null && cls.isSubClassOf(OClass.EDGE_CLASS_NAME)) { return getIndexedKeys(className); } return new HashSet<String>(); }
public static void setRestricted(ODatabaseDocument db, OClass oClass) { OClass restricted = db.getMetadata().getSchema().getClass("ORestricted"); if (!oClass.isSubClassOf(restricted)) { oClass.addSuperClass(restricted); Collection<OProperty> properties = restricted.properties(); oClass.properties().stream() .filter(p -> !properties.contains(p)) .filter(p -> !(boolean) CustomAttribute.HIDDEN.getValue(p)) .forEach(p -> CustomAttribute.DISPLAYABLE.setValue(p, true)); } }
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 + "'"); }
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 ODocument createWidgetDocument(IWidgetType<?> widgetType) { String oClassName = widgetType.getOClassName(); if(oClassName==null) oClassName = OCLASS_WIDGET; OClass oClass = getDatabase().getMetadata().getSchema().getClass(oClassName); if(oClass==null || !oClass.isSubClassOf(OCLASS_WIDGET)) throw new WicketRuntimeException("Wrong OClass specified for widget settings: "+oClassName); ODocument widgetDoc = new ODocument(oClass); widgetDoc.field(OPROPERTY_TYPE_ID, widgetType.getId()); return widgetDoc; }