Search in sources :

Example 1 with CreateMovementBatchRequest

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;
}
Also used : MovementActivityType(eu.europa.ec.fisheries.schema.movement.v1.MovementActivityType) MovementBaseType(eu.europa.ec.fisheries.schema.movement.v1.MovementBaseType) CreateMovementBatchRequest(eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementBatchRequest) MovementPoint(eu.europa.ec.fisheries.schema.movement.v1.MovementPoint) AssetId(eu.europa.ec.fisheries.schema.movement.asset.v1.AssetId)

Example 2 with 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);
}
Also used : Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) CreateMovementBatchRequest(eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementBatchRequest) CreateMovementBatchResponse(eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementBatchResponse) MobileTerminalType(eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType) Test(org.junit.Test) AbstractRestServiceTest(eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)

Aggregations

CreateMovementBatchRequest (eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementBatchRequest)2 MobileTerminalType (eu.europa.ec.fisheries.schema.mobileterminal.types.v1.MobileTerminalType)1 AssetId (eu.europa.ec.fisheries.schema.movement.asset.v1.AssetId)1 CreateMovementBatchResponse (eu.europa.ec.fisheries.schema.movement.module.v1.CreateMovementBatchResponse)1 MovementActivityType (eu.europa.ec.fisheries.schema.movement.v1.MovementActivityType)1 MovementBaseType (eu.europa.ec.fisheries.schema.movement.v1.MovementBaseType)1 MovementPoint (eu.europa.ec.fisheries.schema.movement.v1.MovementPoint)1 AbstractRestServiceTest (eu.europa.ec.fisheries.uvms.docker.validation.common.AbstractRestServiceTest)1 Asset (eu.europa.ec.fisheries.wsdl.asset.types.Asset)1 Test (org.junit.Test)1