remove old notification

This commit is contained in:
Efstratios Giannopoulos 2024-01-04 13:11:13 +02:00
parent 5b18809da0
commit 26ab1fb612
10 changed files with 146 additions and 593 deletions

View File

@ -1,174 +0,0 @@
package eu.eudat.data.old;
import eu.eudat.commons.enums.old.notification.ActiveStatus;
import eu.eudat.commons.enums.old.notification.ContactType;
import eu.eudat.commons.enums.old.notification.NotificationType;
import eu.eudat.commons.enums.old.notification.NotifyState;
import eu.eudat.data.UserEntity;
import eu.eudat.data.old.queryableentity.DataEntity;
import jakarta.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@Entity
@Table(name = "\"NotificationLegacy\"")
public class Notification implements DataEntity<Notification, UUID> {
@Id
@GeneratedValue
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "\"UserId\"")
private UserEntity userId;
@Enumerated
@Column(name = "\"IsActive\"", nullable = false)
private ActiveStatus isActive;
@Enumerated
@Column(name = "\"Type\"", nullable = false)
private NotificationType type;
@Enumerated
@Column(name = "\"ContactTypeHint\"")
private ContactType contactTypeHint;
@Column(name = "\"ContactHint\"")
private String contactHint;
@Column(name = "\"Data\"")
private String data;
@Enumerated
@Column(name = "\"NotifyState\"")
private NotifyState notifyState;
@Column(name = "\"NotifiedAt\"")
private Date notifiedAt;
@Column(name = "\"RetryCount\"")
private Integer retryCount;
@Column(name = "\"CreatedAt\"")
private Date createdAt;
@Column(name = "\"UpdatedAt\"")
private Date updatedAt;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public UserEntity getUserId() {
return userId;
}
public void setUserId(UserEntity userId) {
this.userId = userId;
}
public ActiveStatus getIsActive() {
return isActive;
}
public void setIsActive(ActiveStatus isActive) {
this.isActive = isActive;
}
public NotificationType getType() {
return type;
}
public void setType(NotificationType type) {
this.type = type;
}
public ContactType getContactTypeHint() {
return contactTypeHint;
}
public void setContactTypeHint(ContactType contactTypeHint) {
this.contactTypeHint = contactTypeHint;
}
public String getContactHint() {
return contactHint;
}
public void setContactHint(String contactHint) {
this.contactHint = contactHint;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public NotifyState getNotifyState() {
return notifyState;
}
public void setNotifyState(NotifyState notifyState) {
this.notifyState = notifyState;
}
public Date getNotifiedAt() {
return notifiedAt;
}
public void setNotifiedAt(Date notifiedAt) {
this.notifiedAt = notifiedAt;
}
public Integer getRetryCount() {
return retryCount;
}
public void setRetryCount(Integer retryCount) {
this.retryCount = retryCount;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
@Override
public void update(Notification entity) {
}
@Override
public UUID getKeys() {
return null;
}
@Override
public Notification buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
return null;
}
}

View File

@ -1,13 +0,0 @@
package eu.eudat.data.dao.entities;
import eu.eudat.data.dao.DatabaseAccessLayer;
import eu.eudat.data.dao.criteria.NotificationCriteria;
import eu.eudat.data.old.Notification;
import eu.eudat.queryable.QueryableList;
import java.util.UUID;
public interface NotificationDao extends DatabaseAccessLayer<Notification, UUID> {
QueryableList<Notification> getWithCriteria(NotificationCriteria criteria);
}

View File

@ -1,61 +0,0 @@
package eu.eudat.data.dao.entities;
import eu.eudat.data.dao.DatabaseAccess;
import eu.eudat.data.dao.criteria.NotificationCriteria;
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.old.Notification;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.management.InvalidApplicationException;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@Service("NotificationDao")
public class NotificationDaoImpl extends DatabaseAccess<Notification> implements NotificationDao {
@Autowired
public NotificationDaoImpl(DatabaseService<Notification> databaseService) {
super(databaseService);
}
@Override
public QueryableList<Notification> getWithCriteria(NotificationCriteria criteria) {
QueryableList<Notification> query = this.getDatabaseService().getQueryable(Notification.class);
if (criteria.getIsActive() != null)
query.where((builder, root) -> builder.equal(root.get("isActive"), criteria.getIsActive()));
if (criteria.getNotifyState() != null)
query.where(((builder, root) -> builder.equal(root.get("notifyState"), criteria.getNotifyState())));
return query;
}
@Override
public Notification createOrUpdate(Notification item) {
return this.getDatabaseService().createOrUpdate(item, Notification.class);
}
@Override
public CompletableFuture<Notification> createOrUpdateAsync(Notification item) {
return CompletableFuture.supplyAsync(() -> this.getDatabaseService().createOrUpdate(item, Notification.class));
}
@Override
public Notification find(UUID id) throws InvalidApplicationException {
return this.getDatabaseService().getQueryable(Notification.class).where(((builder, root) -> builder.equal(root.get("id"), id))).getSingle();
}
@Override
public Notification find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
@Override
public void delete(Notification item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<Notification> asQueryable() {
return this.getDatabaseService().getQueryable(Notification.class);
}
}

View File

@ -2672,22 +2672,22 @@ public class DataManagementPlanManager {
List<DmpUserEntity> userDMPS = this.queryFactory.query(DmpUserQuery.class).dmpIds(dmp.getId()).collect();
for (DmpUserEntity userDMP : userDMPS) {
if (!userDMP.getUserId().equals(user.getId())) {
Notification notification = new Notification();
notification.setUserId(user);
notification.setType(notificationType);
notification.setNotifyState(NotifyState.PENDING);
notification.setIsActive(ActiveStatus.ACTIVE);
notification.setData("{" +
"\"userId\": \"" + userDMP.getId() + "\"" +
// ", \"id\": \"" + userDMP.getDmp().getId() + "\"" + //TODO
// ", \"name\": \"" + userDMP.getDmp().getLabel() + "\"" +
", \"path\": \"" + notificationPaths.get(notificationType) +"\"" +
"}");
notification.setCreatedAt(new Date());
notification.setUpdatedAt(notification.getCreatedAt());
notification.setContactTypeHint(ContactType.EMAIL);
//notification.setContactHint(userDMP.getUser().getEmail()); //TODO
databaseRepository.getNotificationDao().createOrUpdate(notification);
// Notification notification = new Notification(); //TODO
// notification.setUserId(user);
// notification.setType(notificationType);
// notification.setNotifyState(NotifyState.PENDING);
// notification.setIsActive(ActiveStatus.ACTIVE);
// notification.setData("{" +
// "\"userId\": \"" + userDMP.getId() + "\"" +
//// ", \"id\": \"" + userDMP.getDmp().getId() + "\"" + //TODO
//// ", \"name\": \"" + userDMP.getDmp().getLabel() + "\"" +
// ", \"path\": \"" + notificationPaths.get(notificationType) +"\"" +
// "}");
// notification.setCreatedAt(new Date());
// notification.setUpdatedAt(notification.getCreatedAt());
// notification.setContactTypeHint(ContactType.EMAIL);
// //notification.setContactHint(userDMP.getUser().getEmail()); //TODO
// databaseRepository.getNotificationDao().createOrUpdate(notification);
}
}

View File

@ -730,25 +730,25 @@ public class DatasetManager {
List<DmpUserEntity> userDMPS = this.queryFactory.query(DmpUserQuery.class).dmpIds(dmp.getId()).collect();
for (DmpUserEntity userDMP : userDMPS) {
if (!userDMP.getUserId().equals(user.getId())) {
Notification notification = new Notification();
notification.setUserId(user);
notification.setType(notificationType);
notification.setNotifyState(NotifyState.PENDING);
notification.setIsActive(ActiveStatus.ACTIVE);
notification.setData("{" +
"\"userId\": \"" + userDMP.getUserId() + "\"" +
", \"id\": \"" + descriptionEntity.getId() + "\"" +
", \"name\": \"" + descriptionEntity.getLabel() + "\"" +
", \"path\": \"" + notificationPaths.get(notificationType) + "\"" +
"}");
notification.setCreatedAt(new Date());
notification.setUpdatedAt(notification.getCreatedAt());
notification.setContactTypeHint(ContactType.EMAIL);
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).userIds(userDMP.getUserId());
query.setOrder(new Ordering().addAscending(UserContactInfo._ordinal));
notification.setContactHint(query.first().getValue());
databaseRepository.getNotificationDao().createOrUpdate(notification);
// Notification notification = new Notification(); //TODO
// notification.setUserId(user);
// notification.setType(notificationType);
// notification.setNotifyState(NotifyState.PENDING);
// notification.setIsActive(ActiveStatus.ACTIVE);
// notification.setData("{" +
// "\"userId\": \"" + userDMP.getUserId() + "\"" +
// ", \"id\": \"" + descriptionEntity.getId() + "\"" +
// ", \"name\": \"" + descriptionEntity.getLabel() + "\"" +
// ", \"path\": \"" + notificationPaths.get(notificationType) + "\"" +
// "}");
// notification.setCreatedAt(new Date());
// notification.setUpdatedAt(notification.getCreatedAt());
// notification.setContactTypeHint(ContactType.EMAIL);
//
// UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).userIds(userDMP.getUserId());
// query.setOrder(new Ordering().addAscending(UserContactInfo._ordinal));
// notification.setContactHint(query.first().getValue());
// databaseRepository.getNotificationDao().createOrUpdate(notification);
}
}

View File

@ -1,12 +1,6 @@
package eu.eudat.logic.managers;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.data.old.Notification;
import eu.eudat.data.UserEntity;
import eu.eudat.commons.enums.old.notification.ActiveStatus;
import eu.eudat.commons.enums.old.notification.NotifyState;
import eu.eudat.logic.services.ApiContext;
import eu.eudat.query.UserQuery;
import gr.cite.tools.data.query.QueryFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -14,11 +8,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import jakarta.mail.MessagingException;
import jakarta.transaction.Transactional;
import java.io.IOException;
import java.util.*;
@Component
public class NotificationManager {
private static final Logger logger = LoggerFactory.getLogger(NotificationManager.class);
@ -36,91 +25,91 @@ public class NotificationManager {
this.queryFactory = queryFactory;
}
@Transactional
public void sendNotification(Notification notification) throws Exception {
if (notification.getNotifyState() == NotifyState.ERROR) {
if (notification.getRetryCount() == null) {
notification.setRetryCount(0);
}
notification.setRetryCount(notification.getRetryCount() + 1);
if (notification.getRetryCount() >= this.environment.getProperty("notification.maxRetries", Integer.class)) {
notification.setIsActive(ActiveStatus.INACTIVE);
notification.setUpdatedAt(new Date());
return;
}
}
notification.setNotifyState(NotifyState.PROCESSING);
notification.setNotifiedAt(new Date());
notification.setUpdatedAt(new Date());
try {
Map<String, String> data = new ObjectMapper().readValue(notification.getData(), HashMap.class);
UserEntity userInfo = this.queryFactory.query(UserQuery.class).ids(UUID.fromString(data.get("userId"))).first();
String subjectTemplate = "";
String contentTemplate = "";
switch (notification.getType()) {
case DMP_MODIFIED:
case DATASET_MODIFIED:
subjectTemplate = this.environment.getProperty("notification.modified.subject");
// contentTemplate = mailService.getMailTemplateContent(this.environment.getProperty("notification.modified.template"));
break;
case DMP_PUBLISH:
subjectTemplate = this.environment.getProperty("notification.publish.subject");
// contentTemplate = mailService.getMailTemplateContent(this.environment.getProperty("notification.publish.template"));
break;
case DMP_FINALISED:
subjectTemplate = this.environment.getProperty("notification.finalised.subject");
// contentTemplate = mailService.getMailTemplateContent(this.environment.getProperty("notification.finalised.template"));
break;
case DMP_MODIFIED_FINALISED:
case DATASET_MODIFIED_FINALISED:
subjectTemplate = this.environment.getProperty("notification.modifiedFinalised.subject");
// contentTemplate = mailService.getMailTemplateContent(this.environment.getProperty("notification.modified_finalised.template"));
break;
}
switch (notification.getContactTypeHint()) {
case EMAIL:
this.sendEmailNotification(notification, userInfo, data, subjectTemplate, contentTemplate);
break;
}
}catch (Exception e) {
notification.setNotifyState(NotifyState.ERROR);
notification.setUpdatedAt(new Date());
logger.error(e.getMessage(), e);
}
}
private void sendEmailNotification(Notification notification, UserEntity userInfo, Map<String, String> data, String subjectTemplate, String contentTemplate) throws IOException {
// SimpleMail simpleMail = new SimpleMail();
// simpleMail.setFrom(this.environment.getProperty("mail.from"));
// simpleMail.setSubject(makeSubject(data, subjectTemplate));
// simpleMail.setTo(notification.getContactHint());
// simpleMail.setContent(makeContent(data, notification, userInfo, contentTemplate));
// try {
// mailService.sendSimpleMail(simpleMail);
// notification.setNotifyState(NotifyState.SUCCEEDED);
// @Transactional
// public void sendNotification(Notification notification) throws Exception {
// if (notification.getNotifyState() == NotifyState.ERROR) {
// if (notification.getRetryCount() == null) {
// notification.setRetryCount(0);
// }
// notification.setRetryCount(notification.getRetryCount() + 1);
// if (notification.getRetryCount() >= this.environment.getProperty("notification.maxRetries", Integer.class)) {
// notification.setIsActive(ActiveStatus.INACTIVE);
// notification.setUpdatedAt(new Date());
// } catch (MessagingException e) {
// return;
// }
// }
// notification.setNotifyState(NotifyState.PROCESSING);
// notification.setNotifiedAt(new Date());
// notification.setUpdatedAt(new Date());
// try {
// Map<String, String> data = new ObjectMapper().readValue(notification.getData(), HashMap.class);
// UserEntity userInfo = this.queryFactory.query(UserQuery.class).ids(UUID.fromString(data.get("userId"))).first();
// String subjectTemplate = "";
// String contentTemplate = "";
//
// switch (notification.getType()) {
// case DMP_MODIFIED:
// case DATASET_MODIFIED:
// subjectTemplate = this.environment.getProperty("notification.modified.subject");
//// contentTemplate = mailService.getMailTemplateContent(this.environment.getProperty("notification.modified.template"));
// break;
// case DMP_PUBLISH:
// subjectTemplate = this.environment.getProperty("notification.publish.subject");
//// contentTemplate = mailService.getMailTemplateContent(this.environment.getProperty("notification.publish.template"));
// break;
// case DMP_FINALISED:
// subjectTemplate = this.environment.getProperty("notification.finalised.subject");
//// contentTemplate = mailService.getMailTemplateContent(this.environment.getProperty("notification.finalised.template"));
// break;
// case DMP_MODIFIED_FINALISED:
// case DATASET_MODIFIED_FINALISED:
// subjectTemplate = this.environment.getProperty("notification.modifiedFinalised.subject");
//// contentTemplate = mailService.getMailTemplateContent(this.environment.getProperty("notification.modified_finalised.template"));
// break;
// }
//
//
// switch (notification.getContactTypeHint()) {
// case EMAIL:
// this.sendEmailNotification(notification, userInfo, data, subjectTemplate, contentTemplate);
// break;
// }
// }catch (Exception e) {
// notification.setNotifyState(NotifyState.ERROR);
// notification.setUpdatedAt(new Date());
// logger.error(e.getMessage(), e);
// }
}
private String makeSubject(Map<String, String> data, String subjectTemplate) {
return subjectTemplate.replace("{name}", data.get("name"));
}
private String makeContent(Map<String, String> data, Notification notification, UserEntity userInfo, String template) {
String content = template;
content = content.replace("{recipient}", userInfo.getName());
for (String key : data.keySet()) {
content = content.replace("{" + key +"}", data.get(key));
}
content = content.replace("{host}", this.environment.getProperty("dmp.domain"));
content = content.replace("{reasonName}", notification.getUserId().getName());
return content;
}
// }
//
// private void sendEmailNotification(Notification notification, UserEntity userInfo, Map<String, String> data, String subjectTemplate, String contentTemplate) throws IOException {
//// SimpleMail simpleMail = new SimpleMail();
//// simpleMail.setFrom(this.environment.getProperty("mail.from"));
//// simpleMail.setSubject(makeSubject(data, subjectTemplate));
//// simpleMail.setTo(notification.getContactHint());
//// simpleMail.setContent(makeContent(data, notification, userInfo, contentTemplate));
//// try {
//// mailService.sendSimpleMail(simpleMail);
//// notification.setNotifyState(NotifyState.SUCCEEDED);
//// notification.setUpdatedAt(new Date());
//// } catch (MessagingException e) {
//// notification.setNotifyState(NotifyState.ERROR);
//// notification.setUpdatedAt(new Date());
//// logger.error(e.getMessage(), e);
//// }
// }
//
// private String makeSubject(Map<String, String> data, String subjectTemplate) {
// return subjectTemplate.replace("{name}", data.get("name"));
// }
//
// private String makeContent(Map<String, String> data, Notification notification, UserEntity userInfo, String template) {
// String content = template;
// content = content.replace("{recipient}", userInfo.getName());
// for (String key : data.keySet()) {
// content = content.replace("{" + key +"}", data.get(key));
// }
// content = content.replace("{host}", this.environment.getProperty("dmp.domain"));
// content = content.replace("{reasonName}", notification.getUserId().getName());
// return content;
// }
}

View File

@ -18,9 +18,6 @@ public interface DatabaseRepository {
EmailConfirmationDao getLoginConfirmationEmailDao();
NotificationDao getNotificationDao();
FileUploadDao getFileUploadDao();
<T> void detachEntity(T entity);

View File

@ -22,8 +22,6 @@ public class DatabaseRepositoryImpl implements DatabaseRepository {
private EmailConfirmationDao loginConfirmationEmailDao;
private NotificationDao notificationDao;
private FileUploadDao fileUploadDao;
private EntityManager entityManager;
@ -97,16 +95,6 @@ public class DatabaseRepositoryImpl implements DatabaseRepository {
this.loginConfirmationEmailDao = loginConfirmationEmailDao;
}
@Override
public NotificationDao getNotificationDao() {
return notificationDao;
}
@Autowired
public void setNotificationDao(NotificationDao notificationDao) {
this.notificationDao = notificationDao;
}
@Override
public FileUploadDao getFileUploadDao() {

View File

@ -1,22 +1,12 @@
package eu.eudat.logic.utilities.schedule.notification;
import eu.eudat.data.old.Notification;
import eu.eudat.commons.enums.old.notification.ActiveStatus;
import eu.eudat.commons.enums.old.notification.NotifyState;
import eu.eudat.logic.managers.NotificationManager;
import eu.eudat.logic.services.ApiContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import jakarta.transaction.Transactional;
import javax.management.InvalidApplicationException;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@Component
public class NotificationScheduleJob {
@ -31,29 +21,29 @@ public class NotificationScheduleJob {
this.notificationManager = notificationManager;
}
@Transactional
@Scheduled(fixedRateString = "${notification.rateInterval}")
public void sendNotifications() throws InvalidApplicationException {
List<CompletableFuture<Notification>> futures = new LinkedList<>();
this.apiContext.getOperationsContext().getDatabaseRepository().getNotificationDao().asQueryable().where(((builder, root) ->
builder.and(
builder.or(
builder.equal(root.get("notifyState"), NotifyState.PENDING), builder.equal(root.get("notifyState"), NotifyState.ERROR))
, builder.equal(root.get("isActive"), ActiveStatus.ACTIVE)))).toListAsync().thenApplyAsync((notifications) -> {
if (!notifications.isEmpty()) {
notifications.forEach(notification -> {
try {
this.notificationManager.sendNotification(notification);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
});
}
return notifications;
}).thenApplyAsync((notifications) -> {
notifications.forEach((notification) -> futures.add(this.apiContext.getOperationsContext().getDatabaseRepository().getNotificationDao().createOrUpdateAsync(notification)));
return futures;
}).join();
}
// @Transactional //TODO
// @Scheduled(fixedRateString = "${notification.rateInterval}")
// public void sendNotifications() throws InvalidApplicationException {
// List<CompletableFuture<Notification>> futures = new LinkedList<>();
// this.apiContext.getOperationsContext().getDatabaseRepository().getNotificationDao().asQueryable().where(((builder, root) ->
// builder.and(
// builder.or(
// builder.equal(root.get("notifyState"), NotifyState.PENDING), builder.equal(root.get("notifyState"), NotifyState.ERROR))
// , builder.equal(root.get("isActive"), ActiveStatus.ACTIVE)))).toListAsync().thenApplyAsync((notifications) -> {
// if (!notifications.isEmpty()) {
// notifications.forEach(notification -> {
// try {
// this.notificationManager.sendNotification(notification);
// } catch (Exception e) {
// logger.error(e.getMessage(), e);
// }
// });
// }
// return notifications;
// }).thenApplyAsync((notifications) -> {
// notifications.forEach((notification) -> futures.add(this.apiContext.getOperationsContext().getDatabaseRepository().getNotificationDao().createOrUpdateAsync(notification)));
// return futures;
// }).join();
//
// }
}

View File

@ -1,163 +0,0 @@
package eu.eudat.models.data.notiication;
import eu.eudat.commons.enums.old.notification.ActiveStatus;
import eu.eudat.commons.enums.old.notification.ContactType;
import eu.eudat.commons.enums.old.notification.NotificationType;
import eu.eudat.commons.enums.old.notification.NotifyState;
import eu.eudat.model.User;
import eu.eudat.models.DataModel;
import java.util.Date;
import java.util.UUID;
public class Notification implements DataModel<eu.eudat.data.old.Notification, Notification> {
private UUID id;
private User userId;
private ActiveStatus isActive;
private NotificationType type;
private ContactType contactTypeHint;
private String contactHint;
private String data;
private NotifyState notifyState;
private Date notifiedAt;
private Integer retryCount;
private Date createdAt;
private Date updatedAt;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public User getUserId() {
return userId;
}
public void setUserId(User userId) {
this.userId = userId;
}
public ActiveStatus getIsActive() {
return isActive;
}
public void setIsActive(ActiveStatus isActive) {
this.isActive = isActive;
}
public NotificationType getType() {
return type;
}
public void setType(NotificationType type) {
this.type = type;
}
public ContactType getContactTypeHint() {
return contactTypeHint;
}
public void setContactTypeHint(ContactType contactTypeHint) {
this.contactTypeHint = contactTypeHint;
}
public String getContactHint() {
return contactHint;
}
public void setContactHint(String contactHint) {
this.contactHint = contactHint;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public NotifyState getNotifyState() {
return notifyState;
}
public void setNotifyState(NotifyState notifyState) {
this.notifyState = notifyState;
}
public Date getNotifiedAt() {
return notifiedAt;
}
public void setNotifiedAt(Date notifiedAt) {
this.notifiedAt = notifiedAt;
}
public Integer getRetryCount() {
return retryCount;
}
public void setRetryCount(Integer retryCount) {
this.retryCount = retryCount;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
@Override
public Notification fromDataModel(eu.eudat.data.old.Notification entity) {
this.id = entity.getId();
this.contactHint = entity.getContactHint();
this.contactTypeHint = entity.getContactTypeHint();
this.createdAt = entity.getCreatedAt();
this.data = entity.getData();
this.isActive = entity.getIsActive();
this.notifiedAt = entity.getNotifiedAt();
this.notifyState = entity.getNotifyState();
this.retryCount = entity.getRetryCount();
this.type = entity.getType();
this.updatedAt = entity.getUpdatedAt();
// this.userId = new UserInfo().fromDataModel(entity.getUserId());
return this;
}
@Override
public eu.eudat.data.old.Notification toDataModel() throws Exception {
eu.eudat.data.old.Notification entity = new eu.eudat.data.old.Notification();
entity.setId(this.id);
entity.setContactHint(this.contactHint);
entity.setContactTypeHint(this.contactTypeHint);
entity.setCreatedAt(this.createdAt);
entity.setData(this.data);
entity.setIsActive(this.isActive);
entity.setNotifiedAt(this.notifiedAt);
entity.setNotifyState(this.notifyState);
entity.setRetryCount(this.retryCount);
entity.setType(this.type);
entity.setUpdatedAt(this.updatedAt);
// entity.setUserId(this.userId.toDataModel());
return entity;
}
@Override
public String getHint() {
return null;
}
}