Compare commits

...

11 Commits

156 changed files with 663 additions and 2065 deletions

View File

@ -11,7 +11,6 @@ import eu.eudat.types.grant.GrantStateType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import schemasMicrosoftComOfficeOffice.LeftDocument;
import javax.persistence.criteria.JoinType;
import java.util.Date;

View File

@ -10,7 +10,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.2</version>
<version>2.6.3</version>
</parent>
<modules>
@ -27,41 +27,34 @@
<java.version>1.8</java.version>
<dmp-backend-commons.version>0.0.1-SNAPSHOT</dmp-backend-commons.version>
<org.springframework.version>5.3.8</org.springframework.version>
<org.springframework.version>5.3.14</org.springframework.version>
<!-- <org.springframeweu.eudat.logic.securityrity.version>3.2.10.RELEASE</org.springframeweu.eudat.logic.securityrity.version> -->
<org.springframework.security.version>5.3.10.RELEASE</org.springframework.security.version>
<!--<com.sun.jersey.version>1.19.1</com.sun.jersey.version>-->
<!--
<org.apache.tomcat.tomcat-jdbc.version>7.0.35</org.apache.tomcat.tomcat-jdbc.version>
-->
<!--<com.fasterxml.jackson>2.9.0</com.fasterxml.jackson>-->
<com.fasterxml.jackson.version>2.13.1</com.fasterxml.jackson.version>
<hibernate.version>5.5.3.Final</hibernate.version>
<hibernate.version>5.6.3.Final</hibernate.version>
<commons-codec.version>1.9</commons-codec.version>
<org.junit.version>4.11</org.junit.version>
<log4j.version>1.2.17</log4j.version>
<log4j2.version>2.15.0</log4j2.version>
<log4j2.version>2.17.0</log4j2.version>
<slf4j.version>1.7.12</slf4j.version>
<!--<jetty.version>11.0.5
</jetty.version>--> <!-- Adapt this to a version found on http://repo.maven.apache.org/maven2/org/eclipse/jetty/jetty-maven-plugin/ -->
<logback.version>1.2.3</logback.version>
<logback.version>1.2.10</logback.version>
<!-- <javax.inject.version>1</javax.inject.version>-->
<!--<javax.servlet.servlet-api.version>3.0.1</javax.servlet.servlet-api.version>-->
<org.apache.poi.version>5.0.0</org.apache.poi.version>
<xml.version>3.0.1</xml.version>
<elasticsearch.version>7.7.0</elasticsearch.version>
</properties>
<dependencies>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160810</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
@ -71,122 +64,70 @@
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>7.7.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore-nio</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.12</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore-nio</artifactId>
<version>4.4.13</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.13</version>
<version>${elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.6.0</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>${hibernate.version}</version>
<version>${elasticsearch.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.api-client/google-api-client -->
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.23.0</version>
<version>1.33.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.jayway.jsonpath/json-path -->
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>2.4.0</version>
<version>2.6.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-xml -->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.12.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackeu.eudat.corecore/jackeu.eudat.corecore -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.12.3</version>
<version>${com.fasterxml.jackson.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackeu.eudat.corecore/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.3</version>
<version>${com.fasterxml.jackson.version}</version>
</dependency>
<!-- g/a spring -->
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackeu.eudat.corecore/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${com.fasterxml.jackson.version}</version>
</dependency>
<!-- Various libs -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.0.0</version>
<version>${org.apache.poi.version}</version>
</dependency>
<!--<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-full</artifactId>
<version>${org.apache.poi.version}</version>
</dependency>-->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.xmlgraphics/fop -->
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop</artifactId>
<version>2.3</version>
<version>${org.apache.poi.version}</version>
</dependency>
<dependency>
@ -194,75 +135,37 @@
<artifactId>jsoup</artifactId>
<version>1.14.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.pdf -->
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>org.apache.poi.xwpf.converter.pdf</artifactId>
<version>1.0.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/fr.opensagres.xdocreport/org.apache.poi.xwpf.convereu.eudat.corecore -->
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>org.apache.poi.xwpf.converter.core</artifactId>
<version>1.0.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/fr.opensagres.xdocreport/fr.opensagres.xdocreport.itext.extension -->
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.itext.extension</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.1</version>
</dependency>
<!--<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
</dependency>-->
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>7.6.0</version>
<version>${elasticsearch.version}</version>
</dependency>
<!--<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
<version>2.8.2</version>
</dependency>-->
<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>${xml.version}</version>
</dependency>
<dependency>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
<version>2.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-core -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
<version>${xml.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-runtime -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api -->
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.1</version>
<version>${xml.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
@ -272,37 +175,11 @@
<version>2.0.1.Final</version>
</dependency>
<!-- The client -->
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient</artifactId>
<version>0.11.0</version>
</dependency>
<!-- Hotspot JVM metrics-->
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_hotspot</artifactId>
<version>0.11.0</version>
</dependency>
<!-- Exposition HTTPServer-->
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_httpserver</artifactId>
<version>0.11.0</version>
</dependency>
<!-- Pushgateway exposition-->
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_pushgateway</artifactId>
<version>0.11.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.micrometer/micrometer-registry-prometheus -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.7.1</version>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@ -43,35 +43,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.12.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
<!--<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.3.8</version>
</dependency>-->
<!-- guava eu.eudat.cache -->
<!-- <dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.1.1-jre</version>
</dependency>-->
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context-support -->
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>2.9.0</version>
<version>2.9.3</version>
</dependency>
@ -80,14 +56,14 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.7.2</version>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.22</version>
<version>42.3.1</version>
</dependency>
<dependency>
@ -116,21 +92,11 @@
<artifactId>spring-social-twitter</artifactId>
<version>1.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<resources>
<resource>
<directory>src/main/ui-resources</directory>
<excludes>
<exclude>node_modules/**</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>

View File

@ -7,7 +7,6 @@ import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.*;
import org.springframework.core.env.Environment;
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
@ -67,7 +66,7 @@ public class DevelDatabaseConfiguration {
private Properties additionalProperties() {
Properties properties = new Properties();
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQL92Dialect");
properties.setProperty("hibernate.show_sql", "true");
properties.setProperty("hibernate.show_sql", "false");
properties.setProperty("hibernate.temp.use_jdbc_metadata_defaults", "false");
return properties;
}

View File

@ -1,30 +0,0 @@
package eu.eudat.configurations;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.module.SimpleModule;
import eu.eudat.criteria.entities.Criteria;
import eu.eudat.criteria.serialzier.CriteriaSerializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
@Configuration
public class JacksonConfiguration {
@Bean
public ObjectMapper buildObjectMapper() {
ArrayList<Module> modules = new ArrayList<>();
SimpleModule criteriaSerializerModule = new SimpleModule();
criteriaSerializerModule.addDeserializer(Criteria.class, new CriteriaSerializer());
modules.add(criteriaSerializerModule);
return new ObjectMapper()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.registerModules(modules);
}
}

View File

@ -10,8 +10,8 @@ import org.springframework.context.annotation.Profile;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.Unmarshaller;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

View File

@ -10,8 +10,8 @@ import org.springframework.context.annotation.Profile;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.Unmarshaller;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

View File

@ -1,8 +1,8 @@
package eu.eudat.configurations.dynamicfunder.entities;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.List;
@XmlRootElement

View File

@ -1,6 +1,6 @@
package eu.eudat.configurations.dynamicfunder.entities;
import javax.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElement;
public class Dependency {
private String id;

View File

@ -1,6 +1,6 @@
package eu.eudat.configurations.dynamicfunder.entities;
import javax.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElement;
public class Language {
private String key;

View File

@ -2,8 +2,8 @@ package eu.eudat.configurations.dynamicfunder.entities;
import eu.eudat.logic.proxy.config.UrlConfiguration;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
public class MainProperty {

View File

@ -1,8 +1,8 @@
package eu.eudat.configurations.dynamicfunder.entities;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
public class Property {

View File

@ -11,8 +11,8 @@ import org.springframework.context.annotation.Profile;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.Unmarshaller;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

View File

@ -11,8 +11,8 @@ import org.springframework.context.annotation.Profile;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.Unmarshaller;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

View File

@ -1,8 +1,8 @@
package eu.eudat.configurations.dynamicgrant.entities;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.List;
/**

View File

@ -1,6 +1,6 @@
package eu.eudat.configurations.dynamicgrant.entities;
import javax.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElement;
/**
* Created by ikalyvas on 3/23/2018.

View File

@ -1,6 +1,6 @@
package eu.eudat.configurations.dynamicgrant.entities;
import javax.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElement;
/**
* Created by ikalyvas on 3/28/2018.

View File

@ -2,8 +2,8 @@ package eu.eudat.configurations.dynamicgrant.entities;
import eu.eudat.logic.proxy.config.UrlConfiguration;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
/**

View File

@ -1,7 +1,7 @@
package eu.eudat.configurations.dynamicgrant.entities;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
/**

View File

@ -11,8 +11,8 @@ import org.springframework.context.annotation.Profile;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.Unmarshaller;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

View File

@ -11,8 +11,8 @@ import org.springframework.context.annotation.Profile;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.Unmarshaller;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

View File

@ -1,9 +1,9 @@
package eu.eudat.configurations.dynamicproject.entities;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.List;
@XmlRootElement

View File

@ -1,6 +1,6 @@
package eu.eudat.configurations.dynamicproject.entities;
import javax.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElement;
public class Dependency {
private String id;

View File

@ -1,6 +1,6 @@
package eu.eudat.configurations.dynamicproject.entities;
import javax.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElement;
public class Language {
private String key;

View File

@ -2,8 +2,8 @@ package eu.eudat.configurations.dynamicproject.entities;
import eu.eudat.logic.proxy.config.UrlConfiguration;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
public class MainProperty {

View File

@ -1,8 +1,8 @@
package eu.eudat.configurations.dynamicproject.entities;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
public class Property {

View File

@ -9,9 +9,7 @@ import eu.eudat.models.data.components.commons.datafield.AutoCompleteData;
import eu.eudat.models.data.externaldataset.ExternalAutocompleteFieldModel;
import eu.eudat.models.data.helpers.common.AutoCompleteLookupItem;
import eu.eudat.models.data.helpers.responses.ResponseItem;
import eu.eudat.models.data.properties.PropertiesModel;
import eu.eudat.models.data.security.Principal;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -19,9 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.xml.xpath.XPathExpressionException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import static eu.eudat.types.Authorities.ADMIN;

View File

@ -14,7 +14,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBException;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
@ -52,7 +52,6 @@ public class UserInvitationController extends BaseController {
public @ResponseBody
// ResponseEntity<ResponseItem<List<UserInfoInvitationModel>>> getUsers(Principal principal) throws IllegalAccessException, InstantiationException {
ResponseEntity<ResponseItem<List<UserInfoInvitationModel>>> getUsers(Principal principal, @RequestBody UserInfoRequestItem userInfoRequestItem) throws IllegalAccessException, InstantiationException {
System.out.println(userInfoRequestItem.getCriteria().getLike());
// List<UserInfoInvitationModel> users = invitationsManager.getUsers(principal);
List<UserInfoInvitationModel> users = invitationsManager.getUsersWithCriteria(principal, userInfoRequestItem);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<UserInfoInvitationModel>>().status(ApiMessageCode.SUCCESS_MESSAGE).payload(users));

View File

@ -1,7 +1,6 @@
package eu.eudat.logic.managers;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.configurations.dynamicgrant.DynamicGrantConfiguration;
import eu.eudat.configurations.dynamicgrant.entities.Property;
@ -61,10 +60,12 @@ import eu.eudat.models.data.userinfo.UserListingModel;
import eu.eudat.queryable.QueryableList;
import eu.eudat.types.Authorities;
import eu.eudat.types.MetricNames;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Unmarshaller;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -80,9 +81,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import javax.transaction.Transactional;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import java.io.*;
import java.math.BigInteger;
import java.nio.file.Files;
@ -299,15 +297,21 @@ public class DataManagementPlanManager {
.filter(dataset -> !dataset.getStatus().equals(Dataset.Status.DELETED) && !dataset.getStatus().equals(Dataset.Status.CANCELED))
.forEach(dataset -> {
dataManagementPlan.getDatasets().stream().filter(datasetWizardModel -> datasetWizardModel.getId().equals(dataset.getId())).forEach(datasetWizardModel -> {
DatasetWizardModel wizardModel = datasetManager.getSingle(datasetWizardModel.getId().toString(), principal);
DatasetWizardModel wizardModel;
try {
wizardModel = datasetManager.getSingle(datasetWizardModel.getId().toString(), principal);
datasetWizardModel.setDatasetProfileDefinition(wizardModel.getDatasetProfileDefinition());
datasetWizardModel.setTags(wizardModel.getTags());
} catch (JsonProcessingException e) {
logger.error(e.getLocalizedMessage(), e);
}
});
});
if (isPublic) {
dataManagementPlan.setDatasets(dataManagementPlan.getDatasets().stream().filter(dataset -> dataset.getStatus() == Dataset.Status.FINALISED.getValue()).collect(Collectors.toList()));
}
Map dmpProperties = dataManagementPlanEntity.getDmpProperties() != null ? new org.json.JSONObject(dataManagementPlanEntity.getDmpProperties()).toMap() : null;
Map dmpProperties = dataManagementPlanEntity.getDmpProperties() != null ? apiContext.getObjectMapper().readValue(dataManagementPlanEntity.getDmpProperties(), HashMap.class) : null;
if (dmpProperties != null && dataManagementPlan.getDynamicFields() != null)
dataManagementPlan.getDynamicFields().forEach(item -> {
@ -1305,10 +1309,11 @@ public class DataManagementPlanManager {
datasetDescriptionRun.setBold(true);
datasetDescriptionRun.setFontSize(12);
PagedDatasetProfile pagedDatasetProfile = datasetManager.getPagedProfile(dataset, datasetEntity);
PagedDatasetProfile pagedDatasetProfile = null;
try {
pagedDatasetProfile = datasetManager.getPagedProfile(dataset, datasetEntity);
visibilityRuleService.setProperties(properties);
visibilityRuleService.buildVisibilityContext(pagedDatasetProfile.getRules());
try {
wordBuilder.build(document, pagedDatasetProfile, visibilityRuleService);
} catch (IOException e) {
logger.error(e.getMessage(), e);
@ -1456,8 +1461,7 @@ public class DataManagementPlanManager {
DatasetWizardModel datasetWizardModel = new DatasetWizardModel();
Map<String, Object> properties = new HashMap<>();
if (dataset.getProperties() != null) {
JSONObject jobject = new JSONObject(dataset.getProperties());
properties = jobject.toMap();
properties = apiContext.getObjectMapper().readValue(dataset.getProperties(), HashMap.class);
}
PagedDatasetProfile pagedDatasetProfile = datasetManager.getPagedProfile(datasetWizardModel, dataset);
visibilityRuleService.setProperties(properties);
@ -2017,7 +2021,7 @@ public class DataManagementPlanManager {
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
headers.setContentType(MediaType.APPLICATION_JSON);
String createData = null;
Map<String, Object> extraProperties = dmp.getExtraProperties() != null ? new org.json.JSONObject(dmp.getExtraProperties()).toMap() : new HashMap<>();
Map<String, Object> extraProperties = dmp.getExtraProperties() != null ? apiContext.getObjectMapper().readValue(dmp.getExtraProperties(), HashMap.class) : new HashMap<>();
StringBuilder dataBuilder = new StringBuilder();
dataBuilder.append("{\n \"metadata\": {\n");
dataBuilder.append( " \"title\": \"").append(dmp.getLabel()).append("\",\n");

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.managers;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.data.dao.criteria.*;
import eu.eudat.data.dao.entities.DataRepositoryDao;
import eu.eudat.data.dao.entities.DatasetDao;
@ -49,22 +49,22 @@ import eu.eudat.models.data.user.composite.PagedDatasetProfile;
import eu.eudat.queryable.QueryableList;
import eu.eudat.types.Authorities;
import eu.eudat.types.MetricNames;
import org.apache.commons.io.IOUtils;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Unmarshaller;
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.*;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@ -75,9 +75,6 @@ import javax.activation.MimetypesFileTypeMap;
import javax.persistence.criteria.Join;
import javax.persistence.criteria.JoinType;
import javax.transaction.Transactional;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
@ -91,8 +88,6 @@ import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@Component
public class DatasetManager {
@ -279,7 +274,7 @@ public class DatasetManager {
return dataTable;
}
public DatasetWizardModel getSingle(String id, Principal principal) {
public DatasetWizardModel getSingle(String id, Principal principal) throws JsonProcessingException {
DatasetWizardModel dataset = new DatasetWizardModel();
eu.eudat.data.entities.Dataset datasetEntity = databaseRepository.getDatasetDao().find(UUID.fromString(id), HintedModelFactory.getHint(DatasetWizardModel.class));
if (datasetEntity.getDmp().getUsers()
@ -380,12 +375,11 @@ public class DatasetManager {
return databaseRepository.getDatasetDao().find(id);
}
public PagedDatasetProfile getPagedProfile(DatasetWizardModel dataset, eu.eudat.data.entities.Dataset datasetEntity) {
public PagedDatasetProfile getPagedProfile(DatasetWizardModel dataset, eu.eudat.data.entities.Dataset datasetEntity) throws JsonProcessingException {
eu.eudat.models.data.user.composite.DatasetProfile datasetprofile = userManager.generateDatasetProfileModel(datasetEntity.getProfile());
datasetprofile.setStatus(dataset.getStatus());
if (datasetEntity.getProperties() != null) {
JSONObject jObject = new JSONObject(datasetEntity.getProperties());
Map<String, Object> properties = jObject.toMap();
Map<String, Object> properties = apiContext.getObjectMapper().readValue(datasetEntity.getProperties(), HashMap.class);
datasetprofile.fromJsonObject(properties);
}
PagedDatasetProfile pagedDatasetProfile = new PagedDatasetProfile();
@ -451,8 +445,7 @@ public class DatasetManager {
Map<String, Object> properties = new HashMap<>();
if (datasetEntity.getProperties() != null) {
JSONObject jObject = new JSONObject(datasetEntity.getProperties());
properties = jObject.toMap();
properties = apiContext.getObjectMapper().readValue(datasetEntity.getProperties(), HashMap.class);
}
wordBuilder.addParagraphContent("Dataset Description", document, ParagraphStyle.HEADER2, BigInteger.ZERO);
@ -484,8 +477,7 @@ public class DatasetManager {
Map<String, Object> properties = new HashMap<>();
if (dataset.getDatasetProfileDefinition() != null) {
JSONObject jObject = new JSONObject(propertiesModelToString(dataset.getDatasetProfileDefinition()));
properties = jObject.toMap();
properties = apiContext.getObjectMapper().readValue(propertiesModelToString(dataset.getDatasetProfileDefinition()), HashMap.class);
}
wordBuilder.addParagraphContent("Dataset Description", document, ParagraphStyle.HEADER2, BigInteger.ZERO);
@ -542,8 +534,7 @@ public class DatasetManager {
throw new UnauthorisedException();
Map<String, Object> properties = new HashMap<>();
if (datasetEntity.getProperties() != null) {
JSONObject jobject = new JSONObject(datasetEntity.getProperties());
properties = jobject.toMap();
properties = apiContext.getObjectMapper().readValue(datasetEntity.getProperties(), HashMap.class);
}
PagedDatasetProfile pagedDatasetProfile = getPagedProfile(dataset, datasetEntity);
visibilityRuleService.setProperties(properties);
@ -656,9 +647,9 @@ public class DatasetManager {
nodeList = (NodeList) xPath.compile(expression).evaluate(xmlDocument, XPathConstants.NODESET);
JSONObject obj = new JSONObject(dataset.getProperties());
Map<String, Object> obj = apiContext.getObjectMapper().readValue(dataset.getProperties(), HashMap.class);
VisibilityRuleService visibilityRuleService = this.apiContext.getUtilitiesService().getVisibilityRuleService();
visibilityRuleService.setProperties(obj.toMap());
visibilityRuleService.setProperties(obj);
dataset.setProfile(profile);
PagedDatasetProfile pagedDatasetProfile = this.getPagedProfile(new DatasetWizardModel(), dataset);
@ -666,7 +657,7 @@ public class DatasetManager {
for (String validator : datasetProfileValidators) {
if ((obj.has(validator) && (obj.getString(validator) == null || obj.getString(validator).trim().isEmpty())) && isElementVisible(nodeList, validator, visibilityRuleService)) {
if ((obj.containsKey(validator) && (obj.get(validator) == null || obj.get(validator).toString().trim().isEmpty())) && isElementVisible(nodeList, validator, visibilityRuleService)) {
throw new Exception("Field value of " + validator + " must be filled.");
}
}
@ -695,11 +686,10 @@ public class DatasetManager {
}
}
private String propertiesModelToString(PagedDatasetProfile pagedDatasetProfile) {
private String propertiesModelToString(PagedDatasetProfile pagedDatasetProfile) throws JsonProcessingException {
Map<String, Object> values = new LinkedHashMap<>();
pagedDatasetProfile.toMap(values);
JSONObject jobject = new JSONObject(values);
return jobject.toString();
return apiContext.getObjectMapper().writeValueAsString(values);
}
public void updateTags(Dataset datasetEntity, List<Tag> tags) throws Exception {
@ -908,12 +898,9 @@ public class DatasetManager {
)))))
.collect(Collectors.toMap(DatasetImportField::getId, DatasetImportField::getValue));
// Transforms map into json file.
JSONObject jsonDatasetProperties = new JSONObject(importMap);
// Creates the entity data set to save.
eu.eudat.data.entities.Dataset entity = new Dataset();
entity.setProperties(jsonDatasetProperties.toString());
entity.setProperties(apiContext.getObjectMapper().writeValueAsString(importMap));
entity.setLabel(importFile.getOriginalFilename());
DMP dmp = new DMP();
dmp.setId(UUID.fromString(dmpId));
@ -942,7 +929,7 @@ public class DatasetManager {
// TODO: When tags functionality return.
}
public DatasetWizardModel datasetUpdateProfile(String id) {
public DatasetWizardModel datasetUpdateProfile(String id) throws JsonProcessingException {
DatasetWizardModel dataset = new DatasetWizardModel();
eu.eudat.data.entities.Dataset datasetEntity = databaseRepository.getDatasetDao().find(UUID.fromString(id), HintedModelFactory.getHint(DatasetWizardModel.class));
eu.eudat.elastic.entities.Dataset datasetElastic;
@ -982,12 +969,11 @@ public class DatasetManager {
return dataset;
}
public PagedDatasetProfile getLatestDatasetProfile(Dataset datasetEntity, DatasetProfile profile) {
public PagedDatasetProfile getLatestDatasetProfile(Dataset datasetEntity, DatasetProfile profile) throws JsonProcessingException {
eu.eudat.models.data.user.composite.DatasetProfile datasetprofile = userManager.generateDatasetProfileModel(profile);
datasetprofile.setStatus(datasetEntity.getStatus());
if (datasetEntity.getProperties() != null) {
JSONObject jobject = new JSONObject(datasetEntity.getProperties());
Map<String, Object> properties = jobject.toMap();
Map<String, Object> properties = apiContext.getObjectMapper().readValue(datasetEntity.getProperties(), HashMap.class);
datasetprofile.fromJsonObject(properties);
}
PagedDatasetProfile pagedDatasetProfile = new PagedDatasetProfile();
@ -1039,9 +1025,8 @@ public class DatasetManager {
public void getTagsFromProfile(DatasetWizardModel wizardModel, Dataset dataset) throws IOException {
dataset.setProfile(apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(dataset.getProfile().getId()));
wizardModel.setDatasetProfileDefinition(this.getPagedProfile(wizardModel, dataset));
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(wizardModel.getDatasetProfileDefinition());
JsonNode propertiesJson = mapper.readTree(json);
String json = apiContext.getObjectMapper().writeValueAsString(wizardModel.getDatasetProfileDefinition());
JsonNode propertiesJson = apiContext.getObjectMapper().readTree(json);
DatasetCriteria criteria = new DatasetCriteria();
criteria.setHasTags(true);
List<Tag> tags = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().query(criteria).stream().map(eu.eudat.elastic.entities.Dataset::getTags).flatMap(Collection::stream).filter(StreamDistinctBy.distinctByKey(Tag::getId)).collect(Collectors.toList());
@ -1053,11 +1038,20 @@ public class DatasetManager {
JsonNode value = node.get("value");
if (!value.toString().equals("\"\"")) {
String stringValue = value.toString().replaceAll("=", ":");
JSONArray values = new JSONArray(stringValue);
List<Map<String, Object>> values = null;
try {
values = apiContext.getObjectMapper().readValue(stringValue, LinkedList.class);
} catch (JsonProcessingException e) {
logger.error(e.getLocalizedMessage(), e);
}
if (values != null) {
values.iterator().forEachRemaining(element -> {
Map<String, Object> data = ((JSONObject) element).toMap();
Map<String, Object> data = element;
this.addTag(tags, wizardModel.getTags(), data.get("id").toString(), data.get("name").toString());
});
} else {
this.addTag(tags, wizardModel.getTags(), "", value.asText());
}
}
});
}

View File

@ -60,9 +60,8 @@ public class ExternalDatasetManager {
List<Map<String, String>> remoteRepos = remoteFetcher.getDatasets(externalUrlCriteria, type);
// Parse items from external sources to listing models.
ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
List<ExternalDatasetListingModel> externalDatasetModels = remoteRepos.stream()
.map(item -> mapper.convertValue(item, ExternalDatasetListingModel.class))
.map(item -> apiContext.getObjectMapper().convertValue(item, ExternalDatasetListingModel.class))
.collect(Collectors.toCollection(LinkedList::new));
// Merge fetched and local.

View File

@ -15,9 +15,9 @@ import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Unmarshaller;
import java.io.IOException;
import java.io.StringReader;
import java.util.*;

View File

@ -40,8 +40,7 @@ public class LicenseManager {
List<LicenseModel> licenseModels = new LinkedList<>();
ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
licenseModels.addAll(remoteRepos.stream().map(item -> mapper.convertValue(item, LicenseModel.class)).collect(Collectors.toList()));
licenseModels.addAll(remoteRepos.stream().map(item -> apiContext.getObjectMapper().convertValue(item, LicenseModel.class)).collect(Collectors.toList()));
licenseModels = licenseModels.stream().filter(licenseModel -> licenseModel.getName().toLowerCase().contains(query.toLowerCase())).collect(Collectors.toList());
return licenseModels;
}

View File

@ -51,7 +51,7 @@ public class NotificationManager {
notification.setNotifiedAt(new Date());
notification.setUpdatedAt(new Date());
try {
Map<String, String> data = new ObjectMapper().readValue(notification.getData(), HashMap.class);
Map<String, String> data = apiContext.getObjectMapper().readValue(notification.getData(), HashMap.class);
UserInfo userInfo = this.apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(UUID.fromString(data.get("userId")));
String subjectTemplate = "";
String contentTemplate = "";

View File

@ -46,8 +46,7 @@ public class ServiceManager {
List<Service> serviceList = (this.apiContext.getOperationsContext().getDatabaseRepository().getServiceDao().getWithCriteria(criteria)).toList();
serviceModels = serviceList.stream().map(item -> new ServiceModel().fromDataModel(item)).collect(Collectors.toList());
}
ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
serviceModels.addAll(remoteRepos.stream().map(item -> mapper.convertValue(item, ServiceModel.class)).collect(Collectors.toList()));
serviceModels.addAll(remoteRepos.stream().map(item -> apiContext.getObjectMapper().convertValue(item, ServiceModel.class)).collect(Collectors.toList()));
return serviceModels;
}

View File

@ -33,7 +33,6 @@ import eu.eudat.models.data.userinfo.UserProfile;
import eu.eudat.queryable.QueryableList;
import eu.eudat.types.Authorities;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -133,7 +132,7 @@ public class UserManager {
userInfo.setName(settings.entrySet().stream().filter(entry -> entry.getKey().equals("name")).filter(Objects::nonNull).map(entry -> entry.getValue().toString()).findFirst().orElse(userInfo.getName()));
settings.remove("name");
result.putAll(settings);
userInfo.setAdditionalinfo(new JSONObject(result).toString());
userInfo.setAdditionalinfo(new ObjectMapper().writeValueAsString(result));
apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao()
.createOrUpdate(userInfo);
}

View File

@ -1,6 +1,6 @@
package eu.eudat.logic.proxy.config;
import javax.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElement;
/**
* Created by ikalyvas on 6/29/2018.

View File

@ -1,6 +1,6 @@
package eu.eudat.logic.proxy.config;
import javax.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElement;
public class DataSearchConfiguration {
private String type;

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.proxy.config;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
/**

View File

@ -4,10 +4,10 @@ package eu.eudat.logic.proxy.config;
import eu.eudat.logic.proxy.config.entities.*;
import eu.eudat.logic.proxy.config.prefilling.PrefillingConfigMapAdapter;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.io.Serializable;
import java.util.Map;

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.proxy.config;
import javax.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElement;
public class UrlConfiguration {

View File

@ -1,9 +1,10 @@
package eu.eudat.logic.proxy.config.configloaders;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.logic.proxy.config.ExternalUrls;
import eu.eudat.logic.security.customproviders.ConfigurableProvider.entities.ConfigurableProviders;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.Unmarshaller;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -15,8 +16,6 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@ -106,7 +105,7 @@ public class DefaultConfigLoader implements ConfigLoader {
InputStream is = null;
try {
is = getStreamFromPath(filePath);
ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
ObjectMapper mapper = new ObjectMapper();
this.configurableProviders = mapper.readValue(is, ConfigurableProviders.class);
} catch (IOException | NullPointerException e) {
logger.error(e.getMessage(), e);

View File

@ -15,8 +15,8 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.Unmarshaller;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

View File

@ -3,8 +3,8 @@ package eu.eudat.logic.proxy.config.entities;
import eu.eudat.logic.proxy.config.FetchStrategy;
import eu.eudat.logic.proxy.config.UrlConfiguration;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.proxy.config.entities;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "mapping")
public class DefaultPrefillingMapping implements PrefillingMapping{

View File

@ -3,8 +3,8 @@ package eu.eudat.logic.proxy.config.entities;
import eu.eudat.logic.proxy.config.FetchStrategy;
import eu.eudat.logic.proxy.config.UrlConfiguration;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
public class FunderUrls extends GenericUrls{

View File

@ -3,8 +3,8 @@ package eu.eudat.logic.proxy.config.entities;
import eu.eudat.logic.proxy.config.FetchStrategy;
import eu.eudat.logic.proxy.config.UrlConfiguration;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;

View File

@ -3,8 +3,8 @@ package eu.eudat.logic.proxy.config.entities;
import eu.eudat.logic.proxy.config.FetchStrategy;
import eu.eudat.logic.proxy.config.UrlConfiguration;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;

View File

@ -3,8 +3,8 @@ package eu.eudat.logic.proxy.config.entities;
import eu.eudat.logic.proxy.config.FetchStrategy;
import eu.eudat.logic.proxy.config.UrlConfiguration;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
public class OrganisationUrls extends GenericUrls{

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.proxy.config.entities;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "config")
public class PrefillingConfig {

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.proxy.config.entities;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "fixedMapping")
public class PrefillingFixedMapping implements PrefillingMapping{

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.proxy.config.entities;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
public class PrefillingGet{
@ -23,7 +23,7 @@ public class PrefillingGet{
}
@XmlElement(name = "mapping")
@XmlElementWrapper
@XmlElementWrapper(name = "mappings")
public void setMappings(List<DefaultPrefillingMapping> mappings) {
this.mappings = mappings;
}
@ -33,7 +33,7 @@ public class PrefillingGet{
}
@XmlElement(name = "fixedMapping")
@XmlElementWrapper
@XmlElementWrapper (name = "fixedMappings")
public void setFixedMappings(List<PrefillingFixedMapping> fixedMappings) {
this.fixedMappings = fixedMappings;
}

View File

@ -1,7 +1,5 @@
package eu.eudat.logic.proxy.config.entities;
import javax.xml.bind.annotation.XmlAttribute;
public interface PrefillingMapping {
String getTarget();

View File

@ -3,7 +3,7 @@ package eu.eudat.logic.proxy.config.entities;
import eu.eudat.logic.proxy.config.FetchStrategy;
import eu.eudat.logic.proxy.config.UrlConfiguration;
import javax.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElement;
import java.util.ArrayList;
import java.util.List;

View File

@ -3,8 +3,8 @@ package eu.eudat.logic.proxy.config.entities;
import eu.eudat.logic.proxy.config.FetchStrategy;
import eu.eudat.logic.proxy.config.UrlConfiguration;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
public class ProjectUrls extends GenericUrls{

View File

@ -3,8 +3,8 @@ package eu.eudat.logic.proxy.config.entities;
import eu.eudat.logic.proxy.config.FetchStrategy;
import eu.eudat.logic.proxy.config.UrlConfiguration;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
public class RegistryUrls extends GenericUrls{

View File

@ -3,8 +3,8 @@ package eu.eudat.logic.proxy.config.entities;
import eu.eudat.logic.proxy.config.FetchStrategy;
import eu.eudat.logic.proxy.config.UrlConfiguration;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
public class RepositoryUrls extends GenericUrls{

View File

@ -3,8 +3,8 @@ package eu.eudat.logic.proxy.config.entities;
import eu.eudat.logic.proxy.config.FetchStrategy;
import eu.eudat.logic.proxy.config.UrlConfiguration;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
public class ResearcherUrls extends GenericUrls{

View File

@ -3,8 +3,8 @@ package eu.eudat.logic.proxy.config.entities;
import eu.eudat.logic.proxy.config.FetchStrategy;
import eu.eudat.logic.proxy.config.UrlConfiguration;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
public class ServiceUrls extends GenericUrls{

View File

@ -3,8 +3,8 @@ package eu.eudat.logic.proxy.config.entities;
import eu.eudat.logic.proxy.config.FetchStrategy;
import eu.eudat.logic.proxy.config.UrlConfiguration;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
/**

View File

@ -2,8 +2,8 @@ package eu.eudat.logic.proxy.config.entities;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import eu.eudat.logic.proxy.config.FetchStrategy;
import eu.eudat.logic.proxy.config.UrlConfiguration;

View File

@ -3,9 +3,9 @@ package eu.eudat.logic.proxy.config.prefilling;
import eu.eudat.logic.proxy.config.entities.PrefillingConfig;
import org.w3c.dom.Element;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.Unmarshaller;
import jakarta.xml.bind.annotation.adapters.XmlAdapter;
import java.util.HashMap;
import java.util.Map;
@ -23,7 +23,6 @@ public class PrefillingConfigMapAdapter extends XmlAdapter<Object, Map<String, P
String id = element.getChildNodes().item(i).getAttributes().getNamedItem("id").getNodeValue();
PrefillingConfig prefillingConfig = (PrefillingConfig) jaxbUnmarshaller.unmarshal(element.getChildNodes().item(i));
prefillingConfig = configMap.put(id, prefillingConfig);
System.out.println(prefillingConfig);
}
return configMap;
}

View File

@ -3,17 +3,25 @@ package eu.eudat.logic.proxy.fetching;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.logic.proxy.fetching.entities.Config;
import eu.eudat.logic.proxy.fetching.entities.ConfigSingle;
import eu.eudat.logic.services.ApiContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.Unmarshaller;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.*;
@Component
public class LocalFetcher {
private final ApiContext apiContext;
@Autowired
public LocalFetcher(ApiContext apiContext) {
this.apiContext = apiContext;
}
@Cacheable("currencies")
public List<Map<String, String>> retrieveCurrency() throws Exception {
@ -45,7 +53,6 @@ public class LocalFetcher {
String camelCaseGetter =configSingle.getParseField() != null && !configSingle.getParseField().isEmpty() ? "get" + configSingle.getParseField().substring(0, 1).toUpperCase() + configSingle.getParseField().substring(1) : "";
reader = aClass.getMethod(camelCaseGetter);
}
ObjectMapper objectMapper = new ObjectMapper();
List<Map<String, String>> values = new ArrayList<>();
int max = 1;
if (reader != null) {
@ -66,7 +73,7 @@ public class LocalFetcher {
} else {
value = object;
}
Map<String, String> map = objectMapper.convertValue(value, Map.class);
Map<String, String> map = apiContext.getObjectMapper().convertValue(value, Map.class);
result.add(new HashMap<>());
result.get(result.size() - 1).put("name", map.get(configSingle.getName()));
result.get(result.size() - 1).put("value", map.get(configSingle.getValue()));

View File

@ -14,6 +14,7 @@ import eu.eudat.logic.proxy.config.entities.GenericUrls;
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
import eu.eudat.logic.proxy.fetching.entities.Results;
import eu.eudat.logic.services.ApiContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -22,8 +23,8 @@ import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.Unmarshaller;
import java.io.File;
import java.io.StringReader;
import java.lang.reflect.Method;
@ -34,8 +35,9 @@ import java.util.stream.Collectors;
@Service
public class RemoteFetcher {
private static final Logger logger = LoggerFactory.getLogger(RemoteFetcher.class);
private final static ObjectMapper mapper = new ObjectMapper();
private ConfigLoader configLoader;
private final ConfigLoader configLoader;
@Autowired
public RemoteFetcher(ConfigLoader configLoader) {
@ -294,7 +296,7 @@ public class RemoteFetcher {
headers.setAccept(Collections.singletonList(MediaType.valueOf(contentType)));
headers.setContentType(MediaType.valueOf(contentType));
}
JsonNode jsonBody = new ObjectMapper().readTree(requestBody);
JsonNode jsonBody = mapper.readTree(requestBody);
entity = new HttpEntity<>(jsonBody, headers);
response = restTemplate.exchange(urlString, HttpMethod.resolve(requestType), entity, String.class);
@ -325,7 +327,6 @@ public class RemoteFetcher {
String camelCaseGetter = jsonDataPath.getParseField() != null && !jsonDataPath.getParseField().isEmpty() ? "get" + jsonDataPath.getParseField().substring(0, 1).toUpperCase() + jsonDataPath.getParseField().substring(1) : "";
reader = aClass.getMethod(camelCaseGetter);
}
ObjectMapper objectMapper = new ObjectMapper();
List<Map<String, String>> values = new ArrayList<>();
int max = 1;
if (reader != null) {
@ -346,7 +347,7 @@ public class RemoteFetcher {
} else {
value = data;
}
Map<String, String> map = objectMapper.convertValue(value, Map.class);
Map<String, String> map = mapper.convertValue(value, Map.class);
if (jsonDataPath.getMergedFields() != null && !jsonDataPath.getMergedFields().isEmpty() && jsonDataPath.getMergedFieldName() != null && !jsonDataPath.getMergedFieldName().isEmpty()) {
Map<String, String> finalMap = new HashMap<>();
for (Map.Entry<String, String> entry : map.entrySet()) {
@ -385,7 +386,6 @@ public class RemoteFetcher {
List<Map<String, String>> internalResults;
try {
String filePath = Paths.get(path).toUri().toURL().toString();
ObjectMapper mapper = new ObjectMapper();
internalResults = mapper.readValue(new File(filePath), new TypeReference<List<Map<String, String>>>(){});
return searchListMap(internalResults, query);
} catch (Exception e) {

View File

@ -1,8 +1,8 @@
package eu.eudat.logic.proxy.fetching.entities;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.List;
@XmlRootElement(name = "fetchConfig")

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.proxy.fetching.entities;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "config")
public class ConfigSingle {

View File

@ -1,8 +1,8 @@
package eu.eudat.logic.proxy.fetching.entities;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.List;
@XmlRootElement(name = "ISO_4217")

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.proxy.fetching.entities;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "CcyNtry")
public class CurrencySingleModel {

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.security.customproviders.B2Access;
import com.google.api.client.repackaged.org.apache.commons.codec.binary.Base64;
import eu.eudat.logic.security.validators.b2access.helpers.B2AccessResponseToken;
import org.apache.commons.codec.binary.Base64;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpEntity;

View File

@ -1,8 +1,11 @@
package eu.eudat.logic.security.customproviders.ConfigurableProvider.entities;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.ArrayList;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public class ConfigurableProviders {
private List<ConfigurableProvider> providers = new ArrayList<>();

View File

@ -5,7 +5,7 @@ import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken.Payload;
import com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.json.gson.GsonFactory;
import eu.eudat.logic.security.validators.TokenValidator;
import eu.eudat.logic.security.validators.TokenValidatorFactoryImpl;
import eu.eudat.logic.services.operations.authentication.AuthenticationService;
@ -29,7 +29,7 @@ public class GoogleTokenValidator implements TokenValidator {
@Autowired
public GoogleTokenValidator(Environment environment, AuthenticationService nonVerifiedUserAuthenticationService) {
this.nonVerifiedUserAuthenticationService = nonVerifiedUserAuthenticationService;
verifier = new GoogleIdTokenVerifier.Builder(transport, JacksonFactory.getDefaultInstance())
verifier = new GoogleIdTokenVerifier.Builder(transport, new GsonFactory())
.setAudience(Collections.singletonList(environment.getProperty("google.login.clientId")))
.build();
}

View File

@ -1,5 +1,6 @@
package eu.eudat.logic.services;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.logic.services.helpers.HelpersService;
import eu.eudat.logic.services.operations.OperationsContext;
import eu.eudat.logic.services.utilities.UtilitiesService;
@ -11,4 +12,6 @@ public interface ApiContext {
OperationsContext getOperationsContext();
UtilitiesService getUtilitiesService();
ObjectMapper getObjectMapper();
}

View File

@ -1,5 +1,6 @@
package eu.eudat.logic.services;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.logic.services.helpers.HelpersService;
import eu.eudat.logic.services.operations.OperationsContext;
import eu.eudat.logic.services.utilities.UtilitiesService;
@ -9,6 +10,7 @@ import org.springframework.stereotype.Service;
@Service("apiContext")
public class ApiContextImpl implements ApiContext {
private static final ObjectMapper mapper = new ObjectMapper();
private OperationsContext operationsContext;
private HelpersService helpersService;
@ -35,4 +37,9 @@ public class ApiContextImpl implements ApiContext {
public UtilitiesService getUtilitiesService() {
return utilitiesService;
}
@Override
public ObjectMapper getObjectMapper() {
return mapper;
}
}

View File

@ -1,5 +1,6 @@
package eu.eudat.logic.services.operations.authentication;
import com.fasterxml.jackson.core.JsonProcessingException;
import eu.eudat.data.entities.Credential;
import eu.eudat.data.entities.UserInfo;
import eu.eudat.data.entities.UserRole;
@ -14,7 +15,6 @@ import eu.eudat.models.data.login.Credentials;
import eu.eudat.models.data.loginprovider.LoginProviderUser;
import eu.eudat.models.data.security.Principal;
import eu.eudat.types.Authorities;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.env.Environment;
@ -164,8 +164,10 @@ public abstract class AbstractAuthenticationService implements AuthenticationSer
apiContext.getOperationsContext().getDatabaseRepository().getUserRoleDao().createOrUpdate(role);
} else {
Map<String, Object> additionalInfo = userInfo.getAdditionalinfo() != null ?
new JSONObject(userInfo.getAdditionalinfo()).toMap() : new HashMap<>();
Map<String, Object> additionalInfo = null;
try {
additionalInfo = userInfo.getAdditionalinfo() != null ?
apiContext.getObjectMapper().readValue(userInfo.getAdditionalinfo(), HashMap.class) : new HashMap<>();
if (profile.getAvatarUrl() != null && !profile.getAvatarUrl().isEmpty() && !profile.getAvatarUrl().equals("null")) {
additionalInfo.put("avatarUrl", profile.getAvatarUrl());
}
@ -182,7 +184,11 @@ public abstract class AbstractAuthenticationService implements AuthenticationSer
additionalInfo.put("zenodoEmail", profile.getEmail());
}
userInfo.setLastloggedin(new Date());
userInfo.setAdditionalinfo(new JSONObject(additionalInfo).toString());
userInfo.setAdditionalinfo(apiContext.getObjectMapper().writeValueAsString(additionalInfo));
} catch (JsonProcessingException e) {
logger.error(e.getLocalizedMessage(), e);
}
Set<Credential> credentials = userInfo.getCredentials();
if (credentials.contains(credential)) {
Credential oldCredential = credentials.stream().filter(item -> credential.getProvider().equals(item.getProvider())).findFirst().get();

View File

@ -30,49 +30,49 @@ public class NonVerifiedUserEmailAuthenticationService extends AbstractAuthentic
if (user == null) return null;
String avatarUrl;
try {
avatarUrl = user.getAdditionalinfo() != null ? new ObjectMapper().readTree(user.getAdditionalinfo()).get("avatarUrl").asText() : "";
avatarUrl = user.getAdditionalinfo() != null ? apiContext.getObjectMapper().readTree(user.getAdditionalinfo()).get("avatarUrl").asText() : "";
} catch (Exception e) {
avatarUrl = "";
}
String zenodoToken;
try {
zenodoToken = user.getAdditionalinfo() != null ? new ObjectMapper().readTree(user.getAdditionalinfo()).get("zenodoToken").asText() : "";
zenodoToken = user.getAdditionalinfo() != null ? apiContext.getObjectMapper().readTree(user.getAdditionalinfo()).get("zenodoToken").asText() : "";
} catch (Exception e) {
zenodoToken = "";
}
Instant zenodoDuration;
try {
zenodoDuration = user.getAdditionalinfo() != null ? Instant.ofEpochMilli(new ObjectMapper().readTree(user.getAdditionalinfo()).get("expirationDate").asLong()) : Instant.now();
zenodoDuration = user.getAdditionalinfo() != null ? Instant.ofEpochMilli(apiContext.getObjectMapper().readTree(user.getAdditionalinfo()).get("expirationDate").asLong()) : Instant.now();
} catch (Exception e) {
zenodoDuration = Instant.now();
}
String zenodoEmail;
try {
zenodoEmail = user.getAdditionalinfo() != null ? new ObjectMapper().readTree(user.getAdditionalinfo()).get("zenodoEmail").asText() : "";
zenodoEmail = user.getAdditionalinfo() != null ? apiContext.getObjectMapper().readTree(user.getAdditionalinfo()).get("zenodoEmail").asText() : "";
} catch (Exception e) {
zenodoEmail = "";
}
String zenodoRefresh;
try {
zenodoRefresh = user.getAdditionalinfo() != null ? new ObjectMapper().readTree(user.getAdditionalinfo()).get("zenodoRefresh").asText() : "";
zenodoRefresh = user.getAdditionalinfo() != null ? apiContext.getObjectMapper().readTree(user.getAdditionalinfo()).get("zenodoRefresh").asText() : "";
} catch (Exception e) {
zenodoRefresh = "";
}
String culture;
try {
culture = user.getAdditionalinfo() != null ? new ObjectMapper().readTree(user.getAdditionalinfo()).get("culture").get("name").asText() : "";
culture = user.getAdditionalinfo() != null ? apiContext.getObjectMapper().readTree(user.getAdditionalinfo()).get("culture").get("name").asText() : "";
} catch (Exception e) {
culture = "";
}
String language;
try {
language = user.getAdditionalinfo() != null ? new ObjectMapper().readTree(user.getAdditionalinfo()).get("language").get("value").asText() : "";
language = user.getAdditionalinfo() != null ? apiContext.getObjectMapper().readTree(user.getAdditionalinfo()).get("language").get("value").asText() : "";
} catch (Exception e) {
language = "";
}
String timezone;
try {
timezone = user.getAdditionalinfo() != null ? new ObjectMapper().readTree(user.getAdditionalinfo()).get("timezone").asText() : "";
timezone = user.getAdditionalinfo() != null ? apiContext.getObjectMapper().readTree(user.getAdditionalinfo()).get("timezone").asText() : "";
} catch (Exception e) {
timezone = "";
}

View File

@ -1,27 +1,21 @@
package eu.eudat.logic.services.operations.authentication;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.data.entities.Credential;
import eu.eudat.data.entities.UserInfo;
import eu.eudat.data.entities.UserRole;
import eu.eudat.data.entities.UserToken;
import eu.eudat.exceptions.security.NullEmailException;
import eu.eudat.logic.builders.entity.CredentialBuilder;
import eu.eudat.logic.builders.entity.UserInfoBuilder;
import eu.eudat.logic.builders.entity.UserTokenBuilder;
import eu.eudat.logic.builders.model.models.PrincipalBuilder;
import eu.eudat.logic.security.validators.TokenValidatorFactoryImpl;
import eu.eudat.logic.services.ApiContext;
import eu.eudat.models.data.login.Credentials;
import eu.eudat.models.data.loginprovider.LoginProviderUser;
import eu.eudat.models.data.security.Principal;
import eu.eudat.types.Authorities;
import org.json.JSONObject;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import java.time.Instant;
import java.util.*;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
@Service("verifiedUserAuthenticationService")
@ -39,49 +33,49 @@ public class VerifiedUserAuthenticationService extends AbstractAuthenticationSer
if (user.getEmail() == null) throw new NullEmailException();
String avatarUrl;
try {
avatarUrl = user.getAdditionalinfo() != null ? new ObjectMapper().readTree(user.getAdditionalinfo()).get("avatarUrl").asText() : "";
avatarUrl = user.getAdditionalinfo() != null ? apiContext.getObjectMapper().readTree(user.getAdditionalinfo()).get("avatarUrl").asText() : "";
} catch (Exception e) {
avatarUrl = "";
}
String zenodoToken;
try {
zenodoToken = user.getAdditionalinfo() != null ? new ObjectMapper().readTree(user.getAdditionalinfo()).get("zenodoToken").asText() : "";
zenodoToken = user.getAdditionalinfo() != null ? apiContext.getObjectMapper().readTree(user.getAdditionalinfo()).get("zenodoToken").asText() : "";
} catch (Exception e) {
zenodoToken = "";
}
Instant zenodoDuration;
try {
zenodoDuration = user.getAdditionalinfo() != null ? Instant.ofEpochMilli(new ObjectMapper().readTree(user.getAdditionalinfo()).get("expirationDate").asLong()) : Instant.now();
zenodoDuration = user.getAdditionalinfo() != null ? Instant.ofEpochMilli(apiContext.getObjectMapper().readTree(user.getAdditionalinfo()).get("expirationDate").asLong()) : Instant.now();
} catch (Exception e) {
zenodoDuration = Instant.now();
}
String zenodoEmail;
try {
zenodoEmail = user.getAdditionalinfo() != null ? new ObjectMapper().readTree(user.getAdditionalinfo()).get("zenodoEmail").asText() : "";
zenodoEmail = user.getAdditionalinfo() != null ? apiContext.getObjectMapper().readTree(user.getAdditionalinfo()).get("zenodoEmail").asText() : "";
} catch (Exception e) {
zenodoEmail = "";
}
String zenodoRefresh;
try {
zenodoRefresh = user.getAdditionalinfo() != null ? new ObjectMapper().readTree(user.getAdditionalinfo()).get("zenodoRefresh").asText() : "";
zenodoRefresh = user.getAdditionalinfo() != null ? apiContext.getObjectMapper().readTree(user.getAdditionalinfo()).get("zenodoRefresh").asText() : "";
} catch (Exception e) {
zenodoRefresh = "";
}
String culture;
try {
culture = user.getAdditionalinfo() != null ? new ObjectMapper().readTree(user.getAdditionalinfo()).get("culture").get("name").asText() : "";
culture = user.getAdditionalinfo() != null ? apiContext.getObjectMapper().readTree(user.getAdditionalinfo()).get("culture").get("name").asText() : "";
} catch (Exception e) {
culture = "";
}
String language;
try {
language = user.getAdditionalinfo() != null ? new ObjectMapper().readTree(user.getAdditionalinfo()).get("language").get("value").asText() : "";
language = user.getAdditionalinfo() != null ? apiContext.getObjectMapper().readTree(user.getAdditionalinfo()).get("language").get("value").asText() : "";
} catch (Exception e) {
language = "";
}
String timezone;
try {
timezone = user.getAdditionalinfo() != null ? new ObjectMapper().readTree(user.getAdditionalinfo()).get("timezone").asText() : "";
timezone = user.getAdditionalinfo() != null ? apiContext.getObjectMapper().readTree(user.getAdditionalinfo()).get("timezone").asText() : "";
} catch (Exception e) {
timezone = "";
}

View File

@ -8,6 +8,7 @@ import eu.eudat.models.data.mail.SimpleMail;
import eu.eudat.models.data.security.Principal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
@ -20,11 +21,11 @@ import java.util.concurrent.CompletableFuture;
@Service("ConfirmationEmailService")
public class ConfirmationEmailServiceImpl implements ConfirmationEmailService {
private static final Logger logger = LoggerFactory.getLogger(ConfirmationEmailServiceImpl.class);
//private Logger logger;
private Environment environment;
private static final ObjectMapper mapper = new ObjectMapper();
private final Environment environment;
public ConfirmationEmailServiceImpl(/*Logger logger,*/ Environment environment) {
// this.logger = logger;
@Autowired
public ConfirmationEmailServiceImpl(Environment environment) {
this.environment = environment;
}
@ -118,7 +119,7 @@ public class ConfirmationEmailServiceImpl implements ConfirmationEmailService {
Map<String, Object> map = new HashMap<>();
map.put("userId", principal.getId());
map.put("provider", provider.toString());
confirmationEmail.setData(new ObjectMapper().writeValueAsString(map));
confirmationEmail.setData(mapper.writeValueAsString(map));
} catch (JsonProcessingException e) {
logger.error(e.getMessage(), e);
}

View File

@ -15,8 +15,8 @@ import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import javax.mail.MessagingException;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.Marshaller;
import java.io.StringWriter;
import java.util.List;
import java.util.UUID;

View File

@ -212,7 +212,6 @@ public class HtmlToWorldBuilder implements NodeVisitor {
f.setAscii("Symbol");
f.setHAnsi("Symbol");
f.setCs("Symbol");
f.setHint(STHint.DEFAULT);
} else {
ctLvl.addNewLvlText().setVal("%1.");
}

View File

@ -1,7 +1,6 @@
package eu.eudat.logic.utilities.documents.xml;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import eu.eudat.logic.services.forms.VisibilityRuleService;
import eu.eudat.logic.utilities.builders.XmlBuilder;
import eu.eudat.models.data.components.commons.datafield.ExternalDatasetsData;
@ -10,8 +9,6 @@ import eu.eudat.models.data.user.components.datasetprofile.FieldSet;
import eu.eudat.models.data.user.components.datasetprofile.Section;
import eu.eudat.models.data.user.composite.DatasetProfilePage;
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
import org.json.JSONArray;
import org.json.JSONException;
import org.springframework.core.env.Environment;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

View File

@ -3,9 +3,9 @@ import eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileMo
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Unmarshaller;
import java.io.*;
public class ImportXmlBuilderDatasetProfile {

View File

@ -1,9 +1,9 @@
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.LinkedList;
import java.util.List;

View File

@ -2,9 +2,9 @@ package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileM
import eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields.Fields;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "field-Set")
public class FieldSet {

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.LinkedList;
import java.util.List;

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "defaultValue")
public class DefaultValue {

View File

@ -4,9 +4,9 @@ import eu.eudat.logic.utilities.builders.ModelBuilder;
import eu.eudat.models.data.components.commons.datafield.FieldData;
import org.w3c.dom.Element;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.LinkedList;
import java.util.List;

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.LinkedList;
import java.util.List;

View File

@ -1,8 +1,8 @@
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "rule")
public class Rule{

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "validation")
public class Validation {

View File

@ -1,8 +1,8 @@
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlValue;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlValue;
@XmlRootElement(name = "value")
public class Value {

View File

@ -1,8 +1,8 @@
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "viewStyle")
public class ViewStyle {

View File

@ -1,8 +1,8 @@
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.LinkedList;
import java.util.List;

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.Fields;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "validations")
public class validations {

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "multiplicity")

View File

@ -1,8 +1,8 @@
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.List;
@XmlRootElement(name = "page")

View File

@ -1,8 +1,8 @@
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.LinkedList;
import java.util.List;

View File

@ -1,9 +1,9 @@
package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.LinkedList;
import java.util.List;

View File

@ -4,9 +4,9 @@ import eu.eudat.logic.utilities.documents.xml.dmpXml.dmpProfileModel.DmpProfile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Unmarshaller;
import java.io.File;
import java.io.IOException;

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.utilities.documents.xml.dmpXml.dmpProfileModel;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "datatype")
public class DMPProfileFieldDataType {

View File

@ -1,8 +1,8 @@
package eu.eudat.logic.utilities.documents.xml.dmpXml.dmpProfileModel;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "type")
public class DMPProfileType {

Some files were not shown because too many files have changed in this diff Show More