@SuppressWarnings("unchecked") private List<MembershipTO> loadMembershipAttrs() { List<MembershipTO> memberships = new ArrayList<>(); try { membershipSchemas.clear(); for (MembershipTO membership : (List<MembershipTO>) PropertyResolver.getPropertyField( "memberships", anyTO).get(anyTO)) { setSchemas(membership.getGroupKey(), anyTypeClassRestClient.list(getMembershipAuxClasses(membership, anyTO.getType())). stream().map(EntityTO::getKey).collect(Collectors.toList())); setAttrs(membership); if (AbstractAttrs.this instanceof PlainAttrs && !membership.getPlainAttrs().isEmpty()) { memberships.add(membership); } else if (AbstractAttrs.this instanceof DerAttrs && !membership.getDerAttrs().isEmpty()) { memberships.add(membership); } else if (AbstractAttrs.this instanceof VirAttrs && !membership.getVirAttrs().isEmpty()) { memberships.add(membership); } } } catch (WicketRuntimeException | IllegalArgumentException | IllegalAccessException ex) { // ignore } return memberships; }
public AnyStatusDirectoryPanel( final BaseModal<?> baseModal, final MultilevelPanel multiLevelPanelRef, final PageReference pageRef, final AnyTO anyTO, final String itemKeyFieldName, final boolean statusOnly) { super(MultilevelPanel.FIRST_LEVEL_ID, pageRef); this.baseModal = baseModal; this.multiLevelPanelRef = multiLevelPanelRef; this.statusOnly = statusOnly; this.anyTO = anyTO; this.itemKeyFieldName = itemKeyFieldName; if (anyTO instanceof UserTO) { this.restClient = new UserRestClient(); anyTypeKind = AnyTypeKind.USER; } else if (anyTO instanceof GroupTO) { this.restClient = new GroupRestClient(); anyTypeKind = AnyTypeKind.GROUP; } else { this.restClient = new AnyObjectRestClient(); anyTypeKind = AnyTypeKind.ANY_OBJECT; } resources = new ResourceRestClient().list().stream(). filter(resource -> resource.getProvision(anyTO.getType()).isPresent()). map(EntityTO::getKey).collect(Collectors.toList()); initResultTable(); }
protected Pair<TO, List<LogicActions>> beforeCreate(final TO input) { Realm realm = realmDAO.findByFullPath(input.getRealm()); if (realm == null) { SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRealm); sce.getElements().add(input.getRealm()); throw sce; } AnyType anyType = input instanceof UserTO ? anyTypeDAO.findUser() : input instanceof GroupTO ? anyTypeDAO.findGroup() : anyTypeDAO.find(input.getType()); if (anyType == null) { SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidAnyType); sce.getElements().add(input.getType()); throw sce; } TO any = input; templateUtils.apply(any, realm.getTemplate(anyType)); List<LogicActions> actions = getActions(realm); for (LogicActions action : actions) { any = action.beforeCreate(any); } LOG.debug("Input: {}\nOutput: {}\n", input, any); return ImmutablePair.of(any, actions); }
target.add(Relationships.this); }, ActionType.CREATE, AnyEntitlement.UPDATE.getFor(anyTO.getType())).hideLabel();
LOG.debug("{} {} successfully created", created.getType(), created.getKey()); } catch (PropagationException e) { LOG.error("Could not propagate {} {}", anyTO.getType(), delta.getUid().getUidValue(), e); output = e; resultStatus = Result.FAILURE; LOG.error("Could not create {} {} ", anyTO.getType(), delta.getUid().getUidValue(), e); output = e; resultStatus = Result.FAILURE;