本文整理汇总了Java中org.kuali.rice.krad.service.DocumentService类的典型用法代码示例。如果您正苦于以下问题:Java DocumentService类的具体用法?Java DocumentService怎么用?Java DocumentService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DocumentService类属于org.kuali.rice.krad.service包,在下文中一共展示了DocumentService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printCreditMemoPDF
import org.kuali.rice.krad.service.DocumentService; //导入依赖的package包/类
/**
* This method generates the Customer Credit Memo PDF
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward printCreditMemoPDF(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
String creditMemoDocId = request.getParameter(KFSConstants.PARAMETER_DOC_ID);
CustomerCreditMemoDocument customerCreditMemoDocument = (CustomerCreditMemoDocument) SpringContext.getBean(DocumentService.class).getByDocumentHeaderId(creditMemoDocId);
AccountsReceivableReportService reportService = SpringContext.getBean(AccountsReceivableReportService.class);
File report = reportService.generateCreditMemo(customerCreditMemoDocument);
if (report.length() == 0) {
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
byte[] content = Files.readAllBytes(report.toPath());
ByteArrayOutputStream baos = SpringContext.getBean(AccountsReceivablePdfHelperService.class).buildPdfOutputStream(content);
StringBuilder fileName = new StringBuilder();
fileName.append(customerCreditMemoDocument.getFinancialDocumentReferenceInvoiceNumber());
fileName.append(KFSConstants.DASH);
fileName.append(customerCreditMemoDocument.getDocumentNumber());
fileName.append(KFSConstants.ReportGeneration.PDF_FILE_EXTENSION);
KfsWebUtils.saveMimeOutputStreamAsFile(response, KFSConstants.ReportGeneration.PDF_MIME_TYPE, baos, fileName.toString(), Boolean.parseBoolean(request.getParameter(KFSConstants.ReportGeneration.USE_JAVASCRIPT)));
return null;
}
示例2: testSaveDocumentWithNonMatchingPO
import org.kuali.rice.krad.service.DocumentService; //导入依赖的package包/类
@Test
public final void testSaveDocumentWithNonMatchingPO() throws Exception {
ElectronicInvoiceLoadSummary eils = ElectronicInvoiceLoadSummaryFixture.EILS_BASIC.createElectronicInvoiceLoadSummary();
BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
boService.save(eils);
GlobalVariables.getUserSession().setBackdoorUser( "ole-parke" );
Integer poId = routePO();
GlobalVariables.getUserSession().setBackdoorUser( "ole" );
eirDoc = ElectronicInvoiceRejectDocumentFixture.EIR_ONLY_REQUIRED_FIELDS.createElectronicInvoiceRejectDocument(eils);
eirDoc.setPurchaseOrderIdentifier(poId);
eirDoc.setInvoicePurchaseOrderNumber(poId.toString());
eirDoc.prepareForSave();
DocumentService documentService = SpringContext.getBean(DocumentService.class);
assertFalse(DocumentStatus.ENROUTE.equals(eirDoc.getDocumentHeader().getWorkflowDocument().getStatus()));
saveDocument(eirDoc, "saving copy source document", documentService);
GlobalVariables.getUserSession().clearBackdoorUser();
Document document = documentService.getByDocumentHeaderId(eirDoc.getDocumentNumber());
assertTrue("Document should be saved.", document.getDocumentHeader().getWorkflowDocument().isSaved());
Document result = documentService.getByDocumentHeaderId(eirDoc.getDocumentNumber());
assertMatch(eirDoc, result);
}
示例3: testChartPermission_1
import org.kuali.rice.krad.service.DocumentService; //导入依赖的package包/类
@ConfigureContext(session=UserNameFixture.day)
public void testChartPermission_1() throws Exception {
DocumentAuthorizer auth = new MaintenanceDocumentAuthorizerBase();
Person user = GlobalVariables.getUserSession().getPerson();
String documentTypeName = "PVEN";
assertTrue(
GlobalVariables.getUserSession().getPrincipalName() + " should be able to initiate " + documentTypeName,
auth.canInitiate( documentTypeName, user)
);
Document doc = SpringContext.getBean(DocumentService.class).getNewDocument(documentTypeName);
assertTrue(
"Initiator should be able to open the document",
auth.canOpen(doc, user)
);
documentTypeName = "GOBJ";
assertFalse(
GlobalVariables.getUserSession().getPrincipalName() + " should not be able to initiate " + documentTypeName,
auth.canInitiate( documentTypeName, GlobalVariables.getUserSession().getPerson())
);
}
示例4: setUp
import org.kuali.rice.krad.service.DocumentService; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
dvDocument = (DisbursementVoucherDocument) SpringContext.getBean(DocumentService.class).getNewDocument(DisbursementVoucherDocument.class);
dvDocument.setDvPayeeDetail(new DisbursementVoucherPayeeDetail());
dvDocument.setDvNonResidentAlienTax(new DisbursementVoucherNonResidentAlienTax());
dvDocument.getDvPayeeDetail().setDisbVchrAlienPaymentCode(true);
AccountingLine line = new SourceAccountingLine();
line.setChartOfAccountsCode("UA");
line.setAccountNumber("1912610");
line.setFinancialObjectCode("5000");
line.setAmount(new KualiDecimal(100));
line.setSequenceNumber(new Integer(1));
dvDocument.getSourceAccountingLines().add(line);
dvDocument.setNextSourceLineNumber(new Integer(2));
}
示例5: printDisbursementVoucherCoverSheet
import org.kuali.rice.krad.service.DocumentService; //导入依赖的package包/类
/**
* Calls service to generate the disbursement voucher cover sheet as a pdf.
*/
public ActionForward printDisbursementVoucherCoverSheet(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
DisbursementVoucherForm dvForm = (DisbursementVoucherForm) form;
// get directory of template
String directory = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(OLEConstants.EXTERNALIZABLE_HELP_URL_KEY);
DisbursementVoucherDocument document = (DisbursementVoucherDocument) SpringContext.getBean(DocumentService.class).getByDocumentHeaderId(request.getParameter(OLEPropertyConstants.DOCUMENT_NUMBER));
// set workflow document back into form to prevent document authorizer "invalid (null)
// document.documentHeader.workflowDocument" since we are bypassing form submit and just linking directly to the action
dvForm.getDocument().getDocumentHeader().setWorkflowDocument(document.getDocumentHeader().getWorkflowDocument());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DisbursementVoucherCoverSheetService coverSheetService = SpringContext.getBean(DisbursementVoucherCoverSheetService.class);
coverSheetService.generateDisbursementVoucherCoverSheet(directory, DisbursementVoucherConstants.DV_COVER_SHEET_TEMPLATE_NM, document, baos);
String fileName = document.getDocumentNumber() + "_cover_sheet.pdf";
WebUtils.saveMimeOutputStreamAsFile(response, "application/pdf", baos, fileName);
return (null);
}
示例6: testRouteDocument
import org.kuali.rice.krad.service.DocumentService; //导入依赖的package包/类
@Test
public final void testRouteDocument() throws Exception {
//create PO
PurchaseOrderDocument po = PurchaseOrderDocumentFixture.PO_ONLY_REQUIRED_FIELDS.createPurchaseOrderDocument();
DocumentService documentService = SpringContext.getBean(DocumentService.class);
po.prepareForSave();
AccountingDocumentTestUtils.routeDocument(po, "saving copy source document", null, documentService);
WorkflowTestUtils.waitForDocumentApproval(po.getDocumentNumber());
PurchaseOrderDocument poResult = (PurchaseOrderDocument) documentService.getByDocumentHeaderId(po.getDocumentNumber());
//create Receiving
LineItemReceivingDocument receivingLineDocument = LineItemReceivingDocumentFixture.EMPTY_LINE_ITEM_RECEIVING.createLineItemReceivingDocument();
receivingLineDocument.populateReceivingLineFromPurchaseOrder(poResult);
for(OleLineItemReceivingItem rli : (List<OleLineItemReceivingItem>)receivingLineDocument.getItems()){
rli.setItemReceivedTotalQuantity( rli.getItemOrderedQuantity());
rli.setItemReceivedTotalParts( rli.getItemOrderedParts());
}
receivingLineDocument.prepareForSave();
assertFalse(DocumentStatus.ENROUTE.equals(receivingLineDocument.getDocumentHeader().getWorkflowDocument().getStatus()));
routeDocument(receivingLineDocument, "routing line item receiving document", documentService);
WorkflowTestUtils.waitForDocumentApproval(receivingLineDocument.getDocumentNumber());
Document document = documentService.getByDocumentHeaderId(receivingLineDocument.getDocumentNumber());
assertTrue("Document should now be final.", receivingLineDocument.getDocumentHeader().getWorkflowDocument().isEnroute());
}
示例7: appSpecificRouteDocumentToUser
import org.kuali.rice.krad.service.DocumentService; //导入依赖的package包/类
/**
* Sends FYI workflow request to the given user on this document.
*
* @param workflowDocument the associated workflow document.
* @param userNetworkId the network ID of the user to be sent to.
* @param annotation the annotation notes contained in this document.
* @param responsibility the responsibility specified in the request.
* @throws WorkflowException
*/
public void appSpecificRouteDocumentToUser(WorkflowDocument workflowDocument, String routePrincipalId, String annotation, String responsibility) throws WorkflowException {
if (ObjectUtils.isNotNull(workflowDocument)) {
boolean isActiveUser = this.isActiveUser(routePrincipalId);
Map<String, String> permissionDetails = new HashMap<String, String>();
permissionDetails.put(KimConstants.AttributeConstants.DOCUMENT_TYPE_NAME, workflowDocument.getDocumentTypeName());
permissionDetails.put(KimConstants.AttributeConstants.ACTION_REQUEST_CD, KewApiConstants.ACTION_REQUEST_FYI_REQ);
boolean canReceiveAdHocRequest = KimApiServiceLocator.getPermissionService().isAuthorizedByTemplate(routePrincipalId, KewApiConstants.KEW_NAMESPACE, KewApiConstants.AD_HOC_REVIEW_PERMISSION, permissionDetails, new HashMap<String, String>());
if(!isActiveUser || !canReceiveAdHocRequest){
String principalName = SpringContext.getBean(PersonService.class).getPerson(routePrincipalId).getName();
String errorText = "cannot send FYI to the user: " + principalName + "; Annotation: " + annotation;
LOG.info(errorText);
Note note = SpringContext.getBean(DocumentService.class).createNoteFromDocument(this, errorText);
this.addNote(SpringContext.getBean(NoteService.class).save(note));
}
String annotationNote = (ObjectUtils.isNull(annotation)) ? "" : annotation;
String responsibilityNote = (ObjectUtils.isNull(responsibility)) ? "" : responsibility;
String currentNodeName = getCurrentRouteNodeName(workflowDocument);
workflowDocument.adHocToPrincipal( ActionRequestType.FYI, currentNodeName, annotationNote, routePrincipalId, responsibilityNote, true);
}
}
示例8: routeMatchingPO
import org.kuali.rice.krad.service.DocumentService; //导入依赖的package包/类
private Integer routeMatchingPO() {
PurchaseOrderDocumentTest purchaseOrderDocumentTest = new PurchaseOrderDocumentTest();
PurchaseOrderDocument poDocument;
try {
poDocument = PurchaseOrderDocumentFixture.EINVOICE_PO.createPurchaseOrderDocument();
DocumentService documentService = SpringContext.getBean(DocumentService.class);
poDocument.prepareForSave();
AccountingDocumentTestUtils.routeDocument(poDocument, "saving copy source document", null, documentService);
WorkflowTestUtils.waitForDocumentApproval(poDocument.getDocumentNumber());
return poDocument.getPurapDocumentIdentifier();
}
catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
示例9: 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;
}
示例10: testMultiSelectIntegration
import org.kuali.rice.krad.service.DocumentService; //导入依赖的package包/类
/**
* Test multiple value searches in the context of whole document search context
*/
@Test
public void testMultiSelectIntegration() throws Exception {
final DocumentService docService = KRADServiceLocatorWeb.getDocumentService();
//docSearchService = KEWServiceLocator.getDocumentSearchService();
DocumentType docType = KEWServiceLocator.getDocumentTypeService().findByName("AccountWithDDAttributes");
String principalName = "quickstart";
String principalId = KimApiServiceLocator.getPersonService().getPersonByPrincipalName(principalName).getPrincipalId();
// Route some test documents.
docService.routeDocument(DOCUMENT_FIXTURE.NORMAL_DOCUMENT.getDocument(docService), "Routing NORMAL_DOCUMENT", null);
assertDDSearchableAttributeWildcardsWork(docType, principalId, "accountStateMultiselect",
new String[][] {{"FirstState"}, {"SecondState"}, {"ThirdState"}, {"FourthState"}, {"FirstState", "SecondState"}, {"FirstState","ThirdState"}, {"FirstState", "FourthState"}, {"SecondState", "ThirdState"}, {"SecondState", "FourthState"}, {"ThirdState", "FourthState"}, {"FirstState", "SecondState", "ThirdState"}, {"FirstState", "ThirdState", "FourthState"}, {"SecondState", "ThirdState", "FourthState"}, {"FirstState","SecondState", "ThirdState", "FourthState"}},
new int[] { 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1 });
assertDDSearchableAttributeWildcardsWork(docType, principalId, "accountOpenDate",
new String[][] {{"10/15/2009"}, {"10/15/2009","10/17/2009"}, {"10/14/2009","10/16/2009"}},
new int[] { 1, 1, 0 });
assertDDSearchableAttributeWildcardsWork(docType, principalId, "accountBalance",
new String[][] {{"501.77"},{"501.77", "63.54"},{"501.78","501.74"}, {"502.00"}, {"0.00"} },
new int[] { 1, 1, 0, 0, 0 });
assertDDSearchableAttributeWildcardsWork(docType, principalId, "accountNumber",
new String[][] {{"1234567890"},{"1234567890", "9876543210"},{"9876543210","77774"}, {"88881"}, {"0"} },
new int[] { 1, 1, 0, 0, 0 });
}
示例11: testIsDebit_source_asset_zeroAmount
import org.kuali.rice.krad.service.DocumentService; //导入依赖的package包/类
/**
* tests an <code>IllegalStateException</code> is thrown for a zero asset
*
* @throws Exception
*/
public void testIsDebit_source_asset_zeroAmount() throws Exception {
AccountingDocument accountingDocument = IsDebitTestUtils.getDocument(SpringContext.getBean(DocumentService.class), InternalBillingDocument.class);
AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(accountingDocument, SourceAccountingLine.class, KualiDecimal.ZERO);
assertTrue(IsDebitTestUtils.isDebitIllegalStateException(SpringContext.getBean(DataDictionaryService.class), SpringContext.getBean(DataDictionaryService.class), accountingDocument, accountingLine));
}
示例12: testIsDebit_errorCorrection_target_asset_positveAmount
import org.kuali.rice.krad.service.DocumentService; //导入依赖的package包/类
/**
* tests an <code>IllegalStateException</code> is thrown for a positive asset
*
* @throws Exception
*/
public void testIsDebit_errorCorrection_target_asset_positveAmount() throws Exception {
AccountingDocument accountingDocument = IsDebitTestUtils.getErrorCorrectionDocument(SpringContext.getBean(DocumentService.class), IndirectCostAdjustmentDocument.class);
AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(accountingDocument, TargetAccountingLine.class, POSITIVE);
assertTrue(IsDebitTestUtils.isDebitIllegalStateException(SpringContext.getBean(DataDictionaryService.class), SpringContext.getBean(DataDictionaryService.class), accountingDocument, accountingLine));
}
示例13: testIsDebit_source_asset_positveAmount
import org.kuali.rice.krad.service.DocumentService; //导入依赖的package包/类
/**
* tests an <code>IllegalStateException</code> is thrown for a positive asset
*
* @throws Exception
*/
public void testIsDebit_source_asset_positveAmount() throws Exception {
AccountingDocument accountingDocument = IsDebitTestUtils.getDocument(SpringContext.getBean(DocumentService.class), ServiceBillingDocument.class);
AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(accountingDocument, SourceAccountingLine.class, POSITIVE);
assertTrue(IsDebitTestUtils.isDebitIllegalStateException(SpringContext.getBean(DataDictionaryService.class), SpringContext.getBean(DataDictionaryService.class), accountingDocument, accountingLine));
}
示例14: createRequisitionDocument
import org.kuali.rice.krad.service.DocumentService; //导入依赖的package包/类
/**
* To create the Requisition document object
*
* @return OleRequisitionDocument
*/
protected OleRequisitionDocument createRequisitionDocument() throws WorkflowException {
String user;
if (GlobalVariables.getUserSession() == null) {
user = getConfigurationService().getPropertyValueAsString(getOleSelectDocumentService().getSelectParameterValue(OleSelectNotificationConstant.ACCOUNT_DOCUMENT_INTIATOR));
if(LOG.isDebugEnabled()){
LOG.debug("createRequisitionDocument - user from session"+user);
}
GlobalVariables.setUserSession(new UserSession(user));
}
return (OleRequisitionDocument) SpringContext.getBean(DocumentService.class).getNewDocument(FinancialDocumentTypeCodes.REQUISITION);
}
示例15: testIsDebit_target_income_negativeAmount
import org.kuali.rice.krad.service.DocumentService; //导入依赖的package包/类
/**
* tests an <code>IllegalStateException</code> is thrown for a negative income
*
* @throws Exception
*/
public void testIsDebit_target_income_negativeAmount() throws Exception {
AccountingDocument accountingDocument = IsDebitTestUtils.getDocument(SpringContext.getBean(DocumentService.class), PreEncumbranceDocument.class);
AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(accountingDocument, TargetAccountingLine.class, NEGATIVE);
assertTrue(IsDebitTestUtils.isDebitIllegalStateException(SpringContext.getBean(DataDictionaryService.class), SpringContext.getBean(DataDictionaryService.class), accountingDocument, accountingLine));
}