本文整理汇总了Java中org.kuali.rice.krad.service.BusinessObjectService.save方法的典型用法代码示例。如果您正苦于以下问题:Java BusinessObjectService.save方法的具体用法?Java BusinessObjectService.save怎么用?Java BusinessObjectService.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.krad.service.BusinessObjectService
的用法示例。
在下文中一共展示了BusinessObjectService.save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveBusinessObject
import org.kuali.rice.krad.service.BusinessObjectService; //导入方法依赖的package包/类
/**
* @see org.kuali.rice.krad.maintenance.Maintainable#saveBusinessObject()
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void saveBusinessObject() {
BusinessObjectService boService = KNSServiceLocator.getBusinessObjectService();
GlobalBusinessObject gbo = (GlobalBusinessObject) businessObject;
// delete any indicated BOs
List bosToDeactivate = gbo.generateDeactivationsToPersist();
if (bosToDeactivate != null) {
if (!bosToDeactivate.isEmpty()) {
boService.save(bosToDeactivate);
}
}
// persist any indicated BOs
List bosToPersist = gbo.generateGlobalChangesToPersist();
if (bosToPersist != null) {
if (!bosToPersist.isEmpty()) {
boService.save(bosToPersist);
}
}
}
示例2: preUpdate
import org.kuali.rice.krad.service.BusinessObjectService; //导入方法依赖的package包/类
@Override protected void preUpdate() {
super.preUpdate();
try {
// KULCOA-549: update the sufficient funds table
// get the current data from the database
BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
Account originalAcct = (Account) boService.retrieve(this);
if (originalAcct != null) {
if (!originalAcct.getSufficientFundsCode().equals(getSufficientFundsCode()) || originalAcct.isExtrnlFinEncumSufficntFndIndicator() != isExtrnlFinEncumSufficntFndIndicator() || originalAcct.isIntrnlFinEncumSufficntFndIndicator() != isIntrnlFinEncumSufficntFndIndicator() || originalAcct.isPendingAcctSufficientFundsIndicator() != isPendingAcctSufficientFundsIndicator() || originalAcct.isFinPreencumSufficientFundIndicator() != isFinPreencumSufficientFundIndicator()) {
SufficientFundRebuild sfr = new SufficientFundRebuild();
sfr.setAccountFinancialObjectTypeCode(SufficientFundRebuild.REBUILD_ACCOUNT);
sfr.setChartOfAccountsCode(getChartOfAccountsCode());
sfr.setAccountNumberFinancialObjectCode(getAccountNumber());
if (boService.retrieve(sfr) == null) {
boService.save(sfr);
}
}
}
}
catch (Exception ex) {
LOG.error("Problem updating sufficient funds rebuild table: ", ex);
}
}
示例3: testSaveDocumentWithNonMatchingPO
import org.kuali.rice.krad.service.BusinessObjectService; //导入方法依赖的package包/类
@ConfigureContext(session = appleton, shouldCommitTransactions = true)
public final void testSaveDocumentWithNonMatchingPO() throws Exception {
ElectronicInvoiceLoadSummary eils = ElectronicInvoiceLoadSummaryFixture.EILS_BASIC.createElectronicInvoiceLoadSummary();
BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
boService.save(eils);
GlobalVariables.getUserSession().setBackdoorUser( "parke" );
Integer poId = routePO();
GlobalVariables.getUserSession().setBackdoorUser( "kfs" );
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);
}
示例4: createPatron
import org.kuali.rice.krad.service.BusinessObjectService; //导入方法依赖的package包/类
/**
* This method will create and persist the patron document
* @param olePatron
* @return savedOlePatronDefinition(OlePatronDefinition)
*/
@Override
public OlePatronDefinition createPatron(OlePatronDefinition olePatron) {
LOG.debug(" Inside create patron ");
OlePatronDefinition savedOlePatronDefinition = new OlePatronDefinition();
try{
BusinessObjectService businessObjectService = KRADServiceLocator.getBusinessObjectService();
OlePatronDocument olePatronDocument = OlePatronDocument.from(olePatron);
EntityBo kimEntity = olePatronDocument.getEntity();
EntityBo entity2 = getBusinessObjectService().save(kimEntity);
List<OleAddressBo> oleAddressBoList = getOlePatronHelperService().retrieveOleAddressBo(entity2,olePatronDocument);
olePatronDocument.setOleAddresses(oleAddressBoList);
olePatronDocument.setOlePatronId(entity2.getId());
olePatronDocument.setEntity(kimEntity);
OlePatronDocument savedPatronDocument = businessObjectService.save(olePatronDocument);
savedOlePatronDefinition = OlePatronDocument.to(savedPatronDocument);
}catch(Exception e){
e.printStackTrace();
}
return savedOlePatronDefinition;
}
示例5: testSaveDocument
import org.kuali.rice.krad.service.BusinessObjectService; //导入方法依赖的package包/类
@Test
public final void testSaveDocument() throws Exception {
ElectronicInvoiceLoadSummary eils = ElectronicInvoiceLoadSummaryFixture.EILS_BASIC.createElectronicInvoiceLoadSummary();
BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
boService.save(eils);
GlobalVariables.getUserSession().setBackdoorUser( "ole" );
eirDoc = ElectronicInvoiceRejectDocumentFixture.EIR_ONLY_REQUIRED_FIELDS.createElectronicInvoiceRejectDocument(eils);
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);
}
示例6: testSaveDocument
import org.kuali.rice.krad.service.BusinessObjectService; //导入方法依赖的package包/类
@ConfigureContext(session = appleton, shouldCommitTransactions = true)
public final void testSaveDocument() throws Exception {
ElectronicInvoiceLoadSummary eils = ElectronicInvoiceLoadSummaryFixture.EILS_BASIC.createElectronicInvoiceLoadSummary();
BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
boService.save(eils);
GlobalVariables.getUserSession().setBackdoorUser( "kfs" );
eirDoc = ElectronicInvoiceRejectDocumentFixture.EIR_ONLY_REQUIRED_FIELDS.createElectronicInvoiceRejectDocument(eils);
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);
}
示例7: transferInstances
import org.kuali.rice.krad.service.BusinessObjectService; //导入方法依赖的package包/类
public void transferInstances(List<RequestDocument> requestDocuments, BusinessObjectService businessObjectService)
throws Exception {
LOG.debug("RdbmsWorkInstanceDocumentManager transferInstances");
Collection<InstanceRecord> instanceRecords = null;
String desBibIdentifier = requestDocuments.get(requestDocuments.size() - 1).getUuid();
LOG.debug("RdbmsWorkInstanceDocumentManager transferInstances desBibIdentifier " + desBibIdentifier);
Map instanceMap = new HashMap();
Map bibInstanceMap = new HashMap();
for (int i = 0; i < requestDocuments.size() - 1; i++) {
RequestDocument requestDocument = requestDocuments.get(i);
instanceMap.put("instanceId", DocumentUniqueIDPrefix.getDocumentId(requestDocument.getUuid()));
bibInstanceMap.put("instanceId", DocumentUniqueIDPrefix.getDocumentId(requestDocument.getUuid()));
List<BibInstanceRecord> bibInstanceRecordList = (List<BibInstanceRecord>) businessObjectService
.findMatching(BibInstanceRecord.class, bibInstanceMap);
if (bibInstanceRecordList.size() > 1) {
//Instances are associated with multiple bibs means it has bound with with other bib. So we cant transfer. So throw exception
LOG.error(requestDocument.getUuid() + " is bounded with other bib and cant be transferred");
throw new Exception(requestDocument.getUuid() + " is bounded with other bib and cant be transferred");
}
//else {
// BibInstanceRecord bibInstanceRecord = bibInstanceRecordList.get(0);
// bibInstanceRecord.setBibId(DocumentUniqueIDPrefix.getDocumentId(desBibIdentifier));
// businessObjectService.save(bibInstanceRecord);
//}
InstanceRecord instanceRecord = businessObjectService.findByPrimaryKey(InstanceRecord.class, instanceMap);
instanceRecord.setBibId(DocumentUniqueIDPrefix.getDocumentId(desBibIdentifier));
businessObjectService.save(instanceRecord);
}
}
示例8: modifyDocumentContent
import org.kuali.rice.krad.service.BusinessObjectService; //导入方法依赖的package包/类
protected void modifyDocumentContent(RequestDocument doc, String identifier, BusinessObjectService businessObjectService) {
String content = doc.getContent().getContent();
if (content != null && content != "" && content.length() > 0) {
Pattern pattern = Pattern.compile("tag=\"001\">.*?</controlfield");
Pattern pattern2 = Pattern.compile("<controlfield.*?tag=\"001\"/>");
Matcher matcher = pattern.matcher(content);
Matcher matcher2 = pattern2.matcher(content);
if (matcher.find()) {
doc.getContent().setContent(matcher.replaceAll("tag=\"001\">" + identifier + "</controlfield"));
} else if (matcher2.find()) {
doc.getContent()
.setContent(matcher2.replaceAll("<controlfield tag=\"001\">" + identifier + "</controlfield>"));
} else {
int ind = content.indexOf("</leader>") + 9;
if (ind == 8) {
ind = content.indexOf("<leader/>") + 9;
if (ind == 8) {
ind = content.indexOf("record>") + 7;
}
}
StringBuilder sb = new StringBuilder();
sb.append(content.substring(0, ind));
sb.append("<controlfield tag=\"001\">");
sb.append(identifier);
sb.append("</controlfield>");
sb.append(content.substring(ind + 1));
doc.getContent().setContent(sb.toString());
}
Map bibMap = new HashMap();
bibMap.put("bibId", DocumentUniqueIDPrefix.getDocumentId(identifier));
List<BibRecord> bibRecords = (List<BibRecord>) businessObjectService
.findMatching(BibRecord.class, bibMap);
if (bibRecords != null && bibRecords.size() > 0) {
BibRecord bibRecord = bibRecords.get(0);
bibRecord.setContent(doc.getContent().getContent());
businessObjectService.save(bibRecord);
}
}
}
示例9: preUpdate
import org.kuali.rice.krad.service.BusinessObjectService; //导入方法依赖的package包/类
@Override protected void preUpdate() {
super.preUpdate();
try {
// KULCOA-549: update the sufficient funds table
// get the current data from the database
BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
ObjectLevel originalObjLevel = (ObjectLevel) boService.retrieve(this);
if (originalObjLevel != null) {
if (!originalObjLevel.getFinancialConsolidationObjectCode().equals(getFinancialConsolidationObjectCode())) {
SufficientFundRebuild sfr = new SufficientFundRebuild();
sfr.setAccountFinancialObjectTypeCode(SufficientFundRebuild.REBUILD_OBJECT);
sfr.setChartOfAccountsCode(originalObjLevel.getChartOfAccountsCode());
sfr.setAccountNumberFinancialObjectCode(originalObjLevel.getFinancialConsolidationObjectCode());
if (boService.retrieve(sfr) == null) {
boService.save(sfr);
}
sfr = new SufficientFundRebuild();
sfr.setAccountFinancialObjectTypeCode(SufficientFundRebuild.REBUILD_OBJECT);
sfr.setChartOfAccountsCode(getChartOfAccountsCode());
sfr.setAccountNumberFinancialObjectCode(getFinancialConsolidationObjectCode());
if (boService.retrieve(sfr) == null) {
boService.save(sfr);
}
}
}
}
catch (Exception ex) {
LOG.error("Problem updating sufficient funds rebuild table: ", ex);
}
}
示例10: checkInContent
import org.kuali.rice.krad.service.BusinessObjectService; //导入方法依赖的package包/类
@Override
public void checkInContent(RequestDocument requestDocument, Object object, ResponseDocument responseDocument) {
modifyAdditionalAttributes(requestDocument);
BusinessObjectService businessObjectService = (BusinessObjectService) object;
if (null == businessObjectService) {
businessObjectService = KRADServiceLocator.getBusinessObjectService();
}
Map parentCriteria1 = new HashMap();
parentCriteria1.put("bibId", DocumentUniqueIDPrefix.getDocumentId(requestDocument.getUuid()));
AdditionalAttributes attributes = requestDocument.getAdditionalAttributes();
BibRecord bibRecord = businessObjectService.findByPrimaryKey(BibRecord.class, parentCriteria1);
bibRecord.setContent(requestDocument.getContent().getContent());
if (attributes != null) {
bibRecord.setFassAddFlag(Boolean.valueOf(attributes.getAttribute(AdditionalAttributes.FAST_ADD_FLAG)));
bibRecord.setSuppressFromPublic(attributes.getAttribute(AdditionalAttributes.SUPRESS_FROM_PUBLIC));
bibRecord.setStatus(attributes.getAttribute(AdditionalAttributes.STATUS));
/* DateFormat df = new SimpleDateFormat("mm/dd/yyyy hh:mm:ss");
Date dateStatusUpdated = null;
try {
dateStatusUpdated = df.parse(attributes.getAttribute(AdditionalAttributes.STATUS_UPDATED_ON));
} catch (ParseException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
bibRecord.setStatusUpdatedDate(dateStatusUpdated);*/
bibRecord.setUpdatedBy(attributes.getAttribute(AdditionalAttributes.UPDATED_BY));
bibRecord.setDateEntered(Timestamp.valueOf(attributes.getAttribute(AdditionalAttributes.DATE_ENTERED)));
if (attributes.getAttribute(AdditionalAttributes.STATUS_UPDATED_BY) != null) {
bibRecord.setStatusUpdatedBy(attributes.getAttribute(AdditionalAttributes.STATUS_UPDATED_BY));
}
if (attributes.getAttribute(AdditionalAttributes.STATUS_UPDATED_ON) != null) {
bibRecord.setStatusUpdatedDate(Timestamp.valueOf(attributes.getAttribute(AdditionalAttributes.STATUS_UPDATED_ON)));
}
bibRecord.setStaffOnlyFlag(Boolean.valueOf(attributes.getAttribute(AdditionalAttributes.STAFFONLYFLAG)));
bibRecord.setUpdatedBy(attributes.getAttribute(AdditionalAttributes.UPDATED_BY));
}
businessObjectService.save(bibRecord);
requestDocument.setUuid(DocumentUniqueIDPrefix.getPrefixedId(bibRecord.getUniqueIdPrefix(), bibRecord.getBibId()));
buildResponseDocument(requestDocument, bibRecord, responseDocument);
}
示例11: saveBusinessObject
import org.kuali.rice.krad.service.BusinessObjectService; //导入方法依赖的package包/类
/**
* @see org.kuali.rice.kns.maintenance.Maintainable#saveBusinessObject()
*/
@Override
public void saveBusinessObject() {
BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
GlobalBusinessObject gbo = (GlobalBusinessObject) businessObject;
// delete any indicated BOs
List<PersistableBusinessObject> bosToDeactivate = gbo.generateDeactivationsToPersist();
if (bosToDeactivate != null) {
if (!bosToDeactivate.isEmpty()) {
boService.save(bosToDeactivate);
}
}
// OJB caches the any ObjectCodes that are retrieved from the database. If multiple queries return the same row (identified by the PK
// values), OJB will return the same instance of the ObjectCode. However, in generateGlobalChangesToPersist(), the ObjectCode returned by
// OJB is altered, meaning that any subsequent OJB calls will return the altered object. The following cache will store the active statuses
// of object codes affected by this global document before generateGlobalChangesToPersist() alters them.
Map<String, Boolean> objectCodeActiveStatusCache = buildObjectCodeActiveStatusCache((ObjectCodeGlobal) gbo);
SubObjectTrickleDownInactivationService subObjectTrickleDownInactivationService = SpringContext.getBean(SubObjectTrickleDownInactivationService.class);
// persist any indicated BOs
List<PersistableBusinessObject> bosToPersist = gbo.generateGlobalChangesToPersist();
if (bosToPersist != null) {
if (!bosToPersist.isEmpty()) {
for (PersistableBusinessObject bo : bosToPersist) {
ObjectCode objectCode = (ObjectCode) bo;
boService.save(objectCode);
if (isInactivatingObjectCode(objectCode, objectCodeActiveStatusCache)) {
subObjectTrickleDownInactivationService.trickleDownInactivateSubObjects(objectCode, getDocumentNumber());
}
}
}
}
}
示例12: createPrincipalSecurityRecords
import org.kuali.rice.krad.service.BusinessObjectService; //导入方法依赖的package包/类
/**
* Creates security principal records for model members (if necessary) so that they will appear on security principal lookup for
* editing
*
* @param memberId String member id of model role
* @param memberTypeCode String member type code for member
*/
protected void createPrincipalSecurityRecords(String memberId, String memberTypeCode) {
Collection<String> principalIds = new HashSet<String>();
if (MemberType.PRINCIPAL.getCode().equals(memberTypeCode)) {
principalIds.add(memberId);
}
else if (MemberType.ROLE.getCode().equals(memberTypeCode)) {
Role roleInfo = KimApiServiceLocator.getRoleService().getRole(memberId);
Collection<String> rolePrincipalIds = KimApiServiceLocator.getRoleService().getRoleMemberPrincipalIds(roleInfo.getNamespaceCode(), roleInfo.getName(), null);
principalIds.addAll(rolePrincipalIds);
}
else if (MemberType.GROUP.getCode().equals(memberTypeCode)) {
List<String> groupPrincipalIds = KimApiServiceLocator.getGroupService().getMemberPrincipalIds(memberId);
principalIds.addAll(groupPrincipalIds);
}
BusinessObjectService businessObjectService = SpringContext.getBean(BusinessObjectService.class);
for (String principalId : principalIds) {
SecurityPrincipal securityPrincipal = businessObjectService.findBySinglePrimaryKey(SecurityPrincipal.class, principalId);
if (securityPrincipal == null) {
SecurityPrincipal newSecurityPrincipal = new SecurityPrincipal();
newSecurityPrincipal.setPrincipalId(principalId);
businessObjectService.save(newSecurityPrincipal);
}
}
}
示例13: oppositifyEntry
import org.kuali.rice.krad.service.BusinessObjectService; //导入方法依赖的package包/类
/**
* Updates the given general ledger pending entry so that it will have the opposite effect of what it was created to do; this,
* in effect, undoes the entries that were already posted for this document
*
* @param glpe the general ledger pending entry to undo
*/
protected void oppositifyEntry(GeneralLedgerPendingEntry glpe, BusinessObjectService boService, GeneralLedgerPendingEntrySequenceHelper glpeSeqHelper) {
if (glpe.getTransactionDebitCreditCode().equals(OLEConstants.GL_CREDIT_CODE)) {
glpe.setTransactionDebitCreditCode(OLEConstants.GL_DEBIT_CODE);
}
else if (glpe.getTransactionDebitCreditCode().equals(OLEConstants.GL_DEBIT_CODE)) {
glpe.setTransactionDebitCreditCode(OLEConstants.GL_CREDIT_CODE);
}
glpe.setTransactionLedgerEntrySequenceNumber(glpeSeqHelper.getSequenceCounter());
glpeSeqHelper.increment();
glpe.setFinancialDocumentApprovedCode(OLEConstants.PENDING_ENTRY_APPROVED_STATUS_CODE.APPROVED);
boService.save(glpe);
}
示例14: createBasicElectronicInvoiceRejectDocument
import org.kuali.rice.krad.service.BusinessObjectService; //导入方法依赖的package包/类
private ElectronicInvoiceRejectDocument createBasicElectronicInvoiceRejectDocument() throws Exception {
ElectronicInvoiceLoadSummary eils = ElectronicInvoiceLoadSummaryFixture.EILS_BASIC.createElectronicInvoiceLoadSummary();
BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
boService.save(eils);
changeCurrentUser(UserNameFixture.kfs);
return ElectronicInvoiceRejectDocumentFixture.EIR_ONLY_REQUIRED_FIELDS.createElectronicInvoiceRejectDocument(eils);
}
示例15: createPrincipalSecurityRecords
import org.kuali.rice.krad.service.BusinessObjectService; //导入方法依赖的package包/类
/**
* Creates security principal records for model members (if necessary) so that they will appear on security principal lookup for
* editing
*
* @param memberId String member id of model role
* @param memberTypeCode String member type code for member
*/
protected void createPrincipalSecurityRecords(String memberId, String memberTypeCode) {
Collection<String> principalIds = new HashSet<String>();
if (MemberType.PRINCIPAL.getCode().equals(memberTypeCode)) {
principalIds.add(memberId);
}
else if (MemberType.ROLE.getCode().equals(memberTypeCode)) {
Role roleInfo = KimApiServiceLocator.getRoleService().getRole(memberId);
Collection<String> rolePrincipalIds = KimApiServiceLocator.getRoleService().getRoleMemberPrincipalIds(roleInfo.getNamespaceCode(), roleInfo.getName(), null);
principalIds.addAll(rolePrincipalIds);
}
else if (MemberType.GROUP.getCode().equals(memberTypeCode)) {
List<String> groupPrincipalIds = KimApiServiceLocator.getGroupService().getMemberPrincipalIds(memberId);
principalIds.addAll(groupPrincipalIds);
}
BusinessObjectService businessObjectService = SpringContext.getBean(BusinessObjectService.class);
for (String principalId : principalIds) {
SecurityPrincipal securityPrincipal = businessObjectService.findBySinglePrimaryKey(SecurityPrincipal.class, principalId);
if (securityPrincipal == null) {
SecurityPrincipal newSecurityPrincipal = new SecurityPrincipal();
newSecurityPrincipal.setPrincipalId(principalId);
businessObjectService.save(newSecurityPrincipal);
}
}
}