@Override public void getEClassRequirements(Set<EClass> classRequirements) { classRequirements.add(reference.getEContainingClass()); }
@Override public void getEClassRequirements(Set<EClass> classRequirements) { classRequirements.add(reference.getEContainingClass()); }
private boolean isException(EReference eReference) { if (eReference.getEContainingClass().getName().contentEquals("IfcRepresentationItem") && eReference.getName().contentEquals("StyledByItem")) { return true; } return false; } }
@Override public boolean matches(IdEObject object) { if (object.eClass().isSuperTypeOf(reference.getEContainingClass())) { Object other = object.eGet(reference); if (other instanceof EList<?>) { EList<?> list = (EList<?>)other; for (Object eObject : list) { if (referencingObjects.contains(eObject)) { return true; } } return false; } else { return referencingObjects.contains(other); } } return false; } }
private int fixMisMatchInstance(Mismatch mismatch, IdEObject entityToBeFixed, IdEObject referenced) { int nrFixes = 0; for(EReference inverse: mismatch.inverse) if(inverse.getEContainingClass().isInstance(referenced)){ if(inverse.isMany()) ((EList<IdEObject>) referenced.eGet(inverse)).add(entityToBeFixed); else referenced.eSet(inverse, entityToBeFixed); nrFixes++; } return nrFixes; }
@Override public void change(Database database, DatabaseSession databaseSession) throws NotImplementedException, BimserverDatabaseException { EClass eClass = eReference.getEContainingClass(); KeyValueStore keyValueStore = database.getKeyValueStore(); for (EClass subClass : schema.getSubClasses(eClass)) {
public void addFieldDirect(String fieldName) throws QueryException { EReference feature = null; for (TypeDef typeDef : types) { if (typeDef.geteClass().getEStructuralFeature(fieldName) == null) { throw new QueryException("Class \"" + typeDef.geteClass().getName() + "\" does not have the field \"" + fieldName + "\""); } if (feature == null) { if (!(typeDef.geteClass().getEStructuralFeature(fieldName) instanceof EReference)) { throw new QueryException(fieldName + " is not a reference"); } feature = (EReference) typeDef.geteClass().getEStructuralFeature(fieldName); } else { if (feature != typeDef.geteClass().getEStructuralFeature(fieldName)) { throw new QueryException("Classes \"" + typeDef.geteClass().getName() + "\" and \"" + feature.getEContainingClass().getName() + "\" have fields with the same name, but they are not logically the same"); } } } if (fieldsDirect == null) { fieldsDirect = new ArrayList<>(); } fieldsDirect.add(feature); }
@Override public boolean matches(IdEObject object) { if (object.eClass().isSuperTypeOf(reference.getEContainingClass())) { Object other = object.eGet(reference); if (other instanceof EList<?>) { EList<?> list = (EList<?>)other; for (Object eObject : list) { // TODO Actually the first test should suffice (object id), the second should always return the same because caching of the objects should allow only 1 per database session if (eObject == referencingObject || ((IdEObject)eObject).getOid() == referencingObject.getOid()) { return true; } } return false; } else { return other == referencingObject; } } return false; } }
/** * Add the fields _after_ adding the types, because the fields will be checked against the types, all types should have the given field. * * @param fieldName * @throws QueryException */ public void addField(String fieldName) throws QueryException { EReference feature = null; for (TypeDef typeDef : types) { if (typeDef.geteClass().getEStructuralFeature(fieldName) == null) { throw new QueryException("Class \"" + typeDef.geteClass().getName() + "\" does not have the field \"" + fieldName + "\""); } if (feature == null) { if (!(typeDef.geteClass().getEStructuralFeature(fieldName) instanceof EReference)) { throw new QueryException(fieldName + " is not a reference"); } feature = (EReference) typeDef.geteClass().getEStructuralFeature(fieldName); } else { if (feature != typeDef.geteClass().getEStructuralFeature(fieldName)) { throw new QueryException("Classes \"" + typeDef.geteClass().getName() + "\" and \"" + feature.getEContainingClass().getName() + "\" have fields with the same name, but they are not logically the same"); } } } if (fields == null) { fields = new ArrayList<>(); } fields.add(feature); }
} else { throw new DeserializeException(waitingObject.getLineNumber(), "Field " + waitingObject.getEReference().getName() + " of " + waitingObject.getEReference().getEContainingClass().getName() + " cannot contain a " + eObject.eClass().getName()); } else { throw new DeserializeException(waitingObject.getLineNumber(), "Field " + waitingObject.getEReference().getName() + " of " + waitingObject.getEReference().getEContainingClass().getName() + " cannot contain a " + eObject.eClass().getName() + "/" + eObject.getOid());
private void initIsInverse(EReference eReference) { EntityDefinition entityBN = schemaDefinition.getEntityBNNoCaseConvert(upperCases.get(eReference.getEContainingClass())); if (entityBN == null) { return;
protected String getFullReferenceName(EObject semanticObject, CrossReference reference) { EReference ref = GrammarUtil.getReference(reference); String clazz = semanticObject.eClass().getName(); if (ref.getEContainingClass() != semanticObject.eClass()) clazz = ref.getEContainingClass().getName() + "(" + clazz + ")"; return clazz + "." + ref.getName(); }
if (eReference.getEContainingClass().getEPackage() == Ifc2x3tc1Package.eINSTANCE) { if (eReference == Ifc2x3tc1Package.eINSTANCE.getIfcRelContainedInSpatialStructure_RelatedElements()) { hasInverse = true; hasInverse = true; } else if (eReference.getEContainingClass().getEPackage() == Ifc4Package.eINSTANCE) { if (eReference == Ifc4Package.eINSTANCE.getIfcExternalReferenceRelationship_RelatedResourceObjects()) { hasInverse = true;
protected Predicate<Method> getPredicate(EObject context, EReference reference) { String methodName = (reference == null || reference.getEContainingClass() == null) ? "no_such_scope" : "scope_" + reference.getEContainingClass().getName() + "_" + reference.getName(); //System.out.println(methodName + " ctx " + context.eClass().getName()); return PolymorphicDispatcher.Predicates.forName(methodName, 2); }
private String getQualifiedName(EReference eReference) { return eReference.getEContainingClass().getName() + "." + eReference.getName(); }
protected Predicate<Method> getPredicate(EObject context, EReference reference) { String methodName = "scope_" + reference.getEContainingClass().getName() + "_" + reference.getName(); return PolymorphicDispatcher.Predicates.forName(methodName, 2); }
/** * @since 3.1 */ public EClassifier getOppositePropertyType(EClassifier owner, EReference property) { return ((UMLReflectionImpl) getUMLReflection()).getOCLCollectionType( property.getEContainingClass(), /* ordered */false, /* unique */false); }
public static void collectSourceCandidates(EReference eReference, Collection<EClass> concreteTypes, Map<EClass, List<EReference>> sourceCandidates, CDOPackageRegistry packageRegistry) { EClass rootClass = eReference.getEContainingClass(); collectSourceCandidates(rootClass, eReference, concreteTypes, sourceCandidates); Collection<EClass> descendentClasses = packageRegistry.getSubTypes().get(rootClass); if (descendentClasses != null) { for (EClass candidateClass : descendentClasses) { collectSourceCandidates(candidateClass, eReference, concreteTypes, sourceCandidates); } } }
for(IdEObject entityToBeFixed : getAllWithSubTypes(mismatch.forward.getEContainingClass())){ Object referenced = entityToBeFixed.eGet(mismatch.forward); if(referenced != null)
return eReference.getEOpposite(); if (eReference.getEContainingClass().getEPackage() == Ifc2x3tc1Package.eINSTANCE) { if (eStructuralFeature == Ifc2x3tc1Package.eINSTANCE.getIfcRelContainedInSpatialStructure_RelatedElements()) { if (Ifc2x3tc1Package.eINSTANCE.getIfcElement().isSuperTypeOf(eClassOfOtherEnd)) {