当前位置: 首页>>代码示例>>Java>>正文


Java Note类代码示例

本文整理汇总了Java中org.kuali.rice.krad.bo.Note的典型用法代码示例。如果您正苦于以下问题:Java Note类的具体用法?Java Note怎么用?Java Note使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Note类属于org.kuali.rice.krad.bo包,在下文中一共展示了Note类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isNoteValid

import org.kuali.rice.krad.bo.Note; //导入依赖的package包/类
/**
 * Verifies that the note's fields are valid - it does required and format checks.
 *
 * @param note
 * @return boolean True if the document description is valid, false otherwise.
 */
public boolean isNoteValid(Note note) {
    // add the error path keys on the stack
    GlobalVariables.getMessageMap().addToErrorPath(UifPropertyPaths.NEW_COLLECTION_LINES
            + "['"
            + KRADConstants.DOCUMENT_PROPERTY_NAME
            + "."
            + KRADConstants.NOTES_PROPERTY_NAME
            + "']");

    // check the document header for fields like the description
    getDictionaryValidationService().validateBusinessObject(note);

    validateSensitiveDataValue(KRADConstants.NOTE_TEXT_PROPERTY_NAME, note.getNoteText(),
            getDataDictionaryService().getAttributeLabel(Note.class, KRADConstants.NOTE_TEXT_PROPERTY_NAME));

    // drop the error path keys off now
    GlobalVariables.getMessageMap().removeFromErrorPath(UifPropertyPaths.NEW_COLLECTION_LINES
            + "['"
            + KRADConstants.DOCUMENT_PROPERTY_NAME
            + "."
            + KRADConstants.NOTES_PROPERTY_NAME
            + "']");

    return GlobalVariables.getMessageMap().hasNoErrors();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:32,代码来源:DocumentRuleBase.java

示例2: moveAttachmentWherePending

import org.kuali.rice.krad.bo.Note; //导入依赖的package包/类
@Override
public void moveAttachmentWherePending(Note note) {
   	if (note == null) {
   		throw new IllegalArgumentException("Note must be non-null");
   	}
   	if (StringUtils.isBlank(note.getObjectId())) {
   		throw new IllegalArgumentException("Note does not have a valid object id, object id was null or empty");
   	}
   	Attachment attachment = note.getAttachment();
   	if(attachment!=null){
   		try {
   			moveAttachmentFromPending(attachment, note.getRemoteObjectIdentifier());
   		}
   		catch (IOException e) {
   			throw new RuntimeException("Problem moving pending attachment to final directory");
   		}
   	}
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:AttachmentServiceImpl.java

示例3: save

import org.kuali.rice.krad.bo.Note; //导入依赖的package包/类
/**
    * @see org.kuali.rice.krad.service.NoteService#save(org.kuali.rice.krad.bo.Note)
    */
   @Override
public Note save(Note note) {
   	validateNoteNotNull(note);
   	if (StringUtils.isBlank(note.getRemoteObjectIdentifier())) {
   		throw new IllegalStateException("The remote object identifier must be established on a Note before it can be saved.  Given note had a null or empty remote object identifier.");
   	}
       if (note.getAttachment() != null && note.getAttachment().getAttachmentFileName() == null) {
           note.setAttachment(null);
       }
       if (note != null && note.getNoteIdentifier() == null && note.getAttachment() != null) {
           Attachment attachment = note.getAttachment();
           note.setAttachment(null);
           // store without attachment
           note = dataObjectService.save(note);
           attachment.setNoteIdentifier(note.getNoteIdentifier());
           // put attachment back
           note.setAttachment(attachment);
       }
       note = dataObjectService.save(note);
       // move attachment from pending directory
       if (note.getAttachment() != null) {
       	attachmentService.moveAttachmentWherePending(note);
       }
       return note;
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:NoteServiceImpl.java

示例4: createNote

import org.kuali.rice.krad.bo.Note; //导入依赖的package包/类
/**
    * TODO this method seems awfully out of place in this service
    *
    */
   @Override
public Note createNote(Note noteToCopy, GloballyUnique bo, String authorPrincipalId) {
   	validateNoteNotNull(noteToCopy);
   	if (bo == null) {
   		throw new IllegalArgumentException("The bo must not be null.");
   	}
   	if (StringUtils.isBlank(authorPrincipalId)) {
   		throw new IllegalArgumentException("The authorPrincipalId must not be null.");
   	}

       Note tmpNote = new CopiedObject<Note>(noteToCopy).getContent();
       tmpNote.setRemoteObjectIdentifier(bo.getObjectId());
       tmpNote.setAuthorUniversalIdentifier(authorPrincipalId);

       return tmpNote;
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:NoteServiceImpl.java

示例5: disapproveDocument

import org.kuali.rice.krad.bo.Note; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.service.DocumentService#disapproveDocument(org.kuali.rice.krad.document.Document,
 *      java.lang.String)
 */
@Override
public Document disapproveDocument(Document document, String annotation) throws Exception {
    checkForNulls(document);

    Note note = createNoteFromDocument(document, annotation);
    //if note type is BO, override and link disapprove notes to Doc Header
    if (document.getNoteType().equals(NoteType.BUSINESS_OBJECT)) {
        note.setNoteTypeCode(NoteType.DOCUMENT_HEADER.getCode());
        note.setRemoteObjectIdentifier(document.getDocumentHeader().getObjectId());
    }
    document.addNote(note);

    //SAVE THE NOTE
    //Note: This save logic is replicated here and in KualiDocumentAction, when to save (based on doc state) should be moved
    //      into a doc service method
    getNoteService().save(note);

    prepareWorkflowDocument(document);
    getWorkflowDocumentService().disapprove(document.getDocumentHeader().getWorkflowDocument(), annotation);
    UserSessionUtils.addWorkflowDocument(GlobalVariables.getUserSession(),
            document.getDocumentHeader().getWorkflowDocument());
    removeAdHocPersonsAndWorkgroups(document);
    return document;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:DocumentServiceImpl.java

示例6: recallDocument

import org.kuali.rice.krad.bo.Note; //导入依赖的package包/类
@Override
public Document recallDocument(Document document, String annotation, boolean cancel) throws WorkflowException {
    checkForNulls(document);
    WorkflowDocument workflowDocument = KRADServiceLocatorWeb.getDocumentService().
            getByDocumentHeaderId(document.getDocumentNumber()).getDocumentHeader().getWorkflowDocument();

    if (!workflowDocument.isFinal() && !workflowDocument.isProcessed()) {
        Note note = createNoteFromDocument(document, annotation);
        document.addNote(note);
        getNoteService().save(note);
    }

    prepareWorkflowDocument(document);
    getWorkflowDocumentService().recall(document.getDocumentHeader().getWorkflowDocument(), annotation, cancel);
    UserSessionUtils.addWorkflowDocument(GlobalVariables.getUserSession(),
            document.getDocumentHeader().getWorkflowDocument());
    removeAdHocPersonsAndWorkgroups(document);
    return document;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:DocumentServiceImpl.java

示例7: loadNotes

import org.kuali.rice.krad.bo.Note; //导入依赖的package包/类
/**
 * Loads the Notes for the note target on this Document.
 *
 * @param document the document for which to load the notes
 */
protected void loadNotes(final Document document) {
    if (isNoteTargetReady(document)) {
        Object legacyObjectClass;
        if (document instanceof MaintenanceDocument) {
            MaintenanceDocument mdoc = (MaintenanceDocument) document;
            legacyObjectClass = ((Maintainable) org.apache.commons.lang.ObjectUtils.defaultIfNull(mdoc.getOldMaintainableObject(), mdoc.getNewMaintainableObject())).getDataObjectClass();
        } else {
            legacyObjectClass = document.getClass();
        }

        List<Note> notes = new ArrayList<Note>();
        if (StringUtils.isNotBlank(document.getNoteTarget().getObjectId())) {
            notes.addAll(getNoteService().getByRemoteObjectId(document.getNoteTarget().getObjectId()));
        }
        //notes created on 'disapprove' are linked to Doc Header, so this checks that even if notetype = BO
        if (document.getNoteType().equals(NoteType.BUSINESS_OBJECT) && document.getDocumentHeader()
                .getWorkflowDocument().isDisapproved()) {
            notes.addAll(getNoteService().getByRemoteObjectId(document.getDocumentHeader().getObjectId()));
        }

        document.setNotes(notes);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:DocumentServiceImpl.java

示例8: createNoteFromDocument

import org.kuali.rice.krad.bo.Note; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.service.DocumentService#createNoteFromDocument(org.kuali.rice.krad.document.Document,
 *      java.lang.String)
 */
@Override
public Note createNoteFromDocument(Document document, String text) {
    Note note = new Note();

    note.setNotePostedTimestamp(getDateTimeService().getCurrentTimestamp());
    note.setNoteText(text);
    note.setNoteTypeCode(document.getNoteType().getCode());

    GloballyUnique bo = document.getNoteTarget();
    // TODO gah! this is awful
    Person kualiUser = GlobalVariables.getUserSession().getPerson();
    if (kualiUser == null) {
        throw new IllegalStateException("Current UserSession has a null Person.");
    }
    return bo == null ? null : getNoteService().createNote(note, bo, kualiUser.getPrincipalId());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:DocumentServiceImpl.java

示例9: processAfterAddLine

import org.kuali.rice.krad.bo.Note; //导入依赖的package包/类
/**
 * In the case of edit maintenance adds a new blank line to the old side
 * This method is intended to override the method in MaintainableImpl
 * but has a different set of parameters, so it is not actually an override.
 * This version was needed to fetch the old collection from a different path
 * than MaintainableImpl uses.
 *
 * @see org.kuali.rice.krad.uif.service.impl.ViewHelperServiceImpl#processAfterAddLine(org.kuali.rice.krad.uif.view.View,
 * org.kuali.rice.krad.uif.container.CollectionGroup, Object, Object, boolean)
 */
@Override
public void processAfterAddLine(ViewModel model, Object addLine, String collectionId, String collectionPath,
            boolean isValidLine) {
    // Check for maintenance documents in edit but exclude notes
    if (model instanceof MaintenanceDocumentForm
            && KRADConstants.MAINTENANCE_EDIT_ACTION.equals(((MaintenanceDocumentForm)model).getMaintenanceAction()) && !(addLine instanceof Note)) {

        Class<?> collectionObjectClass = (Class<?>) model.getViewPostMetadata().getComponentPostData(collectionId,
                UifConstants.PostMetadata.COLL_OBJECT_CLASS);

        // get the old object's collection
        String oldCollectionPath = collectionPath.replace("newMaintainableObject","oldMaintainableObject");
        Collection<Object> oldCollection = ObjectPropertyUtils.getPropertyValue(model, oldCollectionPath );
        try {
            Object blankLine = collectionObjectClass.newInstance();
            oldCollection.add(blankLine);
        } catch (Exception e) {
            throw new RuntimeException("Unable to create new line instance for old maintenance object", e);
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:32,代码来源:PeopleFlowMaintainableImpl.java

示例10: downloadBOAttachment

import org.kuali.rice.krad.bo.Note; //导入依赖的package包/类
/**
 * Downloads the selected attachment to the user's browser
 *
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return ActionForward
 * @throws Exception
 */
public ActionForward downloadBOAttachment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    Long noteIdentifier = Long.valueOf(request.getParameter(KRADConstants.NOTE_IDENTIFIER));

    Note note = this.getNoteService().getNoteByNoteId(noteIdentifier);
    if(note != null){
    	Attachment attachment = note.getAttachment();
    	if(attachment != null){
    		//make sure attachment is setup with backwards reference to note (rather then doing this we could also just call the attachment service (with a new method that took in the note)
    		attachment.setNote(note);
    		WebUtils.saveMimeInputStreamAsFile(response, attachment.getAttachmentMimeTypeCode(), attachment.getAttachmentContents(), attachment.getAttachmentFileName(), attachment.getAttachmentFileSize().intValue());
    	}
    	return null;
    }
    
    return mapping.findForward(RiceConstants.MAPPING_BASIC);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:27,代码来源:KualiInquiryAction.java

示例11: downloadBOAttachment

import org.kuali.rice.krad.bo.Note; //导入依赖的package包/类
/**
 * Downloads the selected attachment to the user's browser
 *
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return ActionForward
 * @throws Exception
 */
public ActionForward downloadBOAttachment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    KualiDocumentFormBase documentForm = (KualiDocumentFormBase) form;

    int attachmentIndex = selectedAttachmentIndex(request);
    if (attachmentIndex >= 0) {
        Note note = documentForm.getDocument().getNote(attachmentIndex);
        Attachment attachment = note.getAttachment();
        //make sure attachment is setup with backwards reference to note (rather then doing this we could also just call the attachment service (with a new method that took in the note)
        attachment.setNote(note);

        // since we're downloading a file, all of the editable properties from the previous request will continue to be editable.
        documentForm.copyPopulateEditablePropertiesToActionEditableProperties();

        WebUtils.saveMimeInputStreamAsFile(response, attachment.getAttachmentMimeTypeCode(), attachment.getAttachmentContents(), attachment.getAttachmentFileName(), attachment.getAttachmentFileSize().intValue());
        return null;
    }

    return mapping.findForward(RiceConstants.MAPPING_BASIC);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:30,代码来源:KualiDocumentActionBase.java

示例12: addMaintenanceLockedNotes

import org.kuali.rice.krad.bo.Note; //导入依赖的package包/类
protected void addMaintenanceLockedNotes(String documentNumber, Map<SubObjectCode, String> lockedSubObjects, String messageKey, PersistableBusinessObject noteParent, Note noteTemplate) {
    for (Map.Entry<SubObjectCode, String> entry : lockedSubObjects.entrySet()) {
        try {
            SubObjectCode subObjCd = entry.getKey();
            String subObjectString = subObjCd.getUniversityFiscalYear() + " - " + subObjCd.getChartOfAccountsCode() + " - " + subObjCd.getAccountNumber() + " - " + subObjCd.getFinancialObjectCode() + " - " + subObjCd.getFinancialSubObjectCode();
            if (StringUtils.isNotBlank(subObjectString)) {
                String noteTextTemplate = kualiConfigurationService.getPropertyValueAsString(messageKey);
                String noteText = MessageFormat.format(noteTextTemplate, subObjectString, entry.getValue());
                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);
        }
    }
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:21,代码来源:SubObjectTrickleDownInactivationServiceImpl.java

示例13: addMaintenanceLockedNotes

import org.kuali.rice.krad.bo.Note; //导入依赖的package包/类
protected void addMaintenanceLockedNotes(String documentNumber, Map<SubAccount, String> lockedSubAccounts, String messageKey, PersistableBusinessObject noteParent, Note noteTemplate) {
    for (Map.Entry<SubAccount, String> entry : lockedSubAccounts.entrySet()) {
        try {
            SubAccount subAccount = entry.getKey();
            String subAccountString = subAccount.getChartOfAccountsCode() + " - " + subAccount.getAccountNumber() + " - " + subAccount.getSubAccountNumber();
            if (StringUtils.isNotBlank(subAccountString)) {
                String noteTextTemplate = kualiConfigurationService.getPropertyValueAsString(messageKey);
                String noteText = MessageFormat.format(noteTextTemplate, subAccountString, entry.getValue());
                Note note = noteService.createNote(noteTemplate, noteParent, GlobalVariables.getUserSession().getPrincipalId());
                note.setNoteText(noteText);
                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);
        }
    }
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:20,代码来源:SubAccountTrickleDownInactivationServiceImpl.java

示例14: addNotes

import org.kuali.rice.krad.bo.Note; //导入依赖的package包/类
protected void addNotes(String documentNumber, List<SubAccount> listOfSubAccounts, String messageKey, PersistableBusinessObject noteParent, Note noteTemplate) {
    for (int i = 0; i < listOfSubAccounts.size(); i += getNumSubAccountsPerNote()) {
        try {
            String subAccountString = createSubAccountChunk(listOfSubAccounts, i, i + getNumSubAccountsPerNote());
            if (StringUtils.isNotBlank(subAccountString)) {
                String noteTextTemplate = kualiConfigurationService.getPropertyValueAsString(messageKey);
                String noteText = MessageFormat.format(noteTextTemplate, subAccountString);
                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);
        }
    }
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:20,代码来源:SubAccountTrickleDownInactivationServiceImpl.java

示例15: buildNote

import org.kuali.rice.krad.bo.Note; //导入依赖的package包/类
/**
 * Builds a note
 * @param description a description to put into the message of the note
 * @param messageKey the key of the note text in ApplicationResources.properties
 * @param noteTemplate the template for the note
 * @param noteParent the thing to stick the note on
 * @return the built note
 */
protected Note buildNote(String description, String messageKey, Note noteTemplate, PersistableBusinessObject noteParent) {
    Note note = null;
    try {
        final String noteTextTemplate = kualiConfigurationService.getPropertyValueAsString(messageKey);
        final String noteText = MessageFormat.format(noteTextTemplate, description);
        note = noteService.createNote(noteTemplate, noteParent, GlobalVariables.getUserSession().getPrincipalId());
        note.setNoteText(noteText);
    }
    catch (Exception e) {
        // noteService.createNote throws *Exception*???
        // weak!!
        throw new RuntimeException("Cannot create note", e);
    }
    return note;
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:24,代码来源:OrganizationReversionDetailTrickleDownInactivationServiceImpl.java


注:本文中的org.kuali.rice.krad.bo.Note类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。