Beispiel #1
0
 @JsonSerialize(include = Inclusion.NON_NULL)
 @SuppressWarnings("unchecked")
 public List<EntityRef> getRefs() {
   if (refs != null) {
     return refs;
   }
   List<?> l = getEntities();
   if ((l != null) && (l.size() > 0)) {
     return (List<EntityRef>) l;
   }
   if (connections != null) {
     refs = new ArrayList<EntityRef>();
     for (ConnectionRef connection : connections) {
       if (forwardConnections) {
         ConnectedEntityRef c = connection.getConnectedEntity();
         if (c != null) {
           refs.add(c);
         }
       } else {
         EntityRef c = connection.getConnectingEntity();
         if (c != null) {
           refs.add(c);
         }
       }
     }
     return refs;
   }
   if (ref != null) {
     refs = new ArrayList<EntityRef>();
     refs.add(ref);
     return refs;
   }
   return new ArrayList<EntityRef>();
 }
Beispiel #2
0
 @JsonSerialize(include = Inclusion.NON_NULL)
 public List<UUID> getIds() {
   if (ids != null) {
     return ids;
   }
   /*
    * if (connectionTypeAndEntityTypeToEntityIdMap != null) { ids = new
    * ArrayList<UUID>(); Set<UUID> entitySet = new LinkedHashSet<UUID>();
    * for (String ctype : connectionTypeAndEntityTypeToEntityIdMap
    * .keySet()) { Map<String, List<UUID>> m =
    * connectionTypeAndEntityTypeToEntityIdMap .get(ctype); for (String
    * etype : m.keySet()) { List<UUID> l = m.get(etype); for (UUID id : l)
    * { if (!entitySet.contains(id)) { ids.add(id); } } } } return ids; }
    */
   if (connections != null) {
     ids = new ArrayList<UUID>();
     for (ConnectionRef connection : connections) {
       if (forwardConnections) {
         ConnectedEntityRef c = connection.getConnectedEntity();
         if (c != null) {
           ids.add(c.getUuid());
         }
       } else {
         EntityRef c = connection.getConnectingEntity();
         if (c != null) {
           ids.add(c.getUuid());
         }
       }
     }
     return ids;
   }
   if ((entities != null)
   /* || (connectionTypeAndEntityTypeToEntityMap != null) */ ) {
     // getEntities();
     ids = new ArrayList<UUID>();
     for (Entity entity : entities) {
       ids.add(entity.getUuid());
     }
     return ids;
   }
   if (refs != null) {
     ids = new ArrayList<UUID>();
     for (EntityRef ref : refs) {
       ids.add(ref.getUuid());
     }
     return ids;
   }
   if (id != null) {
     ids = new ArrayList<UUID>();
     ids.add(id);
     return ids;
   }
   if (entity != null) {
     ids = new ArrayList<UUID>();
     ids.add(entity.getUuid());
     return ids;
   }
   return new ArrayList<UUID>();
 }
Beispiel #3
0
 private void setConnections(List<ConnectionRef> connections, boolean forwardConnections) {
   init();
   this.connections = connections;
   this.forwardConnections = forwardConnections;
   level = Level.REFS;
   for (ConnectionRef connection : connections) {
     if (forwardConnections) {
       this.setMetadata(
           connection.getConnectedEntity().getUuid(),
           "connection",
           connection.getConnectionType());
     } else {
       this.setMetadata(
           connection.getConnectingEntity().getUuid(),
           "connection",
           connection.getConnectionType());
     }
   }
 }