use of eu.europa.ec.fisheries.schema.movement.v1.MovementActivityType 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.v1.MovementActivityType in project UVMS-Docker by UnionVMS.
the class MovementHelper method createMovementRequest.
public CreateMovementRequest createMovementRequest(Asset testAsset, MobileTerminalType mobileTerminalType, LatLong latlong) throws IOException, ClientProtocolException, JsonProcessingException, JsonParseException, JsonMappingException {
// Date positionTime = new Date(System.currentTimeMillis());
final CreateMovementRequest createMovementRequest1 = new CreateMovementRequest();
final MovementBaseType movementBaseType = new MovementBaseType();
AssetId assetId = new AssetId();
assetId.setAssetType(AssetType.VESSEL);
assetId.setIdType(AssetIdType.GUID);
assetId.setValue(testAsset.getAssetId().getGuid());
movementBaseType.setAssetId(assetId);
movementBaseType.setConnectId(mobileTerminalType.getConnectId());
MovementActivityType movementActivityType = new MovementActivityType();
movementBaseType.setActivity(movementActivityType);
movementActivityType.setMessageId(UUID.randomUUID().toString());
movementActivityType.setMessageType(MovementActivityTypeType.ANC);
createMovementRequest1.setMovement(movementBaseType);
createMovementRequest1.setMethod(MovementModuleMethod.CREATE);
createMovementRequest1.setUsername("vms_admin_com");
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);
return createMovementRequest1;
}
use of eu.europa.ec.fisheries.schema.movement.v1.MovementActivityType in project UVMS-Docker by UnionVMS.
the class SetMovementReportRequestJmsIT method createSetReportMovementType.
/**
* Creates the set report movement type.
*
* @param testAsset
* the test asset
* @param mobileTerminalType
* the mobile terminal type
* @param createMovementRequest
* the create movement request
* @return the sets the movement report request
*/
private SetMovementReportRequest createSetReportMovementType(Asset testAsset, MobileTerminalType mobileTerminalType, CreateMovementRequest createMovementRequest) {
final SetMovementReportRequest request = new SetMovementReportRequest();
request.setUsername("vms_admin_com");
request.setDate(new Date());
request.setMethod(ExchangeModuleMethod.SET_MOVEMENT_REPORT);
request.setPluginType(PluginType.NAF);
final SetReportMovementType movementType = new SetReportMovementType();
request.setRequest(movementType);
movementType.setPluginType(PluginType.NAF);
movementType.setTimestamp(new Date());
movementType.setPluginName(mobileTerminalType.getPlugin().getServiceName());
MovementBaseType movementBaseType = new MovementBaseType();
movementType.setMovement(movementBaseType);
MovementActivityType movementActivityType = new MovementActivityType();
movementBaseType.setActivity(movementActivityType);
AssetId assetId = new AssetId();
movementBaseType.setAssetId(assetId);
assetId.setAssetType(AssetType.VESSEL);
AssetIdList assetIdList = new AssetIdList();
{
assetIdList.setIdType(AssetIdType.GUID);
assetIdList.setValue(testAsset.getAssetId().getGuid());
assetId.getAssetIdList().add(assetIdList);
}
{
assetIdList.setIdType(AssetIdType.IRCS);
assetIdList.setValue(testAsset.getIrcs());
assetId.getAssetIdList().add(assetIdList);
}
{
assetIdList.setIdType(AssetIdType.CFR);
assetIdList.setValue(testAsset.getCfr());
assetId.getAssetIdList().add(assetIdList);
}
{
assetIdList.setIdType(AssetIdType.MMSI);
assetIdList.setValue(testAsset.getMmsiNo());
assetId.getAssetIdList().add(assetIdList);
}
movementBaseType.setAssetName(testAsset.getName());
movementBaseType.setComChannelType(MovementComChannelType.NAF);
movementBaseType.setExternalMarking(testAsset.getExternalMarking());
movementBaseType.setFlagState(testAsset.getCountryCode());
movementBaseType.setInternalReferenceNumber(testAsset.getIrcs());
movementBaseType.setIrcs(testAsset.getIrcs());
movementBaseType.setMmsi(testAsset.getMmsiNo());
MobileTerminalId mobileTerminalId = new MobileTerminalId();
mobileTerminalId.setConnectId(mobileTerminalType.getConnectId());
mobileTerminalId.setGuid(mobileTerminalType.getMobileTerminalId().getGuid());
movementBaseType.setMobileTerminalId(mobileTerminalId);
movementBaseType.setMovementType(MovementTypeType.POS);
MovementPoint movementPoint = new MovementPoint();
movementPoint.setLongitude(createMovementRequest.getMovement().getPosition().getLongitude());
movementPoint.setLatitude(createMovementRequest.getMovement().getPosition().getLatitude());
movementPoint.setAltitude(createMovementRequest.getMovement().getPosition().getAltitude());
movementBaseType.setPosition(movementPoint);
movementBaseType.setPositionTime(new Date());
movementBaseType.setReportedCourse(1d);
movementBaseType.setReportedSpeed(1d);
movementBaseType.setSource(MovementSourceType.INMARSAT_C);
movementBaseType.setTripNumber(1d);
return request;
}
Aggregations