for (TypeDef type : include.getTypes()) { ObjectNode typeDefNode = OBJECT_MAPPER.createObjectNode(); typeDefNode.put("name", type.geteClass().getName()); typeDefNode.put("includeAllSubTypes", type.isIncludeSubTypes()); if (type.getExcluded() != null) {
sb.append(indent(indent) + "types\n"); for (TypeDef type : getTypes()) { sb.append(indent(indent + 1) + type.geteClass().getName() + ", " + type.isIncludeSubTypes() + "\n");
Set<EClass> set = new HashSet<>(); for (TypeDef typeDef : partialQuery.getTypes()) { set.add(typeDef.geteClass()); if (typeDef.isIncludeSubTypes()) { if (typeDef.hasExcludes()) { for (EClass eClass : reusable.getPackageMetaData().getAllSubClasses(typeDef.geteClass())) { if (!typeDef.excludes(eClass)) { set.add(eClass); set.addAll(reusable.getPackageMetaData().getAllSubClasses(typeDef.geteClass()));
if (packageMetaData.getEClass("IfcProduct").isSuperTypeOf(typeDef.geteClass())) { Include include = queryPart.createInclude(); applyFields(geometryFields, new TypeDef(packageMetaData.getEClass("IfcProduct"), true), include);
for (TypeDef filterClass : include.getTypes()) { if (!filterClass.geteClass().isSuperTypeOf(object.eClass())) {
sb.append(indent(indent) + "types\n"); for (TypeDef typeDef : getTypes()) { sb.append(indent(indent + 1) + typeDef.geteClass().getName() + "\n");
/** * 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); }
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); }
private boolean typeDefContains(QueryPart queryPart, EClass eClass) { for (TypeDef typeDef : queryPart.getTypes()) { if (typeDef.geteClass() == eClass) { return true; } if (typeDef.isIncludeSubTypes()) { for (EClass subType : packageMetaData.getAllSubClasses(eClass)) { if (subType == eClass && !typeDef.excludes(subType)) { return true; } } } } return false; }