Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring
# Conflicts: # dmp-backend/core/src/main/java/eu/eudat/audit/AuditableAction.java
This commit is contained in:
commit
0c1509a1a1
|
@ -20,9 +20,16 @@ public class AuditableAction {
|
||||||
|
|
||||||
public static final EventId EntityDoi_Delete = new EventId(2003, "EntityDoi_Delete");
|
public static final EventId EntityDoi_Delete = new EventId(2003, "EntityDoi_Delete");
|
||||||
|
|
||||||
public static final EventId User_Settings_Query = new EventId(3000, "User_Settings_Query");
|
public static final EventId DmpBlueprint_Query = new EventId(3000, "DmpBlueprint_Query");
|
||||||
public static final EventId User_Settings_Lookup = new EventId(3001, "User_Settings_Lookup");
|
|
||||||
public static final EventId User_Settings_Persist = new EventId(3002, "User_Settings_Persist");
|
|
||||||
public static final EventId User_Settings_Delete = new EventId(3003, "User_Settings_Delete");
|
|
||||||
|
|
||||||
|
public static final EventId DmpBlueprint_Lookup = new EventId(3001, "DmpBlueprint_Lookup");
|
||||||
|
|
||||||
|
public static final EventId DmpBlueprint_Persist = new EventId(3002, "DmpBlueprint_Persist");
|
||||||
|
|
||||||
|
public static final EventId DmpBlueprint_Delete = new EventId(3003, "DmpBlueprint_Delete");
|
||||||
|
|
||||||
|
public static final EventId User_Settings_Query = new EventId(4000, "User_Settings_Query");
|
||||||
|
public static final EventId User_Settings_Lookup = new EventId(4001, "User_Settings_Lookup");
|
||||||
|
public static final EventId User_Settings_Persist = new EventId(4002, "User_Settings_Persist");
|
||||||
|
public static final EventId User_Settings_Delete = new EventId(4003, "User_Settings_Delete");
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
package eu.eudat.query.lookup;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DmpBlueprintStatus;
|
||||||
|
import eu.eudat.commons.enums.IsActive;
|
||||||
|
import eu.eudat.query.DmpBlueprintQuery;
|
||||||
|
import gr.cite.tools.data.query.Lookup;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class DmpBlueprintLookup extends Lookup {
|
||||||
|
|
||||||
|
private String like;
|
||||||
|
|
||||||
|
private List<IsActive> isActive;
|
||||||
|
|
||||||
|
private List<DmpBlueprintStatus> statuses;
|
||||||
|
|
||||||
|
private List<UUID> ids;
|
||||||
|
|
||||||
|
private List<UUID> excludedIds;
|
||||||
|
|
||||||
|
public String getLike() {
|
||||||
|
return like;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLike(String like) {
|
||||||
|
this.like = like;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<IsActive> getIsActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsActive(List<IsActive> isActive) {
|
||||||
|
this.isActive = isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<UUID> getIds() {
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIds(List<UUID> ids) {
|
||||||
|
this.ids = ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<UUID> getExcludedIds() {
|
||||||
|
return excludedIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExcludedIds(List<UUID> excludeIds) {
|
||||||
|
this.excludedIds = excludeIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpBlueprintQuery enrich(QueryFactory queryFactory) {
|
||||||
|
DmpBlueprintQuery query = queryFactory.query(DmpBlueprintQuery.class);
|
||||||
|
if (this.like != null) query.like(this.like);
|
||||||
|
if (this.isActive != null) query.isActive(this.isActive);
|
||||||
|
if (this.statuses != null) query.statuses(this.statuses);
|
||||||
|
if (this.ids != null) query.ids(this.ids);
|
||||||
|
if (this.excludedIds != null) query.excludedIds(this.excludedIds);
|
||||||
|
|
||||||
|
this.enrichCommon(query);
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package eu.eudat.service.dmpblueprint;
|
||||||
|
|
||||||
|
import eu.eudat.model.DmpBlueprint;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.exception.MyForbiddenException;
|
||||||
|
import gr.cite.tools.exception.MyNotFoundException;
|
||||||
|
import gr.cite.tools.exception.MyValidationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
|
||||||
|
import javax.management.InvalidApplicationException;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public interface DmpBlueprintService {
|
||||||
|
|
||||||
|
// DmpBlueprint persist(DmpBlueprintPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException;
|
||||||
|
|
||||||
|
void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,129 @@
|
||||||
|
package eu.eudat.service.dmpblueprint;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.authorization.Permission;
|
||||||
|
import eu.eudat.commons.JsonHandlingService;
|
||||||
|
import eu.eudat.commons.enums.IsActive;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
import eu.eudat.event.EventBroker;
|
||||||
|
import eu.eudat.model.DmpBlueprint;
|
||||||
|
import eu.eudat.model.builder.DmpBlueprintBuilder;
|
||||||
|
import eu.eudat.model.deleter.DmpBlueprintDeleter;
|
||||||
|
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.data.deleter.DeleterFactory;
|
||||||
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.exception.MyForbiddenException;
|
||||||
|
import gr.cite.tools.exception.MyNotFoundException;
|
||||||
|
import gr.cite.tools.exception.MyValidationException;
|
||||||
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
|
import jakarta.persistence.EntityManager;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.management.InvalidApplicationException;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
||||||
|
|
||||||
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpBlueprintServiceImpl.class));
|
||||||
|
|
||||||
|
private final EntityManager entityManager;
|
||||||
|
|
||||||
|
private final AuthorizationService authorizationService;
|
||||||
|
|
||||||
|
private final DeleterFactory deleterFactory;
|
||||||
|
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
|
||||||
|
private final ConventionService conventionService;
|
||||||
|
|
||||||
|
private final ErrorThesaurusProperties errors;
|
||||||
|
|
||||||
|
private final MessageSource messageSource;
|
||||||
|
|
||||||
|
private final EventBroker eventBroker;
|
||||||
|
|
||||||
|
private final QueryFactory queryFactory;
|
||||||
|
|
||||||
|
private final JsonHandlingService jsonHandlingService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public DmpBlueprintServiceImpl(
|
||||||
|
EntityManager entityManager,
|
||||||
|
AuthorizationService authorizationService,
|
||||||
|
DeleterFactory deleterFactory,
|
||||||
|
BuilderFactory builderFactory,
|
||||||
|
ConventionService conventionService,
|
||||||
|
ErrorThesaurusProperties errors,
|
||||||
|
MessageSource messageSource,
|
||||||
|
EventBroker eventBroker,
|
||||||
|
QueryFactory queryFactory,
|
||||||
|
JsonHandlingService jsonHandlingService) {
|
||||||
|
this.entityManager = entityManager;
|
||||||
|
this.authorizationService = authorizationService;
|
||||||
|
this.deleterFactory = deleterFactory;
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
this.conventionService = conventionService;
|
||||||
|
this.errors = errors;
|
||||||
|
this.messageSource = messageSource;
|
||||||
|
this.eventBroker = eventBroker;
|
||||||
|
this.queryFactory = queryFactory;
|
||||||
|
this.jsonHandlingService = jsonHandlingService;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public DmpBlueprint persist(DmpBlueprintPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException {
|
||||||
|
// logger.debug(new MapLogEntry("persisting data dmpBlueprint").And("model", model).And("fields", fields));
|
||||||
|
//
|
||||||
|
// this.authorizationService.authorizeForce(Permission.EditDmpBlueprint);
|
||||||
|
//
|
||||||
|
// Boolean isUpdate = this.conventionService.isValidGuid(model.getId());
|
||||||
|
//
|
||||||
|
// DmpBlueprintEntity data;
|
||||||
|
// if (isUpdate) {
|
||||||
|
// data = this.entityManager.find(DmpBlueprintEntity.class, model.getId());
|
||||||
|
// if (data == null)
|
||||||
|
// throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
|
// } else {
|
||||||
|
// data = new DmpBlueprintEntity();
|
||||||
|
// data.setId(UUID.randomUUID());
|
||||||
|
// data.setIsActive(IsActive.Active);
|
||||||
|
// data.setCreatedAt(Instant.now());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// data.setName(model.getName());
|
||||||
|
// data.setStatus(model.getStatus());
|
||||||
|
// data.setUpdatedAt(Instant.now());
|
||||||
|
// if (isUpdate)
|
||||||
|
// this.entityManager.merge(data);
|
||||||
|
// else
|
||||||
|
// this.entityManager.persist(data);
|
||||||
|
//
|
||||||
|
// this.entityManager.flush();
|
||||||
|
//
|
||||||
|
// this.eventBroker.emit(new DmpBlueprintTouchedEvent(data.getId()));
|
||||||
|
// return this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(BaseFieldSet.build(fields, DmpBlueprint._id), data);
|
||||||
|
// }
|
||||||
|
|
||||||
|
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException {
|
||||||
|
logger.debug("deleting dataset: {}", id);
|
||||||
|
|
||||||
|
this.authorizationService.authorizeForce(Permission.DeleteDmpBlueprint);
|
||||||
|
|
||||||
|
this.deleterFactory.deleter(DmpBlueprintDeleter.class).deleteAndSaveByIds(List.of(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,130 +1,128 @@
|
||||||
//package eu.eudat.controllers.v2;
|
package eu.eudat.controllers.v2;
|
||||||
//
|
|
||||||
//import eu.eudat.audit.AuditableAction;
|
import eu.eudat.audit.AuditableAction;
|
||||||
//import eu.eudat.authorization.AuthorizationFlags;
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
//import eu.eudat.data.DescriptionTemplateTypeEntity;
|
import eu.eudat.data.DmpBlueprintEntity;
|
||||||
//import eu.eudat.model.DmpBlueprint;
|
import eu.eudat.model.DmpBlueprint;
|
||||||
//import eu.eudat.model.builder.DescriptionTemplateTypeBuilder;
|
import eu.eudat.model.builder.DmpBlueprintBuilder;
|
||||||
//import eu.eudat.model.censorship.DescriptionTemplateTypeCensor;
|
import eu.eudat.model.censorship.DmpBlueprintCensor;
|
||||||
//import eu.eudat.model.persist.DescriptionTemplateTypePersist;
|
import eu.eudat.model.result.QueryResult;
|
||||||
//import eu.eudat.model.result.QueryResult;
|
import eu.eudat.query.DmpBlueprintQuery;
|
||||||
//import eu.eudat.query.DescriptionTemplateTypeQuery;
|
import eu.eudat.query.lookup.DmpBlueprintLookup;
|
||||||
//import eu.eudat.query.lookup.DescriptionTemplateTypeLookup;
|
import eu.eudat.service.dmpblueprint.DmpBlueprintService;
|
||||||
//import eu.eudat.service.DescriptionTemplateTypeService;
|
import gr.cite.tools.auditing.AuditService;
|
||||||
//import gr.cite.tools.auditing.AuditService;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
//import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.censor.CensorFactory;
|
||||||
//import gr.cite.tools.data.censor.CensorFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
//import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
//import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyForbiddenException;
|
||||||
//import gr.cite.tools.exception.MyForbiddenException;
|
import gr.cite.tools.exception.MyNotFoundException;
|
||||||
//import gr.cite.tools.exception.MyNotFoundException;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
//import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
//import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
//import gr.cite.tools.logging.MapLogEntry;
|
import jakarta.transaction.Transactional;
|
||||||
//import gr.cite.tools.validation.MyValidate;
|
import org.slf4j.LoggerFactory;
|
||||||
//import org.slf4j.LoggerFactory;
|
import org.springframework.context.MessageSource;
|
||||||
//import org.springframework.context.MessageSource;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
//import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.web.bind.annotation.*;
|
||||||
//import org.springframework.transaction.annotation.Transactional;
|
|
||||||
//import org.springframework.web.bind.annotation.*;
|
import javax.management.InvalidApplicationException;
|
||||||
//
|
import java.util.*;
|
||||||
//import javax.management.InvalidApplicationException;
|
|
||||||
//import java.util.*;
|
@RestController
|
||||||
//
|
@CrossOrigin
|
||||||
//@RestController
|
@RequestMapping(path = "api/dmp-blueprint")
|
||||||
//@CrossOrigin
|
public class DmpBlueprintController {
|
||||||
//@RequestMapping(path = "api/dmp-blueprint")
|
|
||||||
//public class DmpBlueprintController {
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpBlueprintController.class));
|
||||||
//
|
|
||||||
// private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpBlueprintController.class));
|
private final BuilderFactory builderFactory;
|
||||||
//
|
|
||||||
// private final BuilderFactory builderFactory;
|
private final AuditService auditService;
|
||||||
//
|
|
||||||
// private final AuditService auditService;
|
private final DmpBlueprintService dmpBlueprintService;
|
||||||
//
|
|
||||||
// private final DescriptionTemplateTypeService descriptionTemplateTypeService;
|
private final CensorFactory censorFactory;
|
||||||
//
|
|
||||||
// private final CensorFactory censorFactory;
|
private final QueryFactory queryFactory;
|
||||||
//
|
|
||||||
// private final QueryFactory queryFactory;
|
private final MessageSource messageSource;
|
||||||
//
|
|
||||||
// private final MessageSource messageSource;
|
public DmpBlueprintController(
|
||||||
//
|
BuilderFactory builderFactory,
|
||||||
// public DmpBlueprintController(
|
AuditService auditService,
|
||||||
// BuilderFactory builderFactory,
|
DmpBlueprintService dmpBlueprintService,
|
||||||
// AuditService auditService,
|
CensorFactory censorFactory,
|
||||||
// DescriptionTemplateTypeService descriptionTemplateTypeService,
|
QueryFactory queryFactory,
|
||||||
// CensorFactory censorFactory,
|
MessageSource messageSource) {
|
||||||
// QueryFactory queryFactory,
|
this.builderFactory = builderFactory;
|
||||||
// MessageSource messageSource) {
|
this.auditService = auditService;
|
||||||
// this.builderFactory = builderFactory;
|
this.dmpBlueprintService = dmpBlueprintService;
|
||||||
// this.auditService = auditService;
|
this.censorFactory = censorFactory;
|
||||||
// this.descriptionTemplateTypeService = descriptionTemplateTypeService;
|
this.queryFactory = queryFactory;
|
||||||
// this.censorFactory = censorFactory;
|
this.messageSource = messageSource;
|
||||||
// this.queryFactory = queryFactory;
|
}
|
||||||
// this.messageSource = messageSource;
|
|
||||||
// }
|
@PostMapping("query")
|
||||||
//
|
public QueryResult<DmpBlueprint> Query(@RequestBody DmpBlueprintLookup lookup) throws MyApplicationException, MyForbiddenException {
|
||||||
// @PostMapping("query")
|
logger.debug("querying {}", DmpBlueprint.class.getSimpleName());
|
||||||
// public QueryResult<DmpBlueprint> Query(@RequestBody DescriptionTemplateTypeLookup lookup) throws MyApplicationException, MyForbiddenException {
|
|
||||||
// logger.debug("querying {}", DmpBlueprint.class.getSimpleName());
|
this.censorFactory.censor(DmpBlueprintCensor.class).censor(lookup.getProject(), null);
|
||||||
//
|
|
||||||
// this.censorFactory.censor(DescriptionTemplateTypeCensor.class).censor(lookup.getProject(), null);
|
DmpBlueprintQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrPermission);
|
||||||
//
|
|
||||||
// DescriptionTemplateTypeQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrPermission);
|
List<DmpBlueprintEntity> data = query.collectAs(lookup.getProject());
|
||||||
//
|
List<DmpBlueprint> models = this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(lookup.getProject(), data);
|
||||||
// List<DescriptionTemplateTypeEntity> data = query.collectAs(lookup.getProject());
|
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||||
// List<DmpBlueprint> models = this.builderFactory.builder(DescriptionTemplateTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(lookup.getProject(), data);
|
|
||||||
// long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
this.auditService.track(AuditableAction.DmpBlueprint_Query, "lookup", lookup);
|
||||||
//
|
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
||||||
// this.auditService.track(AuditableAction.DescriptionTemplateType_Query, "lookup", lookup);
|
|
||||||
// //this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
return new QueryResult<>(models, count);
|
||||||
//
|
}
|
||||||
// return new QueryResult<>(models, count);
|
|
||||||
// }
|
@GetMapping("{id}")
|
||||||
//
|
public DmpBlueprint Get(@PathVariable("id") UUID id, FieldSet fieldSet, Locale locale) throws MyApplicationException, MyForbiddenException, MyNotFoundException {
|
||||||
// @GetMapping("{id}")
|
logger.debug(new MapLogEntry("retrieving" + DmpBlueprint.class.getSimpleName()).And("id", id).And("fields", fieldSet));
|
||||||
// public DmpBlueprint Get(@PathVariable("id") UUID id, FieldSet fieldSet, Locale locale) throws MyApplicationException, MyForbiddenException, MyNotFoundException {
|
|
||||||
// logger.debug(new MapLogEntry("retrieving" + DmpBlueprint.class.getSimpleName()).And("id", id).And("fields", fieldSet));
|
this.censorFactory.censor(DmpBlueprintCensor.class).censor(fieldSet, null);
|
||||||
//
|
|
||||||
// this.censorFactory.censor(DescriptionTemplateTypeCensor.class).censor(fieldSet, null);
|
DmpBlueprintQuery query = this.queryFactory.query(DmpBlueprintQuery.class).authorize(AuthorizationFlags.OwnerOrPermission).ids(id);
|
||||||
//
|
DmpBlueprint model = this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||||
// DescriptionTemplateTypeQuery query = this.queryFactory.query(DescriptionTemplateTypeQuery.class).authorize(AuthorizationFlags.OwnerOrPermission).ids(id);
|
if (model == null)
|
||||||
// DmpBlueprint model = this.builderFactory.builder(DescriptionTemplateTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||||
// if (model == null)
|
|
||||||
// throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
this.auditService.track(AuditableAction.DmpBlueprint_Lookup, Map.ofEntries(
|
||||||
//
|
new AbstractMap.SimpleEntry<String, Object>("id", id),
|
||||||
// this.auditService.track(AuditableAction.DescriptionTemplateType_Lookup, Map.ofEntries(
|
new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
||||||
// new AbstractMap.SimpleEntry<String, Object>("id", id),
|
));
|
||||||
// new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
||||||
// ));
|
|
||||||
// //this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
return model;
|
||||||
//
|
}
|
||||||
// return model;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @PostMapping("persist")
|
// @PostMapping("persist")
|
||||||
// @Transactional
|
// @Transactional
|
||||||
// public DmpBlueprint Persist(@MyValidate @RequestBody DescriptionTemplateTypePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException {
|
// public DmpBlueprint Persist(@MyValidate @RequestBody DmpBlueprintPersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException {
|
||||||
// logger.debug(new MapLogEntry("persisting" + DmpBlueprint.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
// logger.debug(new MapLogEntry("persisting" + DmpBlueprint.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
|
||||||
// DmpBlueprint persisted = this.descriptionTemplateTypeService.persist(model, fieldSet);
|
// DmpBlueprint persisted = this.dmpBlueprintService.persist(model, fieldSet);
|
||||||
//
|
//
|
||||||
// this.auditService.track(AuditableAction.DescriptionTemplateType_Persist, Map.ofEntries(
|
// this.auditService.track(AuditableAction.DmpBlueprint_Persist, Map.ofEntries(
|
||||||
// new AbstractMap.SimpleEntry<String, Object>("model", model),
|
// new AbstractMap.SimpleEntry<String, Object>("model", model),
|
||||||
// new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
// new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
|
||||||
// ));
|
// ));
|
||||||
// //this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
// //this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
||||||
// return persisted;
|
// return persisted;
|
||||||
// }
|
// }
|
||||||
//
|
|
||||||
// @DeleteMapping("{id}")
|
@DeleteMapping("{id}")
|
||||||
// @Transactional
|
@Transactional
|
||||||
// public void Delete(@PathVariable("id") UUID id) throws MyForbiddenException, InvalidApplicationException {
|
public void Delete(@PathVariable("id") UUID id) throws MyForbiddenException, InvalidApplicationException {
|
||||||
// logger.debug(new MapLogEntry("retrieving" + DmpBlueprint.class.getSimpleName()).And("id", id));
|
logger.debug(new MapLogEntry("retrieving" + DmpBlueprint.class.getSimpleName()).And("id", id));
|
||||||
//
|
|
||||||
// this.descriptionTemplateTypeService.deleteAndSave(id);
|
this.dmpBlueprintService.deleteAndSave(id);
|
||||||
//
|
|
||||||
// this.auditService.track(AuditableAction.DescriptionTemplateType_Delete, "id", id);
|
this.auditService.track(AuditableAction.DmpBlueprint_Delete, "id", id);
|
||||||
// //this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ export class DmpBlueprintService {
|
||||||
this.actionUrl = configurationService.server + 'dmpprofile/';
|
this.actionUrl = configurationService.server + 'dmpprofile/';
|
||||||
}
|
}
|
||||||
|
|
||||||
private get apiBase(): string { return `${this.configurationService.server}dmpprofile`; }
|
private get apiBase(): string { return `${this.configurationService.server}dmp-blueprint`; }
|
||||||
|
|
||||||
query(q: DmpBlueprintLookup): Observable<QueryResult<DmpBlueprint>> {
|
query(q: DmpBlueprintLookup): Observable<QueryResult<DmpBlueprint>> {
|
||||||
const url = `${this.apiBase}/query`;
|
const url = `${this.apiBase}/query`;
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { DragDropModule } from '@angular/cdk/drag-drop';
|
||||||
import { NgModule } from "@angular/core";
|
import { NgModule } from "@angular/core";
|
||||||
import { AutoCompleteModule } from "@app/library/auto-complete/auto-complete.module";
|
import { AutoCompleteModule } from "@app/library/auto-complete/auto-complete.module";
|
||||||
import { UrlListingModule } from '@app/library/url-listing/url-listing.module';
|
import { UrlListingModule } from '@app/library/url-listing/url-listing.module';
|
||||||
|
import { CommonFormattingModule } from '@common/formatting/common-formatting.module';
|
||||||
import { CommonFormsModule } from '@common/forms/common-forms.module';
|
import { CommonFormsModule } from '@common/forms/common-forms.module';
|
||||||
import { ConfirmationDialogModule } from '@common/modules/confirmation-dialog/confirmation-dialog.module';
|
import { ConfirmationDialogModule } from '@common/modules/confirmation-dialog/confirmation-dialog.module';
|
||||||
import { HybridListingModule } from "@common/modules/hybrid-listing/hybrid-listing.module";
|
import { HybridListingModule } from "@common/modules/hybrid-listing/hybrid-listing.module";
|
||||||
|
@ -29,7 +30,8 @@ import { DmpBlueprintListingFiltersComponent } from "./listing/filters/dmp-bluep
|
||||||
AutoCompleteModule,
|
AutoCompleteModule,
|
||||||
HybridListingModule,
|
HybridListingModule,
|
||||||
TextFilterModule,
|
TextFilterModule,
|
||||||
UserSettingsModule
|
UserSettingsModule,
|
||||||
|
CommonFormattingModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
DmpBlueprintEditorComponent,
|
DmpBlueprintEditorComponent,
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
*ngIf="authService.hasPermission(authService.permissionEnum.EditDescriptionTemplateType)"
|
*ngIf="authService.hasPermission(authService.permissionEnum.EditDescriptionTemplateType)"
|
||||||
[routerLink]="['/dmp-blueprint/new']">
|
[routerLink]="['/dmp-blueprint/new']">
|
||||||
<mat-icon>add</mat-icon>
|
<mat-icon>add</mat-icon>
|
||||||
{{'DMP-BLUEPRINT-LISTING.CREATE-TYPE' | translate}}
|
{{'DMP-BLUEPRINT-LISTING.CREATE-DMP-BLUEPRINT' | translate}}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -97,6 +97,12 @@
|
||||||
<button mat-menu-item [routerLink]="['/dmp-blueprint/' + row.id]">
|
<button mat-menu-item [routerLink]="['/dmp-blueprint/' + row.id]">
|
||||||
<mat-icon>edit</mat-icon>{{'DMP-BLUEPRINT-LISTING.ACTIONS.EDIT' | translate}}
|
<mat-icon>edit</mat-icon>{{'DMP-BLUEPRINT-LISTING.ACTIONS.EDIT' | translate}}
|
||||||
</button>
|
</button>
|
||||||
|
<button mat-menu-item [routerLink]="['/dmp-blueprint/' + row.id]">
|
||||||
|
<mat-icon>edit</mat-icon>{{'DMP-BLUEPRINT-LISTING.ACTIONS.CLONE' | translate}}
|
||||||
|
</button>
|
||||||
|
<button mat-menu-item [routerLink]="['/dmp-blueprint/' + row.id]">
|
||||||
|
<mat-icon>download</mat-icon>{{'DMP-BLUEPRINT-LISTING.ACTIONS.EXPORT' | translate}}
|
||||||
|
</button>
|
||||||
<button mat-menu-item (click)="deleteType(row.id)">
|
<button mat-menu-item (click)="deleteType(row.id)">
|
||||||
<mat-icon>delete</mat-icon>
|
<mat-icon>delete</mat-icon>
|
||||||
{{'DMP-BLUEPRINT-LISTING.ACTIONS.DELETE' | translate}}
|
{{'DMP-BLUEPRINT-LISTING.ACTIONS.DELETE' | translate}}
|
||||||
|
|
|
@ -95,28 +95,28 @@ export class DmpBlueprintListingComponent extends BaseListingComponent<DmpBluepr
|
||||||
this.gridColumns.push(...[{
|
this.gridColumns.push(...[{
|
||||||
prop: nameof<DmpBlueprint>(x => x.label),
|
prop: nameof<DmpBlueprint>(x => x.label),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
languageName: 'DMP-BLUEPRINT.FIELDS.NAME'
|
languageName: 'DMP-BLUEPRINT-LISTING.FIELDS.NAME'
|
||||||
}, {
|
}, {
|
||||||
prop: nameof<DmpBlueprint>(x => x.status),
|
prop: nameof<DmpBlueprint>(x => x.status),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
languageName: 'DMP-BLUEPRINT.FIELDS.STATUS',
|
languageName: 'DMP-BLUEPRINT-LISTING.FIELDS.STATUS',
|
||||||
cellTemplate: this.DmpBlueprintStatus
|
cellTemplate: this.DmpBlueprintStatus
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// prop: nameof<DmpBlueprint>(x => x.isExclude),
|
// prop: nameof<DmpBlueprint>(x => x.isExclude),
|
||||||
// languageName: 'DMP-BLUEPRINT.FIELDS.IS-EXCLUDE',
|
// languageName: 'DMP-BLUEPRINT-LISTING.FIELDS.IS-EXCLUDE',
|
||||||
// pipe: this.pipeService.getPipe<IsExcludeTypePipe>(IsExcludeTypePipe)
|
// pipe: this.pipeService.getPipe<IsExcludeTypePipe>(IsExcludeTypePipe)
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
prop: nameof<DmpBlueprint>(x => x.createdAt),
|
prop: nameof<DmpBlueprint>(x => x.createdAt),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
languageName: 'DMP-BLUEPRINT.FIELDS.CREATED-AT',
|
languageName: 'DMP-BLUEPRINT-LISTING.FIELDS.CREATED-AT',
|
||||||
pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short')
|
pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: nameof<DmpBlueprint>(x => x.updatedAt),
|
prop: nameof<DmpBlueprint>(x => x.updatedAt),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
languageName: 'DMP-BLUEPRINT.FIELDS.UPDATED-AT',
|
languageName: 'DMP-BLUEPRINT-LISTING.FIELDS.UPDATED-AT',
|
||||||
pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short')
|
pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -232,7 +232,10 @@
|
||||||
"HOME":"Board",
|
"HOME":"Board",
|
||||||
"DESCRIPTION-TEMPLATE-TYPES": "Description Types",
|
"DESCRIPTION-TEMPLATE-TYPES": "Description Types",
|
||||||
"NEW-DESCRIPTION-TEMPLATE-TYPE": "New",
|
"NEW-DESCRIPTION-TEMPLATE-TYPE": "New",
|
||||||
"EDIT-DESCRIPTION-TEMPLATE-TYPE": "Edit"
|
"EDIT-DESCRIPTION-TEMPLATE-TYPE": "Edit",
|
||||||
|
"DMP-BLUEPRINTS": "DMP Bluperints",
|
||||||
|
"NEW-DMP-BLUEPRINT": "New",
|
||||||
|
"EDIT-DMP-BLUEPRINT": "Edit"
|
||||||
},
|
},
|
||||||
"COOKIE": {
|
"COOKIE": {
|
||||||
"MESSAGE": "This website uses cookies to enhance the user experience.",
|
"MESSAGE": "This website uses cookies to enhance the user experience.",
|
||||||
|
@ -1262,32 +1265,40 @@
|
||||||
"DMP-BLUEPRINT-LISTING": {
|
"DMP-BLUEPRINT-LISTING": {
|
||||||
"TITLE": "DMP Blueprints",
|
"TITLE": "DMP Blueprints",
|
||||||
"CREATE-DMP-BLUEPRINT": "Create DMP Blueprint",
|
"CREATE-DMP-BLUEPRINT": "Create DMP Blueprint",
|
||||||
"COLUMNS": {
|
"FIELDS": {
|
||||||
"NAME": "Name",
|
"NAME": "Name",
|
||||||
"STATUS": "Status",
|
"STATUS": "Status",
|
||||||
"CREATED": "Created",
|
"UPDATED-AT": "Updated",
|
||||||
"PUBLISHED": "Published",
|
"CREATED-AT": "Created",
|
||||||
"LAST-EDITED": "Last Edited"
|
"PUBLISHED-AT": "Published"
|
||||||
|
},
|
||||||
|
"FILTER": {
|
||||||
|
"TITLE": "Filters",
|
||||||
|
"IS-ACTIVE": "Is Active",
|
||||||
|
"CANCEL": "Cancel",
|
||||||
|
"APPLY-FILTERS": "Apply filters"
|
||||||
|
},
|
||||||
|
"CONFIRM-DELETE-DIALOG":{
|
||||||
|
"MESSAGE": "Would you like to delete this DMP Blueprint?",
|
||||||
|
"CONFIRM-BUTTON": "Yes, delete",
|
||||||
|
"CANCEL-BUTTON": "No"
|
||||||
},
|
},
|
||||||
"ACTIONS": {
|
"ACTIONS": {
|
||||||
|
"DELETE": "Delete",
|
||||||
|
"EDIT":"Edit",
|
||||||
"CLONE": "Clone",
|
"CLONE": "Clone",
|
||||||
"DOWNLOAD-XML":"Download XML",
|
"DOWNLOAD-XML":"Download XML"
|
||||||
"DELETE": "Delete"
|
|
||||||
},
|
},
|
||||||
"UPLOAD": {
|
"IMPORT": {
|
||||||
"UPLOAD-XML": "Import",
|
"UPLOAD-XML": "Import",
|
||||||
"UPLOAD-XML-FILE-TITLE": "Import Data Management Plan Template",
|
"UPLOAD-XML-FILE-TITLE": "Import Data Management Plan Template",
|
||||||
"UPLOAD-XML-NAME": "Name Of DMP Template",
|
"UPLOAD-XML-NAME": "Name Of DMP Template",
|
||||||
"UPLOAD-XML-IMPORT": "File",
|
"UPLOAD-XML-IMPORT": "File",
|
||||||
"UPLOAD-XML-FILE-CANCEL": "Cancel"
|
"UPLOAD-XML-FILE-CANCEL": "Cancel"
|
||||||
},
|
},
|
||||||
"STATUS":{
|
"SUCCESSFUL-DELETE": "Successful Delete",
|
||||||
"DRAFT": "Draft",
|
"UNSUCCESSFUL-DELETE": "This item could not be deleted.",
|
||||||
"FINALIZED": "Finalized"
|
|
||||||
},
|
|
||||||
"MESSAGES":{
|
|
||||||
"TEMPLATE-UPLOAD-SUCCESS":"Template successfully uploaded"
|
"TEMPLATE-UPLOAD-SUCCESS":"Template successfully uploaded"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"DYNAMIC-FORM": {
|
"DYNAMIC-FORM": {
|
||||||
"FIELDS": {
|
"FIELDS": {
|
||||||
|
|
Loading…
Reference in New Issue