use of com.haulmont.cuba.core.entity.diff.EntityPropertyDiff in project cuba by cuba-platform.
the class DiffTreeDatasource method loadPropertyDiff.
protected Node<EntityPropertyDiff> loadPropertyDiff(EntityPropertyDiff propertyDiff) {
Node<EntityPropertyDiff> diffNode = null;
if (propertyDiff != null) {
Security security = AppBeans.get(Security.NAME);
MetaClass propMetaClass = metadata.getClassNN(propertyDiff.getMetaClassName());
if (!security.isEntityOpPermitted(propMetaClass, EntityOp.READ) || !security.isEntityAttrPermitted(propMetaClass, propertyDiff.getPropertyName(), EntityAttrAccess.VIEW)) {
return null;
}
diffNode = new Node<>(propertyDiff);
if (propertyDiff instanceof EntityClassPropertyDiff) {
EntityClassPropertyDiff classPropertyDiff = (EntityClassPropertyDiff) propertyDiff;
for (EntityPropertyDiff childPropertyDiff : classPropertyDiff.getPropertyDiffs()) {
Node<EntityPropertyDiff> childPropDiffNode = loadPropertyDiff(childPropertyDiff);
if (childPropDiffNode != null)
diffNode.addChild(childPropDiffNode);
}
} else if (propertyDiff instanceof EntityCollectionPropertyDiff) {
EntityCollectionPropertyDiff collectionPropertyDiff = (EntityCollectionPropertyDiff) propertyDiff;
for (EntityPropertyDiff childPropertyDiff : collectionPropertyDiff.getAddedEntities()) {
Node<EntityPropertyDiff> childPropDiffNode = loadPropertyDiff(childPropertyDiff);
if (childPropDiffNode != null)
diffNode.addChild(childPropDiffNode);
}
for (EntityPropertyDiff childPropertyDiff : collectionPropertyDiff.getModifiedEntities()) {
Node<EntityPropertyDiff> childPropDiffNode = loadPropertyDiff(childPropertyDiff);
if (childPropDiffNode != null)
diffNode.addChild(childPropDiffNode);
}
for (EntityPropertyDiff childPropertyDiff : collectionPropertyDiff.getRemovedEntities()) {
Node<EntityPropertyDiff> childPropDiffNode = loadPropertyDiff(childPropertyDiff);
if (childPropDiffNode != null)
diffNode.addChild(childPropDiffNode);
}
}
}
return diffNode;
}
use of com.haulmont.cuba.core.entity.diff.EntityPropertyDiff in project cuba by cuba-platform.
the class DiffTreeDatasource method loadTree.
@Override
protected Tree<EntityPropertyDiff> loadTree(Map params) {
Tree<EntityPropertyDiff> diffTree = new Tree<>();
List<Node<EntityPropertyDiff>> rootNodes = new ArrayList<>();
if (entityDiff != null) {
for (EntityPropertyDiff childPropertyDiff : entityDiff.getPropertyDiffs()) {
Node<EntityPropertyDiff> childPropDiffNode = loadPropertyDiff(childPropertyDiff);
if (childPropDiffNode != null)
rootNodes.add(childPropDiffNode);
}
}
diffTree.setRootNodes(rootNodes);
return diffTree;
}
Aggregations