CST-12868 remove Outbound Patterns

This commit is contained in:
frabacche
2024-01-09 11:53:39 +01:00
parent 997171b029
commit 9c83afe740
26 changed files with 2 additions and 2528 deletions

View File

@@ -51,9 +51,6 @@ public class NotifyServiceEntity implements ReloadableEntity<Integer> {
@OneToMany(mappedBy = "notifyService")
private List<NotifyServiceInboundPattern> inboundPatterns;
@OneToMany(mappedBy = "notifyService")
private List<NotifyServiceOutboundPattern> outboundPatterns;
@Column(name = "enabled")
private boolean enabled = false;
@@ -113,14 +110,6 @@ public class NotifyServiceEntity implements ReloadableEntity<Integer> {
this.inboundPatterns = inboundPatterns;
}
public List<NotifyServiceOutboundPattern> getOutboundPatterns() {
return outboundPatterns;
}
public void setOutboundPatterns(List<NotifyServiceOutboundPattern> outboundPatterns) {
this.outboundPatterns = outboundPatterns;
}
@Override
public Integer getID() {
return id;

View File

@@ -1,83 +0,0 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.app.ldn;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
/**
* Database object representing notify services outbound patterns. Every {@link org.dspace.app.ldn.NotifyServiceEntity}
* may have inbounds and outbounds. Outbounds are to be sent to the external service.
*
* @author Mohamed Eskander (mohamed.eskander at 4science.com)
*/
@Entity
@Table(name = "notifyservice_outbound_pattern")
public class NotifyServiceOutboundPattern {
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "notifyservice_outbound_pattern_id_seq")
@SequenceGenerator(name = "notifyservice_outbound_pattern_id_seq",
sequenceName = "notifyservice_outbound_pattern_id_seq",
allocationSize = 1)
private Integer id;
@ManyToOne
@JoinColumn(name = "service_id", referencedColumnName = "id")
private NotifyServiceEntity notifyService;
@Column(name = "pattern")
private String pattern;
@Column(name = "constraint_name")
private String constraint;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public NotifyServiceEntity getNotifyService() {
return notifyService;
}
public void setNotifyService(NotifyServiceEntity notifyService) {
this.notifyService = notifyService;
}
/**
* https://notify.coar-repositories.org/patterns/
* @return pattern of the outbound notification
*/
public String getPattern() {
return pattern;
}
public void setPattern(String pattern) {
this.pattern = pattern;
}
public String getConstraint() {
return constraint;
}
public void setConstraint(String constraint) {
this.constraint = constraint;
}
}

View File

@@ -1,38 +0,0 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.app.ldn.dao;
import java.sql.SQLException;
import org.dspace.app.ldn.NotifyServiceEntity;
import org.dspace.app.ldn.NotifyServiceOutboundPattern;
import org.dspace.core.Context;
import org.dspace.core.GenericDAO;
/**
* This is the Data Access Object for the {@link NotifyServiceOutboundPattern} object
*
* @author Mohamed Eskander (mohamed.eskander at 4science.com)
*/
public interface NotifyServiceOutboundPatternDao extends GenericDAO<NotifyServiceOutboundPattern> {
/**
* find all notifyServiceOutboundPatterns matched with
* the provided notifyServiceEntity and pattern
*
* @param context the context
* @param notifyServiceEntity the notifyServiceEntity
* @param pattern the pattern
* @return all notifyServiceInboundPatterns matched with
* the provided notifyServiceEntity and pattern
* @throws SQLException if database error
*/
public NotifyServiceOutboundPattern findByServiceAndPattern(Context context,
NotifyServiceEntity notifyServiceEntity,
String pattern) throws SQLException;
}

View File

@@ -1,46 +0,0 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.app.ldn.dao.impl;
import java.sql.SQLException;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import org.dspace.app.ldn.NotifyServiceEntity;
import org.dspace.app.ldn.NotifyServiceOutboundPattern;
import org.dspace.app.ldn.NotifyServiceOutboundPattern_;
import org.dspace.app.ldn.dao.NotifyServiceOutboundPatternDao;
import org.dspace.core.AbstractHibernateDAO;
import org.dspace.core.Context;
/**
* Implementation of {@link NotifyServiceOutboundPatternDao}.
*
* @author Mohamed Eskander (mohamed.eskander at 4science.com)
*/
public class NotifyServiceOutboundPatternDaoImpl
extends AbstractHibernateDAO<NotifyServiceOutboundPattern> implements NotifyServiceOutboundPatternDao {
@Override
public NotifyServiceOutboundPattern findByServiceAndPattern(Context context,
NotifyServiceEntity notifyServiceEntity,
String pattern) throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, NotifyServiceOutboundPattern.class);
Root<NotifyServiceOutboundPattern> outboundPatternRoot = criteriaQuery.from(NotifyServiceOutboundPattern.class);
criteriaQuery.select(outboundPatternRoot);
criteriaQuery.where(criteriaBuilder.and(
criteriaBuilder.equal(
outboundPatternRoot.get(NotifyServiceOutboundPattern_.notifyService), notifyServiceEntity),
criteriaBuilder.equal(
outboundPatternRoot.get(NotifyServiceOutboundPattern_.pattern), pattern)
));
return uniqueResult(context, criteriaQuery, false, NotifyServiceOutboundPattern.class);
}
}

View File

@@ -1,66 +0,0 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.app.ldn.service;
import java.sql.SQLException;
import org.dspace.app.ldn.NotifyServiceEntity;
import org.dspace.app.ldn.NotifyServiceOutboundPattern;
import org.dspace.core.Context;
/**
* Service interface class for the {@link NotifyServiceOutboundPattern} object.
*
* @author Mohamed Eskander (mohamed.eskander at 4science.com)
*/
public interface NotifyServiceOutboundPatternService {
/**
* find all notifyServiceOutboundPatterns matched with
* the provided notifyServiceEntity and pattern
*
* @param context the context
* @param notifyServiceEntity the notifyServiceEntity
* @param pattern the pattern
* @return all notifyServiceOutboundPatterns matched with
* the provided notifyServiceEntity and pattern
* @throws SQLException if database error
*/
public NotifyServiceOutboundPattern findByServiceAndPattern(Context context,
NotifyServiceEntity notifyServiceEntity,
String pattern) throws SQLException;
/**
* create new notifyServiceOutboundPattern
*
* @param context the context
* @param notifyServiceEntity the notifyServiceEntity
* @return the created notifyServiceOutboundPattern
* @throws SQLException if database error
*/
public NotifyServiceOutboundPattern create(Context context, NotifyServiceEntity notifyServiceEntity)
throws SQLException;
/**
* update the provided notifyServiceOutboundPattern
*
* @param context the context
* @param outboundPattern the notifyServiceOutboundPattern
* @throws SQLException if database error
*/
public void update(Context context, NotifyServiceOutboundPattern outboundPattern) throws SQLException;
/**
* delete the provided notifyServiceOutboundPattern
*
* @param context the context
* @param outboundPattern the notifyServiceOutboundPattern
* @throws SQLException if database error
*/
public void delete(Context context, NotifyServiceOutboundPattern outboundPattern) throws SQLException;
}

View File

@@ -1,53 +0,0 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.app.ldn.service.impl;
import java.sql.SQLException;
import org.dspace.app.ldn.NotifyServiceEntity;
import org.dspace.app.ldn.NotifyServiceOutboundPattern;
import org.dspace.app.ldn.dao.NotifyServiceOutboundPatternDao;
import org.dspace.app.ldn.service.NotifyServiceOutboundPatternService;
import org.dspace.core.Context;
import org.springframework.beans.factory.annotation.Autowired;
/**
* Implementation Service class for the {@link NotifyServiceOutboundPatternService}.
*
* @author Mohamed Eskander (mohamed.eskander at 4science.com)
*/
public class NotifyServiceOutboundPatternServiceImpl implements NotifyServiceOutboundPatternService {
@Autowired
private NotifyServiceOutboundPatternDao outboundPatternDao;
@Override
public NotifyServiceOutboundPattern findByServiceAndPattern(Context context,
NotifyServiceEntity notifyServiceEntity,
String pattern) throws SQLException {
return outboundPatternDao.findByServiceAndPattern(context, notifyServiceEntity, pattern);
}
@Override
public NotifyServiceOutboundPattern create(Context context, NotifyServiceEntity notifyServiceEntity)
throws SQLException {
NotifyServiceOutboundPattern outboundPattern = new NotifyServiceOutboundPattern();
outboundPattern.setNotifyService(notifyServiceEntity);
return outboundPatternDao.create(context, outboundPattern);
}
@Override
public void update(Context context, NotifyServiceOutboundPattern outboundPattern) throws SQLException {
outboundPatternDao.save(context, outboundPattern);
}
@Override
public void delete(Context context, NotifyServiceOutboundPattern outboundPattern) throws SQLException {
outboundPatternDao.delete(context, outboundPattern);
}
}