@Override protected void dumpValues(StringBuilder sb, String label, Collection<PrismContainerValue<V>> values, int indent) { DebugUtil.debugDumpLabel(sb, label, indent); if (values == null) { sb.append(" (null)"); } else if (values.isEmpty()) { sb.append(" (empty)"); } else { for (PrismContainerValue<V> val: values) { sb.append("\n"); sb.append(val.debugDump(indent+1)); } } }
@Override public String debugDump(int indent) { StringBuilder sb = new StringBuilder(); DebugUtil.debugDumpLabel(sb, "Authorization", indent); if (authorizationType == null) { sb.append(" null"); } else { sb.append("\n"); authorizationType.asPrismContainerValue().debugDump(indent+1); } return sb.toString(); }
@Override public String debugDump(int indent) { StringBuilder sb = new StringBuilder(); DebugUtil.indentDebugDump(sb, indent); sb.append("SmartAssignmentElement: "); flag(sb, isCurrent, "current"); flag(sb, isOld, "old"); flag(sb, isChanged, "changed"); sb.append("\n"); sb.append(assignmentCVal.debugDump(indent + 1)); return sb.toString(); }
public static void display(String title, Containerable value) { if (value == null) { System.out.println(OBJECT_TITLE_OUT_PREFIX + title + ": null"); LOGGER.debug(OBJECT_TITLE_LOG_PREFIX + title + ": null"); } else { System.out.println(OBJECT_TITLE_OUT_PREFIX + title); System.out.println(SchemaDebugUtil.prettyPrint(value.asPrismContainerValue().debugDump())); LOGGER.debug(OBJECT_TITLE_LOG_PREFIX + title + "\n" + SchemaDebugUtil.prettyPrint(value.asPrismContainerValue().debugDump(1))); } }
@Override public String debugDump(int indent) { StringBuilder sb = new StringBuilder(); DebugUtil.indentDebugDump(sb, indent); sb.append("WfTaskCreationInstruction: process: ").append(getProcessName()).append("/").append(getProcessInstanceName()); sb.append(" ").append(simple ? "simple" : "smart").append(", ").append(noProcess ? "no-process" : "with-process").append(", model-context: "); sb.append(taskModelContext != null ? "YES" : "no").append(", task = ").append(taskName).append("\n"); DebugUtil.indentDebugDump(sb, indent); sb.append("Workflow context:\n"); sb.append(wfContext.asPrismContainerValue().debugDump(indent+2)).append("\n"); DebugUtil.debugDumpWithLabelLn(sb, "Change processor", changeProcessor.getClass().getName(), indent+1); DebugUtil.debugDumpWithLabelLn(sb, "Process creation timestamp", String.valueOf(processCreationTimestamp), indent+1); DebugUtil.debugDumpWithLabelLn(sb, "Task object", String.valueOf(taskObject), indent+1); DebugUtil.debugDumpWithLabelLn(sb, "Task owner", String.valueOf(taskOwner), indent+1); DebugUtil.debugDumpWithLabelLn(sb, "Task initial state", String.valueOf(taskInitialState), indent+1); DebugUtil.debugDumpWithLabelLn(sb, "Send start confirmation", String.valueOf(sendStartConfirmation), indent+1); DebugUtil.debugDumpWithLabelLn(sb, "Handlers after model operation", String.valueOf(handlersAfterModelOperation), indent+1); DebugUtil.debugDumpWithLabelLn(sb, "Handlers before model operation", String.valueOf(handlersBeforeModelOperation), indent+1); DebugUtil.debugDumpWithLabelLn(sb, "Handlers after wf process", String.valueOf(handlersAfterWfProcess), indent+1); DebugUtil.debugDumpWithLabelLn(sb, "Processor instruction", String.valueOf(processorContent), indent+1); DebugUtil.debugDumpWithLabelLn(sb, "Process instruction", String.valueOf(processContent), indent+1); return sb.toString(); } //endregion
sb.append(pval.debugDump(indent + 1)); if (i.hasNext()) { sb.append("\n");
PrismContainerValue<AssignmentType> assignmentValue = valueIterator.next(); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Assignment to add = {}", assignmentValue.debugDump()); PrismContainerValue<AssignmentType> assignmentValue = valueIterator.next(); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Assignment to replace = {}", assignmentValue.debugDump());
private ObjectPolicyConfigurationType determineObjectPolicyConfiguration(PrismObject<UserType> user, PrismObject<SystemConfigurationType> systemConfiguration) throws SchemaException { ObjectPolicyConfigurationType policyConfigurationType; try { policyConfigurationType = ModelUtils.determineObjectPolicyConfiguration(user, systemConfiguration.asObjectable()); } catch (ConfigurationException e) { throw new SchemaException(e.getMessage(), e); } if (LOGGER.isTraceEnabled()) { LOGGER.trace("Selected policy configuration from subtypes {}:\n{}", FocusTypeUtil.determineSubTypes(user), policyConfigurationType==null?null:policyConfigurationType.asPrismContainerValue().debugDump(1)); } return policyConfigurationType; }
private ObjectDelta<? extends ObjectType> factorOutAssignmentValue(EvaluatedAssignment<?> evaluatedAssignment, PlusMinusZero assignmentMode, @NotNull ObjectTreeDeltas<?> objectTreeDeltas, ModelInvocationContext<?> ctx) throws SchemaException { assert assignmentMode == PLUS || assignmentMode == MINUS; @SuppressWarnings("unchecked") PrismContainerValue<AssignmentType> assignmentValue = evaluatedAssignment.getAssignmentType().asPrismContainerValue(); boolean assignmentRemoved = assignmentMode == MINUS; boolean reallyRemoved = objectTreeDeltas.subtractFromFocusDelta(FocusType.F_ASSIGNMENT, assignmentValue, assignmentRemoved, false); if (!reallyRemoved) { ObjectDelta<?> secondaryDelta = ctx.modelContext.getFocusContext().getSecondaryDelta(); if (secondaryDelta != null && secondaryDelta.subtract(FocusType.F_ASSIGNMENT, assignmentValue, assignmentRemoved, true)) { LOGGER.trace("Assignment to be added/deleted was not found in primary delta. It is present in secondary delta, so there's nothing to be approved."); return null; } String message = "Assignment to be added/deleted was not found in primary nor secondary delta." + "\nAssignment:\n" + assignmentValue.debugDump() + "\nPrimary delta:\n" + objectTreeDeltas.debugDump(); throw new IllegalStateException(message); } String objectOid = getFocusObjectOid(ctx.modelContext); return assignmentToDelta(ctx.modelContext.getFocusClass(), evaluatedAssignment.getAssignmentType(), assignmentRemoved, objectOid); }
private <F extends FocusType> void applyAssignmentValueMetadataAdd(LensContext<F> context, PrismContainerValue<AssignmentType> assignmentContainerValue, String desc, XMLGregorianCalendar now, Task task, OperationResult result) throws SchemaException { AssignmentType assignmentType = assignmentContainerValue.asContainerable(); MetadataType metadataType = assignmentType.getMetadata(); if (metadataType == null) { metadataType = new MetadataType(); assignmentType.setMetadata(metadataType); } transplantRequestMetadata(context, metadataType); // This applies the effective status only to assignments that are completely new (whole container is added/replaced) // The effectiveStatus of existing assignments is processed in FocusProcessor.processAssignmentActivation() // We cannot process that here. Because this code is not even triggered when there is no delta. So recompute will not work. ActivationType activationType = assignmentType.getActivation(); ActivationStatusType effectiveStatus = activationComputer.getEffectiveStatus(assignmentType.getLifecycleState(), activationType, null); if (activationType == null) { activationType = new ActivationType(); assignmentType.setActivation(activationType); } activationType.setEffectiveStatus(effectiveStatus); applyCreateMetadata(context, metadataType, now, task); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Adding operational data {} to assignment cval ({}):\nMETADATA:\n{}\nACTIVATION:\n{}", metadataType, desc, assignmentContainerValue.debugDump(1), activationType.asPrismContainerValue().debugDump(1)); } }
@Test public void testParseSerialize() throws Exception{ displayTestTitle("testParseSerialize"); PrismContext prismContext = getPrismContext(); PrismParser parser = prismContext.parserFor(getFile()); PrismContainerValue<MappingType> mappingPval = parser.parseItemValue(); System.out.println("\nmappingPval:\n"+mappingPval.debugDump(1)); PrismSerializer<RootXNode> serializer = prismContext.xnodeSerializer(); RootXNode xnode = serializer.root(new QName("dummy")).serialize(mappingPval); System.out.println("\nSerialized xnode:\n"+xnode.debugDump(1)); MapXNode xexpression = (MapXNode)((MapXNode)xnode.getSubnode()).get(new QName("expression")); ListXNode xconstList = (ListXNode) xexpression.get(new QName("const")); XNode xconst = xconstList.get(0); if (!(xconst instanceof PrimitiveXNode<?>)) { AssertJUnit.fail("const is not primitive: "+xconst); } }
private void updateObjectPolicy() throws ConfigurationException { PrismObject<SystemConfigurationType> systemConfiguration = getLensContext().getSystemConfiguration(); if (systemConfiguration == null) { return; } PrismObject<O> object = getObjectAny(); ObjectPolicyConfigurationType policyConfigurationType = ModelUtils.determineObjectPolicyConfiguration(object, systemConfiguration.asObjectable()); if (policyConfigurationType != getObjectPolicyConfigurationType()) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Changed policy configuration because of changed subtypes {}:\n{}", FocusTypeUtil.determineSubTypes(object), policyConfigurationType==null?null:policyConfigurationType.asPrismContainerValue().debugDump(1)); } setObjectPolicyConfigurationType(policyConfigurationType); } }
@Test public void testAssignmentHashcode3() throws SchemaException { LOGGER.info("\n\n===[ testAssignmentHashcode3 ]===\n"); System.out.println("\n\n===[ testAssignmentHashcode3 ]===\n"); PrismContext prismContext = PrismTestUtil.getPrismContext(); AssignmentType a1a = new AssignmentType(prismContext) .beginActivation() .validTo("2018-01-01T00:00:00.000+01:00") .end(); AssignmentType a1b = a1a.clone(); // use unqualified item name for validTo a1b.getActivation().asPrismContainerValue() .findItem(ActivationType.F_VALID_TO) .setElementName(new QName("validTo")); System.out.println("a1a = " + a1a.asPrismContainerValue().debugDump()); System.out.println("a1b = " + a1b.asPrismContainerValue().debugDump()); // WHEN assertEquals("Wrong hashCode", a1a.hashCode(), a1b.hashCode()); }
@Test public void testSubtractAssignmentFromAddDelta() throws Exception { final String TEST_NAME = "testSubtractAssignmentFromAddDelta"; displayTestTile(TEST_NAME); // GIVEN PrismObject<UserType> user = PrismTestUtil.parseObject(USER_BILL_FILE); ObjectDelta<UserType> addDelta = DeltaFactory.Object.createAddDelta(user); // WHEN PrismContainerDefinition<AssignmentType> assignmentDef = PrismTestUtil.getSchemaRegistry() .findContainerDefinitionByCompileTimeClass(AssignmentType.class).clone(); assignmentDef.toMutable().setMaxOccurs(1); PrismContainer<AssignmentType> assignmentContainer = assignmentDef.instantiate(); PrismContainerValue<AssignmentType> assignmentValue = ObjectTypeUtil.createAssignmentTo("00000001-d34d-b33f-f00d-000000000002", ObjectTypes.ROLE, getPrismContext()) .asPrismContainerValue(); assignmentContainer.add(assignmentValue); System.out.println("Delta before operation:\n" + addDelta.debugDump() + "\n"); System.out.println("Assignment to subtract:\n" + assignmentValue.debugDump() + "\n"); boolean removed = addDelta.subtract(ItemPath.create(SchemaConstants.PATH_ASSIGNMENT), assignmentValue, false, false); // THEN System.out.println("Delta after operation:\n" + addDelta.debugDump() + "\n"); System.out.println("Removed: " + removed + "\n"); assertTrue("Not removed", removed); assertTrue("Remaining delta is not an ADD delta", addDelta.isAdd()); assertEquals("Wrong # of remaining assignments", 2, addDelta.getObjectToAdd().asObjectable().getAssignment().size()); }
LOGGER.trace("Configuring connector {}, provided configuration:\n{}", connectorType, configurationOriginal.debugDump(1));
System.out.println("Assignment to subtract:\n" + assignmentValue.debugDump() + "\n"); boolean removed = delta.subtract(ItemPath.create(SchemaConstants.PATH_ASSIGNMENT), assignmentValue, true, false);
assertEquals("Wrong # of work items found", 1, workItems.size()); System.out.println(workItems.get(0).asPrismContainerValue().debugDump());
if (LOGGER.isTraceEnabled()) { LOGGER.trace("Selected policy configuration from subtypes {}:\n{}", FocusTypeUtil.determineSubTypes(object), policyConfigurationType==null?null:policyConfigurationType.asPrismContainerValue().debugDump(1));