use of org.apache.cayenne.reflect.ClassDescriptor in project cayenne by apache.
the class CustomColumnSetExtractor method extractFullObject.
private void extractFullObject(String prefix, Property<?> property) {
prefix = calculatePrefix(prefix, property);
ensureJoin(prefix);
ObjEntity entity = context.getResolver().getObjEntity(property.getType());
ColumnExtractor extractor;
if (context.getMetadata().getPageSize() > 0) {
extractor = new IdColumnExtractor(context, entity);
} else {
ClassDescriptor descriptor = context.getResolver().getClassDescriptor(entity.getName());
extractor = new DescriptorColumnExtractor(context, descriptor);
}
int index = context.getResultNodeList().size();
// extract required columns of entity
extractor.extract(prefix);
// Maybe we should change resolver, as it seems cleaner to have path from root as prefix in data row key.
for (int i = index; i < context.getResultNodeList().size(); i++) {
context.getResultNodeList().get(i).setDataRowKey(null);
}
}
use of org.apache.cayenne.reflect.ClassDescriptor in project cayenne by apache.
the class DataObjectDescriptorFactory method createToManySetProperty.
@Override
protected void createToManySetProperty(PersistentDescriptor descriptor, ObjRelationship relationship) {
ClassDescriptor targetDescriptor = descriptorMap.getDescriptor(relationship.getTargetEntityName());
descriptor.addDeclaredProperty(new DataObjectToManyProperty(relationship, targetDescriptor, faultFactory.getSetFault()));
}
use of org.apache.cayenne.reflect.ClassDescriptor in project cayenne by apache.
the class DataObjectDescriptorFactory method createToManyListProperty.
@Override
protected void createToManyListProperty(PersistentDescriptor descriptor, ObjRelationship relationship) {
ClassDescriptor targetDescriptor = descriptorMap.getDescriptor(relationship.getTargetEntityName());
descriptor.addDeclaredProperty(new DataObjectToManyProperty(relationship, targetDescriptor, faultFactory.getListFault()));
}
use of org.apache.cayenne.reflect.ClassDescriptor in project cayenne by apache.
the class ValueHolderDescriptorFactory method createToOneProperty.
@Override
protected void createToOneProperty(PersistentDescriptor descriptor, ObjRelationship relationship) {
ClassDescriptor targetDescriptor = descriptorMap.getDescriptor(relationship.getTargetEntityName());
String reverseName = relationship.getReverseRelationshipName();
Accessor accessor = createAccessor(descriptor, relationship.getName(), ValueHolder.class);
PropertyDescriptor property = new ValueHolderProperty(descriptor, targetDescriptor, accessor, reverseName);
descriptor.addDeclaredProperty(property);
}
use of org.apache.cayenne.reflect.ClassDescriptor in project cayenne by apache.
the class ValueHolderDescriptorFactory method createToManySetProperty.
@Override
protected void createToManySetProperty(PersistentDescriptor descriptor, ObjRelationship relationship) {
ClassDescriptor targetDescriptor = descriptorMap.getDescriptor(relationship.getTargetEntityName());
String reverseName = relationship.getReverseRelationshipName();
Accessor accessor = createAccessor(descriptor, relationship.getName(), Set.class);
descriptor.addDeclaredProperty(new ValueHolderSetProperty(descriptor, targetDescriptor, accessor, reverseName));
}
Aggregations