@Override public String getNewName() { return (attribute != null) ? attribute.getName() : null; } }
/** * Changes the name of the attribute and all references to this attribute. */ public static void setAttributeName(Attribute attribute, String newName) { String oldName = attribute.getName(); attribute.setName(newName); Entity entity = attribute.getEntity(); if (entity != null) { entity.removeAttribute(oldName); entity.addAttribute(attribute); } }
public void setParent(Object parent) { if (parent != null && !(parent instanceof Entity)) { throw new IllegalArgumentException("Expected null or Entity, got: " + parent); } setEntity((Entity) parent); } }
/** * Adds new attribute to the entity, setting its parent entity to be this object. If * attribute has no name, IllegalArgumentException is thrown. */ public void addAttribute(Attribute attribute) { if (attribute.getName() == null) { throw new IllegalArgumentException("Attempt to insert unnamed attribute."); } // block overrides // TODO: change method signature to return replaced attribute and make sure the Modeler handles it... Object existingAttribute = attributes.get(attribute.getName()); if (existingAttribute != null) { if (existingAttribute == attribute) { return; } else { throw new IllegalArgumentException("An attempt to override attribute '" + attribute.getName() + "'"); } } // Check that there aren't any relationships with the same name as the given // attribute. Object existingRelationship = relationships.get(attribute.getName()); if (existingRelationship != null) { throw new IllegalArgumentException( "Attribute name conflict with existing relationship '" + attribute.getName() + "'"); } attributes.put(attribute.getName(), attribute); attribute.setEntity(this); }
@Override public ObjEntity getEntity() { return (ObjEntity) super.getEntity(); }
/** * Returns <code>true</code> if path contains an Entity object. */ @Override public boolean enableForPath(ConfigurationNode object) { if (object == null) { return false; } if (object instanceof Attribute) { return ((Attribute) object).getParent() != null && ((Attribute) object).getParent() instanceof Entity; } return false; } }
if (attribute.getName() == null) { throw new IllegalArgumentException("Attempt to insert unnamed attribute."); Object existingAttribute = attributes.get(attribute.getName()); if (existingAttribute != null) { if (existingAttribute == attribute) { + attribute.getName()); Object existingRelationship = relationships.get(attribute.getName()); if (existingRelationship != null) { throw new IllegalArgumentException( "Attribute name conflict with existing relationship '" + attribute.getName()); attributes.put(attribute.getName(), attribute); attribute.setEntity(this);
private int getWeight(Attribute a) { return a.getEntity() == entity ? 1 : -1; } }
public String getNewName() { return (attribute != null) ? attribute.getName() : null; } }
public Object getParent() { return getEntity(); }
public void setParent(Object parent) { if (parent != null && !(parent instanceof Entity)) { throw new IllegalArgumentException("Expected null or Entity, got: " + parent); } setEntity((Entity) parent); } }
public String getName() { return attribute.getName(); }
@Override public DbEntity getEntity() { return (DbEntity) super.getEntity(); }
private Set<String> upperCaseEntityNames(Collection<? extends Attribute> attributes) { Set<String> names = new HashSet<String>(); for (Attribute attr : attributes) { names.add(attr.getName().toUpperCase()); } return names; } }
public Object getParent() { return getEntity(); }
private void appendSimpleProperties(Map dbDiff) { // populate changed columns if (currentPropertyDiff != null) { Iterator it = currentPropertyDiff.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); ObjAttribute attribute = (ObjAttribute) objEntity.getAttribute(entry .getKey() .toString()); // this takes care of the flattened attributes, as 'getDbAttributeName' // returns the last path component... Attribute dbAttribute = dbEntity.getAttribute(attribute .getDbAttributeName()); dbDiff.put(dbAttribute.getName(), entry.getValue()); } } }
/** * Constructor for AttributeErrorMsg. * * @param result */ public AttributeErrorMsg(ValidationFailure result) { super(result); Object object = result.getSource(); attribute = (Attribute) object; entity = attribute.getEntity(); map = entity.getDataMap(); domain = (DataChannelDescriptor) Application .getInstance() .getProject() .getRootNode(); }
/** * * @since 4.0 */ public void updateAttribute(Attribute attribute) { removeAttribute(attribute.getName()); addAttribute(attribute); }
Entity entity; if (searchResultEntry.getObject() instanceof Attribute) { map = ((Attribute) searchResultEntry.getObject()).getEntity().getDataMap(); entity = ((Attribute) searchResultEntry.getObject()).getEntity(); } else { map = ((Relationship) searchResultEntry.getObject()).getSourceEntity().getDataMap();
/** * Creates label for this cell */ String createLabel() { Entity entity = fetchEntity(); StringBuilder label = new StringBuilder("<html><center><u><b>"). append(entity.getName()).append("</b></u></center>"); for (Attribute attr : entity.getAttributes()) { if (isPrimary(attr)) { label.append("<br><i>").append(attr.getName()).append("</i>"); } } for (Attribute attr : entity.getAttributes()) { if (!isPrimary(attr)) { label.append("<br>").append(attr.getName()); } } return label.toString(); }