private void link(final Realm realm, final boolean unlink, final ProvisioningReport result) { RealmTO realmTO = binder.getRealmTO(realm, true); if (unlink) { realmTO.getResources().remove(profile.getTask().getResource().getKey()); } else { realmTO.getResources().add(profile.getTask().getResource().getKey()); } update(realmTO, null, result); }
private void assign(final Realm realm, final ProvisioningReport result) { RealmTO realmTO = binder.getRealmTO(realm, true); realmTO.getResources().add(profile.getTask().getResource().getKey()); provision(update(realmTO, null, result), result); }
private void unassign(final Realm realm, final ConnectorObject beforeObj, final ProvisioningReport result) { RealmTO realmTO = binder.getRealmTO(realm, true); realmTO.getResources().remove(profile.getTask().getResource().getKey()); deprovision(update(realmTO, beforeObj, result), beforeObj, result); }
realmTO.getResources().forEach(resourceKey -> { ExternalResource resource = resourceDAO.find(resourceKey); if (resource == null) {
realmTO.getResources().forEach(resourceKey -> { ExternalResource resource = resourceDAO.find(resourceKey); if (resource == null) { boolean contained = realmTO.getResources().contains(resource.getKey()); if (!contained) { propByRes.add(ResourceOperation.DELETE, resource.getKey());
@Override public RealmTO getRealmTO(final Realm realm, final boolean admin) { RealmTO realmTO = new RealmTO(); realmTO.setKey(realm.getKey()); realmTO.setName(realm.getName()); realmTO.setParent(realm.getParent() == null ? null : realm.getParent().getKey()); realmTO.setFullPath(realm.getFullPath()); if (admin) { realmTO.setAccountPolicy(realm.getAccountPolicy() == null ? null : realm.getAccountPolicy().getKey()); realmTO.setPasswordPolicy(realm.getPasswordPolicy() == null ? null : realm.getPasswordPolicy().getKey()); realm.getActions().forEach(action -> { realmTO.getActions().add(action.getKey()); }); realm.getTemplates().forEach(template -> { realmTO.getTemplates().put(template.getAnyType().getKey(), template.get()); }); realm.getResources().forEach(resource -> { realmTO.getResources().add(resource.getKey()); }); } return realmTO; }
private List<ProvisioningReport> assign(final SyncDelta delta, final OrgUnit orgUnit) throws JobExecutionException { if (!profile.getTask().isPerformCreate()) { LOG.debug("PullTask not configured for create"); finalize(UnmatchingRule.toEventName(UnmatchingRule.ASSIGN), Result.SUCCESS, null, null, delta); return Collections.<ProvisioningReport>emptyList(); } RealmTO realmTO = connObjectUtils.getRealmTO(delta.getObject(), profile.getTask(), orgUnit); if (realmTO.getFullPath() == null) { if (realmTO.getParent() == null) { realmTO.setParent(profile.getTask().getDestinatioRealm().getFullPath()); } realmTO.setFullPath(realmTO.getParent() + "/" + realmTO.getName()); } realmTO.getResources().add(profile.getTask().getResource().getKey()); ProvisioningReport result = new ProvisioningReport(); result.setOperation(ResourceOperation.CREATE); result.setAnyType(REALM_TYPE); result.setStatus(ProvisioningReport.Status.SUCCESS); result.setName(realmTO.getFullPath()); if (profile.isDryRun()) { result.setKey(null); finalize(UnmatchingRule.toEventName(UnmatchingRule.ASSIGN), Result.SUCCESS, null, null, delta); } else { for (PullActions action : profile.getActions()) { action.beforeAssign(profile, delta, realmTO); } create(realmTO, delta, UnmatchingRule.ASSIGN, result); } return Collections.singletonList(result); }