private void addRelationship(final Map<String, List<RelationshipTO>> relationships, final RelationshipTO... rels) { for (RelationshipTO relationship : rels) { final List<RelationshipTO> listrels; if (relationships.containsKey(relationship.getType())) { listrels = relationships.get(relationship.getType()); } else { listrels = new ArrayList<>(); relationships.put(relationship.getType(), listrels); } listrels.add(relationship); } }
private void removeRelationships( final Map<String, List<RelationshipTO>> relationships, final RelationshipTO... rels) { final List<RelationshipTO> currentRels = getCurrentRelationships(); for (RelationshipTO relationship : rels) { currentRels.remove(relationship); if (relationships.containsKey(relationship.getType())) { final List<RelationshipTO> rellist = relationships.get(relationship.getType()); rellist.remove(relationship); if (rellist.isEmpty()) { relationships.remove(relationship.getType()); } } } }
@JsonIgnore @Override public Optional<RelationshipTO> getRelationship(final String type, final String otherKey) { return relationships.stream().filter( relationship -> type.equals(relationship.getType()) && otherKey.equals(relationship.getOtherEndKey())). findFirst(); }
@JsonIgnore @Override public Optional<RelationshipTO> getRelationship(final String type, final String otherKey) { return relationships.stream().filter( relationship -> type.equals(relationship.getType()) && otherKey.equals(relationship.getOtherEndKey())). findFirst(); }
@JsonIgnore @Override public Optional<RelationshipTO> getRelationship(final String type, final String otherKey) { return relationships.stream().filter( relationship -> type.equals(relationship.getType()) && otherKey.equals(relationship.getOtherEndKey())). findFirst(); }
@JsonIgnore @Override public Optional<RelationshipTO> getRelationship(final String type, final String otherKey) { return relationships.stream().filter( relationship -> type.equals(relationship.getType()) && otherKey.equals(relationship.getOtherEndKey())). findFirst(); }
public static Map<Pair<String, String>, RelationshipTO> buildRelationshipMap( final Collection<RelationshipTO> relationships) { Map<Pair<String, String>, RelationshipTO> result = new HashMap<>(relationships.size()); relationships.forEach(rel -> result.put(Pair.of(rel.getType(), rel.getOtherEndKey()), rel)); return Collections.unmodifiableMap(result); }
@JsonIgnore @Override public Optional<RelationshipTO> getRelationship(final String type, final String otherKey) { return relationships.stream().filter( relationship -> type.equals(relationship.getType()) && otherKey.equals(relationship.getOtherEndKey())). findFirst(); }
public static Map<Pair<String, String>, RelationshipTO> buildRelationshipMap( final Collection<RelationshipTO> relationships) { Map<Pair<String, String>, RelationshipTO> result = new HashMap<>(relationships.size()); relationships.forEach(rel -> result.put(Pair.of(rel.getType(), rel.getOtherEndKey()), rel)); return Collections.unmodifiableMap(result); }
@JsonIgnore @Override public Optional<RelationshipTO> getRelationship(final String type, final String otherKey) { return relationships.stream().filter( relationship -> type.equals(relationship.getType()) && otherKey.equals(relationship.getOtherEndKey())). findFirst(); }
RelationshipType relationshipType = relationshipTypeDAO.find(patch.getRelationshipTO().getType()); if (relationshipType == null) { LOG.debug("Ignoring invalid relationship type {}", patch.getRelationshipTO().getType()); } else { anyObject.getRelationship(relationshipType, patch.getRelationshipTO().getOtherEndKey()).
RelationshipType relationshipType = relationshipTypeDAO.find(patch.getRelationshipTO().getType()); if (relationshipType == null) { LOG.debug("Ignoring invalid relationship type {}", patch.getRelationshipTO().getType()); } else { user.getRelationship(relationshipType, patch.getRelationshipTO().getOtherEndKey()).
LOG.debug("Ignoring invalid anyObject " + relationshipTO.getOtherEndKey()); } else if (anyObject.getRealm().getFullPath().startsWith(otherEnd.getRealm().getFullPath())) { RelationshipType relationshipType = relationshipTypeDAO.find(relationshipTO.getType()); if (relationshipType == null) { LOG.debug("Ignoring invalid relationship type {}", relationshipTO.getType()); } else { ARelationship relationship = entityFactory.newEntity(ARelationship.class);
LOG.debug("Ignoring invalid anyObject " + relationshipTO.getOtherEndKey()); } else if (user.getRealm().getFullPath().startsWith(otherEnd.getRealm().getFullPath())) { RelationshipType relationshipType = relationshipTypeDAO.find(relationshipTO.getType()); if (relationshipType == null) { LOG.debug("Ignoring invalid relationship type {}", relationshipTO.getType()); } else { URelationship relationship = entityFactory.newEntity(URelationship.class);