Search in sources :

Example 1 with FaReportStatusType

use of eu.europa.ec.fisheries.ers.fa.utils.FaReportStatusType 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);
}
Also used : FaReportStatusType(eu.europa.ec.fisheries.ers.fa.utils.FaReportStatusType) FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) ArrayList(java.util.ArrayList) FAReportDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument)

Aggregations

FaReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity)1 FaReportStatusType (eu.europa.ec.fisheries.ers.fa.utils.FaReportStatusType)1 ArrayList (java.util.ArrayList)1 FAReportDocument (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument)1