Search in sources :

Example 21 with Note

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;
}
Also used : NoteExtendedAttribute(edu.cornell.kfs.sys.businessobject.NoteExtendedAttribute) KualiDocumentFormBase(org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase) Note(org.kuali.kfs.krad.bo.Note) ActionForward(org.apache.struts.action.ActionForward) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Example 22 with Note

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");
    }
}
Also used : Note(org.kuali.kfs.krad.bo.Note) NoteService(org.kuali.kfs.krad.service.NoteService)

Example 23 with Note

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;
}
Also used : Note(org.kuali.kfs.krad.bo.Note) ArrayList(java.util.ArrayList) NoteService(org.kuali.kfs.krad.service.NoteService) CuPaymentRequestService(edu.cornell.kfs.module.purap.document.service.CuPaymentRequestService)

Example 24 with Note

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;
}
Also used : HashMap(java.util.HashMap) VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) VendorService(org.kuali.kfs.vnd.document.service.VendorService) IdentityManagementService(org.kuali.rice.kim.api.services.IdentityManagementService) UserSession(org.kuali.kfs.krad.UserSession) Note(org.kuali.kfs.krad.bo.Note) HashSet(java.util.HashSet)

Example 25 with Note

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);
        }
    }
}
Also used : Note(org.kuali.kfs.krad.bo.Note)

Aggregations

Note (org.kuali.kfs.krad.bo.Note)76 Attachment (org.kuali.kfs.krad.bo.Attachment)14 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)12 IOException (java.io.IOException)9 FileNotFoundException (java.io.FileNotFoundException)7 ArrayList (java.util.ArrayList)7 NoteService (org.kuali.kfs.krad.service.NoteService)7 FileInputStream (java.io.FileInputStream)6 KualiDocumentFormBase (org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase)6 NonTransactional (org.kuali.kfs.sys.service.NonTransactional)6 File (java.io.File)5 Iterator (java.util.Iterator)5 DocumentService (org.kuali.kfs.krad.service.DocumentService)5 Person (org.kuali.rice.kim.api.identity.Person)5 NoteExtendedAttribute (edu.cornell.kfs.sys.businessobject.NoteExtendedAttribute)4 SimpleDateFormat (java.text.SimpleDateFormat)4 Document (org.kuali.kfs.krad.document.Document)4 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)4 HashMap (java.util.HashMap)3 List (java.util.List)3