本文整理汇总了Java中org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent类的典型用法代码示例。如果您正苦于以下问题:Java SaveDocumentEvent类的具体用法?Java SaveDocumentEvent怎么用?Java SaveDocumentEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SaveDocumentEvent类属于org.kuali.rice.krad.rules.rule.event包,在下文中一共展示了SaveDocumentEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testSaveDocument_DocumentEvent
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
/**
* tests saveDocument, in particular, the save document rule event and the custom rule method
* invocation of the business rule associated with the document.
*
* @throws Exception
*/
@Test
public void testSaveDocument_DocumentEvent() throws Exception {
MaintenanceDocument maintenanceDocument = ( MaintenanceDocument ) KRADServiceLocatorWeb
.getDocumentService().getNewDocument( "AccountMaintenanceDocument" );
Account account = ( Account ) maintenanceDocument.getNewMaintainableObject().getDataObject();
SaveDocumentEvent documentEvent = new SaveDocumentEvent( maintenanceDocument );
documentEvent.setName( "DocumentControllerBaseSaveDocumentRuleTest#testSave_SaveDocumentEvent()" );
documentEvent.setRuleMethodName( "processEvent" );
Document savedDocument = KRADServiceLocatorWeb.getDocumentService()
.saveDocument(maintenanceDocument, documentEvent);
assertNull( "New maintenance document should not have a version number yet.",
maintenanceDocument.getDocumentHeader().getVersionNumber() );
assertNotNull( "Saved maintenance document must have a version number.", savedDocument.getDocumentHeader().getVersionNumber() );
List<ErrorMessage> msgs = GlobalVariables.getMessageMap().getInfoMessagesForProperty( documentEvent.getName() );
assertEquals( "There must be one entry added by the business rule method.", 1, msgs.size() );
assertEquals( "The message set by the business rule must match the test message.",
documentEvent.getRuleMethodName() + "()", msgs.get(0).toString() );
}
开发者ID:kuali,项目名称:kc-rice,代码行数:31,代码来源:DocumentServiceTest.java
示例2: save
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public ModelAndView save(DocumentFormBase form, SaveDocumentEvent saveDocumentEvent) {
Document document = form.getDocument();
// get the explanation from the document and check it for sensitive data
String explanation = document.getDocumentHeader().getExplanation();
ModelAndView sensitiveDataDialogModelAndView = checkSensitiveDataAndWarningDialog(explanation, form);
// if a sensitive data warning dialog is returned then display it
if (sensitiveDataDialogModelAndView != null) {
return sensitiveDataDialogModelAndView;
}
performWorkflowAction(form, UifConstants.WorkflowAction.SAVE, saveDocumentEvent);
return getModelAndViewService().getModelAndView(form);
}
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:DocumentControllerServiceImpl.java
示例3: postProcessSave
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
/**
* this needs to happen after the document itself is saved, to preserve consistency of the ver_nbr and in the case
* of initial save, because this can't be saved until the document is saved initially
*
* @see org.kuali.rice.krad.document.DocumentBase#postProcessSave(org.kuali.rice.krad.rules.rule.event.DocumentEvent)
*/
@Override
public void postProcessSave(DocumentEvent event) {
Object bo = getNewMaintainableObject().getDataObject();
if (bo instanceof GlobalBusinessObject) {
bo = KRADServiceLocatorWeb.getLegacyDataAdapter().save(bo);
// KRAD/JPA - have to change the handle to object to that just saved
getNewMaintainableObject().setDataObject(bo);
}
//currently only global documents could change the list of what they're affecting during routing,
//so could restrict this to only happening with them, but who knows if that will change, so safest
//to always do the delete and re-add...seems a bit inefficient though if nothing has changed, which is
//most of the time...could also try to only add/update/delete what's changed, but this is easier
if (!(event instanceof SaveDocumentEvent)) { //don't lock until they route
getMaintenanceDocumentService().deleteLocks(MaintenanceDocumentBase.this.getDocumentNumber());
getMaintenanceDocumentService().storeLocks(MaintenanceDocumentBase.this.getNewMaintainableObject().generateMaintenanceLocks());
}
}
开发者ID:kuali,项目名称:kc-rice,代码行数:25,代码来源:MaintenanceDocumentBase.java
示例4: testProcessVendorValidation_REQ_Invalid_Vendor_Fax_Number_Contains_Letter
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
public void testProcessVendorValidation_REQ_Invalid_Vendor_Fax_Number_Contains_Letter() {
boolean validationFailed = false;
RequisitionDocument req = RequisitionDocumentFixture.REQ_INVALID_VENDOR_FAX_NUMBER_CONTAINS_LETTER.createRequisitionDocument();
PurchasingProcessVendorValidation validation = (PurchasingProcessVendorValidation)validations.get("Purchasing-processVendorValidation-test");
assertTrue( validation.validate(new AttributedDocumentEventBase("","", req)) );
try {
req.validateBusinessRules(new SaveDocumentEvent(req));
} catch (ValidationException e) {
validationFailed = true;
}
assertTrue(validationFailed);
assertTrue(GlobalVariables.getMessageMap().containsMessageKey(new PhoneNumberValidationPattern().getValidationErrorMessageKey()));
}
开发者ID:kuali,项目名称:kfs,代码行数:17,代码来源:RequisitionDocumentRuleTest.java
示例5: testProcessVendorValidation_REQ_Invalid_Vendor_Fax_Number_Bad_Format
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
public void testProcessVendorValidation_REQ_Invalid_Vendor_Fax_Number_Bad_Format() {
boolean validationFailed = false;
RequisitionDocument req = RequisitionDocumentFixture.REQ_INVALID_VENDOR_FAX_NUMBER_BAD_FORMAT.createRequisitionDocument();
PurchasingProcessVendorValidation validation = (PurchasingProcessVendorValidation)validations.get("Purchasing-processVendorValidation-test");
assertTrue( validation.validate(new AttributedDocumentEventBase("","", req)) );
try {
req.validateBusinessRules(new SaveDocumentEvent(req));
} catch (ValidationException e) {
validationFailed = true;
}
assertTrue(validationFailed);
assertTrue(GlobalVariables.getMessageMap().containsMessageKey(new PhoneNumberValidationPattern().getValidationErrorMessageKey()));
}
开发者ID:kuali,项目名称:kfs,代码行数:17,代码来源:RequisitionDocumentRuleTest.java
示例6: testProcessVendorValidation_REQ_Valid_Vendor_Fax_Number
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
public void testProcessVendorValidation_REQ_Valid_Vendor_Fax_Number() {
boolean validationFailed = false;
RequisitionDocument req = RequisitionDocumentFixture.REQ_VALID_VENDOR_FAX_NUMBER.createRequisitionDocument();
PurchasingProcessVendorValidation validation = (PurchasingProcessVendorValidation)validations.get("Purchasing-processVendorValidation-test");
assertTrue( validation.validate(new AttributedDocumentEventBase("","", req)) );
try {
req.validateBusinessRules(new SaveDocumentEvent(req));
} catch (ValidationException e) {
validationFailed = true;
}
assertFalse(validationFailed);
assertTrue(GlobalVariables.getMessageMap().hasNoErrors());
}
开发者ID:kuali,项目名称:kfs,代码行数:17,代码来源:RequisitionDocumentRuleTest.java
示例7: generateAccountingLinesForCapitalization
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
/**
* Supports the generate button on the UI. It generates the capital accounting lines
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward generateAccountingLinesForCapitalization(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
KualiAccountingDocumentFormBase kualiAccountingDocumentFormBase = (KualiAccountingDocumentFormBase) form;
CapitalAccountingLinesFormBase capitalAccountingLinesFormBase = (CapitalAccountingLinesFormBase) form;
CapitalAccountingLinesDocumentBase caldb = (CapitalAccountingLinesDocumentBase) capitalAccountingLinesFormBase.getFinancialDocument();
CapitalAssetAccountingLineUniquenessEnforcementValidation uniquenessValidation = new CapitalAssetAccountingLineUniquenessEnforcementValidation();
uniquenessValidation.setAccountingDocumentForValidation(caldb);
if (uniquenessValidation.validate(new AttributedRouteDocumentEvent(caldb))
&& getRuleService().applyRules(new SaveDocumentEvent(caldb))) {
String distributionAmountCode = capitalAccountingLinesFormBase.getCapitalAccountingLine().getDistributionCode();
List<CapitalAccountingLines> capitalAccountingLines = caldb.getCapitalAccountingLines();
AccountingDocument tdoc = (AccountingDocument) kualiAccountingDocumentFormBase.getDocument();
createCapitalAccountingLines(capitalAccountingLines, tdoc, distributionAmountCode);
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
开发者ID:kuali,项目名称:kfs,代码行数:29,代码来源:CapitalAccountingLinesActionBase.java
示例8: postProcessSave
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
/**
* @see org.kuali.rice.kns.document.DocumentBase#postProcessSave(org.kuali.rice.kns.rule.event.KualiDocumentEvent)
*/
public void postProcessSave(KualiDocumentEvent event) {
super.postProcessSave(event);
if (!(event instanceof SaveDocumentEvent)) { // don't lock until they route
ArrayList capitalAssetNumbers = new ArrayList<Long>();
if (this.getCapitalAssetNumber() != null) {
capitalAssetNumbers.add(this.getCapitalAssetNumber());
}
if (!this.getCapitalAssetManagementModuleService().storeAssetLocks(capitalAssetNumbers, this.getDocumentNumber(), CamsConstants.DocumentTypeName.ASSET_TRANSFER, null)) {
throw new ValidationException("Asset " + capitalAssetNumbers.toString() + " is being locked by other documents.");
}
}
}
开发者ID:kuali,项目名称:kfs,代码行数:19,代码来源:AssetTransferDocument.java
示例9: postProcessSave
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
/**
* @see org.kuali.rice.krad.document.DocumentBase#postProcessSave(org.kuali.rice.krad.rule.event.KualiDocumentEvent)
*/
public void postProcessSave(KualiDocumentEvent event) {
super.postProcessSave(event);
if (!(event instanceof SaveDocumentEvent)) { // don't lock until they route
ArrayList capitalAssetNumbers = new ArrayList<Long>();
if (this.getCapitalAssetNumber() != null) {
capitalAssetNumbers.add(this.getCapitalAssetNumber());
}
// check and lock on asset numbers exclude approve event.
if (!this.getCapitalAssetManagementModuleService().storeAssetLocks(capitalAssetNumbers, this.getDocumentNumber(), CamsConstants.DocumentTypeName.ASSET_EQUIPMENT_LOAN_OR_RETURN, null)) {
throw new ValidationException("Asset " + capitalAssetNumbers.toString() + " is being locked by other documents.");
}
}
}
开发者ID:kuali,项目名称:kfs,代码行数:19,代码来源:EquipmentLoanOrReturnDocument.java
示例10: postProcessSave
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
/**
* @see org.kuali.rice.krad.document.DocumentBase#postProcessSave(org.kuali.rice.krad.rule.event.KualiDocumentEvent)
*/
@Override
public void postProcessSave(KualiDocumentEvent event) {
super.postProcessSave(event);
if (!(event instanceof SaveDocumentEvent)) { // don't lock until they
// route
ArrayList<Long> capitalAssetNumbers = new ArrayList<Long>();
for (AssetPaymentAssetDetail assetPaymentAssetDetail : this.getAssetPaymentAssetDetail()) {
if (assetPaymentAssetDetail.getCapitalAssetNumber() != null) {
capitalAssetNumbers.add(assetPaymentAssetDetail.getCapitalAssetNumber());
}
}
String documentTypeForLocking = CamsConstants.DocumentTypeName.ASSET_PAYMENT;
if (this.isCapitalAssetBuilderOriginIndicator()) {
documentTypeForLocking = CamsConstants.DocumentTypeName.ASSET_PAYMENT_FROM_CAB;
}
if (!this.getCapitalAssetManagementModuleService().storeAssetLocks(capitalAssetNumbers, this.getDocumentNumber(), documentTypeForLocking, null)) {
throw new ValidationException("Asset " + capitalAssetNumbers.toString() + " is being locked by other documents.");
}
}
}
开发者ID:kuali,项目名称:kfs,代码行数:27,代码来源:AssetPaymentDocument.java
示例11: saveDocumentNoWorkFlow
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
/**
* @see org.kuali.kfs.module.bc.document.service.BudgetDocumentService#saveDocumentNoWorkFlow(org.kuali.kfs.module.bc.document.BudgetConstructionDocument,
* org.kuali.kfs.module.bc.BCConstants.MonthSpreadDeleteType, boolean)
*/
@Transactional
public Document saveDocumentNoWorkFlow(BudgetConstructionDocument bcDoc, MonthSpreadDeleteType monthSpreadDeleteType, boolean doMonthRICheck) throws ValidationException {
checkForNulls(bcDoc);
bcDoc.prepareForSave();
// validate and save the local objects not workflow objects
// this eventually calls BudgetConstructionRules.processSaveDocument() which overrides the method in DocumentRuleBase
if (doMonthRICheck) {
validateAndPersistDocument(bcDoc, new SaveDocumentEvent(bcDoc));
}
else {
validateAndPersistDocument(bcDoc, new DeleteMonthlySpreadEvent(bcDoc, monthSpreadDeleteType));
}
return bcDoc;
}
开发者ID:kuali,项目名称:kfs,代码行数:22,代码来源:BudgetDocumentServiceImpl.java
示例12: postProcessSave
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
/**
* this needs to happen after the document itself is saved, to preserve consistency of the ver_nbr and in the case
* of initial save, because this can't be saved until the document is saved initially
*
* @see org.kuali.rice.krad.document.DocumentBase#postProcessSave(org.kuali.rice.krad.rules.rule.event.KualiDocumentEvent)
*/
@Override
public void postProcessSave(KualiDocumentEvent event) {
if (getNewMaintainableObject().getDataObject() instanceof PersistableBusinessObject) {
PersistableBusinessObject bo = (PersistableBusinessObject) getNewMaintainableObject().getDataObject();
if (bo instanceof GlobalBusinessObject) {
KRADServiceLocator.getBusinessObjectService().save(bo);
}
}
//currently only global documents could change the list of what they're affecting during routing,
//so could restrict this to only happening with them, but who knows if that will change, so safest
//to always do the delete and re-add...seems a bit inefficient though if nothing has changed, which is
//most of the time...could also try to only add/update/delete what's changed, but this is easier
if (!(event instanceof SaveDocumentEvent)) { //don't lock until they route
getMaintenanceDocumentService().deleteLocks(this.getDocumentNumber());
getMaintenanceDocumentService().storeLocks(this.getNewMaintainableObject().generateMaintenanceLocks());
}
}
开发者ID:ewestfal,项目名称:rice-xml-converter,代码行数:25,代码来源:MaintenanceDocumentBase.java
示例13: postProcessSave
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
/**
* this needs to happen after the document itself is saved, to preserve consistency of the ver_nbr and in the case
* of initial save, because this can't be saved until the document is saved initially
*
* @see org.kuali.rice.krad.document.DocumentBase#postProcessSave(org.kuali.rice.krad.rules.rule.event.DocumentEvent)
*/
@Override
public void postProcessSave(DocumentEvent event) {
//currently only global documents could change the list of what they're affecting during routing,
//so could restrict this to only happening with them, but who knows if that will change, so safest
//to always do the delete and re-add...seems a bit inefficient though if nothing has changed, which is
//most of the time...could also try to only add/update/delete what's changed, but this is easier
if (!(event instanceof SaveDocumentEvent)) { //don't lock until they route
getMaintenanceDocumentService().deleteLocks(MaintenanceDocumentBase.this.getDocumentNumber());
getMaintenanceDocumentService().storeLocks(MaintenanceDocumentBase.this.getNewMaintainableObject().generateMaintenanceLocks());
}
}
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:MaintenanceDocumentBase.java
示例14: postProcessSave
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
/**
* @see org.kuali.rice.krad.document.DocumentBase#postProcessSave(org.kuali.rice.krad.rule.event.KualiDocumentEvent)
*/
@Override
public void postProcessSave(KualiDocumentEvent event) {
super.postProcessSave(event);
if (!(event instanceof SaveDocumentEvent)) { // don't lock until they route
String documentTypeName = SpringContext.getBean(DataDictionaryService.class).getDocumentTypeNameByClass(this.getClass());
this.getCapitalAssetManagementModuleService().generateCapitalAssetLock(this, documentTypeName);
}
}
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:12,代码来源:DistributionOfIncomeAndExpenseDocument.java
示例15: postProcessSave
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
@Override
public void postProcessSave(KualiDocumentEvent event) {
super.postProcessSave(event);
if (!(event instanceof SaveDocumentEvent)) { // don't lock until they route
String documentTypeName = SpringContext.getBean(DataDictionaryService.class).getDocumentTypeNameByClass(this.getClass());
this.getCapitalAssetManagementModuleService().generateCapitalAssetLock(this,documentTypeName);
}
}
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:9,代码来源:CreditCardReceiptDocument.java
示例16: postProcessSave
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
@Override
public void postProcessSave(KualiDocumentEvent event) {
super.postProcessSave(event);
if (!(event instanceof SaveDocumentEvent)) {
String documentTypeName = SpringContext.getBean(DataDictionaryService.class).getDocumentTypeNameByClass(this.getClass());
this.getCapitalAssetManagementModuleService().generateCapitalAssetLock(this,documentTypeName);
}
}
开发者ID:kuali,项目名称:kfs,代码行数:9,代码来源:IntraAccountAdjustmentDocument.java
示例17: postProcessSave
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
@Override
public void postProcessSave(KualiDocumentEvent event) {
super.postProcessSave(event);
if (!(event instanceof SaveDocumentEvent)) { // don't lock until they route
String documentTypeName = SpringContext.getBean(DataDictionaryService.class).getDocumentTypeNameByClass(this.getClass());
this.getCapitalAssetManagementModuleService().generateCapitalAssetLock(this,documentTypeName);
}
}
开发者ID:kuali,项目名称:kfs,代码行数:9,代码来源:CreditCardReceiptDocument.java
示例18: validateDocument
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
/**
* @see org.kuali.kfs.module.bc.document.service.BudgetDocumentService#validateDocument(org.kuali.rice.krad.document.Document)
*/
@Transactional
public void validateDocument(Document document) throws ValidationException {
if (document == null) {
LOG.error("document passed to validateDocument was null");
throw new IllegalArgumentException("invalid (null) document");
}
LOG.info("validating document " + document.getDocumentNumber());
document.validateBusinessRules(new SaveDocumentEvent(document));
}
开发者ID:kuali,项目名称:kfs,代码行数:14,代码来源:BudgetDocumentServiceImpl.java
示例19: validateBusinessRules
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
/**
* Explicitly NOT calling super here. This is a complete override of the validation rules behavior.
*
* @see org.kuali.rice.krad.document.DocumentBase#validateBusinessRules(org.kuali.rice.krad.rules.rule.event.DocumentEvent)
*/
@Override
public void validateBusinessRules(DocumentEvent event) {
if (GlobalVariables.getMessageMap().hasErrors()) {
logErrors();
throw new ValidationException("errors occured before business rule");
}
// check for locking documents for MaintenanceDocuments
checkForLockingDocument(true);
// Make sure the business object's version number matches that of the databases copy.
if (newMaintainableObject != null) {
KRADServiceLocatorWeb.getLegacyDataAdapter().verifyVersionNumber(newMaintainableObject.getDataObject());
}
// perform validation against rules engine
if (LOG.isInfoEnabled()) {
LOG.info("invoking rules engine on document " + getDocumentNumber());
}
boolean isValid = true;
isValid = KRADServiceLocatorWeb.getKualiRuleService().applyRules(event);
// check to see if the br eval passed or failed
if (!isValid) {
logErrors();
// TODO: better error handling at the lower level and a better error message are
// needed here
throw new ValidationException("business rule evaluation failed");
} else if (GlobalVariables.getMessageMap().hasErrors()) {
logErrors();
if (event instanceof SaveDocumentEvent) {
// for maintenance documents, we want to always actually do a save if the
// user requests a save, even if there are validation or business rules
// failures. this empty if does this, and allows the document to be saved,
// even if there are failures.
// BR or validation failures on a ROUTE even should always stop the route,
// that has not changed
} else {
throw new ValidationException(
"Unreported errors occurred during business rule evaluation (rule developer needs to put meaningful error messages into global ErrorMap)");
}
}
LOG.debug("validation completed");
}
开发者ID:kuali,项目名称:kc-rice,代码行数:53,代码来源:MaintenanceDocumentBase.java
示例20: saveDocument
import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent; //导入依赖的package包/类
/**
* @see org.kuali.rice.krad.service.DocumentService#saveDocument(org.kuali.rice.krad.document.Document)
*/
@Override
public Document saveDocument(Document document) throws WorkflowException, ValidationException {
return saveDocument(document, SaveDocumentEvent.class);
}
开发者ID:kuali,项目名称:kc-rice,代码行数:8,代码来源:DocumentServiceImpl.java
注:本文中的org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论