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));
}
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;
}
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;
}
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);
}
}
}
Aggregations