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;
}
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;
}
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;
}
Aggregations