Search in sources :

Example 1 with ActionItemExtension

use of edu.cornell.kfs.kew.actionitem.ActionItemExtension in project cu-kfs by CU-CommunityApps.

the class CuActionItemDAOOjbImpl method findActionItemExtensionByActionItemId.

@Override
public ActionItemExtension findActionItemExtensionByActionItemId(String actionItemId) {
    Criteria criteria = new Criteria();
    criteria.addEqualTo(CuKewPropertyConstants.ACTION_ITEM_ID, actionItemId);
    return (ActionItemExtension) getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(ActionItemExtension.class, criteria));
}
Also used : ActionItemExtension(edu.cornell.kfs.kew.actionitem.ActionItemExtension) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) ReportQueryByCriteria(org.apache.ojb.broker.query.ReportQueryByCriteria) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) Criteria(org.apache.ojb.broker.query.Criteria) ReportQueryByCriteria(org.apache.ojb.broker.query.ReportQueryByCriteria)

Example 2 with ActionItemExtension

use of edu.cornell.kfs.kew.actionitem.ActionItemExtension in project cu-kfs by CU-CommunityApps.

the class DocumentMaintenanceServiceImpl method buildActionItemExtension.

private ActionItemExtension buildActionItemExtension(ActionItemNoteDetailDto detailDto, ActionItem item) {
    ActionItemExtension actionItemExtension = new ActionItemExtension();
    actionItemExtension.setActionItemId(item.getId());
    actionItemExtension.setActionNote(detailDto.getActionNote());
    return actionItemExtension;
}
Also used : ActionItemExtension(edu.cornell.kfs.kew.actionitem.ActionItemExtension)

Example 3 with ActionItemExtension

use of edu.cornell.kfs.kew.actionitem.ActionItemExtension in project cu-kfs by CU-CommunityApps.

the class CuActionListServiceImpl method saveActionItemNoteForActionItemId.

/**
 * Part of MSU action item notes contribution; updated as needed by CU.
 * Allows for blank inputs, to prevent errors when this is invoked
 * by JavaScript on the action list page.
 */
@Override
public String saveActionItemNoteForActionItemId(String note, String actionItemId) {
    String resultStatus = KFSConstants.EMPTY_STRING;
    try {
        if (StringUtils.isNotBlank(note) && !validateNoteMaxLength(note)) {
            int maxLength = Integer.parseInt(configurationService.getPropertyValueAsString(CuKewKeyConstants.ACTION_LIST_RESULTS_NOTES_MAXLENGTH));
            note = StringUtils.substring(note, 0, maxLength);
            resultStatus = configurationService.getPropertyValueAsString(CuKewKeyConstants.ACTION_LIST_RESULTS_SAVED_TRUNCATE);
        }
        if (StringUtils.isNotBlank(actionItemId)) {
            ActionItemExtension extension = findActionItemExtensionByActionItemId(actionItemId);
            if (isCreatingNewNonBlankNoteOrChangingExistingNote(extension, note)) {
                if (ObjectUtils.isNull(extension)) {
                    extension = new ActionItemExtension();
                    extension.setActionItemId(actionItemId);
                } else if (StringUtils.isBlank(note)) {
                    note = KFSConstants.EMPTY_STRING;
                }
                extension.setActionNote(note);
                getCuActionItemDAO().saveActionItemExtension(extension);
                if (StringUtils.isBlank(resultStatus)) {
                    resultStatus = configurationService.getPropertyValueAsString(CuKewKeyConstants.ACTION_LIST_RESULTS_SAVED_SUCCESS);
                }
            }
        } else {
            resultStatus = getNoteSaveFailureStatus();
        }
    } catch (RuntimeException e) {
        LOG.error("saveActionItemNoteForActionItemId, Unexpected exception when saving action item note with ID: " + StringUtils.defaultIfBlank(actionItemId, "(Blank ID)"), e);
        resultStatus = getNoteSaveFailureStatus();
    }
    return resultStatus;
}
Also used : ActionItemExtension(edu.cornell.kfs.kew.actionitem.ActionItemExtension)

Example 4 with ActionItemExtension

use of edu.cornell.kfs.kew.actionitem.ActionItemExtension in project cu-kfs by CU-CommunityApps.

the class DocumentMaintenanceServiceImpl method requeueDocumentByDocumentId.

@Transactional
private void requeueDocumentByDocumentId(List<ActionItemNoteDetailDto> noteDetails, String docId) {
    LOG.info("requeueDocumentByDocumentId: Requesting requeue for document: " + docId);
    documentRefreshQueue.refreshDocument(docId);
    List<ActionItemNoteDetailDto> noteDetailsForDocument = findNoteDetailsForDocument(noteDetails, docId);
    for (ActionItemNoteDetailDto detailDto : noteDetailsForDocument) {
        ActionItem actionItem = findActionItem(detailDto);
        if (ObjectUtils.isNotNull(actionItem)) {
            ActionItemExtension actionItemExtension = findActionItemExtension(actionItem.getId());
            if (ObjectUtils.isNull(actionItemExtension)) {
                actionItemExtension = buildActionItemExtension(detailDto, actionItem);
                LOG.info("requeueDocumentByDocumentId, adding note details " + detailDto.toString() + " to action item " + actionItem.getId());
            } else {
                actionItemExtension.setActionNote(detailDto.getActionNote());
                LOG.info("requeueDocumentByDocumentId, updating note details " + detailDto.toString() + " to action item " + actionItem.getId());
            }
            businessObjectService.save(actionItemExtension);
        }
    }
}
Also used : ActionItemExtension(edu.cornell.kfs.kew.actionitem.ActionItemExtension) ActionItem(org.kuali.kfs.kew.actionitem.ActionItem) ActionItemNoteDetailDto(edu.cornell.kfs.sys.dataaccess.ActionItemNoteDetailDto) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ActionItemExtension (edu.cornell.kfs.kew.actionitem.ActionItemExtension)4 ActionItemNoteDetailDto (edu.cornell.kfs.sys.dataaccess.ActionItemNoteDetailDto)1 Criteria (org.apache.ojb.broker.query.Criteria)1 QueryByCriteria (org.apache.ojb.broker.query.QueryByCriteria)1 ReportQueryByCriteria (org.apache.ojb.broker.query.ReportQueryByCriteria)1 ActionItem (org.kuali.kfs.kew.actionitem.ActionItem)1 Transactional (org.springframework.transaction.annotation.Transactional)1