use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.
the class CuRequisitionAction method insertBONote.
@Override
public ActionForward insertBONote(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
KualiDocumentFormBase kualiDocumentFormBase = (KualiDocumentFormBase) form;
Note newNote = kualiDocumentFormBase.getNewNote();
NoteExtendedAttribute extendedAttribute = (NoteExtendedAttribute) newNote.getExtension();
ActionForward forward = super.insertBONote(mapping, form, request, response);
if (newNote != kualiDocumentFormBase.getNewNote()) {
Note addedNote = kualiDocumentFormBase.getDocument().getNotes().get(kualiDocumentFormBase.getDocument().getNotes().size() - 1);
extendedAttribute.setNoteIdentifier(addedNote.getNoteIdentifier());
addedNote.setExtension(extendedAttribute);
SpringContext.getBean(BusinessObjectService.class).save(extendedAttribute);
addedNote.refreshReferenceObject("extension");
}
return forward;
}
use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.
the class VendorInactivateConvertBatchServiceImpl method inactivateVendor.
private void inactivateVendor(VendorDetail vnd, String note, String reasonCd) {
if (checkReasonCd(reasonCd)) {
vnd.setActiveIndicator(false);
vnd.setVendorInactiveReasonCode(reasonCd);
Note newNote = new Note();
newNote.setNoteText("Vendor has been inactivated via inactivate vendor batch job for reason: " + note);
newNote.setNotePostedTimestampToCurrent();
LOG.info("Inactivating " + vnd.getVendorNumber());
Note tmpNote = noteService.createNote(newNote, vnd, GlobalVariables.getUserSession().getPrincipalId());
LOG.info("save note");
SpringContext.getBean(NoteService.class).save(tmpNote);
businessObjectService.save(vnd);
} else {
LOG.info("Invalid reason code for vendor: " + vnd.getVendorName() + ". This vendor was not deactivated");
}
}
use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.
the class PaymentRequestView method getNotes.
/**
* @see org.kuali.kfs.module.purap.businessobject.AbstractRelatedView#getNotes()j
* This is overriden to prevent duplicate fetching of the object id needed to fetch notes
* which becomes a problem when you have a lot of associated payment requests with a
* given purchase order
*/
@Override
public List<Note> getNotes() {
List<Note> notes = new ArrayList<Note>();
// reverse the order of notes only when anything exists in it..
NoteService noteService = SpringContext.getBean(NoteService.class);
// ==== CU Customization: Use a CU-specific PREQ service method to get the note target object ID, instead of always using the doc header one. ====
CuPaymentRequestService cuPaymentRequestService = SpringContext.getBean(CuPaymentRequestService.class);
List<Note> tmpNotes = noteService.getByRemoteObjectId(cuPaymentRequestService.getPaymentRequestNoteTargetObjectId(getDocumentNumber()));
notes.clear();
// reverse the order of notes retrieved so that newest note is in the front
for (int i = tmpNotes.size() - 1; i >= 0; i--) {
Note note = tmpNotes.get(i);
notes.add(note);
}
return notes;
}
use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.
the class VendorDetailInquiryPresentationController method getConditionallyHiddenPropertyNames.
/**
* Implement this method to hide fields based on specific data in the record being inquired into
*
* @return Set of property names that should be hidden
*/
@Override
public Set<String> getConditionallyHiddenPropertyNames(BusinessObject businessObject) {
Set<String> retVal = new HashSet<String>();
IdentityManagementService idService = SpringContext.getBean(IdentityManagementService.class);
UserSession uSession = GlobalVariables.getUserSession();
Map<String, String> permissionDetails = new HashMap<String, String>();
permissionDetails.put(KewApiConstants.DOCUMENT_TYPE_NAME_DETAIL, "PVEN");
boolean canViewAttachments = idService.isAuthorizedByTemplateName(uSession.getPrincipalId(), KRADConstants.KNS_NAMESPACE, KimConstants.PermissionTemplateNames.VIEW_NOTE_ATTACHMENT, permissionDetails, null);
if (!canViewAttachments) {
VendorDetail detail = (VendorDetail) businessObject;
VendorService vendorService = SpringContext.getBean(VendorService.class);
List<Note> boNotes = vendorService.getVendorNotes(detail);
for (int i = 0; i < boNotes.size(); i++) retVal.add("boNotes[" + i + "].attachmentLink");
}
return retVal;
}
use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.
the class AccountReversionTrickleDownInactivationServiceImpl method addNotes.
/**
* Adds notes for the given account reversions.
*
* @param documentNumber
* @param listOfAccountReversions
* @param messageKey
* @param noteParent
* @param noteTemplate
*/
protected void addNotes(String documentNumber, List<AccountReversion> listOfAccountReversions, String messageKey, PersistableBusinessObject noteParent, Note noteTemplate) {
for (int i = 0; i < listOfAccountReversions.size(); i += getNumAccountReversionsPerNote()) {
try {
String accountReversionString = createAccountReversionChunk(listOfAccountReversions, i, i + getNumAccountReversionsPerNote());
if (StringUtils.isNotBlank(accountReversionString)) {
String noteTextTemplate = kualiConfigurationService.getPropertyValueAsString(messageKey);
String noteText = MessageFormat.format(noteTextTemplate, accountReversionString);
Note note = noteService.createNote(noteTemplate, noteParent, GlobalVariables.getUserSession().getPrincipalId());
note.setNoteText(noteText);
note.setNotePostedTimestampToCurrent();
noteService.save(note);
}
} catch (Exception e) {
LOG.error("Unable to create/save notes for document " + documentNumber, e);
throw new RuntimeException("Unable to create/save notes for document " + documentNumber, e);
}
}
}
Aggregations