private ObjAttribute makeObjAttribute( EmbeddableAttribute embeddableAttribute, String dbPath) { String fullName = getName() + "." + embeddableAttribute.getName(); ObjAttribute oa = new ObjAttribute( fullName, embeddableAttribute.getType(), (ObjEntity) getEntity()); oa.setDbAttributePath(dbPath); return oa; }
public DbAttribute getTarget() { if (targetName == null) { return null; } DbRelationship r = getNonNullRelationship(); DbEntity entity = r.getTargetEntity(); if (entity == null) { return null; } return entity.getAttribute(targetName); }
public AshwoodEntitySorter(Collection dataMaps) { tableComparator = new TableComparator(); dbEntityComparator = new DbEntityComparator(); objEntityComparator = new ObjEntityComparator(); setDataMaps(dataMaps); }
private String getDBAttrType(String dbAttributeName) { DbEntity currentEnt = ((ObjEntity) attr.getEntity()).getDbEntity(); if (currentEnt != null && currentEnt.getAttributes() != null && dbAttributeName != null) { DbAttribute dbAttr = (DbAttribute) currentEnt.getAttribute(dbAttributeName); if (dbAttr != null) { return TypesMapping.getSqlNameByType(dbAttr.getType()); } } return null; }
private boolean isToDependentPK(DbRelationship forwardRelationship) { for (DbJoin dbJoin : forwardRelationship.getJoins()) { if (!dbJoin.getTarget().isPrimaryKey()) { return false; } } return true; }
/** * Creates a ColumnDescriptor from stored procedure parameter. * * @since 1.2 */ public ColumnDescriptor(ProcedureParameter parameter) { this(parameter.getName(), parameter.getType()); if (parameter.getProcedure() != null) { this.procedureName = parameter.getProcedure().getName(); } }
/** Changes the name of the attribute in all places in DataMap. */ public static void setRelationshipName(Entity entity, Relationship rel, String newName) { if (rel == null || rel != entity.getRelationship(rel.getName())) { return; } entity.removeRelationship(rel.getName()); rel.setName(newName); entity.addRelationship(rel); }
/** * Returns whether this attribute is mandatory * * @see DbAttribute#isMandatory() */ public boolean isMandatory() { DbAttribute dbAttribute = getDbAttribute(); return dbAttribute == null ? false : dbAttribute.isMandatory(); }
/** * Sets the parent entity of this derived DbEntity. */ public void setParentEntity(DbEntity parentEntity) { setParentEntityName(parentEntity != null ? parentEntity.getName() : null); }
public DbAttribute getTarget() { if (targetName == null) { return null; } Relationship r = getNonNullRelationship(); Entity entity = r.getTargetEntity(); if (entity == null) { return null; } return (DbAttribute) entity.getAttribute(targetName); }
@Override public boolean isToMany() { refreshFromDeferredPath(); recalculateToManyValue(); return super.isToMany(); }
private void resetState() { DbAttribute oldAttribute = findGeneratedAttribute(); if(oldAttribute != null) { oldAttribute.setGenerated(false); } dbEntity.setPrimaryKeyGenerator(null); }
/** * Sets relationship target entity. Internally calls <code>setTargetEntityName</code>. */ public void setTargetEntity(Entity targetEntity) { if (targetEntity != null) { setTargetEntityName(targetEntity.getName()); } else { setTargetEntityName(null); } }
public ObjEntity getObjEntity(String name) { checkMappingCache(); ObjEntity result = mappingCache.getObjEntity(name); if (result == null) { // reconstruct cache just in case some of the datamaps // have changed and now contain the required information refreshMappingCache(); result = mappingCache.getObjEntity(name); } return result; }
/** * Returns a "super" entity in the entity inheritance hierarchy. * * @since 1.1 */ public ObjEntity getSuperEntity() { return (superEntityName != null) ? getNonNullNamespace().getObjEntity(superEntityName) : null; }
public ObjRelationship getReverseRelationship() { if (reverseRelationshipName == null) { return null; } Entity target = getTargetEntity(); if (target == null) { return null; } return (ObjRelationship) target.getRelationship(reverseRelationshipName); } }
/** * Adds a result set column mapping for a single object property of the root * entity. */ public void addObjectField(String attributeName, String column) { addField(new FieldResult(null, attributeName, column, false)); }
public CallbackMap() { LifecycleEvent[] events = LifecycleEvent.values(); callbacks = new CallbackDescriptor[events.length]; for (int i = 0; i < events.length; i++) { callbacks[i] = new CallbackDescriptor(events[i]); } }
/** * Returns all DbEntities. */ public Collection<DbEntity> getDbEntities() { checkMappingCache(); return mappingCache.getDbEntities(); }
/** * Adds a result set column mapping for a single DbAttribute. */ public void addDbField(String dbAttributeName, String column) { addField(new FieldResult(null, dbAttributeName, column, true)); }