/** * This method works only for case when all inherited entities bound to same DbEntity * if this will ever change some additional checks should be performed. */ private void filterInheritedEntities(Collection<ObjEntity> entities) { // entities.removeIf(c -> c.getSuperEntity() != null); Iterator<ObjEntity> it = entities.iterator(); while(it.hasNext()) { if(it.next().getSuperEntity() != null) { it.remove(); } } }
/** * Returns a fully-qualified name of the super class of the DataObject class. This * value is used as a hint for class generation. If the entity inherits from another * entity, a superclass is the class of that entity. */ public String getSuperClassName() { ObjEntity superEntity = getSuperEntity(); return (superEntity != null) ? superEntity.getClassName() : superClassName; }
/** * Returns a fully-qualified name of the super class of the DataObject * class. This value is used as a hint for class generation. If the entity * inherits from another entity, a superclass is the class of that entity. */ public String getSuperClassName() { ObjEntity superEntity = getSuperEntity(); return (superEntity != null) ? superEntity.getClassName() : superClassName; }
/** * @return ObjEntities mapped to current DbEntity excluding inherited */ public Collection<ObjEntity> getMappedObjEntities() { Collection<ObjEntity> entities = entity.mappedObjEntities(); Iterator<ObjEntity> iterator = entities.iterator(); while(iterator.hasNext()) { if(iterator.next().getSuperEntity() != null) { iterator.remove(); } } return entities; }
/** * Returns a fully-qualified name of the client-side super class of the * DataObject class. This value is used as a hint for class generation. If * the entity inherits from another entity, a superclass is the class of * that entity. * * @since 1.2 */ public String getClientSuperClassName() { ObjEntity superEntity = getSuperEntity(); return (superEntity != null) ? superEntity.getClientClassName() : clientSuperClassName; }
/** * Returns a fully-qualified name of the client-side super class of the DataObject * class. This value is used as a hint for class generation. If the entity inherits * from another entity, a superclass is the class of that entity. * * @since 1.2 */ public String getClientSuperClassName() { ObjEntity superEntity = getSuperEntity(); return (superEntity != null) ? superEntity.getClientClassName() : clientSuperClassName; }
/** * Recursively appends all relationships in the entity inheritance hierarchy. */ final void appendRelationships(Map map) { map.putAll(super.getRelationshipMap()); ObjEntity superEntity = getSuperEntity(); if (superEntity != null) { superEntity.appendRelationships(map); } }
/** * Recursively appends all attributes in the entity inheritance hierarchy. */ final void appendAttributes(Map map) { map.putAll(super.getAttributeMap()); ObjEntity superEntity = getSuperEntity(); if (superEntity != null) { superEntity.appendAttributes(map); } }
/** * Recursively appends all relationships in the entity inheritance * hierarchy. */ final void appendRelationships(Map<String, ObjRelationship> map) { map.putAll(getRelationshipMapInternal()); ObjEntity superEntity = getSuperEntity(); if (superEntity != null) { superEntity.appendRelationships(map); } }
@Override protected Entity getEntity() { ObjEntity objEntity = getProjectController().getCurrentObjEntity(); if (objEntity == null) { return null; } return objEntity.getSuperEntity(); } }
public Collection<ObjRelationship> allRelationships() { if (subentities == null) { return entity.getRelationships(); } Collection<ObjRelationship> c = new ArrayList<>(); appendDeclaredRelationships(c); // add base relationships if any ObjEntity superEntity = entity.getSuperEntity(); if (superEntity != null) { c.addAll(superEntity.getRelationships()); } return c; }
public Collection<ObjAttribute> allAttributes() { if (subentities == null) { return entity.getAttributes(); } Collection<ObjAttribute> c = new ArrayList<>(); appendDeclaredAttributes(c); // add base attributes if any ObjEntity superEntity = entity.getSuperEntity(); if (superEntity != null) { c.addAll(superEntity.getAttributes()); } return c; }
public Collection allAttributes() { if (subentities == null) { return entity.getAttributes(); } Collection c = new ArrayList(); appendDeclaredAttributes(c); // add base attributes if any ObjEntity superEntity = entity.getSuperEntity(); if (superEntity != null) { c.addAll(superEntity.getAttributes()); } return c; }
/** * Returns true if the entity or its super entities have a limiting * qualifier. */ private boolean isQualifiedEntity(ObjEntity entity) { if (entity.getDeclaredQualifier() != null) { return true; } entity = entity.getSuperEntity(); if (entity == null) { return false; } return isQualifiedEntity(entity); }
/** * Returns a named attribute that either belongs to this ObjEntity or is inherited. * Returns null if no matching attribute is found. */ public Attribute getAttribute(String name) { Attribute attribute = super.getAttribute(name); if (attribute != null) { return attribute; } if (superEntityName == null) { return null; } ObjEntity superEntity = getSuperEntity(); return (superEntity != null) ? superEntity.getAttribute(name) : null; }
public Collection allRelationships() { if (subentities == null) { return entity.getRelationships(); } Collection c = new ArrayList(); appendDeclaredRelationships(c); // add base relationships if any ObjEntity superEntity = entity.getSuperEntity(); if (superEntity != null) { c.addAll(superEntity.getRelationships()); } return c; }
/** * Returns a DbEntity associated with this ObjEntity. */ public DbEntity getDbEntity() { // since 1.2 - allow overriding DbEntity in the inheritance hierarchy... if (dbEntityName != null) { return getNonNullNamespace().getDbEntity(dbEntityName); } ObjEntity superEntity = getSuperEntity(); if (superEntity != null) { return superEntity.getDbEntity(); } return null; }
/** * Returns a DbEntity associated with this ObjEntity. */ public DbEntity getDbEntity() { // since 1.2 - allow overriding DbEntity in the inheritance hierarchy... if (dbEntityName != null) { return getNonNullNamespace().getDbEntity(dbEntityName); } ObjEntity superEntity = getSuperEntity(); if (superEntity != null) { return superEntity.getDbEntity(); } return null; }
private void removeShadowAttributes(Project project) { DataChannelDescriptor rootNode = (DataChannelDescriptor) project.getRootNode(); for (DataMap dataMap : rootNode.getDataMaps()) { // if objEntity has super entity, then checks it // for duplicated attributes for (ObjEntity objEntity : dataMap.getObjEntities()) { ObjEntity superEntity = objEntity.getSuperEntity(); if (superEntity != null) { removeShadowAttributes(objEntity, superEntity); } } } }
private void checkSuperEntityAttributes(ObjAttribute attribute, ValidationResult validationResult) { // Check there is an attribute in entity and super entity at the same time boolean selfAttribute = false; if (attribute.getEntity().getDeclaredAttribute(attribute.getName()) != null) { selfAttribute = true; } ObjEntity superEntity = attribute.getEntity().getSuperEntity(); if (selfAttribute && superEntity != null && superEntity.getAttribute(attribute.getName()) != null) { addFailure(validationResult, attribute, "'%s' and super '%s' can't have attribute '%s' together ", attribute.getEntity().getName(), superEntity.getName(), attribute.getName()); } }