/** * @since 1.24 */ public CayenneAgAttribute(ObjAttribute objAttribute, Class<?> type) { super(objAttribute.getName(), type); this.objAttribute = objAttribute; }
@Override public String getName() { return attribute.getName(); }
public void keyPressed(KeyEvent e) { if (!view.getAttributeName().getText().equals(attribute.getName())) { setEnabledSaveButton(); } }
public void keyReleased(KeyEvent e) { if (!view.getAttributeName().getText().equals(attribute.getName())) { setEnabledSaveButton(); } }
MutableCommitLogLogEntity setIgnoreAttributes(boolean ignore) { if (ignore) { for (ObjAttribute a : entity.getAttributes()) { this.ignoredProperties.add(a.getName()); } } return this; }
public Object transform(Object input) { return ((ObjectDiff) input).getSnapshotValue(attribute .getName()); } });
public Object transform(Object input) { return ((ObjectDiff) input).getSnapshotValue(attribute.getName()); } });
public ObjEntityViewField getFieldForObjAttribute(String objAttributeName) { for (int i = 0; i < fields.size(); i++) { ObjEntityViewField field = getField(i); if (objAttributeName.equals(field.getObjAttribute().getName())) return field; } return null; }
public void setDbAttributePath(String dbAttributePath) { this.dbAttributePath = dbAttributePath; if (isInherited()) { ((ObjEntity) entity).addAttributeOverride(getName(), dbAttributePath); } }
private List<ObjAttribute> getDuplicatedAttributes(ObjEntity superEntity) { List<ObjAttribute> result = new LinkedList<ObjAttribute>(); ObjEntity entity = mediator.getCurrentObjEntity(); for (ObjAttribute attribute : entity.getAttributes()) { if (superEntity.getAttribute(attribute.getName()) != null) { result.add(attribute); } } return result; }
public void setDuplicatedAttributes(List<ObjAttribute> attributes) { if (duplicatedAttributes == null) { duplicatedAttributes = new LinkedList<DuplicatedAttributeInfo>(); } duplicatedAttributes.clear(); for (ObjAttribute attribute : attributes) { DuplicatedAttributeInfo attributeInfo = new DuplicatedAttributeInfo(attribute.getName(), attribute.getType(), superEntity.getAttribute(attribute.getName()).getType(), DELETE_ACTION); duplicatedAttributes.add(attributeInfo); } attributesTable.setModel(new DuplicatedAttributeTableModel(getMediator(), this, duplicatedAttributes)); }
@Override public String toString() { ToStringBuilder tsb = new ToStringBuilder(this); tsb.append("name", objAttribute.getName()); return tsb.toString(); } }
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()); } }
public boolean isChange() { boolean isOverrideTableChange = ((OverrideEmbeddableAttributeTableModel) view.getOverrideAttributeTable() .getModel()).isAttributeOverrideChange(); return isOverrideTableChange || !attribute.getName().equals(view.getAttributeName().getText()) || (attribute.getType() == null && view.getTypeComboBox().getSelectedItem() != null) || !Objects.equals(attribute.getType(), view.getTypeComboBox().getSelectedItem()); }
public boolean visitAttribute(AttributeProperty property) { ObjAttribute oa = property.getAttribute(); if (visited.add(oa.getDbAttributePath())) { entityResult.addObjectField( oa.getEntity().getName(), oa.getName(), prefix + index[0]++); } return true; }
protected void createAttributeProperty(PersistentDescriptor descriptor, ObjAttribute attribute) { Class<?> propertyType = attribute.getJavaClass(); Accessor accessor = createAccessor(descriptor, attribute.getName(), propertyType); descriptor.addDeclaredProperty(new SimpleAttributeProperty(descriptor, accessor, attribute)); }
public boolean visitAttribute(AttributeProperty property) { ObjAttribute oa = property.getAttribute(); if (visited.add(oa.getDbAttributePath())) { result.addObjectField(oa.getEntity().getName(), "fetch." + prefix + "." + oa.getName(), prefix + "." + oa.getDbAttributeName()); } return true; }
public Object getRawValue(DataObject obj) { if (obj == null) return null; Object value = null; if (!isLookup() && objAttribute != null) { value = obj.readProperty(objAttribute.getName()); } else if (isLookup() && objRelationship != null) { value = obj.readProperty(objRelationship.getName()); } return value; }
public void addEqual(String fieldName, Object value) { ObjEntityViewField field = queryTarget.getField(fieldName); String path = null; if (field.getCalcType().getValue() == CalcTypeEnum.NO_CALC_TYPE_VALUE) { path = field.getObjAttribute().getName(); } else if (field.isLookup()) { path = field.getObjRelationship().getName(); } Object rawValue = field.toRawValue(value); conditions.add(ExpressionFactory.matchExp(path, rawValue)); }
/** * Creates a clone of an ObjAttribute argument. * * @since 3.0 */ public ObjAttribute(ObjAttribute attribute) { setName(attribute.getName()); setType(attribute.getType()); setEntity(attribute.getEntity()); setDbAttributePath(attribute.getDbAttributePath()); setUsedForLocking(attribute.isUsedForLocking()); }