The common code server eas

Write server-side code primarily for PurOrderControllerBean implementation class in App Catalog, typical of the code have to add, modify, test and other operations

1. Submit to control
the user clicks 'Save' application framework calls PurOrderControllerBean the submit button method, the submit method overloading PurOrderControllerBean parent class in the editing interface
can be added, modified data verify, correct or do Analyzing some relevant:
protected IObjectPK _submit (CTX the Context, IObjectValue Model) throws BOSException, EASBizException
{
PurOrderInfo purOrderInfo = (PurOrderInfo) Model;
// whether the record is new, to false representation is modified, thus can operate as a relative
boolean isAddNew = to true;
iF (purOrderInfo.getId () = null && _ EXISTS (CTX, new new ObjectUuidPK (purOrderInfo.getId ()))!)
{= isAddNew to false;}
// check if Number
// checkNumber (CTX, otherBillInfo);
// call the method of checking whether a parent class number weight
//super._checkNumberDup(ctx, null, purOrderInfo);
// set the value of the object in some default values
setDefaultValue (CTX, purOrderInfo);
// check whether the attribute value of the object in the legitimate
CheckValid (purOrderInfo);
// call the frame submitted methods
return super._submit (CTX, purOrderInfo);
}
for the user clicks on the Edit interface 'temporary' protected IObjectPK _save call button (Context ctx, IObjectValue model) { } method, its operation is similar to calling _submit method.

For submit method server corresponding to the new addNew or modify the update in practical applications, so the server architecture submit method is based on whether pk is empty further update method is called, then the server side
can override the implementation class addNew and update to doing specific processing, for example, submit method CoreBaseControllerBean class implementations:
protected void _submit (the Context CTX, IObjectPK PK, IObjectValue Model) throws BOSException, EASBizException {
CoreBaseInfo coreBaseInfo = (CoreBaseInfo) Model;
IF (isExistPropertyName (CTX, coreBaseInfo, IFWStatus. effectedStatus)) {
coreBaseInfo.setInt (IFWStatus.effectedStatus, EffectedStatusEnum.EFFECTED_VALUE);
}
ServiceStateManager.getInstance () enableNextCallServices ();.
! IF (coreBaseInfo.getId () = null && this.exists (CTX, PK)) {
, super.update (CTX, PK, coreBaseInfo);
} the else {
super.addNew (CTX, PK, coreBaseInfo);
}
}

protected IObjectPK _submit(Context ctx,IObjecrtValue model)throws BOSException,EASBizException{
CoreBaseInfo coreBaseInfo=(CoreBaseInfo)model;
if(isExistPropertyName(ctx,coreBaseInfo,IFWStatus,effectedStatus)){
coreBaseInfo.setInt(IFWStatus.effectedStatus,EffectedStatusEnum.EFFECTED_VALUE);
}
IObjectPK retValue;
ServiceStateManager.getInstance().enableNextCallService();
if(coreBaseInfo.getId!null && this.exists(ctx,new ObjectUuidPK(coreBaseInfo.getId()))){
retValue=new ObjectUuidPK(coreBaseInfo.getId()){
super.update(ctx,retValue,coreBaseInfo);
return retValue;
}
}else{
retValue=super.addNew(ctx,coreBaseInfo);
return retValue;
}
}

Server implementation class code of the user as follows:
protected void _addNew (CTX the Context, the IObject PK, IObjectValue Model) BizeException {
PurOrderInfp purOrderInfo = (PurOrderInfo) Model;
// check if Number
checkNumber (CTX, otherBillInfo);
// weight check number;
checkNumberDup (CTX, null, purOrerInfo);
// set the value of the object in some default values
setDefaultValue (CTX, purOrderInfo);
// check whether the attribute value of the object in the legal
CheckValid (purOrderInfo);
// Submit method invocation framework
return super.addNew (CTX, PK, purOrderInfo);
}


2.


3. Generate control before credential
achieved by other control createVoucher overloaded methods of the parent class
protected void createVoucher (CTX the Context, String BILLID) throws BOSException, EASBizException {
IPurOrder purOrder = PurOrderFactory.getLocalInstance (CTX);
// Create Object pk
ObjectUuiPK pk ObjectUuidPK new new = (BILLID);
// the client user information acquiring
the UserInfo the currentUser = (the UserInfo) ctx.get (SysContextConstant.USERINFO);
// returns the current value of the object based on ID
purOrderInfo purOrderInfo;
purOrderInfo = getPurOrderInfo (CTX, PK) ;
// for correlation determination
IF (purOrderInfo = null!) {
a Date billDate purOrderInfo.getBillDate = ();
IF (! billDate = null) {
// treated accordingly
}
}

// generated credentials, credentials can not be repeatedly generated
IF (purOrderInfo.isFiVouchered ()) {
the throw new new IBizException ( "..............");
}
IF (BillStatusEnum.AUDITED.equals ( purOrderInfo.getBillStatus ())) {
// this process automatically generated certificate
purOrderInfo.setFiVouchered (to true);
purOrderInfo.update (PK, otherBillInfo);
}
}

4. Generate document
protected IObjectValue _genVoucher (CTX the Context, String BILLID) throws BOSException, EASBizException {
// generates and returns a collection of document
IOjectCollection tmpCollection = null;
// DEP dynamic internet accounting
IDAPTransformer iDAPTransformer = DAPTransformerFactory.getLocalInstance (CTX);
CoreBaseInfooCollection coreTransCollection = CoreBillBaseCollection new new ();
ObjectUuidPK new new ObjectUuidPK PK = (BILLID);
// get the value of the object
PurOrderInfo = Model (PurOrderInfo) this.getValue (CTX, PK);
coreTransCollection.add (Model);

Document // Get the value of the object after conversion
tmpCollection = iDAPTransformer.transformAuto (coreTransCollection, DAPVoucherTypeEnum.FIVoucher);
// create a document object interface entity
; IVoucher vchCtrl = (IVoucher) VoucherFactory.getLocalInstance (ctx)
after conversion // removed from the collection certificate value object
VoucherInfo VCH = (VoucherInfo) tmpCollection.getObject (0);
VoucherInfo Vch1 new new VoucherInfo = ();
Vch1 = vchCtrl.exteriorLazyLoad (VCH, VoucherInfo.getDefaultSelector ());
return Vch1;
}

The audit actions
_audit overloaded methods parent class implementation audit controls
protected void _audit (CTX the Context, IObjectPK PK) throws BOSException, EASBizException {
// used to determine the parameters of the
IF (PK == null) {
the throw an IllegalArgumentException new new () ;
}
// the current user
the UserInfo the currentUser = (the UserInfo) ctx.get (SysContextConstant.USERINFO);
// current date
a date = new new currentDate a date ();
// check whether the document is present, PurOrderBizException exception class is a user-defined custom BillStatusEnum enumeration
Boolean exist EXISTS = (CTX, PK);
IF (exist!) {
the throw new new PurOrderBizException (PurOrderBizException.BILL_NOTEXIST);
}
PurOrderInfo purOrderInfo = getPurOrderInfo (CTX, PK);
// set approver
purOrderInfo.setAuditor (currentUser) ;
// set the review date
purOrderInfo.setAuditDate (currentDate);
state // to set documents - hexanoic review
purOrderInfo.setBillStatus (BillStatusEnum.AUDITD);
// update entity
reviewed flag
Update (CTX, PK, purOrderInfo);
}

Guess you like

Origin www.cnblogs.com/luojiabao/p/11091512.html
EAS