use of com.evolveum.midpoint.schema.util.WorkItemId in project midpoint by Evolveum.
the class AbstractIdMatchTest method test130ResolveAmbiguityAsExisting.
/**
* Resolve the case created in the previous test. (By confirming it is the same person.)
*
* The user should be updated, because the import is executed immediately.
*/
@Test
public void test130ResolveAmbiguityAsExisting() throws CommonException {
given();
Task task = getTestTask();
OperationResult result = task.getResult();
ShadowType newShadow = getShadow("4", result).asObjectable();
CaseType correlationCase = java.util.Objects.requireNonNull(correlationCaseManager.findCorrelationCase(newShadow, true, result));
WorkItemId workItemId = WorkItemId.of(correlationCase.getWorkItem().get(0));
// TODO adapt when URIs are changed to use OIDs
AbstractWorkItemOutputType output = new AbstractWorkItemOutputType(prismContext).outcome(// unqualified should be OK here
SchemaConstants.CORRELATION_EXISTING_PREFIX + getReferenceId(john));
dummyAuditService.clear();
dummyTransport.clearMessages();
when();
caseService.completeWorkItem(workItemId, output, task, result);
then();
assertSuccess(result);
// @formatter:off
UserType john = findUserByUsername("smith2").asObjectable();
assertUser(john, "John after").display().assertFullName("John Smith").assignments().assertAssignments(3).assertOrg(ORG_PROGRAM_SW_ENG.oid).assertOrg(ORG_PROGRAM_MATH.oid).assertOrg(ORG_PROGRAM_E_ENG.oid).end().assertLinks(3, 0);
// @formatter:on
PrismObject<ShadowType> newShadowAfter = getShadow("4", result);
assertShadow(newShadowAfter, "after").display().assertSynchronizationSituation(LINKED).assertMatchReferenceId(getReferenceId(john));
// match request ID may or may not be there
// @formatter:off
assertCase(correlationCase.getOid(), "correlation case").display().assertClosed().workItems().assertWorkItems(2).forOriginalAssignee(USER_ADMINISTRATOR_OID).assertClosed().end().forOriginalAssignee(USER_FRED.oid).assertClosed().end();
// @formatter:on
displayDumpable("audit", dummyAuditService);
displayDumpable("dummy transport", dummyTransport);
// TODO check audit and notification event content
}
use of com.evolveum.midpoint.schema.util.WorkItemId in project midpoint by Evolveum.
the class CompleteWorkItemsAction method updateCaseHistory.
private void updateCaseHistory(@NotNull CaseWorkItemType workItem, @NotNull AbstractWorkItemOutputType output) {
WorkItemId workItemId = WorkItemId.create(operation.getCaseOidRequired(), workItem.getId());
WorkItemCompletionEventType event = new WorkItemCompletionEventType(PrismContext.get());
fillInWorkItemEvent(event, operation.getPrincipal(), workItemId, workItem);
event.setCause(request.getCauseInformation());
event.setOutput(output);
operation.addCaseHistoryEvent(event);
}
use of com.evolveum.midpoint.schema.util.WorkItemId in project midpoint by Evolveum.
the class CorrelationContextPanel method initLayout.
@Override
protected void initLayout() {
IModel<CorrelationContextDto> correlationCtxModel = createCorrelationContextModel();
ListView<String> headers = new ListView<>(ID_HEADERS, new PropertyModel<>(correlationCtxModel, F_OPTION_HEADERS)) {
@Override
protected void populateItem(ListItem<String> item) {
item.add(new Label(ID_HEADER, item.getModel()));
}
};
add(headers);
ListView<CorrelationOptionDto> actions = new ListView<>(ID_ACTIONS, new PropertyModel<>(correlationCtxModel, CorrelationContextDto.F_CORRELATION_OPTIONS)) {
@Override
protected void populateItem(ListItem<CorrelationOptionDto> item) {
AjaxButton actionButton = new AjaxButton(ID_ACTION) {
@Override
public void onClick(AjaxRequestTarget target) {
CaseType correlationCase = getObjectDetailsModels().getObjectType();
WorkItemId workItemId = WorkItemId.of(correlationCase.getWorkItem().get(0));
AbstractWorkItemOutputType output = new AbstractWorkItemOutputType().outcome(item.getModelObject().getIdentifier());
Task task = getPageBase().createSimpleTask("DecideCorrelation");
OperationResult result = task.getResult();
try {
getPageBase().getCaseService().completeWorkItem(workItemId, output, task, result);
result.computeStatusIfUnknown();
} catch (Throwable e) {
result.recordFatalError("Cannot finish correlation process, " + e.getMessage(), e);
}
getPageBase().showResult(result);
target.add(getPageBase().getFeedbackPanel());
}
};
actionButton.add(new Label(ID_ACTION_LABEL, item.getModelObject().isNewOwner() ? TEXT_CREATE_NEW : TEXT_CORRELATE));
item.add(actionButton);
}
};
add(actions);
ListView<CorrelationOptionDto> referenceIds = new ListView<>(ID_NAMES, new PropertyModel<>(correlationCtxModel, CorrelationContextDto.F_CORRELATION_OPTIONS)) {
@Override
protected void populateItem(ListItem<CorrelationOptionDto> item) {
// A full-object reference to the candidate owner
ReadOnlyModel<ObjectReferenceType> referenceModel = new ReadOnlyModel<>(() -> {
CorrelationOptionDto optionDto = item.getModelObject();
if (!optionDto.isNewOwner()) {
return ObjectTypeUtil.createObjectRefWithFullObject(optionDto.getObject());
} else {
// GUI cannot currently open object that does not exist in the repository.
return null;
}
});
item.add(new LinkedReferencePanel<>(ID_NAME, referenceModel));
}
};
add(referenceIds);
ListView<CorrelationPropertyDefinition> rows = new ListView<>(ID_ROWS, new PropertyModel<>(correlationCtxModel, CorrelationContextDto.F_CORRELATION_PROPERTIES)) {
@Override
protected void populateItem(ListItem<CorrelationPropertyDefinition> item) {
// First column contains the property name
item.add(new Label(ID_ATTR_NAME, new PropertyModel<>(item.getModel(), CorrelationPropertyDefinition.F_DISPLAY_NAME)));
// Here are columns for values for individual options
item.add(createColumnsForPropertyRow(correlationCtxModel, item));
}
};
add(rows);
}
use of com.evolveum.midpoint.schema.util.WorkItemId in project midpoint by Evolveum.
the class AbstractMultiAccountsCorrelationTest method test130ResolveAmbiguityAsExisting.
/**
* Resolve the case created in the previous test. (By confirming it is the same person.)
*
* The user should be updated, because the import is executed immediately.
*/
@Test
public void test130ResolveAmbiguityAsExisting() throws CommonException {
given();
Task task = getTestTask();
OperationResult result = task.getResult();
ShadowType newShadow = getShadow("4", result).asObjectable();
CaseType correlationCase = java.util.Objects.requireNonNull(correlationCaseManager.findCorrelationCase(newShadow, true, result));
WorkItemId workItemId = WorkItemId.of(correlationCase.getWorkItem().get(0));
AbstractWorkItemOutputType output = new AbstractWorkItemOutputType(prismContext).outcome(OwnerOptionIdentifier.forExistingOwner(john.getOid()).getStringValue());
dummyAuditService.clear();
dummyTransport.clearMessages();
when();
caseService.completeWorkItem(workItemId, output, task, result);
then();
assertSuccess(result);
// @formatter:off
UserType john = findUserByUsername("smith2").asObjectable();
assertUser(john, "John after").display().assertFullName("John Smith").assignments().assertAssignments(3).assertOrg(ORG_PROGRAM_SW_ENG.oid).assertOrg(ORG_PROGRAM_MATH.oid).assertOrg(ORG_PROGRAM_E_ENG.oid).end().assertLinks(3, 0);
// @formatter:on
PrismObject<ShadowType> newShadowAfter = getShadow("4", result);
assertShadow(newShadowAfter, "after").display().assertSynchronizationSituation(LINKED);
// @formatter:off
assertCase(correlationCase.getOid(), "correlation case").display().assertClosed().workItems().assertWorkItems(1);
// @formatter:on
displayDumpable("audit", dummyAuditService);
displayDumpable("dummy transport", dummyTransport);
// TODO check audit and notification event content
}
use of com.evolveum.midpoint.schema.util.WorkItemId in project midpoint by Evolveum.
the class AbstractMultiAccountsCorrelationTest method test160ResolveAmbiguityAsNone.
/**
* Resolve the case created in the previous test. (By telling it's a different person.)
*/
@Test
public void test160ResolveAmbiguityAsNone() throws CommonException {
given();
Task task = getTestTask();
OperationResult result = task.getResult();
ShadowType newShadow = getShadow("6", result).asObjectable();
CaseType correlationCase = java.util.Objects.requireNonNull(correlationCaseManager.findCorrelationCase(newShadow, true, result));
WorkItemId workItemId = WorkItemId.of(correlationCase.getWorkItem().get(0));
AbstractWorkItemOutputType output = new AbstractWorkItemOutputType(prismContext).outcome(OwnerOptionIdentifier.forNoOwner().getStringValue());
dummyAuditService.clear();
dummyTransport.clearMessages();
when();
caseService.completeWorkItem(workItemId, output, task, result);
then();
assertSuccess(result);
// @formatter:off
UserType john = findUserByUsername("smith3").asObjectable();
assertUser(john, "New john after").display().assertFullName("John Smith").assignments().assertAssignments(1).assertOrg(ORG_PROGRAM_SW_ENG_DOCTORAL.oid).end().assertLinks(1, 0);
// @formatter:on
PrismObject<ShadowType> newShadowAfter = getShadow("6", result);
assertShadow(newShadowAfter, "after").display().assertSynchronizationSituation(LINKED);
assertCase(correlationCase.getOid(), "correlation case").display().assertClosed();
displayDumpable("audit", dummyAuditService);
displayDumpable("dummy transport", dummyTransport);
// TODO check audit and notification event content
}
Aggregations