use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument in project UVMS-ActivityModule-APP by UnionVMS.
the class FluxMessageServiceBeanTest method setUp.
@Before
public void setUp() {
FAReportDocument faReportDocument2 = MapperUtil.getFaReportDocument();
faReportDocument2.getRelatedFLUXReportDocument().setPurposeCode(MapperUtil.getCodeType("9", "4fyrh-58fj4-5jtu-58tjr"));
IDType id = faReportDocument2.getRelatedFLUXReportDocument().getReferencedID();
FAReportDocument faReportDocument1 = MapperUtil.getFaReportDocument();
faReportDocument1.getRelatedFLUXReportDocument().setIDS(Arrays.asList(id));
faReportDocument1.getRelatedFLUXReportDocument().setPurposeCode(MapperUtil.getCodeType("3", "4f5yrh-58f7j4-5j5tu-58tj7r"));
fluxFaReportMessage = new FLUXFAReportMessage();
faReportDocuments = Arrays.asList(faReportDocument1, faReportDocument2);
fluxFaReportMessage.setFAReportDocuments(faReportDocuments);
fluxFaReportMessage.setFLUXReportDocument(MapperUtil.getFluxReportDocument());
}
use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument in project UVMS-ActivityModule-APP by UnionVMS.
the class FluxMessageServiceBean method updateFaReportCorrections.
/**
* If there is a reference Id exist for any of the FaReport Document, than it means this is an update to an existing report.
*/
private void updateFaReportCorrections(List<FAReportDocument> faReportDocuments) throws ServiceException {
List<FaReportDocumentEntity> faReportDocumentEntities = new ArrayList<>();
for (FAReportDocument faReportDocument : faReportDocuments) {
if (faReportDocument.getRelatedFLUXReportDocument().getReferencedID() != null && faReportDocument.getRelatedFLUXReportDocument().getPurposeCode() != null) {
FaReportDocumentEntity faReportDocumentEntity = faReportDocumentDao.findFaReportByIdAndScheme(faReportDocument.getRelatedFLUXReportDocument().getReferencedID().getValue(), faReportDocument.getRelatedFLUXReportDocument().getReferencedID().getSchemeID());
if (faReportDocumentEntity != null) {
FaReportStatusType faReportStatusEnum = FaReportStatusType.getFaReportStatusEnum(Integer.parseInt(faReportDocument.getRelatedFLUXReportDocument().getPurposeCode().getValue()));
faReportDocumentEntity.setStatus(faReportStatusEnum.getStatus());
faReportDocumentEntities.add(faReportDocumentEntity);
}
}
}
faReportDocumentDao.updateAllFaData(faReportDocumentEntities);
}
use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEventServiceBean method deleteBranchesThatMatchWithTheIdsList.
private void deleteBranchesThatMatchWithTheIdsList(List<ActivityIDType> ids, List<FAReportDocument> faReportDocuments) {
final Iterator<FAReportDocument> iterator = faReportDocuments.iterator();
while (iterator.hasNext()) {
FAReportDocument faRep = iterator.next();
FLUXReportDocument relatedFLUXReportDocument = faRep.getRelatedFLUXReportDocument();
if (relatedFLUXReportDocument != null && reportDocumentIdsMatch(relatedFLUXReportDocument.getIDS(), ids)) {
log.warn("[WARN] Deleted FaReportDocument (from XML MSG Node) since it already exist in the Activity DB..\n" + "Following is the ID : { " + preetyPrintIds(relatedFLUXReportDocument.getIDS()) + " }");
iterator.remove();
log.info("[INFO] Remaining [ " + faReportDocuments.size() + " ] FaReportDocuments to be saved.");
}
}
}
use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEventServiceBean method deleteDuplicatedReportsFromXMLDocument.
private void deleteDuplicatedReportsFromXMLDocument(FLUXFAReportMessage repMsg) {
GetNonUniqueIdsRequest getNonUniqueIdsRequest = null;
try {
getNonUniqueIdsRequest = ActivityModuleRequestMapper.mapToGetNonUniqueIdRequestObject(collectAllIdsFromMessage(repMsg));
} catch (ActivityModelMarshallException e) {
log.error("[ERROR] Error while trying to get the unique ids from FaReportDocumentIdentifiers table...");
}
GetNonUniqueIdsResponse matchingIdsResponse = matchingIdsService.getMatchingIdsResponse(getNonUniqueIdsRequest.getActivityUniquinessLists());
List<ActivityUniquinessList> activityUniquinessLists = matchingIdsResponse.getActivityUniquinessLists();
final List<FAReportDocument> faReportDocuments = repMsg.getFAReportDocuments();
if (CollectionUtils.isNotEmpty(activityUniquinessLists)) {
for (ActivityUniquinessList unique : activityUniquinessLists) {
deleteBranchesThatMatchWithTheIdsList(unique.getIds(), faReportDocuments);
}
}
}
use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEntityToModelMapper method mapPurposeCode.
private void mapPurposeCode(FAReportDocument target, String typeCode, String listId) {
if (ObjectUtils.allNotNull(target)) {
CodeType codeType = new CodeType();
codeType.setValue(typeCode);
codeType.setListID(listId);
target.setTypeCode(codeType);
}
}
Aggregations