public static List<PropertyDelta<?>> createSynchronizationSituationAndDescriptionDelta(PrismObject<ShadowType> shadow, SynchronizationSituationType situation, String sourceChannel, boolean full, XMLGregorianCalendar timestamp, PrismContext prismContext) throws SchemaException { List<PropertyDelta<?>> propertyDeltas = new ArrayList<>(); PropertyDelta<SynchronizationSituationDescriptionType> syncDescriptionDelta = createSynchronizationSituationDescriptionDelta(shadow, situation, timestamp, sourceChannel, full, prismContext); propertyDeltas.add(syncDescriptionDelta); propertyDeltas.addAll(createSynchronizationTimestampsDelta(shadow, timestamp, full, prismContext)); PropertyDelta<SynchronizationSituationType> syncSituationDelta = createSynchronizationSituationDelta(shadow, situation, prismContext); propertyDeltas.add(syncSituationDelta); return propertyDeltas; }
public static boolean isPolicyApplicable(QName objectClass, ShadowKindType kind, String intent, ObjectSynchronizationType synchronizationPolicy, PrismObject<ResourceType> resource) throws SchemaException{ return isPolicyApplicable(objectClass, kind, intent, synchronizationPolicy, resource, false); }
private static List<PropertyDelta<?>> createSynchronizationTimestampsDelta(PrismObject<ShadowType> shadow, XMLGregorianCalendar timestamp, boolean full, PrismContext prismContext) { List<PropertyDelta<?>> deltas = new ArrayList<>(); PropertyDelta<XMLGregorianCalendar> timestampDelta = createSynchronizationTimestampDelta(shadow, ShadowType.F_SYNCHRONIZATION_TIMESTAMP, timestamp, prismContext); deltas.add(timestampDelta); if (full) { timestampDelta = createSynchronizationTimestampDelta(shadow, ShadowType.F_FULL_SYNCHRONIZATION_TIMESTAMP, timestamp, prismContext); deltas.add(timestampDelta); } return deltas; }
createSynchronizationSituationAndDescriptionDelta(account, SynchronizationSituationType.LINKED, null, false, timestamp, prismContext); syncSituationDeltas = SynchronizationUtils.createSynchronizationSituationAndDescriptionDelta(afterFirstModify, null, null, false, timestamp, prismContext);
public static List<PropertyDelta<?>> createSynchronizationTimestampsDelta( PrismObject<ShadowType> shadow, PrismContext prismContext) { XMLGregorianCalendar timestamp = XmlTypeConverter .createXMLGregorianCalendar(System.currentTimeMillis()); return createSynchronizationTimestampsDelta(shadow, timestamp, true, prismContext); }
private static PropertyDelta<SynchronizationSituationDescriptionType> createSynchronizationSituationDescriptionDelta( PrismObject<ShadowType> shadow, SynchronizationSituationType situation, XMLGregorianCalendar timestamp, String sourceChannel, boolean full, PrismContext prismContext) throws SchemaException { SynchronizationSituationDescriptionType syncSituationDescription = new SynchronizationSituationDescriptionType(); syncSituationDescription.setSituation(situation); syncSituationDescription.setChannel(sourceChannel); syncSituationDescription.setTimestamp(timestamp); syncSituationDescription.setFull(full); S_MaybeDelete builder = prismContext.deltaFor(ShadowType.class) .item(ShadowType.F_SYNCHRONIZATION_SITUATION_DESCRIPTION).add(syncSituationDescription); List<SynchronizationSituationDescriptionType> oldSituationDescriptions = getSituationFromSameChannel( shadow, sourceChannel); if (CollectionUtils.isNotEmpty(oldSituationDescriptions)) { builder.deleteRealValues(oldSituationDescriptions); } return (PropertyDelta<SynchronizationSituationDescriptionType>) builder.asItemDelta(); }
.createSynchronizationSituationAndDescriptionDelta(shadow, syncCtx.getSituation(), change.getSourceChannel(), full, now, prismContext);
private <F extends FocusType> List<PropertyDelta<?>> createShadowIntentAndSynchronizationTimestampDelta(SynchronizationContext<F> syncCtx, boolean saveIntent) throws SchemaException { Validate.notNull(syncCtx.getApplicableShadow(), "No current nor old shadow present: "); List<PropertyDelta<?>> modifications = SynchronizationUtils.createSynchronizationTimestampsDelta(syncCtx.getApplicableShadow(), prismContext); if (saveIntent && StringUtils.isNotBlank(syncCtx.getIntent())) { PropertyDelta<String> intentDelta = prismContext.deltaFactory().property().createModificationReplaceProperty(ShadowType.F_INTENT, syncCtx.getApplicableShadow().getDefinition(), syncCtx.getIntent()); modifications.add(intentDelta); } return modifications; }
private static boolean isPolicyApplicable(ObjectSynchronizationDiscriminatorType synchronizationDiscriminator, ObjectSynchronizationType synchronizationPolicy, PrismObject<ResourceType> resource) throws SchemaException { ShadowKindType kind = synchronizationDiscriminator.getKind(); String intent = synchronizationDiscriminator.getIntent(); if (kind == null && intent == null) { throw new SchemaException( "Illegal state, object synchronization discriminator type must have kind/intent specified. Current values are: kind=" + kind + ", intent=" + intent); } return SynchronizationUtils.isPolicyApplicable(null, kind, intent, synchronizationPolicy, resource); }
.createXMLGregorianCalendar(System.currentTimeMillis()); List<PropertyDelta<?>> syncSituationDeltas = SynchronizationUtils .createSynchronizationSituationAndDescriptionDelta(repoShadow, SynchronizationSituationType.LINKED, null, false, now, prismContext);
PrismObject<ShadowType> applicableShadow = syncCtx.getApplicableShadow(); Validate.notNull(applicableShadow, "No current nor old shadow present: "); List<PropertyDelta<?>> modifications = SynchronizationUtils.createSynchronizationTimestampsDelta(applicableShadow, prismContext); ShadowType applicableShadowType = applicableShadow.asObjectable(); if (applicableShadowType.getIntent() == null || SchemaConstants.INTENT_UNKNOWN.equals(applicableShadowType.getIntent())) {
private static <F extends FocusType> boolean isPolicyApplicable(ObjectSynchronizationType synchronizationPolicy, SynchronizationContext<F> syncCtx) throws SchemaException { ShadowType currentShadowType = syncCtx.getApplicableShadow().asObjectable(); // objectClass QName shadowObjectClass = currentShadowType.getObjectClass(); Validate.notNull(shadowObjectClass, "No objectClass in currentShadow"); return SynchronizationUtils.isPolicyApplicable(shadowObjectClass, currentShadowType.getKind(), currentShadowType.getIntent(), synchronizationPolicy, syncCtx.getResource()); }
.createSynchronizationSituationAndDescriptionDelta(currentShadow, newSituation, task.getChannel(), projectionCtx.hasFullShadow(), now, prismContext);
public boolean isSatisfyTaskConstraints() throws SchemaException { ShadowKindType kind = getTaskPropertyValue(SchemaConstants.MODEL_EXTENSION_KIND); String intent = getTaskPropertyValue(SchemaConstants.MODEL_EXTENSION_INTENT); QName objectClass = getTaskPropertyValue(SchemaConstants.MODEL_EXTENSION_OBJECTCLASS); LOGGER.trace("checking task constraints: {}", task); boolean isApplicable = SynchronizationUtils.isPolicyApplicable(objectClass, kind, intent, objectSynchronization, resource, true); //this mean that kind/intent are null in the task..but this can be a case, so check if at least the objectClass is the same if (!isApplicable && objectClass != null) { return QNameUtil.matchAny(objectClass, objectSynchronization.getObjectClass()); } return isApplicable; }