protected PersistentDescriptor createDescriptor() { return new PersistentDescriptor(); }
@Override protected void createAttributeProperty( PersistentDescriptor descriptor, ObjAttribute attribute) { descriptor.addDeclaredProperty(new DataObjectAttributeProperty(attribute)); }
private void appendDeclaredRootDbEntity(PersistentDescriptor descriptor, ObjEntity entity) { DbEntity dbEntity = entity.getDbEntity(); if (dbEntity != null) { // descriptor takes care of weeding off duplicates, which are likely // in cases // of non-horizontal inheritance descriptor.addRootDbEntity(dbEntity); } }
descriptor.setEntity(entity); descriptor.setSuperclassDescriptor(superDescriptor); descriptor.setObjectClass(entityClass); descriptor.setPersistenceStateAccessor(new BeanAccessor(entityClass, "persistenceState", Integer.TYPE)); for (ObjAttribute attribute : descriptor.getEntity().getDeclaredAttributes()) { for (ObjRelationship relationship : descriptor.getEntity().getDeclaredRelationships()) { descriptor.getEntity().getName()); descriptor.setEntityInheritanceTree(inheritanceTree); indexSubclassDescriptors(descriptor, inheritanceTree); indexQualifiers(descriptor, inheritanceTree); appendDeclaredRootDbEntity(descriptor, descriptor.getEntity()); indexRootDbEntities(descriptor, inheritanceTree); descriptor.sortProperties();
qualifier = inheritanceTree.qualifierForEntityAndSubclasses(); } else { qualifier = descriptor.getEntity().getDeclaredQualifier(); final DbEntity dbEntity = descriptor.getEntity().getDbEntity(); descriptor.setDiscriminatorColumns(attributes.values()); descriptor.setEntityQualifier(qualifier);
public boolean visitToMany(ToManyProperty property) { descriptor.addSuperProperty(property); return true; }
/** * Registers a superclass property. */ public void addSuperProperty(PropertyDescriptor property) { properties.put(property.getName(), property); indexAddedProperty(property); }
/** * Invokes 'prepareForAccess' of a super descriptor and then invokes * 'prepareForAccess' of each declared property. */ public void injectValueHolders(Object object) throws PropertyException { // do super first if (getSuperclassDescriptor() != null) { getSuperclassDescriptor().injectValueHolders(object); } for (PropertyDescriptor property : declaredProperties.values()) { property.injectValueHolder(object); } }
/** * Recursively looks up property descriptor in this class descriptor and all * superclass descriptors. */ public PropertyDescriptor getProperty(String propertyName) { PropertyDescriptor property = getDeclaredProperty(propertyName); if (property == null && superclassDescriptor != null) { property = superclassDescriptor.getProperty(propertyName); } return property; }
/** * Creates an accessor for the property. */ protected Accessor createAccessor(PersistentDescriptor descriptor, String propertyName, Class<?> propertyType) throws PropertyException { return new FieldAccessor(descriptor.getObjectClass(), propertyName, propertyType); }
protected void indexSubclassDescriptors(PersistentDescriptor descriptor, EntityInheritanceTree inheritanceTree) { if (inheritanceTree != null) { for (EntityInheritanceTree child : inheritanceTree.getChildren()) { ObjEntity childEntity = child.getEntity(); descriptor.addSubclassDescriptor(childEntity.getClassName(), descriptorMap.getDescriptor(childEntity.getName())); indexSubclassDescriptors(descriptor, child); } } }
public boolean visitToOne(ToOneProperty property) { descriptor.addSuperProperty(property); return true; } });
/** * Registers a property. This method is useful to customize default * ClassDescriptor generated from ObjEntity by adding new properties or * overriding the standard ones. */ public void addDeclaredProperty(PropertyDescriptor property) { declaredProperties.put(property.getName(), property); properties.put(property.getName(), property); indexAddedProperty(property); }
/** * Adds superclass properties to the descriptor, applying proper overrides. */ protected void indexSuperclassProperties(final PersistentDescriptor descriptor) { ClassDescriptor superDescriptor = descriptor.getSuperclassDescriptor(); if (superDescriptor != null) { superDescriptor.visitProperties(new PropertyVisitor() { public boolean visitAttribute(AttributeProperty property) { // decorate super property to return an overridden attribute descriptor.addSuperProperty(new AttributePropertyDecorator(descriptor, property)); return true; } public boolean visitToMany(ToManyProperty property) { descriptor.addSuperProperty(property); return true; } public boolean visitToOne(ToOneProperty property) { descriptor.addSuperProperty(property); return true; } }); } }
@Override protected void createToManySetProperty( PersistentDescriptor descriptor, ObjRelationship relationship) { ClassDescriptor targetDescriptor = descriptorMap.getDescriptor(relationship .getTargetEntityName()); descriptor.addDeclaredProperty(new DataObjectToManyProperty( relationship, targetDescriptor, faultFactory.getSetFault())); }
public boolean visitAttribute(AttributeProperty property) { // decorate super property to return an overridden attribute descriptor.addSuperProperty(new AttributePropertyDecorator(descriptor, property)); return true; }
@Override protected void createToManyCollectionProperty( PersistentDescriptor descriptor, ObjRelationship relationship) { ClassDescriptor targetDescriptor = descriptorMap.getDescriptor(relationship .getTargetEntityName()); descriptor.addDeclaredProperty(new DataObjectToManyProperty( relationship, targetDescriptor, faultFactory.getCollectionFault())); }
@Override protected void createToManyListProperty( PersistentDescriptor descriptor, ObjRelationship relationship) { ClassDescriptor targetDescriptor = descriptorMap.getDescriptor(relationship .getTargetEntityName()); descriptor.addDeclaredProperty(new DataObjectToManyProperty( relationship, targetDescriptor, faultFactory.getListFault())); }
@Override protected void createToOneProperty( PersistentDescriptor descriptor, ObjRelationship relationship) { ClassDescriptor targetDescriptor = descriptorMap.getDescriptor(relationship .getTargetEntityName()); descriptor.addDeclaredProperty(new DataObjectToOneProperty( relationship, targetDescriptor, faultFactory.getToOneFault())); }