@Override protected AnyPatch doUpdate( final AnyTO before, final AnyPatch anyPatch, final SyncDelta delta, final ProvisioningReport result) { AnyObjectPatch anyObjectPatch = AnyObjectPatch.class.cast(anyPatch); Pair<AnyObjectPatch, List<PropagationStatus>> updated = anyObjectProvisioningManager.update( anyObjectPatch, Collections.singleton(profile.getTask().getResource().getKey()), true); return anyPatch; } }
pullTask.setResource(provision.getResource()); pullTask.setMatchingRule(pullTaskTO.getMatchingRule() == null ? MatchingRule.UPDATE : pullTaskTO.getMatchingRule()); pullTask.setUnmatchingRule(pullTaskTO.getUnmatchingRule() == null ? UnmatchingRule.PROVISION : pullTaskTO.getUnmatchingRule()); pullTask.setPullMode(PullMode.FILTERED_RECONCILIATION); pullTask.setPerformCreate(pullTaskTO.isPerformCreate()); pullTask.setPerformUpdate(pullTaskTO.isPerformUpdate()); pullTask.setPerformDelete(pullTaskTO.isPerformDelete()); pullTask.setSyncStatus(pullTaskTO.isSyncStatus()); pullTask.setDestinationRealm(realm); pullTask.setRemediation(pullTaskTO.isRemediation()); LOG.debug("Invalid AnyType {} specified, ignoring...", type); } else { AnyTemplatePullTask anyTemplate = pullTask.getTemplate(anyType).orElse(null); if (anyTemplate == null) { anyTemplate = entityFactory.newEntity(AnyTemplatePullTask.class); anyTemplate.setPullTask(pullTask); pullTask.add(anyTemplate);
pullTask.setJobDelegate(jobDelegate); pullTask.setPullMode(pullTaskTO.getPullMode()); pullTask.setReconFilterBuilder(null); } else { Implementation reconFilterBuilder = implementationDAO.find(pullTaskTO.getReconFilterBuilder()); pullTaskTO.getReconFilterBuilder()); } else { pullTask.setReconFilterBuilder(reconFilterBuilder); pullTask.setDestinationRealm(realmDAO.findByFullPath(pullTaskTO.getDestinationRealm())); pullTask.setMatchingRule(pullTaskTO.getMatchingRule() == null ? MatchingRule.UPDATE : pullTaskTO.getMatchingRule()); pullTask.setUnmatchingRule(pullTaskTO.getUnmatchingRule() == null ? UnmatchingRule.PROVISION : pullTaskTO.getUnmatchingRule()); LOG.debug("Invalid AnyType {} specified, ignoring...", type); } else { AnyTemplatePullTask anyTemplate = pullTask.getTemplate(anyType).orElse(null); if (anyTemplate == null) { anyTemplate = entityFactory.newEntity(AnyTemplatePullTask.class); pullTask.add(anyTemplate); pullTask.getTemplates(). removeIf(anyTemplate -> !pullTaskTO.getTemplates().containsKey(anyTemplate.getAnyType().getKey()));
pullTaskTO.setDestinationRealm(pullTask.getDestinatioRealm().getFullPath()); pullTaskTO.setMatchingRule(pullTask.getMatchingRule() == null ? MatchingRule.UPDATE : pullTask.getMatchingRule()); pullTaskTO.setUnmatchingRule(pullTask.getUnmatchingRule() == null ? UnmatchingRule.PROVISION : pullTask.getUnmatchingRule()); pullTaskTO.setPullMode(pullTask.getPullMode()); if (pullTask.getReconFilterBuilder() != null) { pullTaskTO.setReconFilterBuilder(pullTask.getReconFilterBuilder().getKey()); pullTask.getTemplates().forEach(template -> { pullTaskTO.getTemplates().put(template.getAnyType().getKey(), template.get()); }); pullTaskTO.setRemediation(pullTask.isRemediation()); break;
LOG.debug("Executing pull on {}", pullTask.getResource()); pullTask.getActions().forEach(impl -> { try { actions.add(ImplementationManager.build(impl)); profile.getActions().addAll(actions); profile.setDryRun(dryRun); profile.setConflictResolutionAction(pullTask.getResource().getPullPolicy() == null ? ConflictResolutionAction.IGNORE : pullTask.getResource().getPullPolicy().getConflictResolutionAction()); if (pullTask.getResource().getOrgUnit() != null) { status.set("Pulling " + pullTask.getResource().getOrgUnit().getObjectClass().getObjectClassValue()); OrgUnit orgUnit = pullTask.getResource().getOrgUnit(); OperationOptions options = MappingUtils.buildOperationOptions( MappingUtils.getPullItems(orgUnit.getItems()).iterator()); switch (pullTask.getPullMode()) { case INCREMENTAL: if (!dryRun) { ImplementationManager.build(pullTask.getReconFilterBuilder()); connector.filteredReconciliation(orgUnit.getObjectClass(), filterBuilder, boolean userIgnoreCaseMatch = false; boolean groupIgnoreCaseMatch = false;
private List<ProvisioningReport> link(final SyncDelta delta, final List<String> keys, final boolean unlink) throws JobExecutionException { if (!profile.getTask().isPerformUpdate()) { LOG.debug("PullTask not configured for update"); finalize(unlink realm.getResources().remove(profile.getTask().getResource()); } else { realm.add(profile.getTask().getResource());
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); }
throws JobExecutionException { if (!profile.getTask().isPerformDelete()) { LOG.debug("PullTask not configured for delete"); finalize(ResourceOperation.DELETE.name().toLowerCase(), Result.SUCCESS, null, null, delta); delete(key, Collections.singleton(profile.getTask().getResource().getKey()), true); output = null; resultStatus = Result.SUCCESS; output = e; if (profile.getTask().isRemediation()) { Remediation entity = entityFactory.newEntity(Remediation.class); entity.setAnyType(provision.getAnyType());
@Override public boolean handle(final SyncDelta delta) { try { OrgUnit orgUnit = profile.getTask().getResource().getOrgUnit(); if (orgUnit == null) { throw new JobExecutionException("No orgUnit found on " + profile.getTask().getResource() + " for " + delta.getObject().getObjectClass()); if (profile.getTask().getPullMode() != PullMode.INCREMENTAL) { return true;
if (SyncDeltaType.CREATE_OR_UPDATE == processed.getDeltaType()) { if (keys.isEmpty()) { switch (profile.getTask().getUnmatchingRule()) { case ASSIGN: profile.getResults().addAll(assign(processed, orgUnit)); switch (profile.getTask().getMatchingRule()) { case UPDATE: profile.getResults().addAll(update(processed, keys, false));
private <T extends AnyTO> T getAnyTOFromConnObject( final ConnectorObject obj, final PullTask pullTask, final Provision provision, final AnyUtils anyUtils) { T anyTO = anyUtils.newAnyTO(); anyTO.setType(provision.getAnyType().getKey()); // 1. fill with data from connector object anyTO.setRealm(pullTask.getDestinatioRealm().getFullPath()); MappingUtils.getPullItems(provision.getMapping().getItems()).forEach(item -> { mappingManager.setIntValues(item, obj.getAttributeByName(item.getExtAttrName()), anyTO); }); // 2. add data from defined template (if any) templateUtils.apply(anyTO, pullTask.getTemplate(provision.getAnyType())); return anyTO; } }
protected List<ProvisioningReport> assign( final SyncDelta delta, final Provision provision, final AnyUtils anyUtils) 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(); } AnyTO anyTO = connObjectUtils.getAnyTO(delta.getObject(), profile.getTask(), provision, anyUtils); anyTO.getResources().add(profile.getTask().getResource().getKey()); ProvisioningReport result = new ProvisioningReport(); result.setOperation(ResourceOperation.CREATE); result.setAnyType(provision.getAnyType().getKey()); result.setStatus(ProvisioningReport.Status.SUCCESS); result.setName(getName(anyTO)); result.setUidValue(delta.getUid().getUidValue()); 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, anyTO); } create(anyTO, delta, UnmatchingRule.toEventName(UnmatchingRule.ASSIGN), provision, result); } return Collections.singletonList(result); }
private List<ProvisioningReport> provision(final SyncDelta delta, final OrgUnit orgUnit) throws JobExecutionException { if (!profile.getTask().isPerformCreate()) { LOG.debug("PullTask not configured for create"); finalize(UnmatchingRule.toEventName(UnmatchingRule.PROVISION), 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()); } 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.PROVISION), Result.SUCCESS, null, null, delta); } else { for (PullActions action : profile.getActions()) { action.beforeProvision(profile, delta, realmTO); } create(realmTO, delta, UnmatchingRule.PROVISION, result); } return Collections.singletonList(result); }
remediationTO.setPullTask(remediation.getPullTask().getKey()); remediationTO.setResource(remediation.getPullTask().getResource().getKey());
Realm realm = realmDAO.save(binder.create(profile.getTask().getDestinatioRealm(), realmTO)); result.setName(profile.getTask().getDestinatioRealm().getFullPath() + "/" + actual.getName());
private List<ProvisioningReport> deprovision(final SyncDelta delta, final List<String> keys, final boolean unlink) throws JobExecutionException { if (!profile.getTask().isPerformUpdate()) { LOG.debug("PullTask not configured for update"); finalize(unlink propByRes.add(ResourceOperation.DELETE, profile.getTask().getResource().getKey()); taskExecutor.execute(propagationManager.createTasks(realm, propByRes, null), false); realm.getResources().remove(profile.getTask().getResource()); realmTO = binder.getRealmTO(realmDAO.save(realm), true); } else {
Provision provision = null; try { provision = profile.getTask().getResource().getProvision(delta.getObject().getObjectClass()).orElse(null); if (provision == null) { throw new JobExecutionException("No provision found on " + profile.getTask().getResource() + " for " + delta.getObject().getObjectClass()); if (profile.getTask().getPullMode() != PullMode.INCREMENTAL) { if (executor.wasInterruptRequested()) { LOG.debug("Pull interrupted");
switch (profile.getTask().getUnmatchingRule()) { case ASSIGN: profile.getResults().addAll(assign(processed, provision, anyUtils)); switch (profile.getTask().getMatchingRule()) { case UPDATE: profile.getResults().addAll(update(processed, keys, provision));
throws JobExecutionException { if (!profile.getTask().isPerformUpdate()) { LOG.debug("PullTask not configured for update"); finalize(unlink anyPatch.getResources().add(new StringPatchItem.Builder(). operation(unlink ? PatchOperation.DELETE : PatchOperation.ADD_REPLACE). value(profile.getTask().getResource().getKey()).build());
@Override protected AnyTO doCreate(final AnyTO anyTO, final SyncDelta delta) { GroupTO groupTO = GroupTO.class.cast(anyTO); Map.Entry<String, List<PropagationStatus>> created = groupProvisioningManager.create( groupTO, groupOwnerMap, Collections.singleton(profile.getTask().getResource().getKey()), true); return getAnyTO(created.getKey()); }