use of eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementBatchRequest in project UVMS-Docker by UnionVMS.
the class MovementHelper method createMovementBatchRequest.
public CreateMovementBatchRequest createMovementBatchRequest(Asset testAsset, MobileTerminalType mobileTerminalType, List<LatLong> route) throws IOException, ClientProtocolException, JsonProcessingException, JsonParseException, JsonMappingException {
// Date positionTime = new Date(System.currentTimeMillis());
final CreateMovementBatchRequest createMovementBatchRequest = new CreateMovementBatchRequest();
AssetId assetId = new AssetId();
assetId.setAssetType(AssetType.VESSEL);
assetId.setIdType(AssetIdType.GUID);
assetId.setValue(testAsset.getAssetId().getGuid());
MovementActivityType movementActivityType = new MovementActivityType();
movementActivityType.setMessageId(UUID.randomUUID().toString());
movementActivityType.setMessageType(MovementActivityTypeType.ANC);
createMovementBatchRequest.setMethod(MovementModuleMethod.CREATE_BATCH);
createMovementBatchRequest.setUsername("vms_admin_com");
for (LatLong latlong : route) {
MovementBaseType movementBaseType = new MovementBaseType();
movementBaseType.setAssetId(assetId);
movementBaseType.setConnectId(mobileTerminalType.getConnectId());
movementBaseType.setActivity(movementActivityType);
MovementPoint movementPoint = new MovementPoint();
movementPoint.setLongitude(latlong.longitude);
movementPoint.setLatitude(latlong.latitude);
movementPoint.setAltitude((double) 5);
movementBaseType.setPosition(movementPoint);
movementBaseType.setPositionTime(latlong.positionTime);
movementBaseType.setMovementType(MovementTypeType.POS);
movementBaseType.setReportedCourse(latlong.bearing);
movementBaseType.setReportedSpeed(latlong.speed);
createMovementBatchRequest.getMovement().add(movementBaseType);
}
return createMovementBatchRequest;
}
use of eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementBatchRequest in project UVMS-Docker by UnionVMS.
the class MovementJmsIT method createMovementBatchRequestTest.
@Test
public void createMovementBatchRequestTest() throws Exception {
Asset testAsset = AssetTestHelper.createTestAsset();
MobileTerminalType mobileTerminalType = MobileTerminalTestHelper.createMobileTerminalType();
MobileTerminalTestHelper.assignMobileTerminal(testAsset, mobileTerminalType);
List<LatLong> latLongList = movementHelper.createRuttCobhNewYork(ALL, 0.4f);
final CreateMovementBatchRequest createMovementBatchRequest = movementHelper.createMovementBatchRequest(testAsset, mobileTerminalType, latLongList);
CreateMovementBatchResponse createMovementResponse = movementHelper.createMovementBatch(testAsset, mobileTerminalType, createMovementBatchRequest);
}
Aggregations