本文整理汇总了Java中org.kuali.rice.krad.service.DocumentService.getNewDocument方法的典型用法代码示例。如果您正苦于以下问题:Java DocumentService.getNewDocument方法的具体用法?Java DocumentService.getNewDocument怎么用?Java DocumentService.getNewDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.krad.service.DocumentService
的用法示例。
在下文中一共展示了DocumentService.getNewDocument方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: disapprove
import org.kuali.rice.krad.service.DocumentService; //导入方法依赖的package包/类
/**
* Performs the disapprove workflow action on the form document instance
*
* @param form - document form base containing the document instance that will be disapproved
* @return ModelAndView
*/
@RequestMapping(params = "methodToCall=disapprove")
public ModelAndView disapprove(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
HttpServletRequest request, HttpServletResponse response) throws Exception {
OLESerialReceivingForm oleSerialReceivingForm = (OLESerialReceivingForm) form;
OLESerialReceivingDocument oldSerialReceivingDocument = (OLESerialReceivingDocument) oleSerialReceivingForm.getDocument();
ModelAndView modelAndView = super.disapprove(form, result, request, response);
form.setDocId(null);
form.setCommand(KewApiConstants.INITIATE_COMMAND);
super.docHandler(form, result, request, response);
OLESerialReceivingService oleSerialReceivingService = new OLESerialReceivingServiceImpl();
String user = oldSerialReceivingDocument.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId();
Person person = SpringContext.getBean(PersonService.class).getPerson(user);
GlobalVariables.setUserSession(new UserSession(person.getPrincipalName()));
DocumentService documentService = GlobalResourceLoader.getService(OLEConstants.DOCUMENT_HEADER_SERVICE);
OLESerialReceivingDocument newDocument = (OLESerialReceivingDocument) documentService.getNewDocument("OLE_SER_RECV_REC");
newDocument.getDocumentHeader().setDocumentDescription(OLEConstants.SERIAL_REC_DESC + form.getDocument().getDocumentNumber());
oleSerialReceivingService.disapproveCreateNewWithExisting(newDocument, oldSerialReceivingDocument);
documentService.saveDocument(newDocument);
form.setDocument(newDocument);
return modelAndView;
}
示例2: editAccountTemporaryRestrictedRecordDocument
import org.kuali.rice.krad.service.DocumentService; //导入方法依赖的package包/类
public void editAccountTemporaryRestrictedRecordDocument(Account TRestrictedAccount) throws Exception {
MaintenanceDocument accountMaintDoc = null;
Account newAccountRecord = new Account();
try {
org.kuali.rice.krad.service.BusinessObjectService businessObjectService = SpringContext.getBean(org.kuali.rice.krad.service.BusinessObjectService.class);
DocumentService documentService = new DocumentServiceImpl();
accountMaintDoc = (MaintenanceDocument) documentService.getNewDocument(OLEConstants.DocumentTypeAttributes.ACCOUNTING_DOCUMENT_TYPE_NAME);
accountMaintDoc.getDocumentHeader().setDocumentDescription(OleSelectNotificationConstant.OLE_ACCOUNT_TEMP_RESTRICTED_EDIT_DOCUMENT_DESCRIPTION);
accountMaintDoc.getOldMaintainableObject().setBusinessObject(TRestrictedAccount);
newAccountRecord = (Account) ObjectUtils.deepCopy(TRestrictedAccount);
accountMaintDoc.getNewMaintainableObject().setBusinessObject(newAccountRecord);
accountMaintDoc.getNewMaintainableObject().setMaintenanceAction(OLEConstants.MAINTENANCE_EDIT_ACTION);
accountMaintDoc.getNewMaintainableObject().setDocumentNumber(accountMaintDoc.getDocumentNumber());
accountMaintDoc.validateBusinessRules(new RouteDocumentEvent(accountMaintDoc));
documentService.routeDocument(accountMaintDoc, null, null);
} catch (WorkflowException ex) {
throw new RuntimeException(ex);
}
}
示例3: getDocument
import org.kuali.rice.krad.service.DocumentService; //导入方法依赖的package包/类
public AccountWithDDAttributesDocument getDocument(DocumentService docService) throws WorkflowException {
AccountWithDDAttributesDocument acctDoc = (AccountWithDDAttributesDocument) docService.getNewDocument(ACCOUNT_WITH_DD_ATTRIBUTES_DOCUMENT_NAME);
acctDoc.getDocumentHeader().setDocumentDescription(this.accountDocumentDescription);
acctDoc.setAccountNumber(this.accountNumber);
acctDoc.setAccountOwner(this.accountOwner);
acctDoc.setAccountBalance(this.accountBalance);
acctDoc.setAccountOpenDate(this.accountOpenDate);
acctDoc.setAccountUpdateDateTime(this.accountUpdateDateTime);
acctDoc.setAccountState(this.accountState);
acctDoc.setAccountAwake(this.accountAwake);
return acctDoc;
}
示例4: testGetNewDocument_byDocumentClass
import org.kuali.rice.krad.service.DocumentService; //导入方法依赖的package包/类
public static <T extends AccountingDocument> void testGetNewDocument_byDocumentClass(Class<T> documentClass, DocumentService documentService) throws Exception {
T document = (T) documentService.getNewDocument(documentClass);
// verify document was created
Assert.assertNotNull("document was null",document);
Assert.assertNotNull("document header was null",document.getDocumentHeader());
Assert.assertNotNull("document number was null",document.getDocumentHeader().getDocumentNumber());
}
示例5: createDocument
import org.kuali.rice.krad.service.DocumentService; //导入方法依赖的package包/类
public static <D extends Document> D createDocument(DocumentService documentService, Class<D> docmentClass) throws WorkflowException {
D document = (D) documentService.getNewDocument(docmentClass);
document.getDocumentHeader().setExplanation("unit test created document");
DocumentHeader documentHeader = document.getDocumentHeader();
documentHeader.setDocumentDescription("unit test created document");
return document;
}
示例6: testValidatePaymentRequestDates_PastAndInitiatedDocument
import org.kuali.rice.krad.service.DocumentService; //导入方法依赖的package包/类
public void testValidatePaymentRequestDates_PastAndInitiatedDocument() throws Exception {
DocumentService documentService = SpringContext.getBean(DocumentService.class);
PaymentRequestService paymentRequestService = SpringContext.getBean(PaymentRequestService.class);
// some date in the past
Date yesterday = getDateFromOffsetFromToday(-1);
assertFalse("Something is wrong with the test. Error map was not empty before document saving called", GlobalVariables.getMessageMap().hasErrors());
// rule 1: past pay dates are NOT allowed if the document has not been successfully saved or submitted yet
PaymentRequestDocument document1 = (PaymentRequestDocument) documentService.getNewDocument(PaymentRequestDocument.class);
document1.setPaymentRequestPayDate(yesterday);
PaymentRequestPayDateNotPastValidation validation = (PaymentRequestPayDateNotPastValidation)validations.get("PaymentRequest-payDateNotPastValidation-test");
assertFalse( validation.validate(new AttributedDocumentEventBase("","", document1)) );
AutoPopulatingList<ErrorMessage> l = GlobalVariables.getMessageMap().getMessages("document.paymentRequestPayDate");
boolean correctError = false;
for ( ErrorMessage m : l ) {
if (PurapKeyConstants.ERROR_INVALID_PAY_DATE.equals(m.getErrorKey())) {
correctError = true;
break;
}
}
assertTrue("Unable to find error message key '" + PurapKeyConstants.ERROR_INVALID_PAY_DATE + "'", correctError);
GlobalVariables.getMessageMap().clearErrorMessages();
}
示例7: createLicenseRequest
import org.kuali.rice.krad.service.DocumentService; //导入方法依赖的package包/类
/** N
* This method creates license request for maintenanceDocument using document number and licenseRequest.
* @param documentnumber
* @param itemUUIDs
*/
@Override
public OleLicenseRequestBo createLicenseRequest(String documentnumber, String itemUUIDs) {
try{
String user = ConfigContext.getCurrentContextConfig().getProperty(OLEConstants.OleLicenseRequest.LICENSE_DOCUMENT_INITIATOR);
GlobalVariables.setUserSession(new UserSession(user));
DocumentService documentService= GlobalResourceLoader.getService(OLEConstants.DOCUMENT_HEADER_SERVICE);
MaintenanceDocument licenseDoc = (MaintenanceDocument) documentService.getNewDocument(OLEConstants.OleLicenseRequest.LICENSE_REQUEST_DOC_TYPE);
OleLicenseRequestBo oleLicenseRequestBo = (OleLicenseRequestBo) licenseDoc.getDocumentDataObject();
oleLicenseRequestBo.setLocationId(OLEConstants.OleLicenseRequest.LICENSE_INITIAL_LOCATON);
oleLicenseRequestBo.setLicenseRequestWorkflowTypeCode(OLEConstants.OleLicenseRequest.LICENSE_INITIAL_WORKFLOW);
OleEventLogBo eventLog = new OleEventLogBo();
eventLog.setEventType("system");
eventLog.setCreatedBy(user);
eventLog.setEventDescription(OLEConstants.OleLicenseRequest.LICENSE_REQ_INTIAL_EVENT_LOG);
eventLog.setCurrentTimeStamp();
oleLicenseRequestBo.getEventLogs().add(eventLog);
oleLicenseRequestBo.seteResourceDocNumber(documentnumber);
oleLicenseRequestBo.setLicenseRequestStatusCode(
ConfigContext.getCurrentContextConfig().getProperty(OLEConstants.OleLicenseRequest.LICENSE_REQ_DOCUMENT_STATUS));
if(licenseDoc.getDocumentNumber() != null) {
oleLicenseRequestBo.setDocumentNumber(licenseDoc.getDocumentNumber());
oleLicenseRequestBo.setLicenseDocumentNumber(licenseDoc.getDocumentNumber());
}
List<OleLicenseRequestItemTitle> oleLicenseRequestItemTitles= new ArrayList<OleLicenseRequestItemTitle>();
OleLicenseRequestItemTitle oleLicenseRequestItemTitle;
String[] bibUUIDs;
if (itemUUIDs != null ) {
bibUUIDs=itemUUIDs.split(",");
for(int i=0;i<bibUUIDs.length;i++){
oleLicenseRequestItemTitle=new OleLicenseRequestItemTitle();
oleLicenseRequestItemTitle.setItemUUID(bibUUIDs[i]);
oleLicenseRequestItemTitles.add(oleLicenseRequestItemTitle);
}
}
oleLicenseRequestBo.setOleLicenseRequestItemTitles(oleLicenseRequestItemTitles);
Date now = CoreApiServiceLocator.getDateTimeService().getCurrentSqlDate();
Map criteria = new HashMap();
criteria.put("code",
ConfigContext.getCurrentContextConfig().getProperty(OLEConstants.OleLicenseRequest.LICENSE_REQ_DOCUMENT_STATUS));
OleLicenseRequestStatus licenseRequestStatus = KRADServiceLocator.getBusinessObjectService().findByPrimaryKey(OleLicenseRequestStatus.class,
criteria);
licenseDoc.getDocumentHeader().getWorkflowDocument().setApplicationDocumentStatus(licenseRequestStatus.getName());
licenseDoc.getDocumentHeader().setDocumentDescription(OLEConstants.OleLicenseRequest.LICENSE_DESC+"[date:"+now+"]");
licenseDoc.getNewMaintainableObject().setDataObject(oleLicenseRequestBo);
MaintenanceDocument createdLicenseRequest = (MaintenanceDocument)documentService.saveDocument(licenseDoc);
DocumentRouteHeaderValue documentHeader= DocumentRouteHeaderValue.from(licenseDoc.getDocumentHeader().getWorkflowDocument().getDocument());
oleLicenseRequestBo.setDocumentRouteHeaderValue(documentHeader);
return oleLicenseRequestBo;
}catch(Exception e){
LOG.error("Exception while creating license request"+e.getMessage());
throw new RuntimeException(e);
}
}
示例8: getDocument
import org.kuali.rice.krad.service.DocumentService; //导入方法依赖的package包/类
/**
* @param documentService
* @param documentClass
* @return TransactionalDocument
* @throws WorkflowException
*/
public static AccountingDocument getDocument(DocumentService documentService, Class<? extends AccountingDocument> documentClass) throws WorkflowException {
return (AccountingDocument) documentService.getNewDocument(documentClass);
}