* if no Entity can be found
*/
public Entity getPrimitiveReferencedEntity(BaseOBObject obObject, Property property) {
if (property.getEntity().getName().equals(TreeNode.ENTITY_NAME)) {
final TreeNode treeNode = (TreeNode) obObject;
final Entity entity = ModelProvider.getInstance().getEntityFromTreeType(
treeNode.getTree().getTypeArea());
if (entity == null) {
throw new OBException("No entity found for treetype " + treeNode.getTree().getTypeArea());
}
return entity;
}
if (property.getEntity().getName().equals(Alert.ENTITY_NAME)) {
final Alert alert = (Alert) obObject;
final Table table = alert.getAlertRule().getTab().getTable();
final Entity entity = ModelProvider.getInstance().getEntity(table.getName());
if (entity == null) {
throw new OBException("No entity for table with name " + table.getName());
}
return entity;
}
if (property.getEntity().getName().equals(Attachment.ENTITY_NAME)) {
final Attachment attachment = (Attachment) obObject;
final Entity entity = ModelProvider.getInstance().getEntity(attachment.getTable().getName());
if (entity == null) {
throw new OBException("No entity for table with name " + attachment.getTable().getName());
}
return entity;
}
if (property.getEntity().getName().equals(AccountingFact.ENTITY_NAME)) {
if (property.getName().equals(AccountingFact.PROPERTY_RECORDID2)) {
return ModelProvider.getInstance().getEntity(DebtPayment.ENTITY_NAME);
}
final AccountingFact accountingFact = (AccountingFact) obObject;
final Entity entity = ModelProvider.getInstance().getEntity(
accountingFact.getTable().getName());
if (entity == null) {
throw new OBException("No entity for table with name "
+ accountingFact.getTable().getName());
}