HI Could yu please tell me how to get previous values from current iteration
in the below example : public void parseDtoCollection(Collection dtos) contains list of dtos
in private AssetClassVersion createNewAssetClassVersion(AssetDTO dto) method i am iterating but i want to get
to get previous itearation values in current iteration if the dto.assetClassId is same then i want to append like previous matchedstring value + current matchedstring value
public void parseDtoCollection(Collection dtos) {
for (Iterator i = dtos.iterator(); i.hasNext();) {
AssetDTO dto = (AssetDTO) i.next();
AssetClass assetClass = findAssetClass(dto.assetClassId);
AssetClassVersion assetClassVersion = createNewAssetClassVersion(dto);
assetClass.addVersion(assetClassVersion);
if (dto.id > 0) {
InformationAsset infoAsset =
findInformationAsset(dto.id, assetClass);
InformationAssetVersion infoAssetVersion =
createInfoAssetVersion(dto);
infoAsset.setBusinessArea(createBusinessArea(dto));
infoAsset.addVersion(infoAssetVersion);
infoAsset.setAssetClass(assetClass);
}
}
}
private AssetClass findAssetClass(int id) {
Integer oid = new Integer(id);
AssetClass assetClass = (AssetClass) assetClassMap.get(oid);
if (null == assetClass) {
assetClass = getOJBFactory().getAssetClass();
assetClass.setOid(oid);
assetClassMap.put(oid, assetClass);
AssetClassAssets aca = getOJBFactory().getAssetClassAssets();
aca.setAssetClass(assetClass);
assetHolder.put(oid, aca);
}
return assetClass;
}
private AssetClassVersion createNewAssetClassVersion(AssetDTO dto) {
AssetClassVersion ac = new AssetClassVersion();
ac.setVersion(new Integer(dto.assetClassVersion));
ac.setName(dto.assetClassName);
ac.setDescription(dto.assetClassDescription);
ac.setStatus(Status.findById(dto.assetClassStatusId));
ac.setModifyDate(dto.assetClassModifyDate);
ac.setEffectiveDate(dto.assetClassEffectiveDate);
ac.setSeriesCode(dto.seriesCode);
ac.setMatchedString(dto.matchedString);
return ac;
}
private InformationAsset findInformationAsset(int id, AssetClass assetClass) {
Integer oid = new Integer(id);
InformationAsset infoAsset = (InformationAsset)infoAssetMap.get(oid);
if (null == infoAsset) {
infoAsset = getOJBFactory().getInformationAsset();
infoAsset.setOid(oid);
infoAsset.setAssetClass(assetClass);
infoAssetMap.put(oid, infoAsset);
}
return infoAsset;
}
raviaaaa 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
richieking 44 Master Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
raviaaaa 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.