Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 68c09627 authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

Implementation of rest services for UI (servicegroup, servicemetadata, domains, users)

parent c899e1cd
No related branches found
No related tags found
No related merge requests found
Showing
with 966 additions and 23 deletions
......@@ -24,6 +24,7 @@
<modules>
<module>smp-parent-pom</module>
<module>smp-api</module>
<!-- module>smp-angular</module -->
<module>smp-server-library</module>
<module>smp-webapp</module>
</modules>
......
......@@ -95,6 +95,7 @@
<lombok.version>1.16.16</lombok.version>
<xmlunit.version>2.5.1</xmlunit.version>
<hamcrest.version>2.0.0.0</hamcrest.version>
<jackson.version>2.9.2</jackson.version>
<!-- jacoco, sonar code coverage settings start -->
<sonar.jacoco.reportPath>${maven.multiModuleProjectDirectory}/code-coverage/jacoco-ut.exec</sonar.jacoco.reportPath>
......@@ -422,6 +423,23 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- Jackson-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<!-- End Jackson-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
......
......@@ -90,6 +90,19 @@
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<!-- Jackson-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
......
......@@ -44,18 +44,18 @@ public class ServiceGroupConverter {
private static final String PARSER_DISALLOW_DTD_PARSING_FEATURE = "http://apache.org/xml/features/disallow-doctype-decl";
static Unmarshaller jaxbUnmarshaller;
private static Unmarshaller getUnmarshaller() throws JAXBException {
if(jaxbUnmarshaller != null) {
return jaxbUnmarshaller;
}
synchronized (ServiceGroupConverter.class) {
private static final ThreadLocal<Unmarshaller> jaxbUnmarshaller = ThreadLocal.withInitial( () -> {
try {
JAXBContext jaxbContext = JAXBContext.newInstance(ServiceGroup.class);
jaxbUnmarshaller = jaxbContext.createUnmarshaller();
return jaxbUnmarshaller;
return jaxbContext.createUnmarshaller();
}catch(JAXBException ex) {
throw new RuntimeException("Could not create ServiceGroup Unmarshaller!");
}
} );
private static Unmarshaller getUnmarshaller() throws JAXBException {
return jaxbUnmarshaller.get();
}
public static ServiceGroup unmarshal(String serviceGroupXml) {
......
......@@ -46,17 +46,17 @@ public class ServiceMetadataConverter {
private static final String DOC_SIGNED_SERVICE_METADATA_EMPTY = "<SignedServiceMetadata xmlns=\""+NS+"\"/>";
private static final String PARSER_DISALLOW_DTD_PARSING_FEATURE = "http://apache.org/xml/features/disallow-doctype-decl";
static Unmarshaller jaxbUnmarshaller;
private static Unmarshaller getUnmarshaller() throws JAXBException {
if (jaxbUnmarshaller != null) {
return jaxbUnmarshaller;
}
synchronized (ServiceMetadataConverter.class) {
private static final ThreadLocal<Unmarshaller> jaxbUnmarshaller = ThreadLocal.withInitial( () -> {
try {
JAXBContext jaxbContext = JAXBContext.newInstance(ServiceMetadata.class);
jaxbUnmarshaller = jaxbContext.createUnmarshaller();
return jaxbUnmarshaller;
return jaxbContext.createUnmarshaller();
}catch(JAXBException ex) {
throw new RuntimeException("Could not create ServiceGroup Unmarshaller!");
}
} );
private static Unmarshaller getUnmarshaller() throws JAXBException {
return jaxbUnmarshaller.get();
}
public static Document toSignedServiceMetadatadaDocument(String serviceMetadataXml) {
......
package eu.europa.ec.edelivery.smp.data.dao.ui;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Service
public class UiDaoService {
@PersistenceContext
protected EntityManager memEManager;
private static final Logger LOG = LoggerFactory.getLogger(UiDaoService.class);
/**
*
* @param <T>
* @param type
* @param searchParams
* @param forCount
* @param sortField
* @param sortOrder
* @return
*/
protected <T, D> CriteriaQuery createSearchCriteria(Class<T> type,
Object searchParams, Class<D> filterType,
boolean forCount, String sortField, String sortOrder) {
CriteriaBuilder cb = memEManager.getCriteriaBuilder();
CriteriaQuery cq = forCount ? cb.createQuery(Long.class
) : cb.createQuery(
type);
Root<T> om = cq.from(filterType == null ? type : filterType);
if (forCount) {
cq.select(cb.count(om));
} else if (sortField != null) {
if (sortOrder != null && sortOrder.equalsIgnoreCase("desc")) {
cq.orderBy(cb.asc(om.get(sortField)));
} else {
cq.orderBy(cb.desc(om.get(sortField)));
}
} else {
// cq.orderBy(cb.desc(om.get("Id")));
}
List<Predicate> lstPredicate = new ArrayList<>();
// set order by
if (searchParams != null) {
Class cls = searchParams.getClass();
Method[] methodList = cls.getMethods();
for (Method m : methodList) {
// only getters (public, starts with get, no arguments)
String mName = m.getName();
if (Modifier.isPublic(m.getModifiers()) && m.getParameterCount() == 0
&& !m.getReturnType().equals(Void.TYPE)
&& (mName.startsWith("get") || mName.startsWith("is"))) {
String fieldName = mName.substring(mName.startsWith("get") ? 3 : 2);
// get returm parameter
Object searchValue;
try {
searchValue = m.invoke(searchParams, new Object[]{});
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
// LOG.error(l, ex);
continue;
}
if (searchValue == null) {
continue;
}
if (fieldName.endsWith("List") && searchValue instanceof List) {
String property = fieldName.substring(0, fieldName.lastIndexOf(
"List"));
if (!((List) searchValue).isEmpty()) {
lstPredicate.add(om.get(property).in(
((List) searchValue).toArray()));
} else {
lstPredicate.add(om.get(property).isNull());
}
} else {
try {
cls.getMethod("set" + fieldName, new Class[]{m.getReturnType()});
} catch (NoSuchMethodException | SecurityException ex) {
// method does not have setter // ignore other methods
continue;
}
if (fieldName.endsWith("From") && searchValue instanceof Comparable) {
lstPredicate.add(cb.greaterThanOrEqualTo(
om.get(fieldName.substring(0, fieldName.
lastIndexOf("From"))),
(Comparable) searchValue));
} else if (fieldName.endsWith("To") && searchValue instanceof Comparable) {
lstPredicate.add(cb.lessThan(
om.
get(fieldName.substring(0, fieldName.lastIndexOf(
"To"))),
(Comparable) searchValue));
} else if (searchValue instanceof String) {
if (!((String) searchValue).isEmpty()) {
lstPredicate.add(cb.equal(om.get(fieldName), searchValue));
}
} else if (searchValue instanceof BigInteger) {
lstPredicate.add(cb.equal(om.get(fieldName), searchValue));
} else {
LOG.warn("Unknown search value type %s for method %s! "
+ "Parameter is ignored!",
searchValue, fieldName);
}
}
}
}
if (!lstPredicate.isEmpty()) {
Predicate[] tblPredicate = lstPredicate.stream().toArray(
Predicate[]::new);
cq.where(cb.and(tblPredicate));
}
}
return cq;
}
public <T> List<T> getDataList(Class<T> type, String hql,
Map<String, Object> params) {
TypedQuery<T> q = memEManager.createQuery(hql, type);
params.forEach((param, value) -> {
q.setParameter(param, value);
});
return q.getResultList();
}
/**
*
* @param <T>
* @param type
* @param startingAt
* @param maxResultCnt
* @param sortField
* @param sortOrder
* @param filters
* @return
*/
public <T> List<T> getDataList(Class<T> type, int startingAt, int maxResultCnt,
String sortField,
String sortOrder, Object filters) {
return getDataList(type, startingAt, maxResultCnt, sortField, sortOrder,
filters, null);
}
/**
*
* @param <T>
* @param resultType
* @param startingAt
* @param maxResultCnt
* @param sortField
* @param sortOrder
* @param filters
* @param filterType
* @return
*/
public <T, D> List<T> getDataList(Class<T> resultType, int startingAt,
int maxResultCnt,
String sortField,
String sortOrder, Object filters, Class<D> filterType) {
List<T> lstResult;
try {
CriteriaQuery<T> cq = createSearchCriteria(resultType, filters, filterType,
false, sortField,
sortOrder);
TypedQuery<T> q = memEManager.createQuery(cq);
if (maxResultCnt > 0) {
q.setMaxResults(maxResultCnt);
}
if (startingAt > 0) {
q.setFirstResult(startingAt);
}
lstResult = q.getResultList();
} catch (NoResultException ex) {
lstResult = new ArrayList<>();
}
return lstResult;
}
/**
*
* @param <T>
* @param type
* @param filters
* @return
*/
public <T> long getDataListCount(Class<T> type, Object filters) {
CriteriaQuery<Long> cqCount = createSearchCriteria(type, filters, null, true,
null,
null);
Long res = memEManager.createQuery(cqCount).getSingleResult();
return res;
}
public <T> void persist(T entity){
memEManager.persist(entity);
}
public <T> void update(T entity){
memEManager.merge(entity);
}
public <T> void remove(T entity){
memEManager.remove(entity);
}
}
package eu.europa.ec.edelivery.smp.data.ui;
import javax.persistence.*;
import java.io.Serializable;
import static eu.europa.ec.edelivery.smp.data.model.CommonColumnsLengths.MAX_IDENTIFIER_VALUE_LENGTH;
import static eu.europa.ec.edelivery.smp.data.model.CommonColumnsLengths.MAX_USERNAME_LENGTH;
/**
* @author Joze Rihtarsic
* @since 4.1
*/
@Entity
@Table(name = "smp_domain")
public class DomainRO implements Serializable {
@Id
@Column(name = "domainId")
private String domainId;
@Column(name = "bdmslClientCertHeader")
private String bdmslClientCertHeader;
@Column(name = "bdmslClientCertAlias")
private String bdmslClientCertAlias;
@Column(name = "bdmslSmpId")
private String bdmslSmpId;
@Column(name = "signatureCertAlias")
private String signatureCertAlias;
public DomainRO(){
}
public DomainRO(String domainId, String bdmslClientCertHeader, String bdmslClientCertAlias, String bdmslSmpId, String signatureCertAlias) {
this.domainId = domainId;
this.bdmslClientCertHeader = bdmslClientCertHeader;
this.bdmslClientCertAlias = bdmslClientCertAlias;
this.bdmslSmpId = bdmslSmpId;
this.signatureCertAlias = signatureCertAlias;
}
public String getDomainId() {
return domainId;
}
public void setDomainId(String domainId) {
this.domainId = domainId;
}
public String getBdmslClientCertHeader() {
return bdmslClientCertHeader;
}
public void setBdmslClientCertHeader(String bdmslClientCertHeader) {
this.bdmslClientCertHeader = bdmslClientCertHeader;
}
public String getBdmslClientCertAlias() {
return bdmslClientCertAlias;
}
public void setBdmslClientCertAlias(String bdmslClientCertAlias) {
this.bdmslClientCertAlias = bdmslClientCertAlias;
}
public String getBdmslSmpId() {
return bdmslSmpId;
}
public void setBdmslSmpId(String bdmslSmpId) {
this.bdmslSmpId = bdmslSmpId;
}
public String getSignatureCertAlias() {
return signatureCertAlias;
}
public void setSignatureCertAlias(String signatureCertAlias) {
this.signatureCertAlias = signatureCertAlias;
}
}
package eu.europa.ec.edelivery.smp.data.ui;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author Joze Rihtarsic
* @since 4.1
*/
@Entity
@Table(name = "smp_service_group")
public class ServiceGroupRO implements Serializable {
@EmbeddedId
ServiceGroupROId serviceGroupROId;
@Column(name = "domainId")
private String domain;
public ServiceGroupROId getServiceGroupROId() {
return serviceGroupROId;
}
public void setServiceGroupROId(ServiceGroupROId serviceGroupROId) {
this.serviceGroupROId = serviceGroupROId;
}
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
@Embeddable
@ToString
@EqualsAndHashCode
public static class ServiceGroupROId implements Serializable {
@Column(name = "businessIdentifier")
private String participantId;
@Column(name = "businessIdentifierScheme")
private String participantSchema;
public ServiceGroupROId(){
}
public ServiceGroupROId(String participantId, String participantSchema) {
this.participantId = participantId;
this.participantSchema = participantSchema;
}
public String getParticipantId() {
return participantId;
}
public void setParticipantId(String participantId) {
this.participantId = participantId;
}
public String getParticipantSchema() {
return participantSchema;
}
public void setParticipantSchema(String participanSchema) {
this.participantSchema = participanSchema;
}
}
}
package eu.europa.ec.edelivery.smp.data.ui;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author Joze Rihtarsic
* @since 4.1
*/
@Entity
@Table(name = "smp_service_metadata")
public class ServiceMetadataRO implements Serializable {
@EmbeddedId
ServiceMetadataROId serviceMetadataROId;
public ServiceMetadataROId getServiceMetadataROId() {
return serviceMetadataROId;
}
public void setServiceMetadataROId(ServiceMetadataROId serviceMetadataROId) {
this.serviceMetadataROId = serviceMetadataROId;
}
@Embeddable
@ToString
@EqualsAndHashCode
public static class ServiceMetadataROId implements Serializable {
@Column(name = "businessIdentifier")
private String participantId;
@Column(name = "businessIdentifierScheme")
private String participantSchema;
@Column(name = "documentIdentifierScheme")
private String documentIdScheme;
@Column(name = "documentIdentifier")
private String documentIdValue;
public ServiceMetadataROId() {
}
public ServiceMetadataROId(String participantId, String participantSchema, String documentIdScheme, String documentIdValue) {
this.participantId = participantId;
this.participantSchema = participantSchema;
this.documentIdScheme = documentIdScheme;
this.documentIdValue = documentIdValue;
}
public String getParticipantId() {
return participantId;
}
public void setParticipantId(String participantId) {
this.participantId = participantId;
}
public String getParticipantSchema() {
return participantSchema;
}
public void setParticipantSchema(String participantSchema) {
this.participantSchema = participantSchema;
}
public String getDocumentIdScheme() {
return documentIdScheme;
}
public void setDocumentIdScheme(String documentIdScheme) {
this.documentIdScheme = documentIdScheme;
}
public String getDocumentIdValue() {
return documentIdValue;
}
public void setDocumentIdValue(String documentIdValue) {
this.documentIdValue = documentIdValue;
}
}
}
package eu.europa.ec.edelivery.smp.data.ui;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author Joze Rihtarsic
* @since 4.1
*/
public class ServiceResult<T> implements Serializable {
private Map<String, Object> filter; //NOSONAR
private List<T> serviceEntities;
private Long count;
private Integer page;
private Integer pageSize;
public Map<String, Object> getFilter() {
return filter;
}
public void setFilter(Map<String, Object> filter) {
this.filter = filter;
}
public List<T> getServiceEntities() {
if (serviceEntities == null) {
serviceEntities = new ArrayList<T>();
}
return serviceEntities;
}
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public Integer getPage() {
return page;
}
public void setPage(Integer page) {
this.page = page;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
}
package eu.europa.ec.edelivery.smp.data.ui;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.persistence.*;
import java.io.Serializable;
import static eu.europa.ec.edelivery.smp.data.model.CommonColumnsLengths.MAX_USERNAME_LENGTH;
/**
* @author Joze Rihtarsic
* @since 4.1
*/
@Entity
@Table(name = "smp_user")
public class UserRO implements Serializable {
@Id
@Column(name = "username")
private String username;
@Column(name = "password")
private String password;
@Column(name = "isadmin")
private boolean isAdmin;
public UserRO(){
}
public UserRO(String username, String password, boolean isAdmin) {
this.username = username;
this.password = password;
this.isAdmin = isAdmin;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public boolean isAdmin() {
return isAdmin;
}
public void setAdmin(boolean admin) {
isAdmin = admin;
}
}
package eu.europa.ec.edelivery.smp.services;
import eu.europa.ec.edelivery.smp.data.dao.ui.UiDaoService;
import eu.europa.ec.edelivery.smp.data.ui.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ServiceUIData {
@Autowired
private UiDaoService uiDaoService;
/**
*
* @param page
* @param pageSize
* @param sortField
* @param sortOrder
* @return
*/
public ServiceResult<ServiceGroupRO> getServiceGroupList(int page, int pageSize,
String sortField,
String sortOrder) {
ServiceResult<ServiceGroupRO> sg = new ServiceResult<>();
sg.setPage(page);
sg.setPageSize(pageSize);
long iCnt = uiDaoService.getDataListCount(ServiceGroupRO.class, null);
sg.setCount(iCnt);
if (iCnt > 0) {
List<ServiceGroupRO> lst = uiDaoService.getDataList(ServiceGroupRO.class, page * pageSize, pageSize, sortField, sortOrder, null);
sg.getServiceEntities().addAll(lst);
}
return sg;
}
/**
*
* @param page
* @param pageSize
* @param sortField
* @param sortOrder
* @return
*/
public ServiceResult<UserRO> getUserList(int page, int pageSize,
String sortField,
String sortOrder) {
ServiceResult<UserRO> sg = new ServiceResult<>();
sg.setPage(page);
sg.setPageSize(pageSize);
long iCnt = uiDaoService.getDataListCount(UserRO.class, null);
sg.setCount(iCnt);
if (iCnt > 0) {
List<UserRO> lst = uiDaoService.getDataList(UserRO.class, page * pageSize, pageSize, sortField, sortOrder, null);
sg.getServiceEntities().addAll(lst);
}
return sg;
}
/**
*
* @param page
* @param pageSize
* @param sortField
* @param sortOrder
* @return
*/
public ServiceResult<DomainRO> getDomainList(int page, int pageSize,
String sortField,
String sortOrder) {
ServiceResult<DomainRO> sg = new ServiceResult<>();
sg.setPage(page);
sg.setPageSize(pageSize);
long iCnt = uiDaoService.getDataListCount(DomainRO.class, null);
sg.setCount(iCnt);
if (iCnt > 0) {
List<DomainRO> lst = uiDaoService.getDataList(DomainRO.class, page * pageSize, pageSize, sortField, sortOrder, null);
sg.getServiceEntities().addAll(lst);
}
return sg;
}
public ServiceResult<ServiceMetadataRO> getServiceMetadataList(int page, int pageSize,
String sortField,
String sortOrder) {
ServiceResult<ServiceMetadataRO> sg = new ServiceResult<>();
sg.setPage(page);
sg.setPageSize(pageSize);
long iCnt = uiDaoService.getDataListCount(DomainRO.class, null);
sg.setCount(iCnt);
if (iCnt > 0) {
List<ServiceMetadataRO> lst = uiDaoService.getDataList(ServiceMetadataRO.class, page * pageSize, pageSize, sortField, sortOrder, null);
sg.getServiceEntities().addAll(lst);
}
return sg;
}
}
......@@ -36,6 +36,11 @@
<artifactId>smp-server-library</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>eu.europa.ec.edelivery</groupId>
<artifactId>smp-angular</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
......
......@@ -67,7 +67,7 @@ public class DatabaseConfig {
LocalContainerEntityManagerFactoryBean lef = new LocalContainerEntityManagerFactoryBean();
lef.setDataSource(dataSource());
lef.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
lef.setPackagesToScan("eu.europa.ec.edelivery.smp.data.model");
lef.setPackagesToScan("eu.europa.ec.edelivery.smp.data.model", "eu.europa.ec.edelivery.smp.data.ui");
lef.setJpaProperties(prop);
//lef.setPersistenceXmlLocation("classpath:META-INF/smp-persistence.xml");
return lef;
......
......@@ -19,6 +19,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.servlet.config.annotation.*;
import static org.springframework.core.Ordered.HIGHEST_PRECEDENCE;
/**
......@@ -28,7 +29,8 @@ import static org.springframework.core.Ordered.HIGHEST_PRECEDENCE;
@EnableWebMvc
@ComponentScan(basePackages = {
"eu.europa.ec.edelivery.smp.controllers",
"eu.europa.ec.edelivery.smp.validation"})
"eu.europa.ec.edelivery.smp.validation",
"eu.europa.ec.edelivery.smp.ui"})
@Import({GlobalMethodSecurityConfig.class, ErrorMappingControllerAdvice.class})
public class SmpWebAppConfig implements WebMvcConfigurer {
......@@ -51,5 +53,4 @@ public class SmpWebAppConfig implements WebMvcConfigurer {
//Default value (true) would break @PathVariable Identifiers containing dot character "."
configurer.setUseSuffixPatternMatch(false);
}
}
package eu.europa.ec.edelivery.smp.ui;
import eu.europa.ec.edelivery.smp.data.ui.DomainRO;
import eu.europa.ec.edelivery.smp.data.ui.ServiceResult;
import eu.europa.ec.edelivery.smp.services.ServiceUIData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
/**
* @author Joze Rihtarsic
* @since 4.1
*/
@RestController
@RequestMapping(value = "/ui/domain")
public class DomainResource {
private static final Logger LOGGER = LoggerFactory.getLogger(UserResource.class);
@Autowired
private ServiceUIData serviceUIData;
@PostConstruct
protected void init() {
}
@PutMapping(produces = {"application/json"})
@ResponseBody
@RequestMapping(method = RequestMethod.GET)
public ServiceResult<DomainRO> getServiceGroupList(
@RequestParam(value = "page", defaultValue = "0") int page,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "orderBy", required = false) String orderBy,
@RequestParam(value = "orderType", defaultValue = "asc", required = false) String orderType,
@RequestParam(value = "user", required = false) String user
) {
return serviceUIData.getDomainList(page,pageSize, orderBy, orderType );
}
}
package eu.europa.ec.edelivery.smp.ui;
import eu.europa.ec.edelivery.smp.data.ui.ServiceGroupRO;
import eu.europa.ec.edelivery.smp.data.ui.ServiceResult;
import eu.europa.ec.edelivery.smp.services.ServiceUIData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
/**
* @author Joze Rihtarsic
* @since 4.1
*/
@RestController
@RequestMapping(value = "/ui/servicegroup")
public class ServiceGroupResource {
private static final Logger LOGGER = LoggerFactory.getLogger(ServiceGroupResource.class);
@Autowired
private ServiceUIData serviceUIData;
@PostConstruct
protected void init() {
}
@PutMapping(produces = {"application/json"})
@ResponseBody
@RequestMapping(method = RequestMethod.GET)
public ServiceResult<ServiceGroupRO> getServiceGroupList(
@RequestParam(value = "page", defaultValue = "0") int page,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "orderBy", required = false) String orderBy,
@RequestParam(value = "orderType", defaultValue = "asc", required = false) String orderType,
@RequestParam(value = "participantId", required = false) String participantId,
@RequestParam(value = "participantSchema", required = false) String participantSchema,
@RequestParam(value = "domain", required = false) String domainwe
) {
return serviceUIData.getServiceGroupList(page,pageSize, orderBy, orderType );
}
}
package eu.europa.ec.edelivery.smp.ui;
import eu.europa.ec.edelivery.smp.data.ui.ServiceMetadataRO;
import eu.europa.ec.edelivery.smp.data.ui.ServiceResult;
import eu.europa.ec.edelivery.smp.services.ServiceUIData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
/**
* @author Joze Rihtarsic
* @since 4.1
*/
@RestController
@RequestMapping(value = "/ui/servicemetadata")
public class ServiceMetadataResource {
private static final Logger LOGGER = LoggerFactory.getLogger(ServiceMetadataResource.class);
@Autowired
private ServiceUIData serviceUIData;
@PostConstruct
protected void init() {
}
@PutMapping(produces = {"application/json"})
@ResponseBody
@RequestMapping(method = RequestMethod.GET)
public ServiceResult<ServiceMetadataRO> getServiceMetadataList(
@RequestParam(value = "page", defaultValue = "0") int page,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "orderBy", required = false) String orderBy,
@RequestParam(value = "orderType", defaultValue = "asc", required = false) String orderType,
@RequestParam(value = "participantId", required = false) String participantId,
@RequestParam(value = "participantSchema", required = false) String participantSchema
) {
return serviceUIData.getServiceMetadataList(page,pageSize, orderBy, orderType );
}
}
package eu.europa.ec.edelivery.smp.ui;
import eu.europa.ec.edelivery.smp.data.ui.ServiceResult;
import eu.europa.ec.edelivery.smp.data.ui.UserRO;
import eu.europa.ec.edelivery.smp.services.ServiceUIData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
/**
* @author Joze Rihtarsic
* @since 4.1
*/
@RestController
@RequestMapping(value = "/ui/user")
public class UserResource {
private static final Logger LOGGER = LoggerFactory.getLogger(UserResource.class);
@Autowired
private ServiceUIData serviceUIData;
@PostConstruct
protected void init() {
}
@PutMapping(produces = {"application/json"})
@ResponseBody
@RequestMapping(method = RequestMethod.GET)
public ServiceResult<UserRO> getUserist(
@RequestParam(value = "page", defaultValue = "0") int page,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "orderBy", required = false) String orderBy,
@RequestParam(value = "orderType", defaultValue = "asc", required = false) String orderType,
@RequestParam(value = "user", required = false) String user
) {
return serviceUIData.getUserList(page,pageSize, orderBy, orderType );
}
}
......@@ -20,7 +20,7 @@
<b:bean id="securityExceptionHandler" class="eu.europa.ec.edelivery.smp.error.SpringSecurityExceptionHandler"/>
<http>
<http >
<csrf disabled="true"/>
<http-basic entry-point-ref="securityExceptionHandler"/>
<anonymous granted-authority="ROLE_ANONYMOUS"/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment