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); }
public Builder otherEnd(final String otherEndType, final String otherEndKey, final String otherEndName) { instance.setOtherEndType(otherEndType); instance.setOtherEndKey(otherEndKey); instance.setOtherEndName(otherEndName); return this; }
public Builder type(final String type) { instance.setType(type); return this; }
public Builder otherEnd(final String otherEndType, final String otherEndKey) { instance.setOtherEndType(otherEndType); instance.setOtherEndKey(otherEndKey); return this; }
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()). ifPresent(relationship -> { anyObject.getRelationships().remove(relationship); if (StringUtils.isBlank(patch.getRelationshipTO().getOtherEndType()) || AnyTypeKind.USER.name().equals(patch.getRelationshipTO().getOtherEndType()) || AnyTypeKind.GROUP.name().equals(patch.getRelationshipTO().getOtherEndType())) { + " not allowed for relationship: " + patch.getRelationshipTO().getOtherEndType()); scce.addException(invalidAnyType); } else { AnyObject otherEnd = anyObjectDAO.find(patch.getRelationshipTO().getOtherEndKey()); if (otherEnd == null) { LOG.debug("Ignoring invalid any object {}", patch.getRelationshipTO().getOtherEndKey()); } else if (anyObject.getRealm().getFullPath().startsWith(otherEnd.getRealm().getFullPath())) { ARelationship newRelationship = entityFactory.newEntity(ARelationship.class);
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 fillRelationships(final GroupableRelatableTO any, final GroupableRelatableTO template) { template.getRelationships().stream(). filter(relationship -> !any.getRelationship( relationship.getOtherEndKey(), relationship.getOtherEndKey()).isPresent()). forEachOrdered(relationship -> { any.getRelationships().add(relationship); }); }
@Override public void setObject(final AnyTypeTO object) { rel.setOtherEndType(object == null ? null : object.getKey()); } }, false);
@Override public void onEvent(final IEvent<?> event) { if (event.getPayload() instanceof SearchClausePanel.SearchEvent) { final AjaxRequestTarget target = SearchClausePanel.SearchEvent.class.cast(event.getPayload()). getTarget(); final String fiql = SearchUtils.buildFIQL(anyObjectSearchPanel.getModel().getObject(), SyncopeClient.getAnyObjectSearchConditionBuilder(anyObjectSearchPanel.getBackObjectType())); AnyDirectoryPanel.class.cast(Specification.this.anyObjectDirectoryPanel).search(fiql, target); } else if (event.getPayload() instanceof AnySelectionDirectoryPanel.ItemSelection) { final AjaxRequestTarget target = AnySelectionDirectoryPanel.ItemSelection.class.cast(event. getPayload()).getTarget(); AnyTO right = AnySelectionDirectoryPanel.ItemSelection.class.cast(event.getPayload()).getSelection(); rel.setOtherEndKey(right.getKey()); Relationships.this.addNewRelationships(rel); Relationships.this.addOrReplace(getViewFragment().setRenderBodyOnly(true)); target.add(Relationships.this); } else { super.onEvent(event); } } }
@Override public AnyTypeTO getObject() { for (AnyTypeTO obj : availableTypes) { if (obj.getKey().equals(rel.getOtherEndType())) { return obj; } } return null; }
if (StringUtils.isBlank(relationshipTO.getOtherEndType()) || AnyTypeKind.USER.name().equals(relationshipTO.getOtherEndType()) || AnyTypeKind.GROUP.name().equals(relationshipTO.getOtherEndType())) { + " not allowed for relationship: " + relationshipTO.getOtherEndType()); scce.addException(invalidAnyType); } else { AnyObject otherEnd = anyObjectDAO.find(relationshipTO.getOtherEndKey()); if (otherEnd == null) { 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);
public Builder otherEnd(final String otherEndType, final String otherEndKey) { instance.setOtherEndType(otherEndType); instance.setOtherEndKey(otherEndKey); return this; }
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()); } } } }
ReportXMLConst.XSD_STRING, rel.getOtherEndKey()); handler.startElement("", "", "relationship", atts); for (URelationship actualRel : user.getRelationships(rel.getOtherEndKey())) { doExtractResources( handler, anyObjectDataBinder.getAnyObjectTO(actualRel.getRightEnd(), true));
@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 Builder otherEnd(final String otherEndType, final String otherEndKey, final String otherEndName) { instance.setOtherEndType(otherEndType); instance.setOtherEndKey(otherEndKey); instance.setOtherEndName(otherEndName); return this; }
public Builder type(final String type) { instance.setType(type); return this; }
@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(); }