use of eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class MapperUtil method getFishingActivityEntityList.
public static List<FishingActivityEntity> getFishingActivityEntityList() {
FishingTripEntity entity = new FishingTripEntity();
FluxReportDocumentEntity fluxReportDocumentEntity1 = ActivityDataUtil.getFluxReportDocumentEntity("FLUX_REPORT_DOCUMENT1", null, DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "PURPOSE", "PURPOSE_CODE_LIST", null, "OWNER_FLUX_ID1", "flux1");
FluxReportDocumentEntity fluxReportDocumentEntity2 = ActivityDataUtil.getFluxReportDocumentEntity("FLUX_REPORT_DOCUMENT2", null, DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "PURPOSE", "PURPOSE_CODE_LIST", null, "OWNER_FLUX_ID2", "flux2");
FluxReportDocumentEntity fluxReportDocumentEntity3 = ActivityDataUtil.getFluxReportDocumentEntity("FLUX_REPORT_DOCUMENT3", null, DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "PURPOSE", "PURPOSE_CODE_LIST", null, "OWNER_FLUX_ID3", "flux3");
VesselTransportMeansEntity vesselTransportMeansEntity1 = ActivityDataUtil.getVesselTransportMeansEntity("PAIR_FISHING_PARTNER", "FA_VESSEL_ROLE", "vesselGroup1", null);
VesselTransportMeansEntity vesselTransportMeansEntity2 = ActivityDataUtil.getVesselTransportMeansEntity("PAIR_FISHING_PARTNER", "FA_VESSEL_ROLE", "vesselGroup2", null);
VesselTransportMeansEntity vesselTransportMeansEntity3 = ActivityDataUtil.getVesselTransportMeansEntity("PAIR_FISHING_PARTNER", "FA_VESSEL_ROLE", "vesselGroup3", null);
FaReportDocumentEntity faReportDocumentEntity1 = ActivityDataUtil.getFaReportDocumentEntity("Declaration", "FLUX_FA_REPORT_TYPE", DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), fluxReportDocumentEntity1, vesselTransportMeansEntity1, "new");
FaReportDocumentEntity faReportDocumentEntity2 = ActivityDataUtil.getFaReportDocumentEntity("Declaration", "FLUX_FA_REPORT_TYPE", DateUtils.parseToUTCDate("2015-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), fluxReportDocumentEntity2, vesselTransportMeansEntity2, "new");
FaReportDocumentEntity faReportDocumentEntity3 = ActivityDataUtil.getFaReportDocumentEntity("Declaration", "FLUX_FA_REPORT_TYPE", DateUtils.parseToUTCDate("2015-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), fluxReportDocumentEntity3, vesselTransportMeansEntity3, "new");
FishingActivityEntity fishingActivityEntity1 = ActivityDataUtil.getFishingActivityEntity("DEPARTURE", "FLUX_FA_TYPE", DateUtils.parseToUTCDate("2014-05-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "FISHING", "FIS", faReportDocumentEntity1, null);
FishingActivityEntity fishingActivityEntity2 = ActivityDataUtil.getFishingActivityEntity("ARRIVAL", "FLUX_FA_TYPE", DateUtils.parseToUTCDate("2014-05-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "FISHING", "FIS", faReportDocumentEntity2, null);
FishingActivityEntity fishingActivityEntity3 = ActivityDataUtil.getFishingActivityEntity("LANDING", "FLUX_FA_TYPE", DateUtils.parseToUTCDate("2014-05-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "FISHING", "FIS", faReportDocumentEntity3, null);
List<FishingActivityEntity> fishingActivityEntityList = new ArrayList<>();
fishingActivityEntityList.add(fishingActivityEntity1);
fishingActivityEntityList.add(fishingActivityEntity2);
fishingActivityEntityList.add(fishingActivityEntity3);
return fishingActivityEntityList;
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class MapperUtil method getFishingTripEntityWithContactParties.
public static FishingTripEntity getFishingTripEntityWithContactParties() {
FishingTripEntity fishingTripEntity = getFishingTripEntity();
Set<VesselTransportMeansEntity> vesselTransportEntityList = fishingTripEntity.getFishingActivity().getFaReportDocument().getVesselTransportMeans();
Set<ContactPartyEntity> contactParties = new HashSet<>();
ContactPartyEntity contPartEntity_1 = ActivityDataUtil.getContactPartyEntity("title1", "givenName1", "middleName1", "familyName1", "familyNamePrefix1", "nameSuffix1", "gender1", "alias1");
ContactPartyEntity contPartEntity_2 = ActivityDataUtil.getContactPartyEntity("title2", "givenName2", "middleName2", "familyName2", "familyNamePrefix2", "nameSuffix2", "gender2", "alias2");
Set<ContactPartyRoleEntity> roleList_1 = ActivityDataUtil.getContactPartyRole("SOMEROLE", "ROLE_CODE1", contPartEntity_1);
Set<ContactPartyRoleEntity> roleList_2 = ActivityDataUtil.getContactPartyRole("MASTER", "ROLE_CODE2", contPartEntity_2);
contPartEntity_1.setContactPartyRole(roleList_1);
contPartEntity_2.setContactPartyRole(roleList_2);
contactParties.addAll(Arrays.asList(contPartEntity_1, contPartEntity_2));
for (VesselTransportMeansEntity vesselTransportMeansEntity : vesselTransportEntityList) {
vesselTransportMeansEntity.setContactParty(contactParties);
}
return fishingTripEntity;
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityServiceBeanTest method mockFishActEntities.
private List<FishingActivityEntity> mockFishActEntities() {
final FishingActivityEntity fishAct = new FishingActivityEntity();
FishingActivityIdentifierEntity ident = new FishingActivityIdentifierEntity();
ident.setFaIdentifierId("faId");
ident.setFaIdentifierSchemeId("faSchemeId");
Set<FishingActivityIdentifierEntity> fishIdentList = new HashSet<>();
fishIdentList.add(ident);
Set<FishingTripEntity> fishTrips = new HashSet<>();
FishingTripEntity fishTrip = new FishingTripEntity();
Set<FishingTripIdentifierEntity> fishingTripIdentifiers = new HashSet<>();
FishingTripIdentifierEntity tripident = new FishingTripIdentifierEntity();
tripident.setTripId("tripId");
tripident.setTripSchemeId("tripSchemeId");
fishingTripIdentifiers.add(tripident);
fishTrips.add(fishTrip);
fishTrip.setTypeCode("someTripCode");
fishTrip.setFishingActivity(fishAct);
fishTrip.setFishingTripIdentifiers(fishingTripIdentifiers);
fishAct.setFishingActivityIdentifiers(fishIdentList);
fishAct.setTypeCode("faTypeCode");
fishAct.setFishingTrips(fishTrips);
return new ArrayList<FishingActivityEntity>() {
{
add(fishAct);
}
};
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityMapperTest method testFishingActivityMapper.
@Test
public void testFishingActivityMapper() {
FishingActivity fishingActivity = MapperUtil.getFishingActivity();
FishingActivityEntity fishingActivityEntity = new FishingActivityEntity();
FishingActivityMapper.INSTANCE.mapToFishingActivityEntity(fishingActivity, null, fishingActivityEntity);
assertFishingActivityFields(fishingActivity, fishingActivityEntity);
assertNull(fishingActivityEntity.getFaReportDocument());
assertNotNull(fishingActivityEntity.getFishingGears());
FishingGearEntity fishingGearEntity = fishingActivityEntity.getFishingGears().iterator().next();
assertNotNull(fishingGearEntity);
assertFishingActivityFields(fishingActivity, fishingGearEntity.getFishingActivity());
assertNotNull(fishingActivityEntity.getFishingTrips());
FishingTripEntity fishingTripEntity = fishingActivityEntity.getFishingTrips().iterator().next();
assertNotNull(fishingTripEntity);
assertFishingActivityFields(fishingActivity, fishingTripEntity.getFishingActivity());
assertNotNull(fishingActivityEntity.getFaCatchs());
FaCatchEntity faCatchEntity = fishingActivityEntity.getFaCatchs().iterator().next();
assertNotNull(faCatchEntity);
assertFishingActivityFields(fishingActivity, faCatchEntity.getFishingActivity());
assertNotNull(fishingActivityEntity.getSourceVesselCharId());
assertFishingActivityFields(fishingActivity, fishingActivityEntity.getSourceVesselCharId().getFishingActivitiesForSourceVesselCharId());
assertNotNull(fishingActivityEntity.getDestVesselCharId());
assertFishingActivityFields(fishingActivity, fishingActivityEntity.getDestVesselCharId().getFishingActivitiesForDestVesselCharId());
assertNotNull(fishingActivityEntity.getDelimitedPeriods());
DelimitedPeriodEntity delimitedPeriodEntity = fishingActivityEntity.getDelimitedPeriods().iterator().next();
assertNotNull(delimitedPeriodEntity);
assertFishingActivityFields(fishingActivity, delimitedPeriodEntity.getFishingActivity());
assertNotNull(fishingActivityEntity.getFluxCharacteristics());
FluxCharacteristicEntity fluxCharacteristicEntity = fishingActivityEntity.getFluxCharacteristics().iterator().next();
assertNotNull(fluxCharacteristicEntity);
assertFishingActivityFields(fishingActivity, fluxCharacteristicEntity.getFishingActivity());
assertNotNull(fishingActivityEntity.getFluxLocations());
FluxLocationEntity fluxLocationEntity = fishingActivityEntity.getFluxLocations().iterator().next();
assertNotNull(fluxLocationEntity);
assertFishingActivityFields(fishingActivity, fluxLocationEntity.getFishingActivity());
assertNotNull(fishingActivityEntity.getAllRelatedFishingActivities());
FishingActivityEntity relatedFishingActivityEntity = fishingActivityEntity.getAllRelatedFishingActivities().iterator().next();
assertNotNull(relatedFishingActivityEntity);
assertFishingActivityFields(fishingActivity.getRelatedFishingActivities().get(0), relatedFishingActivityEntity);
assertNotNull(fishingActivityEntity.getFishingActivityIdentifiers());
FishingActivityIdentifierEntity fishingActivityIdentifierEntity = fishingActivityEntity.getFishingActivityIdentifiers().iterator().next();
assertNotNull(fishingActivityIdentifierEntity);
assertEquals(fishingActivity.getIDS().get(0).getValue(), fishingActivityIdentifierEntity.getFaIdentifierId());
assertEquals(fishingActivity.getIDS().get(0).getSchemeID(), fishingActivityIdentifierEntity.getFaIdentifierSchemeId());
assertFishingActivityFields(fishingActivity, fishingActivityIdentifierEntity.getFishingActivity());
}
use of eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingTripMapperTest method getFishingTripWithFishingActivity.
@Test
public void getFishingTripWithFishingActivity() {
FishingTrip fishingTrip = MapperUtil.getFishingTrip();
FishingTripEntity fishingTripEntity = FishingTripMapper.INSTANCE.mapToFishingTripEntity(fishingTrip);
assertEquals(fishingTrip.getTypeCode().getValue(), fishingTripEntity.getTypeCode());
assertEquals(fishingTrip.getTypeCode().getListID(), fishingTripEntity.getTypeCodeListId());
assertNull(fishingTripEntity.getFishingActivity());
assertNotNull(fishingTripEntity.getDelimitedPeriods());
assertNotNull(fishingTripEntity.getFishingTripIdentifiers());
}
Aggregations