Search in sources :

Example 1 with KeyValueType

use of eu.europa.ec.fisheries.schema.exchange.common.v1.KeyValueType in project UVMS-ExchangeModule-APP by UnionVMS.

the class ExchangeLogMapper method getRecipientOfPoll.

private static String getRecipientOfPoll(List<KeyValueType> pollReceiverList) throws ExchangeLogException {
    if (pollReceiverList == null || pollReceiverList.isEmpty()) {
        throw new ExchangeLogException("No poll receiver list");
    }
    String dnid = null;
    String memberNumber = null;
    String satelliteNumber = null;
    String les = null;
    for (KeyValueType pollReceiver : pollReceiverList) {
        if (IdType.DNID.name().equalsIgnoreCase(pollReceiver.getKey())) {
            dnid = pollReceiver.getValue();
        } else if (IdType.MEMBER_NUMBER.name().equalsIgnoreCase(pollReceiver.getKey())) {
            memberNumber = pollReceiver.getValue();
        } else if (IdType.SERIAL_NUMBER.name().equalsIgnoreCase(pollReceiver.getKey())) {
            satelliteNumber = pollReceiver.getValue();
        } else if (IdType.LES.name().equalsIgnoreCase(pollReceiver.getKey())) {
            les = pollReceiver.getValue();
        }
    }
    if (dnid != null && memberNumber != null) {
        return dnid + "." + memberNumber;
    } else if (satelliteNumber != null) {
        return satelliteNumber;
    } else if (les != null) {
        return les;
    }
    throw new ExchangeLogException("No receiver of poll");
}
Also used : ExchangeLogException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException) KeyValueType(eu.europa.ec.fisheries.schema.exchange.common.v1.KeyValueType)

Aggregations

KeyValueType (eu.europa.ec.fisheries.schema.exchange.common.v1.KeyValueType)1 ExchangeLogException (eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException)1