public boolean visitAttribute(AttributeProperty property) { String target = property.getAttribute().getDbAttributePath(); appendColumn(targetSource, target, prefix + target); return true; }
void indexAddedProperty(PropertyDescriptor property) { if (property instanceof AttributeProperty) { AttributeProperty attributeProperty = (AttributeProperty) property; ObjAttribute attribute = attributeProperty.getAttribute(); if (attribute.isPrimaryKey()) { if (idProperties == null) { idProperties = new ArrayList<>(2); } idProperties.add(attributeProperty); } } else if (property instanceof ArcProperty) { ObjRelationship relationship = ((ArcProperty) property).getRelationship(); ObjRelationship reverseRelationship = relationship.getReverseRelationship(); if (reverseRelationship != null && "java.util.Map".equals(reverseRelationship.getCollectionType())) { if (mapArcProperties == null) { mapArcProperties = new ArrayList<>(2); } mapArcProperties.add((ArcProperty) property); } } }
public boolean visitAttribute(AttributeProperty property) { ObjAttribute oa = property.getAttribute(); Iterator<CayenneMapEntry> dbPathIterator = oa.getDbPathIterator(); while (dbPathIterator.hasNext()) { CayenneMapEntry pathPart = dbPathIterator.next(); if (pathPart instanceof DbAttribute) { result.addDbField(pathPart.getName(), pathPart.getName()); } } return true; }
public boolean visitAttribute(AttributeProperty property) { ObjAttribute objAttr = property.getAttribute(); // processing compound attributes correctly snapshot.put(objAttr.getDbAttributePath(), property.readPropertyDirectly(object)); return true; }
public TargetPropertyWriter getOrCreateWriter(AttributeProperty property) { if (!entity.equals(property.getAttribute().getEntity())) { throw new LmRuntimeException("Property belongs to a different entity: " + property.getName()); } return getOrCreateWriter( property.getName(), ASTDbPath.DB_PREFIX + property.getAttribute().getDbAttributeName(), () -> new TargetAttributePropertyWriter(property) ); }
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; }
public boolean visitAttribute(AttributeProperty property) { ObjAttribute oa = property.getAttribute(); Iterator<CayenneMapEntry> dbPathIterator = oa.getDbPathIterator(); while (dbPathIterator.hasNext()) { Object pathPart = dbPathIterator.next(); if (pathPart == null) { throw new CayenneRuntimeException("ObjAttribute has no component: %s", oa.getName()); } else if (pathPart instanceof DbRelationship) { DbRelationship rel = (DbRelationship) pathPart; dbRelationshipAdded(rel, JoinType.INNER, null); } else if (pathPart instanceof DbAttribute) { DbAttribute dbAttr = (DbAttribute) pathPart; appendColumn(columns, oa, dbAttr, attributes, labelPrefix + '.' + dbAttr.getName()); } } return true; }
public boolean visitAttribute(AttributeProperty property) { ObjAttribute oa = property.getAttribute(); resetJoinStack(); Iterator<CayenneMapEntry> dbPathIterator = oa.getDbPathIterator(); while (dbPathIterator.hasNext()) { Object pathPart = dbPathIterator.next(); if (pathPart == null) { throw new CayenneRuntimeException("ObjAttribute has no component: %s", oa.getName()); } else if (pathPart instanceof DbRelationship) { DbRelationship rel = (DbRelationship) pathPart; dbRelationshipAdded(rel, JoinType.LEFT_OUTER, null); } else if (pathPart instanceof DbAttribute) { DbAttribute dbAttr = (DbAttribute) pathPart; appendColumn(columns, oa, dbAttr, attributes, null, tableAlias); } } return true; }
public boolean visitAttribute(AttributeProperty property) { ObjAttribute attr = property.getAttribute(); String dbAttrPath = attr.getDbAttributePath(); Object value = snapshot.get(dbAttrPath); property.writePropertyDirectly(object, null, value); // note that a check "snaphsot.get(..) == null" would be incorrect in this // case, as NULL value is entirely valid; still save a map lookup by // checking for the null value first if (value == null && !snapshot.containsKey(dbAttrPath)) { isPartialSnapshot[0] = true; } return true; }
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 boolean visitAttribute(AttributeProperty property) { ObjAttribute oa = property.getAttribute(); Iterator<?> dbPathIterator = oa.getDbPathIterator(); EJBQLJoinAppender joinAppender = null; String marker = null; EJBQLTableId lhsId = new EJBQLTableId(idVar); while (dbPathIterator.hasNext()) { Object pathPart = dbPathIterator.next(); if (pathPart == null) { throw new CayenneRuntimeException("ObjAttribute has no component: %s", oa.getName()); } else if (pathPart instanceof DbRelationship) { if (marker == null) { marker = EJBQLJoinAppender.makeJoinTailMarker(idVar); joinAppender = context.getTranslatorFactory().getJoinAppender(context); } DbRelationship dr = (DbRelationship) pathPart; EJBQLTableId rhsId = new EJBQLTableId(lhsId, dr.getName()); joinAppender.appendOuterJoin(marker, lhsId, rhsId); lhsId = rhsId; } else if (pathPart instanceof DbAttribute) { appendColumn(idVar, oa, (DbAttribute) pathPart, fields, oa.getType()); } } return true; }
@Override public boolean visitAttribute(AttributeProperty property) { if (!entity.isIncluded(property.getName())) { return true; } Object value; if (entity.isConfidential(property.getName())) { value = Confidential.getInstance(); } else { String key = property.getAttribute().getDbAttributeName(); value = row.get(key); } if (value != null) { objectChangeSet.attributeChanged(property.getName(), value, null); } return true; }
public boolean visitAttribute(AttributeProperty property) { String dbAttrPath = property.getAttribute().getDbAttributePath(); // supports merging of partial snapshots... // check for null is cheaper than double lookup // for a key... so check for partial snapshot // only if the value is null Object newValue = snapshot.get(dbAttrPath); if (newValue != null || snapshot.containsKey(dbAttrPath)) { Object curValue = property.readPropertyDirectly(object); Object oldValue = diff != null ? diff.getSnapshotValue(property .getName()) : null; // if value not modified, update it from snapshot, // otherwise leave it alone if (Util.nullSafeEquals(curValue, oldValue) && !Util.nullSafeEquals(newValue, curValue)) { property.writePropertyDirectly(object, oldValue, newValue); } } return true; }
.getAttribute() .getDbAttributeName());
String atrType = ((AttributeProperty) property).getAttribute().getType();