Beruflich Dokumente
Kultur Dokumente
AP-RAPDRP
(SDK KT Document)
Prepared By
Last Update
: SivaRamakrishna Battula
: 21 July 2016
Revision History
Version & Rev ID
Date
Changed By
Changes Made
1.0
10/08/11
SivaRamakris
hna Battula
Initial Draft
02/05/12
SivaRamakris
hna
22/05/12
SivaRamakris
hna
06/06/12
SivaRamakris
hna
Related Documents
Version & Rev ID
Related Documents
1 Table of Contents
Revision History............................................................................................................................. 2
Revision History............................................................................................................................. 2
Revision History............................................................................................................................. 2
Revision History............................................................................................................................. 2
Revision History............................................................................................................................. 2
Revision History............................................................................................................................. 2
Revision History............................................................................................................................. 2
Revision History............................................................................................................................. 2
Revision History............................................................................................................................. 2
Revision History............................................................................................................................. 2
Revision History............................................................................................................................. 2
Revision History............................................................................................................................. 2
Related Documents....................................................................................................................... 3
Related Documents....................................................................................................................... 3
Related Documents....................................................................................................................... 3
Related Documents....................................................................................................................... 3
Related Documents....................................................................................................................... 3
Related Documents....................................................................................................................... 3
Related Documents....................................................................................................................... 3
Related Documents....................................................................................................................... 3
Related Documents....................................................................................................................... 3
Related Documents....................................................................................................................... 3
Related Documents....................................................................................................................... 3
Related Documents....................................................................................................................... 3
1 Table of Contents......................................................................................................................... 4
2 CC&B KT Documentation ........................................................................................................... 6
2.1 BusinessEntity : .................................................................................................................. 7
2.2 SDK Common Code ............................................................................................................. 8
2.3 BussinessComponent:......................................................................................................... 13
2.4 Algorithms Implementaion................................................................................................... 14
2.5 Algorithm Example............................................................................................................... 14
2.6 Algoritm Junit Testing.......................................................................................................... 21
2.7 JavaBussiness Service ....................................................................................................... 24
2.8 Error Handling..................................................................................................................... 30
2.9 SDK File Deployment in the CC&B Server .........................................................................35
MP-RAPDRP
2 CC&B KT Documentation
Deposit Recommendation
Technical Design
2.1 BusinessEntity :
In All OUAF Projects Every Transaction will be happened through BussinessObject or Bussines Service
only. BusinessObect or Bussiness Service Internally call Maintenance Object.
Maintenance Object
Maintenance Objects are logical transactions that are made up of several tables.The Term Maintenance
Object refers to the group of tables that relatedd each other.
Maintenance Object Consist of All Related Tables ,in that at leas one primary table and remaining child
Tables optional.
For Creating Maintenace The Steps need to follow are
1.
2.
3.
4.
5.
Business Entity is The Entity class for a database table .Generally Per Table Business Entity will Exist.
Syntax of the Business Entity is like
Example of the Business Entity is
package com.splwg.cm.domain.meterReader;
/**
*
@BusinessEntity (tableName=CM_MTRR_MSTR,
*
oneToManyCollections = { @Child (collectionName = readerSBM, childTableName =
CM_MTRR_SBM,
*
orderByColumnNames = {"CRE_DTTM"})
*
})
*
*/
public class MeterReader_Impl extends MeterReader_Gen
{
}
package com.splwg.cm.domain.meterReader;
/**
* @author suraj
*
@EntityPageMaintenance (entity = meterReader, service = CM_MTRR_MSTR, program =
CM_MTRR_MSTR,
*
body = @DataElement (contents = { @RowField (entity = meterReader, name = meterReader)
*
, @ListField (name = SBMREADER, owner = meterReader,property = readerSBM)}),
*
modules = { "billing"},
*
actions = { "add"
*
, "read"
*
, "delete"
*
, "change"},
*
lists = { @List (name = SBMREADER, size = 50,
*
body = @DataElement (contents = { @RowField (entity = readerSBM, name =
readerSBM)}))})
*/
public class MeterReaderMaintenance extends MeterReaderMaintenance_Gen
{
}
if(fcOption.fetchIdOptionType().toString().trim().equalsIgnoreCase(fcValue))
{
strSaType=fcOption.getValue();
}
}
logger.info("strSaType"+strSaType);
if(strSaType.split(",").length>1)
{
saList=strSaType.split(",");
for(String saType:saList)
{
objSa=getSaUsingSaTypeandAcct(objAcct,saType);
logger.info("TotalAMount"+totalAmount+"SaType"+saType+"sa"+objSa);
if(objSa!=null)
totalAmount=totalAmount.add(retriveAdjAmountofPresentBill(objSa));
}
Sample Code For Using BO or BS in Side Algorithm or Batch
For Bussiness Service
BusinessServiceInstance bs=BusinessServiceInstance.create("CM_MTR_REG");
bs.set("mtrid", mrId.getIdValue());
logger.info("MeterId"+mrId);
bs = BusinessServiceDispatcher.execute(bs);
COTSInstanceList retrieveBS1= bs.getList("results");
java.util.Iterator<COTSInstanceListNode> list=retrieveBS1.iterator();
while(list.hasNext())
{
COTSInstanceListNode node=list.next();
regVal=node.getString("kwh");
kwhRegId=new Register_Id(regVal);
regVal=node.getString("kvah");
kVahRegId=new Register_Id(regVal);
regVal=node.getString("pf");
pfRegId=new Register_Id(regVal);
regVal=node.getString("rmd");
rmdRegId=new Register_Id(regV
For Bussiness Object
BusinessObjectInstance
boInstance=BusinessObjectInstance.create("CM_EstimateRead");
boInstance.set("meterReadId",meterReadId.getIdValue());
boInstance=BusinessObjectDispatcher.read(boInstance);
COTSInstanceList regList=boInstance.getList("registerRead");
Iterator<COTSInstanceListNode> objIterator=regList.iterator();
while(objIterator.hasNext())
{
COTSInstanceListNode regNode=objIterator.next();
regId=regNode.getXMLString("registerId");
if(objRegMap.get("kwh").getIdValue().trim().equalsIgnoreCase(regId))
{
kwhRegReadId=new
RegisterRead_Id(regNode.getXMLString("registerReadingId"));
kwhSeq=new BigDecimal(regNode.getXMLString("seq"));
kwhregReadNode=regNode;
System.out.println("kwhRegReadId Register Read"+kwhRegReadId);
}
else
if(objRegMap.get("kvah").getIdValue().trim().equalsIgnoreCase(regId))
{
kvahRegReadId=new
RegisterRead_Id(regNode.getXMLString("registerReadingId"));
kvahSeq=new BigDecimal(regNode.getXMLString("seq"));
kvahregReadNode=regNode;
System.out.println("kvahRegReadId Register Read"+kwhRegReadId);
}
else
if(objRegMap.get("pf").getIdValue().trim().equalsIgnoreCase(regId))
{
pfRegReadId=new
RegisterRead_Id(regNode.getXMLString("registerReadingId"));
pfSeq=new BigDecimal(regNode.getXMLString("seq"));
pfregReadNode=regNode;
System.out.println("pfRegReadId Register Read"+kwhRegReadId);
}
else
if(objRegMap.get("rmd").getIdValue().trim().equalsIgnoreCase(regId))
{
rmdRegReadId=new
RegisterRead_Id(regNode.getXMLString("registerReadingId"));
rmdSeq=new BigDecimal(regNode.getXMLString("seq"));
rmdregReadNode=regNode;
System.out.println("pfRegReadId Register Read"+rmdRegReadId);
}
}
/* Updating the KWH Based Register Read*/
kwhregReadNode.set("registerId", objRegMap.get("kwh").getIdValue());
kwhregReadNode.set("registerReadingId", kwhRegReadId.getIdValue());
kwhregReadNode.set("readType",
ReadTypeLookup.constants.OFFICE_ESTIMATE);
kwhregReadNode.set("registerReading", estimateKwhRead);
kwhregReadNode.set("seq",kwhSeq);
String charValue=null;
String qureryString1="select CHAR_VAL from ci_sp_char where
char_type_cd=:serviceType and sp_id=:spId";
PreparedStatement
prepStatement1=createPreparedStatement(qureryString1.toString());
prepStatement1.bindId("serviceType", charTypeId);
prepStatement1.bindId("spId", spId);
String SerivceType=null;
String categoryName=null;
charValue=prepStatement1.firstRow().getString("CHAR_VAL");
return charValue;
} catch (Exception e)
{
e.printStackTrace();
return null;
2.3 BussinessComponent:
The Main Purpose of the Business Component is for Reusability . The common Code Which is useful in
the algorithms and batches you can place that code in business component .
Syntax of the BusinessComponent is
/**
@BusinessComponent (customizationReplaceable=false, customizationCallable=true)
*/
public class CmBillCalculation_Impl extends GenericBusinessComponent implements CmBillCalculation
{
//write the reusablity code
}
Example is like
public class CmBillCalculation_Impl extends GenericBusinessComponent
implements CmBillCalculation
{
private static final Logger
logger=LoggerFactory.getLogger(CmBillCalculation_Impl.class);
private ServiceAgreement objSa=null;
private ServiceAgreementType saType=null;
private RateSchedule rateSchedule=null;
private Date calculationDate;
private Account_Id acctId=null;
private BigDecimal calUnits=BigDecimal.ZERO;
public ServicePoint retrieveServicePoint(ServiceAgreement objSa )
ServicePoint_Id spId=null;
StringBuffer queryString2=new StringBuffer("from
ServiceAgreementServicePoint sasp where ");
queryString2.append(" sasp.serviceAgreement=:sa ");
Query query2=createQuery(queryString2.toString());
query2.addResult("spId", "sasp.servicePoint");
query2.bindEntity("sa",objSa);
for(Iterator iter=query2.list().iterator(); iter.hasNext();)
{
spId=((ServicePoint)iter.next()).getId();
}
return spId.getEntity();
}
}
@AlgorithmComponent
(softParameters={@AlgorithmSoftParameter(name=rateSchedule,required=true,type=
entity,entityName = rateSchedule)
*
*
,
@AlgorithmSoftParameter(name=UOM,required=true,type=entity,entityName =
unitOfMeasure)
*
SoftParameters is like
})
package com.splwg.cm.domain.bills;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Iterator;
import java.util.List;
import com.ibm.icu.math.BigDecimal;
import com.splwg.base.api.Query;
import com.splwg.base.api.QueryResultRow;
import com.splwg.base.api.datatypes.Bool;
import com.splwg.base.api.datatypes.Date;
import com.splwg.base.api.datatypes.DateTime;
import com.splwg.base.api.datatypes.Money;
import com.splwg.base.domain.common.currency.Currency;
import com.splwg.base.support.context.FrameworkSession;
import com.splwg.base.support.context.SessionHolder;
import com.splwg.ccb.api.lookup.AdjustmentStatusLookup;
import com.splwg.ccb.api.lookup.BillCompletionActionLookup;
import com.splwg.ccb.domain.adjustment.adjustment.Adjustment;
import com.splwg.ccb.domain.adjustment.adjustment.Adjustment_DTO;
import com.splwg.ccb.domain.admin.adjustmentType.AdjustmentType_Id;
import com.splwg.ccb.domain.admin.customerClass.CustomerClassPreBillCompletionAlgorithmSpot;
import com.splwg.ccb.domain.admin.unitOfMeasure.UnitOfMeasure_Id;
import com.splwg.ccb.domain.billing.bill.Bill;
import com.splwg.ccb.domain.billing.billSegment.BillSegment;
import com.splwg.ccb.domain.billing.billSegment.BillSegment_Id;
import com.splwg.ccb.domain.customerinfo.account.Account;
import com.splwg.ccb.domain.customerinfo.serviceAgreement.ServiceAgreement;
import com.splwg.ccb.domain.customerinfo.serviceAgreement.ServiceAgreement_Id;
import com.splwg.ccb.domain.customerinfo.servicePoint.ServicePoint;
import com.splwg.cm.domain.billingutil.CmBillCalculation;
import com.splwg.shared.common.ServerMessage;
/**
*The descriptive text that explaining the purpose and use of the class.
* @version 1.0 01 AUG 2011
* @author SivaRamakrishna Battula
* Class : CmSaEdPreBillCompAlg_Impl
* Description : Calculating Ed Charges For LT Consumers
* Other Info :
* Creation Date : 01-AUG-2011
* History[FunctionalDesc]:
* Date Modified by Description
* ---------------------------------------------------------------------------------------------------------* SNO
dd-mmm-yyyy
<Name>
[Multiline / Precise description]
* ----------------------------------------------------------------------------------------------------------* 01
15/05/2012
Siva Battula
*
*
* --------------------------------------------------------------------------------------------------------* @AlgorithmComponent (softParameters = { @AlgorithmSoftParameter (entityName=adjustmentType,
name = adjType, required = true, type =entity)
*
,@AlgorithmSoftParameter (entityName=currency, name = currencyCode,
required = true, type =entity)
*
,@AlgorithmSoftParameter ( name = saType, required = true, type =string)
*
,@AlgorithmSoftParameter ( name = edFactor, required = true, type =string)
*
,@AlgorithmSoftParameter ( name = uomCode, entityName=unitOfMeasure,
type =entity)
*
})
*/
public class CmSaEdPreBillCompAlg_Impl extends CmSaEdPreBillCompAlg_Gen
implements CustomerClassPreBillCompletionAlgorithmSpot
{
private Bill objBill=null;
private BigDecimal totalAmount=BigDecimal.ZERO;
private Currency objCurrency=null;
private AdjustmentType_Id adjTypeId=null;
private ServiceAgreement objServiceAgreement=null;
private Account obtAcct=null;
private String saType;
private BillSegment bseg=null;
private UnitOfMeasure_Id uomId=null;
private java.sql.PreparedStatement prepStatment=null;
public void invoke()
{
try{
initializeParameters();
bseg=getBillSegmentUsingBillId(objBill);
totalAmount=getTotalBillSq(bseg,uomId);
String tempVal=this.getEdFactor();
totalAmount=totalAmount.multiply(new BigDecimal(tempVal));
totalAmount=roundingBigDecimal(totalAmount);
raiseAdjustment(new Money(totalAmount,objCurrency.getId()));
}catch(Exception e)
{
e.printStackTrace();
}
}
/** Initializing Values Required in Algo
* @return void
*/
public void initializeParameters()
{
//objBill=new Bill_Id("462370264262").getEntity();
adjTypeId=this.getAdjType().getId();
objCurrency=this.getCurrencyCode();
saType=this.getSaType();
objServiceAgreement=retrieveServiceAgreement();
System.out.println("Service Agrement new"+objServiceAgreement);
if(this.getUomCode()!=null)
{
uomId=this.getUomCode().getId();
}
else
{
CmBillCalculation objBillCal;
objBillCal=CmBillCalculation.Factory.newInstance();
ServiceAgreement objUtilSa=objBillCal.retrieveServiceAgreement(obtAcct);
ServicePoint objSp=objBillCal.retrieveServicePoint(objUtilSa);
uomId =objBillCal.retrieveUom(objSp.getId());
System.out.println("Sp"+objSp.getId().getIdValue());
}
}
/**
* Retrieving ED ServiceAgreement
*
* @return ServiceAgreement
*/
public ServiceAgreement retrieveServiceAgreement()
{
ServiceAgreement_Id objSaId=null;
StringBuffer queryString1=new StringBuffer("from ServiceAgreement sa where ");
queryString1.append(" sa.account=:acctId and
sa.serviceAgreementType.id.saType='"+saType.trim()+"'");
System.out.println("sa Type"+saType+"adjtype"+adjTypeId);
Query<QueryResultRow> query1=createQuery(queryString1.toString());
query1.addResult("sa", "sa.id");
query1.bindId("acctId", obtAcct.getId());
Iterator<QueryResultRow> iter=query1.list().iterator();
while(iter.hasNext())
{
objSaId=((ServiceAgreement_Id)iter.next());
System.out.println("ServiceAgreement"+objSaId.getIdValue());
}
return objSaId.getEntity();
}
/**
* Raising Calculated Amount as Adjustment On ED Service Agreement
* @param adjustAmt is Calculated Amount
*/
public void raiseAdjustment(Money adjustAmt)
{
Adjustment_DTO adjustmentDTO=new Adjustment_DTO();
Adjustment adjustment=null;
adjustmentDTO.setAdjustmentTypeId(adjTypeId);
adjustmentDTO.setAdjustmentStatus(AdjustmentStatusLookup.constants.FREEZABLE);
//adjustAmt=new Money(new BigDecimal(1.75),objCurrency.getId());
adjustmentDTO.setCurrentAmount(adjustAmt);
DateTime curdate= DateTime.getSystemDateTime();
System.out.println(""+ DateTime.getSystemDateTime().getDate());
adjustmentDTO.setCalculationDate(curdate.getDate());
adjustmentDTO.setComments("some comments");
adjustmentDTO.setCurrencyId(objCurrency.getId());
adjustmentDTO.setVersion(2);
System.out.println("raising Adjustment"+objServiceAgreement);
adjustment=objServiceAgreement.addAdjustment(adjustmentDTO);
adjustment.generate(this.getSystemDateTime().getDate() ,this.getProcessDateTime().getDate());
adjustment.freeze(curdate.getDate());
System.out.println("i have generated adjustment"+adjustment.getId()+"adjustement
Amount"+adjustment.getCurrentAmount());
}
/**
* Retrieving The BillSegment Using Bill
* @param objBill Bill
* @return BillSegment
*/
public BillSegment getBillSegmentUsingBillId(Bill objBill)
{
BillSegment objBillSeg=null;
StringBuffer queryString=new StringBuffer("from BillSegment bseg where ");
queryString.append(" bseg.billId=:billId");
Query<QueryResultRow> query=createQuery(queryString.toString());
query.bindId("billId", objBill.getId());
query.addResult("bsegment", "bseg.id");
Iterator<QueryResultRow> iter=query.list().iterator();
while(iter.hasNext())
{
objBillSeg=((BillSegment_Id)iter.next()).getEntity();
System.out.println("BillSegment"+objBillSeg.getId().getIdValue());
}
return objBillSeg;
}
/**
* To Get The Billed Units
* @param Billed Units in BigDecimal
*/
public BigDecimal getTotalBillSq(BillSegment bsegObj,UnitOfMeasure_Id uom_Id)
{
BigDecimal totalAmount=BigDecimal.ZERO;
StringBuffer queryString=null;
ResultSet rs1=null;
try
{
}
catch(NullPointerException e)
{
e.printStackTrace();
return null;
}
catch(Exception e)
{
e.printStackTrace();
return null;
}
finally
{
try
{
if(rs1!=null)
rs1.close();
if(prepStatment!=null)
prepStatment.close();
}
catch(SQLException e)
{
e.printStackTrace();
}
catch(Exception e)
{
e.printStackTrace();
}
}
return totalAmount;
}
@Override
public void setBill(Bill arg0)
{
this.objBill=arg0;
}
@Override
public void setBillDate(Date arg0)
{
}
@Override
public void setBillSegments(List<BillSegment> objBillSeg)
{
}
@Override
public void setCreditNoteForBill(Bill arg0)
{
}
}
This Algorithm Is For Calculating The ED.
Here The Given Set Parameters Are the input parameters to the algorithm means the input coming
Dynamicalu at the time of the Exectuion.
Get Parameters are the out put parameters expecting by the framework during the bill processing.
Framework call the interface which will be generated by Artifact generator.
When Algorithm Processing happen first framework pass values to setMethods and Execute The Invoke
method after processing of invoke method it will fetch the results from getMethods().
import com.splwg.base.api.testers.AlgorithmImplementationTestCase;
import com.splwg.base.domain.common.algorithm.Algorithm;
import com.splwg.base.domain.common.algorithm.Algorithm_Id;
import com.splwg.ccb.domain.billing.bill.Bill;
import com.splwg.ccb.domain.billing.bill.Bill_DTO;
import com.splwg.ccb.domain.billing.bill.Bill_Id;
import com.splwg.ccb.domain.billing.billSegment.BillSegment;
import com.splwg.ccb.domain.billing.billSegment.BillSegment_Id;
import com.splwg.ccb.domain.customerinfo.account.Account_Id;
public class CmSaEdPreBillCompAlg_Test extends AlgorithmImplementationTestCase
{
public void testInvoke()
{
System.out.println("We are at invoke method");
try {
Bill_Id billId=new Bill_Id("869160573044");
System.out.println("billId"+billId);
Bill objBill=billId.getEntity();
Bill_DTO billDto=objBill.getDTO();
billDto.setAccountId(new Account_Id("7874677562"));
objBill.setDTO(billDto);
BillSegment_Id bsegid=new BillSegment_Id("462838673192");
List<BillSegment>billSegList=new ArrayList<BillSegment>();
billSegList.add(0, bsegid.getEntity());
CmSaEdPreBillCompAlg algRec = getAlgComp();
algRec.setBill(objBill);
algRec.setAccount(new Account_Id("7874677562").getEntity());
algRec.setBillSegments(billSegList);
algRec.invoke();
System.out.println("Message"+algRec.getServerMessage());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
protected Class getAlgorithmImplementationClass()
{
return CmPostBillRoundingAlgComp_Impl.class;
}
private CmSaEdPreBillCompAlg getAlgComp() {
CmSaEdPreBillCompAlg algComp;
try {
Algorithm algorithm = new Algorithm_Id("CM-SP-ED-LT").getEntity();
if(algorithm!=null){
algComp = algorithm.getAlgorithmComponent(CmSaEdPreBillCompAlg.class);
return algComp;
}
return null;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
}
boInstanceSummary.set("currency", "INR");
boInstanceSummary.set("messageCategory", new BigDecimal(1));
boInstanceSummary.set("messageNumber", new BigDecimal(101));
boInstanceSummary.set("version", new BigDecimal(1));
boInstanceSummary = BusinessObjectDispatcher.add(boInstanceSummary);
adjUploadId = (AdjUpload_Id) iterator.next();
// System.out.println("adjUploadId : "+adjUploadId.toString());
// AdjUpload_Id adjupload_id
// =(AdjUpload_Id)adjUploadId.getId("ADJ_UPD_ID",AdjUpload.class);
BusinessObjectInstance boInstanceClob = BusinessObjectInstance
.create("CM_ADJUPLOAD");
boInstanceClob.set("adjUploadId", adjUploadId.getIdValue());
boInstanceClob = BusinessObjectDispatcher.read(boInstanceClob);
COTSInstanceNode cotins = boInstanceClob.getGroup("dataAreaSchema");
COTSInstanceList cotinslinst = cotins.getList("dataList");
COTSInstanceListNode cotsinstlistnode = null;
int isize = cotinslinst.getSize();
for (Iterator<COTSInstanceListNode> it = cotinslinst.iterator(); it
.hasNext();) {
System.out.println("for loop");
BusinessObjectInstance boInstanceDetail = BusinessObjectInstance
.create("CM_ADJSTGUP");
cotsinstlistnode = it.next();
String rjdesc = cotsinstlistnode.getString("rjType");
String discom = cotsinstlistnode.getString("discom");
queryString = new StringBuffer(
"select adjl.adj_type_cd from ci_adj_type_l adjl ");
queryString
.append("where adjl.descr like '%"+rjdesc +"%'");
prepStatement = createPreparedStatement(queryString.toString());
String adjTypeCode = prepStatement.firstRow().getString(
"ADJ_TYPE_CD");
adjTypeCode = adjTypeCode.trim();
System.out.println(" adjTypeCode : " + adjTypeCode);
String str = cotsinstlistnode.getString("rjAmount");
System.out.println("oBJECT" + str);
Integer strLength = str.length();
Pattern p = Pattern
.compile("^([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$");
Matcher match = p.matcher(str);
System.out.println("output: " + match.matches());
match.matches(); // TRUE
boInstanceError.set("ero",
cotsinstlistnode.getString("ero"));
boInstanceError.set("errorType", "20001");
boInstanceError.set("rjAmt", curAmountMoney);
boInstanceError.set("rjType",
cotsinstlistnode.getString("rjType"));
boInstanceError.set("section",
cotsinstlistnode.getString("section"));
boInstanceError.set("uniqueServiceNumber",
cotsinstlistnode.getString("uscno"));
boInstanceError.set("status", "P");
boInstanceError = BusinessObjectDispatcher
.add(boInstanceError);
boInstanceError = null;
}
else if (!match.matches()) {
System.out.println("not a number");
// addError(CustomMessageRepository.saIdMissing(adjTypeCode));
BusinessObjectInstance boInstanceError = BusinessObjectInstance
.create("CM_ADJUPERR");
boInstanceError.set("businessObject", "CM_ADJUPERR");
boInstanceError.set("discom",
cotsinstlistnode.getString("discom"));
boInstanceError.set("ero",
cotsinstlistnode.getString("ero"));
boInstanceError.set("errorType", "20002");
boInstanceError.set("rjAmt", new Money(BigDecimal.ZERO));
boInstanceError.set("rjType",
cotsinstlistnode.getString("rjType"));
boInstanceError.set("section",
cotsinstlistnode.getString("section"));
boInstanceError.set("uniqueServiceNumber",
cotsinstlistnode.getString("uscno"));
boInstanceError.set("status", "P");
boInstanceError = BusinessObjectDispatcher
.add(boInstanceError);
boInstanceError = null;
} else {
boInstanceDetail.set("currentAmount", curAmountMoney);
boInstanceDetail.set("adjustmentType", adjTypeCode);
boInstanceDetail
.set("adjustmentUploadStatus",
AdjustmentStagingControlStatusLookup.constants.PENDING);
boInstanceDetail.set("adjustmentSuspense",
AdjustmentSuspenseLookup.constants.NOT_IN_SUSPENSE);
sid = row.get("SA_ID").toString();
boInstanceDetail.set("serviceAgreement", sid);
boInstanceDetail.set("adjustmentId", " ");
boInstanceDetail.set("suspenseAdjustmentId", " ");
boInstanceDetail.set("adjustmentStagingControlID",
boInstanceSummary
.getNumber("adjustmentStagingControlID"));
boInstanceDetail.set("messageCategory", new BigDecimal(1));
boInstanceDetail.set("messageNumber", new BigDecimal(101));
boInstanceDetail.set("version", new BigDecimal(1));
boInstanceDetail = BusinessObjectDispatcher
.add(boInstanceDetail);
count = count.add(new BigDecimal(1));
System.out.println("count :::" + count);
System.out.println("Current Amount::::"
+ boInstanceDetail.getMoney("currentAmount"));
m = m.add(boInstanceDetail.getMoney("currentAmount"));
System.out.println("Amount :::" + m.getAmount());
boInstanceDetail = null;
}
}
BusinessObjectInstance boInstanceSummary1 = BusinessObjectInstance
.create("CM_ADJSTGCTL");
boInstanceSummary1.set("adjustmentStagingControlID",
boInstanceSummary.getNumber("adjustmentStagingControlID"));
boInstanceSummary1.set("totalAdjustmentAmount", m);
boInstanceSummary1.set("adjustmentUploadRecordCount", count);
boInstanceSummary1 = BusinessObjectDispatcher
.update(boInstanceSummary1);
System.out.println("
"
+ boInstanceSummary1
.getNumber("adjustmentStagingControlID"));
System.out.println("
"
+ boInstanceSummary1.getMoney("totalAdjustmentAmount"));
System.out.println("
"
+ boInstanceSummary1
.getNumber("adjustmentUploadRecordCount"));
BusinessObjectInstance boStatusUpdate = BusinessObjectInstance
.create("CM_ADJUPLOAD");
boStatusUpdate.set("adjUploadId",
boInstanceClob.getString("adjUploadId"));
boStatusUpdate.set("status", "C");
boStatusUpdate = BusinessObjectDispatcher.update(boStatusUpdate);
System.out.println("Update Bo :: "
+ boStatusUpdate.getString("status"));
boInstanceSummary = null;
boInstanceClob = null;
boStatusUpdate = null;
}
setOverrideResultForChange(element);
}
}
Junit For Java Bussiness Service
{
adjustment=objServiceAgreement.addAdjustment(adjustmentDTO);
adjustment.generate(this.getSystemDateTime().getDate()
,this.getProcessDateTime().getDate());
adjustment.freeze(curdate.getDate());
System.out.println("i have generated adjustment"+adjustment.getId()
+"adjustement Amount"+adjustment.getCurrentAmount());
}catch(NullPointerException e)
{
updateBillException(e,objBill,"AverageUnits","ED Algorithm");
}
private void updateBillException(Exception exception, Bill objBill,String
strMessage1,String strMessage2)
{
ServerMessage exceptionMsg;
BillExceptions billExcp = objBill.getExceptions();
BillException_DTO billExcpDTO = new BillException_DTO();
exceptionMsg =
CustomMessageRepository.exceptionMessages(strMessage1,strMessage2);
billExcpDTO.setMessageId(exceptionMsg.getMessageId());
billExcpDTO.setCreationDateTime(this.getProcessDateTime());
billExcpDTO.setBillExceptionType(BillExceptionTypeLookup.constants.BILLING_ERR
OR);
billExcpDTO.setExpandedMessage(exceptionMsg.getMessageText());
billExcpDTO.setUserId(this.getActiveContextUser().getId());
billExcpDTO.setMessageParameter1(exceptionMsg.getMessageText());
//
if (!isNull(myParams)) populateMessageParms(myParams,billExcpDTO);
billExcp.add(billExcpDTO);
Bill_DTO billDto = objBill.getDTO();
System.out.println(billDto.getLatePaymentChargeDate());
billDto.setBillStatus(BillStatusLookup.constants.PENDING);
objBill.setDTO(billDto);
172
173
174
175
176
177
178
179
180
181
182
183
184
162
163
164
165
166
167
168
169
170
171
query.bindId(USAGE_SUBSCRIPTION_HQL, usageSubscription);
query.addResult(US_FACTOR_ID_HQL, "usageSubscriptionFactorOverride.id.factor.id");
query.addResult(START_DATE_HQL, "usageSubscriptionFactorOverride.id.startDateTime");
query.addResult(END_DATE_HQL, "usageSubscriptionFactorOverride.endDateTime");
query.orderBy(US_FACTOR_ID_HQL);
query.orderBy(START_DATE_HQL);
List result = query.list();
return result;
}
}
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
endDateCount++;
if (endDateCount > 1) {
faultySP = sp_Id_current.getIdValue();
break;
}
}
} else {
if (isNull(spStopDateTime_next)) {
endDateCount = 1;
} else {
endDateCount = 0;
}
}
sp_Id_current = sp_Id_next;
spStopDateTime_current = spStopDateTime_next;
}
}
}
return faultySP;
}
}
You May See To Folder structures Called SDK_Packaging and CM_Packaging folders
SDK_Packaging Folder Consist of the packaging structure of all the packages involved in the CM Jar.
What ever packaging structure you have in eclipse you can find in the SDK Packaging folder also