diff --git a/dmp-backend/108131ae-d07a-4e8c-8f75-8c8e33fe9974.xml b/dmp-backend/108131ae-d07a-4e8c-8f75-8c8e33fe9974.xml deleted file mode 100644 index b046de687..000000000 --- a/dmp-backend/108131ae-d07a-4e8c-8f75-8c8e33fe9974.xml +++ /dev/null @@ -1 +0,0 @@ -
Will you use metadata to describe the data?Will your metadata use standardised vocabularies? Will you make the metadata available free-of-charge?Will your metadata be harvestable?Will you use a naming conventions for your data?Will you provide clear version numbers for your data?Will you provide persistent identifiers for your data?Persistent identifiers Will you provide searchable metadata for your data?Will you use standardised formats for some or all of your data?Are the file formats you will use open?Please describe which data are not in an open format and why?Please describe which data are not in an open format and why? Do supported open-source tools exist for accessing the data? Please describe which data require proprietary tools to access the data? Please describe which data require proprietary tools to access the data?Will you provide metadata describing the quality of the data?
Are there ethical or legal issues that can impact sharing the data?ReasonWill all your data be openly accessible?How will the data be made available? Is the storage sufficiently secure for the data and does the storage provide backup and recovery procedures?ReasonReason Will you provide methods and tools to access the data?Will you also make auxiliary data that may be of interest to researchers available?Reason
Will you use a standard vocabulary for your data types?Will you provide a mapping to more commonly used ontologies? Will you provide a mapping to more commonly used ontologies?
When do you plan to make your data available for reuse?Please specify how long after the project has ended the data will be made available?Please describe the reason the data will not be made available.What internationally recognised licence will you use for your data?Do you have documented procedures for quality assurance of your data?Will you provide any support for data reuse?How long do you intend to support data reuse?Please specify why the data will be unsupported for reuse.
How will the cost of making your data findable, accessible, interoperable and reusable be covered?Will you identify a data manager to manage your data, if not who will be responsible for the management of your data?Identify the people or roles that will be responsible for the management of the project dataHow do you intend to ensure data reuse after your project finishes?
What do you plan to do with research data of limited usePlease describe why the data will be kept on insecure, unmanaged storage
Do you make use of other procedures for data management?Please provide links to documentation on these other procedures.
\ No newline at end of file diff --git a/dmp-backend/7b1bdf71-945e-40db-b8fb-1b2d313fbebe.xml b/dmp-backend/7b1bdf71-945e-40db-b8fb-1b2d313fbebe.xml deleted file mode 100644 index 14140ad44..000000000 --- a/dmp-backend/7b1bdf71-945e-40db-b8fb-1b2d313fbebe.xml +++ /dev/null @@ -1 +0,0 @@ -DMP DemodfgdfgOpenAIREplus \ No newline at end of file diff --git a/dmp-backend/be3facf6-0eb9-4668-99d6-f99215ccec1b.xml b/dmp-backend/be3facf6-0eb9-4668-99d6-f99215ccec1b.xml deleted file mode 100644 index b046de687..000000000 --- a/dmp-backend/be3facf6-0eb9-4668-99d6-f99215ccec1b.xml +++ /dev/null @@ -1 +0,0 @@ -
Will you use metadata to describe the data?Will your metadata use standardised vocabularies? Will you make the metadata available free-of-charge?Will your metadata be harvestable?Will you use a naming conventions for your data?Will you provide clear version numbers for your data?Will you provide persistent identifiers for your data?Persistent identifiers Will you provide searchable metadata for your data?Will you use standardised formats for some or all of your data?Are the file formats you will use open?Please describe which data are not in an open format and why?Please describe which data are not in an open format and why? Do supported open-source tools exist for accessing the data? Please describe which data require proprietary tools to access the data? Please describe which data require proprietary tools to access the data?Will you provide metadata describing the quality of the data?
Are there ethical or legal issues that can impact sharing the data?ReasonWill all your data be openly accessible?How will the data be made available? Is the storage sufficiently secure for the data and does the storage provide backup and recovery procedures?ReasonReason Will you provide methods and tools to access the data?Will you also make auxiliary data that may be of interest to researchers available?Reason
Will you use a standard vocabulary for your data types?Will you provide a mapping to more commonly used ontologies? Will you provide a mapping to more commonly used ontologies?
When do you plan to make your data available for reuse?Please specify how long after the project has ended the data will be made available?Please describe the reason the data will not be made available.What internationally recognised licence will you use for your data?Do you have documented procedures for quality assurance of your data?Will you provide any support for data reuse?How long do you intend to support data reuse?Please specify why the data will be unsupported for reuse.
How will the cost of making your data findable, accessible, interoperable and reusable be covered?Will you identify a data manager to manage your data, if not who will be responsible for the management of your data?Identify the people or roles that will be responsible for the management of the project dataHow do you intend to ensure data reuse after your project finishes?
What do you plan to do with research data of limited usePlease describe why the data will be kept on insecure, unmanaged storage
Do you make use of other procedures for data management?Please provide links to documentation on these other procedures.
\ No newline at end of file diff --git a/dmp-backend/queryengine/pom.xml b/dmp-backend/queryengine/pom.xml deleted file mode 100644 index 7e74fc9f2..000000000 --- a/dmp-backend/queryengine/pom.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - dmp-backend - eu.eudat - 1.0.0-SNAPSHOT - - 4.0.0 - - query-engine - - - - eu.eudat - data - 1.0-SNAPSHOT - - - - \ No newline at end of file diff --git a/dmp-backend/queryengine/src/main/java/Main.java b/dmp-backend/queryengine/src/main/java/Main.java deleted file mode 100644 index 00364e090..000000000 --- a/dmp-backend/queryengine/src/main/java/Main.java +++ /dev/null @@ -1,23 +0,0 @@ -import eu.eudat.data.entities.DataRepository; -import eu.eudat.query.engine.builder.QueryBuilder; -import eu.eudat.query.engine.builder.QueryBuilderImpl; -import eu.eudat.query.engine.predicates.ComparisonPredicate; - -/** - * Created by ikalyvas on 7/5/2018. - */ -public class Main { - public static void main(String[] args){ - new Main().Test(); - } - public void Test(){ - QueryBuilder queryBuilder = new QueryBuilderImpl<>(DataRepository.class); - queryBuilder.where((comparisonExpression) -> comparisonExpression.field("id").greaterThan(5) ); - queryBuilder.where((comparisonExpression) -> comparisonExpression.field("label").equal("mitsos") ); - queryBuilder.toList(); - - QueryBuilder queryBuilder2 = new QueryBuilderImpl<>(DataRepository.class); - queryBuilder2.where((comparisonExpression) -> comparisonExpression.field("id").lessOrEqualThan(11111) ); - queryBuilder2.toList(); - } -} diff --git a/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/builder/QueryBuilder.java b/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/builder/QueryBuilder.java deleted file mode 100644 index 07d96b1a2..000000000 --- a/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/builder/QueryBuilder.java +++ /dev/null @@ -1,16 +0,0 @@ -package eu.eudat.query.engine.builder; - -import eu.eudat.query.engine.expressions.Expression; -import eu.eudat.query.engine.predicates.Predicate; - -import java.util.List; - -/** - * Created by ikalyvas on 7/5/2018. - */ -public interface QueryBuilder { - -

Expression where(P wherePredicate); - - List toList(); -} diff --git a/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/builder/QueryBuilderImpl.java b/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/builder/QueryBuilderImpl.java deleted file mode 100644 index f1211415b..000000000 --- a/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/builder/QueryBuilderImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -package eu.eudat.query.engine.builder; - -import eu.eudat.query.engine.expressions.ComparisonExpression; -import eu.eudat.query.engine.expressions.Expression; -import eu.eudat.query.engine.predicates.Predicate; - -import java.lang.annotation.Annotation; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; -import java.util.Optional; - -/** - * Created by ikalyvas on 7/5/2018. - */ -public class QueryBuilderImpl implements QueryBuilder { - - private List expressions = new LinkedList<>(); - private Class tClass; - - public QueryBuilderImpl(Class tClass) { - this.tClass = tClass; - } - - @Override - public

Expression where(P wherePredicate) { - ComparisonExpression comparisonExpression = new ComparisonExpression(); - Expression expression = wherePredicate.apply(comparisonExpression); - this.expressions.add(expression); - return expression; - } - - @Override - public List toList() { - String query = "Select * from "; - Optional optionalAnnotation = Arrays.stream(this.tClass.getAnnotations()) - .filter(x-> x.annotationType().equals(javax.persistence.Table.class)) - .findFirst(); - - javax.persistence.Table annotation = optionalAnnotation.isPresent() ? (javax.persistence.Table)optionalAnnotation.get() : null; - query += annotation.name()+" "; - for (Expression expression : expressions) { - if(expressions.indexOf(expression) > 0) query+= " and "; - else query += " where "; - query += expression.evaluate(); - } - System.out.println(query); - return null; - } -} diff --git a/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/expressions/AbstractFieldExpression.java b/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/expressions/AbstractFieldExpression.java deleted file mode 100644 index c61161db3..000000000 --- a/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/expressions/AbstractFieldExpression.java +++ /dev/null @@ -1,17 +0,0 @@ -package eu.eudat.query.engine.expressions; - -/** - * Created by ikalyvas on 7/5/2018. - */ -public abstract class AbstractFieldExpression> { - private String field; - - protected String getField() { - return field; - } - - public T field(String field) { - this.field = field; - return (T)this; - } -} diff --git a/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/expressions/ComparisonExpression.java b/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/expressions/ComparisonExpression.java deleted file mode 100644 index 7c418741f..000000000 --- a/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/expressions/ComparisonExpression.java +++ /dev/null @@ -1,47 +0,0 @@ -package eu.eudat.query.engine.expressions; - -import eu.eudat.query.engine.types.expression.comparison.ComparisonExpressionType; - -/** - * Created by ikalyvas on 7/5/2018. - */ -public class ComparisonExpression extends AbstractFieldExpression implements Expression { - - private ComparisonExpressionType type; - private Object value; - - public Expression greaterThan(T value){ - this.value = value; - this.type = ComparisonExpressionType.GREATER_THAN; - return this; - } - - public Expression greaterThanOrEqual(T value){ - this.value = value; - this.type = ComparisonExpressionType.GREATER_OR_EQUAL_THAN; - return this; - } - - public Expression equal(T value){ - this.value = value; - this.type = ComparisonExpressionType.EQUAL; - return this; - } - - public Expression lessThan(T value){ - this.value = value; - this.type = ComparisonExpressionType.LESS_THAN; - return this; - } - - public Expression lessOrEqualThan(T value){ - this.value = value; - this.type = ComparisonExpressionType.LESS_OR_EQUAL_THAN; - return this; - } - - @Override - public String evaluate() { - return this.getField() +" " + type.toString() + " " + value ; - } -} diff --git a/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/expressions/Expression.java b/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/expressions/Expression.java deleted file mode 100644 index d093c93ad..000000000 --- a/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/expressions/Expression.java +++ /dev/null @@ -1,8 +0,0 @@ -package eu.eudat.query.engine.expressions; - -/** - * Created by ikalyvas on 7/5/2018. - */ -public interface Expression { - String evaluate(); -} diff --git a/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/predicates/ComparisonPredicate.java b/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/predicates/ComparisonPredicate.java deleted file mode 100644 index 56147519f..000000000 --- a/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/predicates/ComparisonPredicate.java +++ /dev/null @@ -1,10 +0,0 @@ -package eu.eudat.query.engine.predicates; - -import eu.eudat.query.engine.expressions.ComparisonExpression; -import eu.eudat.query.engine.expressions.Expression; - -/** - * Created by ikalyvas on 7/5/2018. - */ -public interface ComparisonPredicate extends Predicate { -} diff --git a/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/predicates/Predicate.java b/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/predicates/Predicate.java deleted file mode 100644 index 9cf40e784..000000000 --- a/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/predicates/Predicate.java +++ /dev/null @@ -1,11 +0,0 @@ -package eu.eudat.query.engine.predicates; - -import eu.eudat.query.engine.expressions.ComparisonExpression; -import eu.eudat.query.engine.expressions.Expression; - -/** - * Created by ikalyvas on 7/5/2018. - */ -public interface Predicate { - Expression apply( E expression); -} diff --git a/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/types/expression/comparison/ComparisonExpressionType.java b/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/types/expression/comparison/ComparisonExpressionType.java deleted file mode 100644 index f2b9ec5ed..000000000 --- a/dmp-backend/queryengine/src/main/java/eu/eudat/query/engine/types/expression/comparison/ComparisonExpressionType.java +++ /dev/null @@ -1,8 +0,0 @@ -package eu.eudat.query.engine.types.expression.comparison; - -/** - * Created by ikalyvas on 7/5/2018. - */ -public enum ComparisonExpressionType { - EQUAL, GREATER_THAN, GREATER_OR_EQUAL_THAN, LESS_THAN, LESS_OR_EQUAL_THAN -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/DMPs.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/DMPs.java index d9a4a2cd2..a5f0dc577 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/DMPs.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/DMPs.java @@ -46,72 +46,66 @@ public class DMPs extends BaseController { private DynamicProjectConfiguration dynamicProjectConfiguration; private Environment environment; + private DataManagementPlanManager dataManagementPlanManager; @Autowired - public DMPs(ApiContext apiContext, DynamicProjectConfiguration dynamicProjectConfiguration, Environment environment) { + public DMPs(ApiContext apiContext, DynamicProjectConfiguration dynamicProjectConfiguration, Environment environment, DataManagementPlanManager dataManagementPlanManager) { super(apiContext); this.dynamicProjectConfiguration = dynamicProjectConfiguration; this.environment = environment; - + this.dataManagementPlanManager = dataManagementPlanManager; } @Transactional @RequestMapping(method = RequestMethod.GET, value = {"{id}/unlock"}, produces = "application/json") public @ResponseBody ResponseEntity> unlock(@PathVariable(value = "id") UUID id, Principal principal) throws Exception { - new DataManagementPlanManager().unlock(this.getApiContext(), id); + this.dataManagementPlanManager.unlock(this.getApiContext(), id); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.SUCCESS_MESSAGE).message("Unlocked")); } - @RequestMapping(method = RequestMethod.POST, value = {"/getPaged"}, consumes = "application/json", produces = "application/json") + @RequestMapping(method = RequestMethod.POST, value = {"/paged"}, consumes = "application/json", produces = "application/json") public @ResponseBody ResponseEntity>> getPaged(@Valid @RequestBody DataManagementPlanTableRequest dataManagementPlanTableRequest, Principal principal) throws Exception { - DataTableData dataTable = new DataManagementPlanManager().getPaged(this.getApiContext(), dataManagementPlanTableRequest, principal); + DataTableData dataTable = this.dataManagementPlanManager.getPaged(this.getApiContext(), dataManagementPlanTableRequest, principal); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable)); } - @RequestMapping(method = RequestMethod.GET, value = {"/getSingle/{id}"}, produces = "application/json") + @RequestMapping(method = RequestMethod.GET, value = {"{id}"}, produces = "application/json") public @ResponseBody ResponseEntity> getSingle(@PathVariable String id, Principal principal) throws IllegalAccessException, InstantiationException { - eu.eudat.models.data.dmp.DataManagementPlan dataManagementPlan = new DataManagementPlanManager().getSingle(this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, principal, this.dynamicProjectConfiguration); + eu.eudat.models.data.dmp.DataManagementPlan dataManagementPlan = this.dataManagementPlanManager.getSingle(this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, principal, this.dynamicProjectConfiguration); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlan)); } @Transactional - @RequestMapping(method = RequestMethod.POST, value = {"/createOrUpdate"}, consumes = "application/json", produces = "application/json") + @RequestMapping(method = RequestMethod.POST, value = {"/post"}, consumes = "application/json", produces = "application/json") public @ResponseBody ResponseEntity> createOrUpdate(@RequestBody eu.eudat.models.data.dmp.DataManagementPlan dataManagementPlan, Principal principal) throws Exception { - DataManagementPlanManager.createOrUpdate(this.getApiContext(), dataManagementPlan, principal); + this.dataManagementPlanManager.createOrUpdate(this.getApiContext(), dataManagementPlan, principal); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created")); } @RequestMapping(method = RequestMethod.POST, value = {"/new/{id}"}, consumes = "application/json", produces = "application/json") public @ResponseBody ResponseEntity> newVersion(@PathVariable UUID id, @Valid @RequestBody eu.eudat.models.data.dmp.DataManagementPlanNewVersionModel dataManagementPlan, Principal principal) throws Exception { - DataManagementPlanManager.newVersion(this.getApiContext(), id, dataManagementPlan, principal); + this.dataManagementPlanManager.newVersion(this.getApiContext(), id, dataManagementPlan, principal); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE)); } @RequestMapping(method = RequestMethod.POST, value = {"/clone/{id}"}, consumes = "application/json", produces = "application/json") public @ResponseBody ResponseEntity> clone(@PathVariable UUID id, @RequestBody eu.eudat.models.data.dmp.DataManagementPlanNewVersionModel dataManagementPlan, Principal principal) throws Exception { - DataManagementPlanManager.clone(this.getApiContext(), id, dataManagementPlan, principal); + this.dataManagementPlanManager.clone(this.getApiContext(), id, dataManagementPlan, principal); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE)); } - @RequestMapping(method = RequestMethod.POST, value = {"/get"}, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity>> getWithCriteria(@RequestBody DataManagementPlanCriteriaRequest dataManagementPlanCriteria, Principal principal) throws InstantiationException, IllegalAccessException { - List dataTable = new DataManagementPlanManager().getWithCriteria(this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), dataManagementPlanCriteria, principal); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable)); - } - @Transactional - @RequestMapping(method = RequestMethod.DELETE, value = {"/delete/{id}"}, consumes = "application/json", produces = "application/json") + @RequestMapping(method = RequestMethod.DELETE, value = {"{id}"}, consumes = "application/json", produces = "application/json") public @ResponseBody ResponseEntity> delete(@PathVariable UUID id, Principal principal) { try{ - DataManagementPlanManager.delete(this.getApiContext(), id); + this.dataManagementPlanManager.delete(this.getApiContext(), id); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully Deleted Datamanagement Plan")); }catch (DMPWithDatasetsDeleteException exception){ return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem().status(ApiMessageCode.ERROR_MESSAGE).message(exception.getMessage())); @@ -122,14 +116,14 @@ public class DMPs extends BaseController { @RequestMapping(method = RequestMethod.POST, value = {"/dynamic"}, consumes = "application/json", produces = "application/json") public @ResponseBody ResponseEntity>>> getWithCriteria(@RequestBody RequestItem criteriaRequestItem, Principal principal) throws InstantiationException, IllegalAccessException { - List> dataTable = new DataManagementPlanManager().getDynamicFields(criteriaRequestItem.getCriteria().getId(), this.dynamicProjectConfiguration, criteriaRequestItem.getCriteria()); + List> dataTable = this.dataManagementPlanManager.getDynamicFields(criteriaRequestItem.getCriteria().getId(), this.dynamicProjectConfiguration, criteriaRequestItem.getCriteria()); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable)); } @RequestMapping(method = RequestMethod.GET, value = {"/getXml/{id}"}) public @ResponseBody ResponseEntity getXml(@PathVariable String id) throws IllegalAccessException, IOException, InstantiationException { - FileEnvelope envelope = new DataManagementPlanManager().getXmlDocument(this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, this.getApiContext().getUtilitiesService().getVisibilityRuleService()); + FileEnvelope envelope = this.dataManagementPlanManager.getXmlDocument(this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, this.getApiContext().getUtilitiesService().getVisibilityRuleService()); InputStream resource = new FileInputStream(envelope.getFile()); System.out.println("Mime Type of " + envelope.getFilename() + " is " + new MimetypesFileTypeMap().getContentType(envelope.getFile())); @@ -149,7 +143,7 @@ public class DMPs extends BaseController { @RequestMapping(method = RequestMethod.GET, value = {"/getWord/{id}"}) public @ResponseBody ResponseEntity getWordDocument(@PathVariable String id) throws IOException, IllegalAccessException, InstantiationException { - File file = new DataManagementPlanManager().getWordDocument(this.environment, this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, this.getApiContext().getUtilitiesService().getVisibilityRuleService()); + File file = this.dataManagementPlanManager.getWordDocument(this.environment, this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, this.getApiContext().getUtilitiesService().getVisibilityRuleService()); InputStream resource = new FileInputStream(file); System.out.println("Mime Type of " + file.getName() + " is " + new MimetypesFileTypeMap().getContentType(file)); @@ -169,7 +163,7 @@ public class DMPs extends BaseController { @RequestMapping(method = RequestMethod.GET, value = {"/getPDF/{id}"}) public @ResponseBody ResponseEntity getPDFDocument(@PathVariable String id) throws IllegalAccessException, IOException, InstantiationException, InterruptedException { - File file = new DataManagementPlanManager().getWordDocument(this.environment, this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, this.getApiContext().getUtilitiesService().getVisibilityRuleService()); + File file = this.dataManagementPlanManager.getWordDocument(this.environment, this.getApiContext().getOperationsContext().getDatabaseRepository().getDmpDao(), id, this.getApiContext().getUtilitiesService().getVisibilityRuleService()); File pdffile = new DatasetManager().convertToPDF(file, environment, file.getName()); InputStream resource = new FileInputStream(pdffile); System.out.println("Mime Type of " + file.getName() + " is " + diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java index 8de44dc13..b884e5289 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java @@ -36,6 +36,7 @@ import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.json.JSONObject; import org.springframework.core.env.Environment; import org.springframework.http.*; +import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -48,6 +49,7 @@ import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; +@Component public class DataManagementPlanManager { public DataTableData getPaged(ApiContext apiContext, DataManagementPlanTableRequest dataManagementPlanTableRequest, Principal principal) throws Exception { @@ -208,7 +210,7 @@ public class DataManagementPlanManager { return result; } - public static void createOrUpdate(ApiContext apiContext, DataManagementPlan dataManagementPlan, Principal principal) throws Exception { + public void createOrUpdate(ApiContext apiContext, DataManagementPlan dataManagementPlan, Principal principal) throws Exception { DMP newDmp = dataManagementPlan.toDataModel(); createOrganisationsIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getOrganisationDao()); createResearchersIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao()); @@ -226,7 +228,7 @@ public class DataManagementPlanManager { assignUser(newDmp, user, apiContext); } - public static void assignUser(DMP dmp, UserInfo userInfo, ApiContext apiContext) { + public void assignUser(DMP dmp, UserInfo userInfo, ApiContext apiContext) { UserDMP userDMP = new UserDMP(); userDMP.setDmp(dmp); userDMP.setUser(userInfo); @@ -234,7 +236,7 @@ public class DataManagementPlanManager { apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().createOrUpdate(userDMP); } - public static void newVersion(ApiContext apiContext, UUID uuid, DataManagementPlanNewVersionModel dataManagementPlan, Principal principal) throws Exception { + public void newVersion(ApiContext apiContext, UUID uuid, DataManagementPlanNewVersionModel dataManagementPlan, Principal principal) throws Exception { DMP oldDmp = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(uuid); DMP newDmp = dataManagementPlan.toDataModel(); createOrganisationsIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getOrganisationDao()); @@ -249,7 +251,7 @@ public class DataManagementPlanManager { copyDatasets(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao()); } - public static void clone(ApiContext apiContext, UUID uuid, DataManagementPlanNewVersionModel dataManagementPlan, Principal principal) throws Exception { + public void clone(ApiContext apiContext, UUID uuid, DataManagementPlanNewVersionModel dataManagementPlan, Principal principal) throws Exception { DMP newDmp = dataManagementPlan.toDataModel(); createOrganisationsIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getOrganisationDao()); createResearchersIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao()); @@ -263,7 +265,7 @@ public class DataManagementPlanManager { copyDatasets(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao()); } - public static void delete(ApiContext apiContext, UUID uuid) throws DMPWithDatasetsDeleteException { + public void delete(ApiContext apiContext, UUID uuid) throws DMPWithDatasetsDeleteException { DMP oldDmp = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(uuid); if (oldDmp.getDataset().size() > 0) throw new DMPWithDatasetsDeleteException("You cannot Remove Datamanagement Plan with Datasets"); @@ -271,7 +273,7 @@ public class DataManagementPlanManager { apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(oldDmp); } - private static void createResearchersIfTheyDontExist(DMP newDmp, ResearcherDao researcherRepository) { + private void createResearchersIfTheyDontExist(DMP newDmp, ResearcherDao researcherRepository) { if (newDmp.getResearchers() != null && !newDmp.getResearchers().isEmpty()) { for (eu.eudat.data.entities.Researcher researcher : newDmp.getResearchers()) { ResearcherCriteria criteria = new ResearcherCriteria(); @@ -283,7 +285,7 @@ public class DataManagementPlanManager { } } - private static void createOrganisationsIfTheyDontExist(DMP newDmp, OrganisationDao organisationRepository) { + private void createOrganisationsIfTheyDontExist(DMP newDmp, OrganisationDao organisationRepository) { if (newDmp.getOrganisations() != null && !newDmp.getOrganisations().isEmpty()) { for (eu.eudat.data.entities.Organisation organisation : newDmp.getOrganisations()) { OrganisationCriteria criteria = new OrganisationCriteria(); @@ -295,7 +297,7 @@ public class DataManagementPlanManager { } } - private static void createProjectIfItDoesntExist(DMP newDmp, ProjectDao projectDao, UserInfo userInfo) { + private void createProjectIfItDoesntExist(DMP newDmp, ProjectDao projectDao, UserInfo userInfo) { if (newDmp.getProject() != null) { Project project = newDmp.getProject(); ProjectCriteria criteria = new ProjectCriteria(); @@ -310,7 +312,7 @@ public class DataManagementPlanManager { } - private static void copyDatasets(DMP newDmp, DatasetDao datasetDao) { + private void copyDatasets(DMP newDmp, DatasetDao datasetDao) { List> futures = new LinkedList<>(); for (Dataset dataset : newDmp.getDataset()) { datasetDao.asQueryable().withHint(HintedModelFactory.getHint(DatasetListingModel.class)).where((builder, root) -> builder.equal(root.get("id"), dataset.getId())).getSingleAsync() diff --git a/dmp-frontend/src/app/core/services/dmp/dmp.service.ts b/dmp-frontend/src/app/core/services/dmp/dmp.service.ts index 78df66786..03b397454 100644 --- a/dmp-frontend/src/app/core/services/dmp/dmp.service.ts +++ b/dmp-frontend/src/app/core/services/dmp/dmp.service.ts @@ -24,18 +24,18 @@ export class DmpService { } getPaged(dataTableRequest: DataTableRequest): Observable> { - return this.http.post>(this.actionUrl + 'getPaged', dataTableRequest, { headers: this.headers }); + return this.http.post>(this.actionUrl + 'paged', dataTableRequest, { headers: this.headers }); } getSingle(id: String): Observable { - return this.http.get(this.actionUrl + 'getSingle/' + id, { headers: this.headers }); + return this.http.get(this.actionUrl + id, { headers: this.headers }); //'getSingle/' + } unlock(id: String): Observable { return this.http.get(this.actionUrl + id + '/unlock', { headers: this.headers }); } createDmp(dataManagementPlanModel: DmpModel): Observable { - return this.http.post(this.actionUrl + 'createOrUpdate', dataManagementPlanModel, { headers: this.headers }); + return this.http.post(this.actionUrl + 'post', dataManagementPlanModel, { headers: this.headers }); } inactivate(id: String): Observable { @@ -55,17 +55,13 @@ export class DmpService { } delete(id: String): Observable { - return this.http.delete(this.actionUrl + 'delete/' + id, { headers: this.headers }); + return this.http.delete(this.actionUrl + id, { headers: this.headers }); // + 'delete/' } getDynamicField(requestItem: RequestItem): any { return this.http.post(this.actionUrl + 'dynamic', requestItem, { headers: this.headers }); } - get(requestItem: RequestItem): Observable { - return this.http.post(this.actionUrl + 'get', requestItem, { headers: this.headers }); - } - public downloadXML(id: string): Observable> { return this.httpClient.get(this.actionUrl + 'getXml/' + id, { responseType: 'blob', observe: 'response' }); } diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts index cd694c24e..a583480ca 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts @@ -25,6 +25,8 @@ import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCru import { DatasetDescriptionFormEditorModel } from '../../misc/dataset-description-form/dataset-description-form.model'; import { DatasetWizardEditorModel } from './dataset-wizard-editor.model'; import { SnackBarNotificationLevel, UiNotificationService } from '../../../core/services/notification/ui-notification-service'; +import { ConfirmationDialogComponent } from '../../../library/confirmation-dialog/confirmation-dialog.component'; +import { DataTableRequest } from '../../../core/model/data-table/data-table-request'; @Component({ selector: 'app-dataset-wizard-component', @@ -206,15 +208,17 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr .pipe(takeUntil(this._destroyed)) .subscribe((params: Params) => { const itemId = params['id']; - if (itemId != null) { setTimeout(()=> this.stepper.selectedIndex = 2); } + if (itemId != null) { setTimeout(() => this.stepper.selectedIndex = 2); } }); } searchDmp(query: string): Observable { - const dmpRequestItem: RequestItem = new RequestItem(); - dmpRequestItem.criteria = new DmpCriteria(); - dmpRequestItem.criteria.like = query; - return this.dmpService.get(dmpRequestItem); + const fields: Array = new Array(); + fields.push('asc'); + const dmpDataTableRequest: DataTableRequest = new DataTableRequest(0, null, { fields: fields }); + dmpDataTableRequest.criteria = new DmpCriteria(); + dmpDataTableRequest.criteria.like = query; + return this.dmpService.getPaged(dmpDataTableRequest).map(x => x.data); } loadDatasetProfiles() { @@ -235,7 +239,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr } getDefinition() { - if (this.formGroup.invalid) { setTimeout(()=> this.stepper.selectedIndex = 0); return; } + if (this.formGroup.invalid) { setTimeout(() => this.stepper.selectedIndex = 0); return; } if (this.isNew) { this.datasetWizardService.getDefinition(this.formGroup.get('profile').value) .pipe(takeUntil(this._destroyed)) @@ -261,17 +265,17 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr this.datasetWizardService.createDataset(this.formGroup.value) .pipe(takeUntil(this._destroyed)) .subscribe( - complete => { - this.datasetWizardService.getSingle(complete.id) - .pipe(takeUntil(this._destroyed)) - .subscribe( - result => { - this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(result); - } - ); - this.onCallbackSuccess(); - }, - error => this.onCallbackError(error) + complete => { + this.datasetWizardService.getSingle(complete.id) + .pipe(takeUntil(this._destroyed)) + .subscribe( + result => { + this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(result); + } + ); + this.onCallbackSuccess(); + }, + error => this.onCallbackError(error) ); } @@ -387,25 +391,23 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr } openConfirm(dmpLabel, id): void { - // this._dialogService.openConfirm({ - // message: 'Are you sure you want to delete the "' + dmpLabel + '"', - // disableClose: true || false, - // viewContainerRef: this._viewContainerRef, - // title: 'Confirm', - // cancelButton: 'No', - // acceptButton: 'Yes' - // }).afterClosed() - // .pipe(takeUntil(this._destroyed)) - // .subscribe((accept: boolean) => { - // if (accept) { - // this.datasetWizardService.delete(id) - // .pipe(takeUntil(this._destroyed)) - // .subscribe(() => { - // this.router.navigate(['/datasets']); - // }); - // } else { - // // DO SOMETHING ELSE - // } - // }); + const dialogRef = this.dialog.open(ConfirmationDialogComponent, { + maxWidth: '300px', + data: { + message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'), + confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'), + cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL') + } + }); + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { + if (result) { + this.datasetWizardService.delete(id) + .pipe(takeUntil(this._destroyed)) + .subscribe( + complete => { this.onCallbackSuccess() }, + error => this.onCallbackError(error) + ); + } + }); } }