use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType in project midpoint by Evolveum.
the class QCaseWorkItemMapping method insert.
// about duplication see the comment in QObjectMapping.toRowObjectWithoutFullObject
@SuppressWarnings("DuplicatedCode")
@Override
public MCaseWorkItem insert(CaseWorkItemType workItem, MCase ownerRow, JdbcSession jdbcSession) {
MCaseWorkItem row = initRowObject(workItem, ownerRow);
row.closeTimestamp = MiscUtil.asInstant(workItem.getCloseTimestamp());
row.createTimestamp = MiscUtil.asInstant(workItem.getCreateTimestamp());
row.deadline = MiscUtil.asInstant(workItem.getDeadline());
setReference(workItem.getOriginalAssigneeRef(), o -> row.originalAssigneeRefTargetOid = o, t -> row.originalAssigneeRefTargetType = t, r -> row.originalAssigneeRefRelationId = r);
AbstractWorkItemOutputType output = workItem.getOutput();
if (output != null) {
row.outcome = output.getOutcome();
}
setReference(workItem.getPerformerRef(), o -> row.performerRefTargetOid = o, t -> row.performerRefTargetType = t, r -> row.performerRefRelationId = r);
row.stageNumber = workItem.getStageNumber();
insert(row, jdbcSession);
storeRefs(row, workItem.getAssigneeRef(), QCaseWorkItemReferenceMapping.getForCaseWorkItemAssignee(), jdbcSession);
storeRefs(row, workItem.getCandidateRef(), QCaseWorkItemReferenceMapping.getForCaseWorkItemCandidate(), jdbcSession);
return row;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType in project midpoint by Evolveum.
the class CaseWorkitemsPanel method initLayout.
protected void initLayout() {
setOutputMarkupId(true);
PrismContainerWrapperModel<CaseType, CaseWorkItemType> workitemsModel = PrismContainerWrapperModel.fromContainerWrapper(getObjectWrapperModel(), CaseType.F_WORK_ITEM);
add(new CaseWorkItemsTableWithDetailsPanel(ID_WORKITEMS_PANEL, workitemsModel) {
private static final long serialVersionUID = 1L;
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PAGE_CASE_WORKITEMS_TAB;
}
});
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType in project midpoint by Evolveum.
the class ReleaseWorkItemsAction method executeInternal.
@Override
@Nullable
public Action executeInternal(OperationResult result) {
for (ReleaseWorkItemsRequest.SingleRelease release : request.getReleases()) {
CaseWorkItemType workItem = operation.getWorkItemById(release.getWorkItemId());
if (workItem.getCloseTimestamp() != null) {
LOGGER.debug("Work item {} in {} cannot be released because it's already closed", workItem, operation.getCurrentCase());
result.recordNotApplicable("There are no candidates this work item can be offered to");
} else if (workItem.getAssigneeRef().isEmpty()) {
throw new SystemException("The work item is not assigned to a user");
} else if (workItem.getAssigneeRef().size() > 1) {
throw new SystemException("The work item is assigned to more than one user, so it cannot be released");
} else if (!operation.getPrincipal().getOid().equals(workItem.getAssigneeRef().get(0).getOid())) {
throw new SystemException("The work item is not assigned to the current user");
} else if (workItem.getCandidateRef().isEmpty()) {
result.recordNotApplicable("There are no candidates this work item can be offered to");
} else {
workItem.getAssigneeRef().clear();
}
}
return null;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType in project midpoint by Evolveum.
the class SimpleStageOpeningHelper method createWorkItems.
private List<CaseWorkItemType> createWorkItems(Collection<ObjectReferenceType> allAssignees, CaseType aCase, SimpleCaseSchemaType schema) {
XMLGregorianCalendar now = clock.currentTimeXMLGregorianCalendar();
XMLGregorianCalendar deadline;
if (schema != null && schema.getDuration() != null) {
deadline = CloneUtil.clone(now);
deadline.add(schema.getDuration());
} else {
deadline = null;
}
return allAssignees.stream().map(assignee -> new CaseWorkItemType(prismContext).originalAssigneeRef(assignee.clone()).assigneeRef(assignee.clone()).name(aCase.getName().getOrig()).createTimestamp(now).deadline(deadline)).collect(Collectors.toList());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType in project midpoint by Evolveum.
the class PageWorkItemsClaimable method createRowActions.
@Override
protected List<InlineMenuItem> createRowActions() {
List<InlineMenuItem> menu = new ArrayList<>();
menu.add(new ButtonInlineMenuItem(createStringResource("pageWorkItem.button.claim")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<PrismContainerValueWrapper<CaseWorkItemType>>() {
@Override
public void onClick(AjaxRequestTarget target) {
claimWorkItemPerformed(getRowModel(), target);
}
};
}
@Override
public IModel<Boolean> getEnabled() {
IModel<PrismContainerValueWrapper<CaseWorkItemType>> rowModel = ((ColumnMenuAction<PrismContainerValueWrapper<CaseWorkItemType>>) getAction()).getRowModel();
if (rowModel != null && rowModel.getObject() != null && rowModel.getObject().getRealValue() != null) {
CaseWorkItemType workItem = rowModel.getObject().getRealValue();
return Model.of(CaseWorkItemUtil.isCaseWorkItemNotClosed(workItem));
} else {
return super.getEnabled();
}
}
@Override
public IModel<String> getConfirmationMessageModel() {
return createStringResource("CaseWorkItemsPanel.confirmWorkItemsClaimAction");
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_ICON_CLAIM);
}
});
return menu;
}
Aggregations