Search in sources :

Example 1 with UnsentMessageProperty

use of eu.europa.ec.fisheries.uvms.exchange.entity.unsent.UnsentMessageProperty in project UVMS-ExchangeModule-APP by UnionVMS.

the class UnsentMessageMapper method mapToUnsentMessagePropertyModel.

private static List<UnsentMessageTypeProperty> mapToUnsentMessagePropertyModel(UnsentMessage entity) {
    List<UnsentMessageProperty> properties = entity.getProperties();
    List<UnsentMessageTypeProperty> unsentMessageTypeProperties = new ArrayList<>();
    for (UnsentMessageProperty property : properties) {
        UnsentMessageTypeProperty unsentMessageTypeProperty = new UnsentMessageTypeProperty();
        unsentMessageTypeProperty.setKey(UnsentMessageTypePropertyKey.fromValue(property.getKey().value()));
        unsentMessageTypeProperty.setValue(property.getValue());
        unsentMessageTypeProperties.add(unsentMessageTypeProperty);
    }
    return unsentMessageTypeProperties;
}
Also used : ArrayList(java.util.ArrayList) UnsentMessageTypeProperty(eu.europa.ec.fisheries.schema.exchange.v1.UnsentMessageTypeProperty) UnsentMessageProperty(eu.europa.ec.fisheries.uvms.exchange.entity.unsent.UnsentMessageProperty)

Example 2 with UnsentMessageProperty

use of eu.europa.ec.fisheries.uvms.exchange.entity.unsent.UnsentMessageProperty in project UVMS-ExchangeModule-APP by UnionVMS.

the class UnsentMessageMapper method toEntity.

public static UnsentMessage toEntity(UnsentMessageType message, String username) {
    UnsentMessage entity = new UnsentMessage();
    entity.setDateReceived(message.getDateReceived());
    entity.setRecipient(message.getRecipient());
    entity.setSenderReceiver(message.getSenderReceiver());
    entity.setMessage(message.getMessage());
    entity.setUpdatedBy(username);
    entity.setUpdateTime(DateUtils.nowUTC().toDate());
    List<UnsentMessageProperty> unsentMessageProperties = mapToUnsentMessagePropertyEntities(message, entity);
    entity.setProperties(unsentMessageProperties);
    return entity;
}
Also used : UnsentMessage(eu.europa.ec.fisheries.uvms.exchange.entity.unsent.UnsentMessage) UnsentMessageProperty(eu.europa.ec.fisheries.uvms.exchange.entity.unsent.UnsentMessageProperty)

Example 3 with UnsentMessageProperty

use of eu.europa.ec.fisheries.uvms.exchange.entity.unsent.UnsentMessageProperty in project UVMS-ExchangeModule-APP by UnionVMS.

the class UnsentMessageMapper method mapToUnsentMessagePropertyEntities.

private static List<UnsentMessageProperty> mapToUnsentMessagePropertyEntities(UnsentMessageType message, UnsentMessage entity) {
    List<UnsentMessageTypeProperty> properties = message.getProperties();
    List<UnsentMessageProperty> unsentMessageProperties = new ArrayList<>();
    for (UnsentMessageTypeProperty property : properties) {
        UnsentMessageProperty unsentMessageProperty = new UnsentMessageProperty();
        unsentMessageProperty.setKey(property.getKey());
        unsentMessageProperty.setValue(property.getValue());
        unsentMessageProperty.setUnsentMessage(entity);
        unsentMessageProperties.add(unsentMessageProperty);
    }
    return unsentMessageProperties;
}
Also used : ArrayList(java.util.ArrayList) UnsentMessageTypeProperty(eu.europa.ec.fisheries.schema.exchange.v1.UnsentMessageTypeProperty) UnsentMessageProperty(eu.europa.ec.fisheries.uvms.exchange.entity.unsent.UnsentMessageProperty)

Aggregations

UnsentMessageProperty (eu.europa.ec.fisheries.uvms.exchange.entity.unsent.UnsentMessageProperty)3 UnsentMessageTypeProperty (eu.europa.ec.fisheries.schema.exchange.v1.UnsentMessageTypeProperty)2 ArrayList (java.util.ArrayList)2 UnsentMessage (eu.europa.ec.fisheries.uvms.exchange.entity.unsent.UnsentMessage)1