public String getNewName() { return (entity != null) ? entity.getName() : null; } }
@Override public String getNewName() { return (entity != null) ? entity.getName() : null; } }
/** * Returns generated name for the DbRelationships. * For to-one case it generates name "TO_XXXX". * For to-many case it generates name "XXXX_ARRAY". */ protected String nameBase() { if (target == null) { return "untitledRel"; } String name = target.getName(); return (toMany) ? name + "_ARRAY" : "TO_" + name; } }
@Override protected EntityCellMetadata getCellMetadata(Entity e) { return new ObjEntityCellMetadata(this, e.getName()); }
private ExpressionException invalidPathException(String message, String pathComponent) { StringBuilder buffer = new StringBuilder(); buffer .append(message) .append(": [") .append(currentEntity.getName()) .append('.') .append(pathComponent) .append("]."); return new ExpressionException(buffer.toString(), path, null); }
@Override protected EntityCellMetadata getCellMetadata(Entity e) { return new DbEntityCellMetadata(this, e.getName()); }
/** * Returns qualified name (entity name + relationship name) for a * relationship */ static String getQualifiedName(Relationship rel) { return rel.getSourceEntity().getName() + "." + rel.getName(); }
/** * Sets relationship target entity. Internally calls <code>setTargetEntityName</code>. */ public void setTargetEntityName(Entity targetEntity) { if (targetEntity != null) { setTargetEntityName(targetEntity.getName()); } else { setTargetEntityName((String) null); } }
final MappingNamespace getNonNullNamespace() { MappingNamespace parent = getDataMap(); if (parent == null) { throw new CayenneRuntimeException("Entity '%s' has no parent MappingNamespace (such as DataMap)", getName()); } return parent; } }
/** * Sets relationship target entity. Internally calls <code>setTargetEntityName</code>. */ public void setTargetEntity(Entity targetEntity) { if (targetEntity != null) { setTargetEntityName(targetEntity.getName()); } else { setTargetEntityName(null); } }
final MappingNamespace getNonNullNamespace() { MappingNamespace parent = getDataMap(); if (parent == null) { throw new CayenneRuntimeException("Entity '" + getName() + "' has no parent MappingNamespace (such as DataMap)"); } return parent; } }
/** * Checks if entity name has changed, then changes map key */ protected void remapRelationship(RelationshipEvent e) { if (e.isNameChange()) { relCells.put(getQualifiedName(e.getRelationship()), relCells.remove(e.getEntity().getName() + "." + e.getOldName())); } }
@Override public String toString() { return new ToStringBuilder(this).append("name", getName()).toString(); }
private boolean display() { Entity entity = builder.getSelectedEntity(); if (entity == null) { return false; } // reusing logic from FindAction FindAction.jumpToResult(new FindAction.SearchResultEntry(entity, entity.getName())); return true; }
/** * Updates specified entity on the graph */ protected void updateEntityCell(Entity e) { DefaultGraphCell cell = entityCells.get(e.getName()); if (cell != null) { GraphConstants.setValue(cell.getAttributes(), getCellMetadata(e)); GraphConstants.setResize(cell.getAttributes(), true); Map nested = new HashMap(); nested.put(cell, cell.getAttributes()); edit(nested); } }
private void prependReversedPath(LinkedList finalPath, DbRelationship relationship) { DbRelationship revNextDBR = relationship.getReverseRelationship(); if (revNextDBR == null) { throw new CayenneRuntimeException( "Unable to find reverse DbRelationship for " + relationship.getSourceEntity().getName() + Entity.PATH_SEPARATOR + relationship.getName() + "."); } finalPath.addFirst(revNextDBR.getName()); }
public String dbRelationshipIdentifier(DbRelationship rel) { if (null == rel.getSourceEntity()) { return "<[null source entity]." + rel.getName() + ">"; } return "<" + rel.getSourceEntity().getName() + "." + rel.getName() + ">"; } }
public String objRelationshipIdentifier(ObjRelationship rel) { if (null == rel.getSourceEntity()) { return "<[null source entity]." + rel.getName() + ">"; } return "<" + rel.getSourceEntity().getName() + "." + rel.getName() + ">"; } }
protected DefaultGraphCell createEntityCell(Entity entity) { DefaultGraphCell cell = new DefaultGraphCell(getCellMetadata(entity)); GraphConstants.setResize(cell.getAttributes(), true); GraphConstants.setBorder(cell.getAttributes(), new LineBorder(Color.BLACK)); GraphConstants.setEditable(cell.getAttributes(), false); entityCells.put(entity.getName(), cell); cell.addPort(); return cell; }