Commit 34a18c91 authored by Gianluca Filippone's avatar Gianluca Filippone
Browse files

Added DAO annotations and aligned with Syncope

parent bb4879cd
......@@ -15,9 +15,9 @@
*/
package org.apache.syncope.client.console.widget;
import org.apache.syncope.client.console.widgets.AbstractWidget;
import org.apache.syncope.client.console.widgets.BaseWidget;
public abstract class StatsWidget extends AbstractWidget {
public abstract class StatsWidget extends BaseWidget {
public StatsWidget(final String id) {
super(id);
......
......@@ -20,9 +20,13 @@ import javax.persistence.TypedQuery;
import org.apache.syncope.core.persistence.api.dao.EndRequestDAO;
import org.apache.syncope.core.persistence.api.entity.EndRequest;
import org.apache.syncope.core.persistence.jpa.entity.JPAEndRequest;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository
public class JPAEndRequestDAO extends AbstractDAO<EndRequest, Long> implements EndRequestDAO {
@Transactional(readOnly = true)
@Override
public EndRequest find(final String cdName, final String operationName, final String instanceName,
final String choreographyName) {
......@@ -41,6 +45,7 @@ public class JPAEndRequestDAO extends AbstractDAO<EndRequest, Long> implements E
return query.getSingleResult();
}
@Transactional(readOnly = true)
@Override
public List<EndRequest> findAll() {
TypedQuery<EndRequest> query = entityManager().createQuery(
......@@ -48,11 +53,13 @@ public class JPAEndRequestDAO extends AbstractDAO<EndRequest, Long> implements E
return query.getResultList();
}
@Transactional
@Override
public void save(final EndRequest request) {
entityManager().persist(request);
}
@Transactional
@Override
public void delete(final String key) {
}
......
......@@ -20,9 +20,13 @@ import javax.persistence.TypedQuery;
import org.apache.syncope.core.persistence.api.dao.ForwardRequestDAO;
import org.apache.syncope.core.persistence.api.entity.ForwardRequest;
import org.apache.syncope.core.persistence.jpa.entity.JPAForwardRequest;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository
public class JPAForwardRequestDAO extends AbstractDAO<ForwardRequest, Long> implements ForwardRequestDAO {
@Transactional(readOnly = true)
@Override
public ForwardRequest find(final String cdName, final String operationName, final String instanceName,
final String choreographyName) {
......@@ -41,6 +45,7 @@ public class JPAForwardRequestDAO extends AbstractDAO<ForwardRequest, Long> impl
return query.getSingleResult();
}
@Transactional(readOnly = true)
@Override
public List<ForwardRequest> findAll() {
TypedQuery<ForwardRequest> query = entityManager().createQuery(
......@@ -48,11 +53,13 @@ public class JPAForwardRequestDAO extends AbstractDAO<ForwardRequest, Long> impl
return query.getResultList();
}
@Transactional
@Override
public void save(final ForwardRequest request) {
entityManager().persist(request);
}
@Transactional
@Override
public void delete(final String key) {
}
......
......@@ -20,9 +20,13 @@ import javax.persistence.TypedQuery;
import org.apache.syncope.core.persistence.api.dao.ForwardResponseDAO;
import org.apache.syncope.core.persistence.api.entity.ForwardResponse;
import org.apache.syncope.core.persistence.jpa.entity.JPAForwardResponse;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository
public class JPAForwardResponseDAO extends AbstractDAO<ForwardResponse, Long> implements ForwardResponseDAO {
@Transactional(readOnly = true)
@Override
public ForwardResponse find(final String cdName, final String operationName, final String instanceName,
final String choreographyName) {
......@@ -41,6 +45,7 @@ public class JPAForwardResponseDAO extends AbstractDAO<ForwardResponse, Long> im
return query.getSingleResult();
}
@Transactional(readOnly = true)
@Override
public List<ForwardResponse> findAll() {
TypedQuery<ForwardResponse> query = entityManager().createQuery(
......@@ -48,11 +53,13 @@ public class JPAForwardResponseDAO extends AbstractDAO<ForwardResponse, Long> im
return query.getResultList();
}
@Transactional
@Override
public void save(final ForwardResponse response) {
entityManager().persist(response);
}
@Transactional
@Override
public void delete(final String key) {
}
......
......@@ -20,16 +20,20 @@ import javax.persistence.TypedQuery;
import org.apache.syncope.core.persistence.api.dao.NumberCoordMessageDAO;
import org.apache.syncope.core.persistence.api.entity.NumberCoordMessage;
import org.apache.syncope.core.persistence.jpa.entity.JPANumberCoordMessage;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository
public class JPANumberCoordMessageDAO extends AbstractDAO<NumberCoordMessage, Long>
implements NumberCoordMessageDAO {
@Transactional(readOnly = true)
@Override
public NumberCoordMessage find(final String cdName, final String operationName, final String instanceName,
final String choreographyName) {
TypedQuery<NumberCoordMessage> query = entityManager().createQuery(
"SELECT e FROM" + JPANumberCoordMessage.class.getSimpleName()
"SELECT e FROM " + JPANumberCoordMessage.class.getSimpleName()
+ " e WHERE e.cdName = :cdName AND e.operationName = :operationName"
+ " AND e.instanceName = :instanceName AND e.choreographyName :choreographyName",
NumberCoordMessage.class);
......@@ -42,6 +46,7 @@ public class JPANumberCoordMessageDAO extends AbstractDAO<NumberCoordMessage, Lo
return query.getSingleResult();
}
@Transactional(readOnly = true)
@Override
public List<NumberCoordMessage> findAll() {
TypedQuery<NumberCoordMessage> query = entityManager().createQuery(
......@@ -49,11 +54,13 @@ public class JPANumberCoordMessageDAO extends AbstractDAO<NumberCoordMessage, Lo
return query.getResultList();
}
@Transactional
@Override
public void save(final NumberCoordMessage messages) {
entityManager().persist(messages);
}
@Transactional
@Override
public void delete(final String key) {
}
......
......@@ -20,9 +20,13 @@ import javax.persistence.TypedQuery;
import org.apache.syncope.core.persistence.api.dao.StartRequestDAO;
import org.apache.syncope.core.persistence.api.entity.StartRequest;
import org.apache.syncope.core.persistence.jpa.entity.JPAStartRequest;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository
public class JPAStartRequestDAO extends AbstractDAO<StartRequest, Long> implements StartRequestDAO {
@Transactional(readOnly = true)
@Override
public StartRequest find(final String cdName,
final String operationName,
......@@ -30,7 +34,7 @@ public class JPAStartRequestDAO extends AbstractDAO<StartRequest, Long> implemen
final String choreographyName) {
TypedQuery<StartRequest> query = entityManager().createQuery(
"SELECT e FROM" + JPAStartRequest.class.getSimpleName()
"SELECT e FROM " + JPAStartRequest.class.getSimpleName()
+ " e WHERE e.cdName = :cdName AND e.operationName = :operationName"
+ " AND e.instanceName = :instanceName AND e.choreographyName :choreographyName",
StartRequest.class);
......@@ -43,6 +47,7 @@ public class JPAStartRequestDAO extends AbstractDAO<StartRequest, Long> implemen
return query.getSingleResult();
}
@Transactional(readOnly = true)
@Override
public List<StartRequest> findAll() {
TypedQuery<StartRequest> query = entityManager().createQuery(
......@@ -50,11 +55,13 @@ public class JPAStartRequestDAO extends AbstractDAO<StartRequest, Long> implemen
return query.getResultList();
}
@Transactional
@Override
public void save(final StartRequest request) {
entityManager().persist(request);
}
@Transactional
@Override
public void delete(final String key) {
}
......
......@@ -30,7 +30,7 @@ public class JPAStartRequest extends AbstractEntity<Long> implements StartReques
@Id
private long recordId;
private String instanceName;
private String operationName;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment