Adds Dataset Profile Versioning.
This commit is contained in:
parent
a7f138c1ea
commit
2c51468dfe
|
@ -25,7 +25,6 @@ public class DatasetProfile implements DataEntity<DatasetProfile,UUID> {
|
||||||
private Status(short value) {
|
private Status(short value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public short getValue() {
|
public short getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -60,11 +59,9 @@ public class DatasetProfile implements DataEntity<DatasetProfile,UUID> {
|
||||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
|
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
|
||||||
private String definition;
|
private String definition;
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "\"Status\"", nullable = false)
|
@Column(name = "\"Status\"", nullable = false)
|
||||||
private Short status;
|
private Short status;
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "\"Created\"")
|
@Column(name = "\"Created\"")
|
||||||
@Convert(converter = DateToUTCConverter.class)
|
@Convert(converter = DateToUTCConverter.class)
|
||||||
private Date created;
|
private Date created;
|
||||||
|
@ -76,90 +73,80 @@ public class DatasetProfile implements DataEntity<DatasetProfile,UUID> {
|
||||||
@Column(name = "\"Description\"")
|
@Column(name = "\"Description\"")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
@Column(name = "\"GroupId\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
|
private UUID groupId;
|
||||||
|
|
||||||
|
@Column(name = "\"Version\"", nullable = false)
|
||||||
|
private Short version;
|
||||||
|
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Short getStatus() {
|
public Short getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setStatus(Short status) {
|
public void setStatus(Short status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Date getCreated() {
|
public Date getCreated() {
|
||||||
return created;
|
return created;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setCreated(Date created) {
|
public void setCreated(Date created) {
|
||||||
this.created = created;
|
this.created = created;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Date getModified() {
|
public Date getModified() {
|
||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setModified(Date modified) {
|
public void setModified(Date modified) {
|
||||||
this.modified = modified;
|
this.modified = modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
public void setId(UUID id) { this.id = id;}
|
||||||
public void setId(UUID id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLabel(String label) {
|
public void setLabel(String label) {
|
||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getDefinition() {
|
public String getDefinition() {
|
||||||
return definition;
|
return definition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefinition(String definition) {
|
public void setDefinition(String definition) {
|
||||||
this.definition = definition;
|
this.definition = definition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Set<Dataset> getDataset() {
|
public Set<Dataset> getDataset() {
|
||||||
return dataset;
|
return dataset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataset(Set<Dataset> dataset) {
|
public void setDataset(Set<Dataset> dataset) {
|
||||||
this.dataset = dataset;
|
this.dataset = dataset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UUID getGroupId() { return groupId; }
|
||||||
|
public void setGroupId(UUID groupId) { this.groupId = groupId;}
|
||||||
|
|
||||||
|
public Short getVersion() { return version; }
|
||||||
|
public void setVersion(Short version) { this.version = version; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "DatasetProfileListingModel [id=" + id + ", label=" + label + ", dataset=" + dataset + ", definition=" + definition + "]";
|
return "DatasetProfileListingModel [id=" + id + ", label=" + label + ", dataset=" + dataset + ", definition=" + definition + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(DatasetProfile entity) {
|
public void update(DatasetProfile entity) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,6 +2,7 @@ package eu.eudat.controllers;
|
||||||
|
|
||||||
import eu.eudat.core.logger.Logger;
|
import eu.eudat.core.logger.Logger;
|
||||||
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
|
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
|
||||||
|
import eu.eudat.exceptions.datasetprofile.DatasetProfileNewVersionException;
|
||||||
import eu.eudat.exceptions.datasetprofile.DatasetProfileWithDatasetsExeption;
|
import eu.eudat.exceptions.datasetprofile.DatasetProfileWithDatasetsExeption;
|
||||||
import eu.eudat.logic.managers.AdminManager;
|
import eu.eudat.logic.managers.AdminManager;
|
||||||
import eu.eudat.logic.managers.DatasetProfileManager;
|
import eu.eudat.logic.managers.DatasetProfileManager;
|
||||||
|
@ -67,12 +68,20 @@ public class Admin extends BaseController {
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<UUID>().status(ApiMessageCode.NO_MESSAGE));
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<UUID>().status(ApiMessageCode.NO_MESSAGE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@RequestMapping(method = RequestMethod.POST, value = {"/newVersion/{id}"}, produces = "application/json")
|
||||||
|
public ResponseEntity newVersionDatasetProfile(@PathVariable String id, @RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws Exception {
|
||||||
|
try {
|
||||||
|
eu.eudat.data.entities.DatasetProfile modelDefinition = this.datasetProfileManager.createNewVersionDatasetProfile(id, profile);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(modelDefinition.getId());
|
||||||
|
} catch (DatasetProfileNewVersionException exception) {
|
||||||
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>().status(ApiMessageCode.ERROR_MESSAGE).message(exception.getMessage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = {"/get/{id}"}, produces = "application/json")
|
@RequestMapping(method = RequestMethod.GET, value = {"/get/{id}"}, produces = "application/json")
|
||||||
public ResponseEntity<ResponseItem<DatasetProfile>> get(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
|
public ResponseEntity<ResponseItem<DatasetProfile>> get(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
|
||||||
eu.eudat.data.entities.DatasetProfile profile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
|
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = this.datasetProfileManager.getDatasetProfile(id);
|
||||||
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
|
|
||||||
datasetprofile.setLabel(profile.getLabel());
|
|
||||||
datasetprofile.setStatus(profile.getStatus());
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DatasetProfile>().status(ApiMessageCode.NO_MESSAGE).payload(datasetprofile));
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DatasetProfile>().status(ApiMessageCode.NO_MESSAGE).payload(datasetprofile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +101,7 @@ public class Admin extends BaseController {
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<PagedDatasetProfile>().status(ApiMessageCode.NO_MESSAGE).payload(pagedDatasetProfile));
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<PagedDatasetProfile>().status(ApiMessageCode.NO_MESSAGE).payload(pagedDatasetProfile));
|
||||||
}
|
}
|
||||||
|
|
||||||
@org.springframework.transaction.annotation.Transactional
|
@Transactional
|
||||||
@RequestMapping(method = RequestMethod.POST, value = {"/datasetprofile/clone/{id}"}, consumes = "application/json", produces = "application/json")
|
@RequestMapping(method = RequestMethod.POST, value = {"/datasetprofile/clone/{id}"}, consumes = "application/json", produces = "application/json")
|
||||||
public ResponseEntity<ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>> clone(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
|
public ResponseEntity<ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>> clone(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
|
||||||
eu.eudat.data.entities.DatasetProfile profile = this.datasetProfileManager.clone(id);
|
eu.eudat.data.entities.DatasetProfile profile = this.datasetProfileManager.clone(id);
|
||||||
|
@ -126,7 +135,6 @@ public class Admin extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = {"/upload"})
|
@RequestMapping(method = RequestMethod.POST, value = {"/upload"})
|
||||||
public ResponseEntity<Object> setDatasetProfileXml(@RequestParam("file") MultipartFile file,
|
public ResponseEntity<Object> setDatasetProfileXml(@RequestParam("file") MultipartFile file,
|
||||||
@ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws IllegalAccessException, IOException {
|
@ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws IllegalAccessException, IOException {
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package eu.eudat.exceptions.datasetprofile;
|
||||||
|
|
||||||
|
public class DatasetProfileNewVersionException extends RuntimeException {
|
||||||
|
|
||||||
|
public DatasetProfileNewVersionException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -7,6 +7,7 @@ import eu.eudat.data.dao.entities.DatasetProfileDao;
|
||||||
import eu.eudat.data.entities.DatasetProfile;
|
import eu.eudat.data.entities.DatasetProfile;
|
||||||
import eu.eudat.data.query.items.item.datasetprofile.DatasetProfileAutocompleteRequest;
|
import eu.eudat.data.query.items.item.datasetprofile.DatasetProfileAutocompleteRequest;
|
||||||
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
|
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
|
||||||
|
import eu.eudat.exceptions.datasetprofile.DatasetProfileNewVersionException;
|
||||||
import eu.eudat.logic.builders.model.models.DataTableDataBuilder;
|
import eu.eudat.logic.builders.model.models.DataTableDataBuilder;
|
||||||
import eu.eudat.logic.services.ApiContext;
|
import eu.eudat.logic.services.ApiContext;
|
||||||
import eu.eudat.logic.services.operations.DatabaseRepository;
|
import eu.eudat.logic.services.operations.DatabaseRepository;
|
||||||
|
@ -49,6 +50,15 @@ public class DatasetProfileManager {
|
||||||
this.databaseRepository = apiContext.getOperationsContext().getDatabaseRepository();
|
this.databaseRepository = apiContext.getOperationsContext().getDatabaseRepository();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public eu.eudat.models.data.admin.composite.DatasetProfile getDatasetProfile(String id) {
|
||||||
|
eu.eudat.data.entities.DatasetProfile profile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
|
||||||
|
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
|
||||||
|
datasetprofile.setLabel(profile.getLabel());
|
||||||
|
datasetprofile.setStatus(profile.getStatus());
|
||||||
|
|
||||||
|
return datasetprofile;
|
||||||
|
}
|
||||||
|
|
||||||
public List<DatasetProfileAutocompleteItem> getWithCriteria(DatasetProfileAutocompleteRequest datasetProfileAutocompleteRequest) throws IllegalAccessException, InstantiationException {
|
public List<DatasetProfileAutocompleteItem> getWithCriteria(DatasetProfileAutocompleteRequest datasetProfileAutocompleteRequest) throws IllegalAccessException, InstantiationException {
|
||||||
QueryableList<DatasetProfile> items = databaseRepository.getDatasetProfileDao().getWithCriteria(datasetProfileAutocompleteRequest.getCriteria());
|
QueryableList<DatasetProfile> items = databaseRepository.getDatasetProfileDao().getWithCriteria(datasetProfileAutocompleteRequest.getCriteria());
|
||||||
List<DatasetProfileAutocompleteItem> datasetProfiles = items.select(item -> new DatasetProfileAutocompleteItem().fromDataModel(item));
|
List<DatasetProfileAutocompleteItem> datasetProfiles = items.select(item -> new DatasetProfileAutocompleteItem().fromDataModel(item));
|
||||||
|
@ -104,10 +114,7 @@ public class DatasetProfileManager {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ResponseEntity<byte[]> getDocument(eu.eudat.models.data.user.composite.DatasetProfile datasetProfile, String label) throws IllegalAccessException, IOException, InstantiationException {
|
public ResponseEntity<byte[]> getDocument(eu.eudat.models.data.user.composite.DatasetProfile datasetProfile, String label) throws IllegalAccessException, IOException, InstantiationException {
|
||||||
|
|
||||||
|
|
||||||
FileEnvelope envelope = getXmlDocument(datasetProfile, label);
|
FileEnvelope envelope = getXmlDocument(datasetProfile, label);
|
||||||
InputStream resource = new FileInputStream(envelope.getFile());
|
InputStream resource = new FileInputStream(envelope.getFile());
|
||||||
System.out.println("Mime Type of " + envelope.getFilename() + " is " +
|
System.out.println("Mime Type of " + envelope.getFilename() + " is " +
|
||||||
|
@ -137,7 +144,6 @@ public class DatasetProfileManager {
|
||||||
return fileEnvelope;
|
return fileEnvelope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.DatasetProfile createDatasetProfileFromXml(MultipartFile multiPartFile) {
|
public eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.DatasetProfile createDatasetProfileFromXml(MultipartFile multiPartFile) {
|
||||||
ImportXmlBuilderDatasetProfile xmlBuilder = new ImportXmlBuilderDatasetProfile();
|
ImportXmlBuilderDatasetProfile xmlBuilder = new ImportXmlBuilderDatasetProfile();
|
||||||
try {
|
try {
|
||||||
|
@ -156,4 +162,30 @@ public class DatasetProfileManager {
|
||||||
fos.close();
|
fos.close();
|
||||||
return convFile;
|
return convFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public eu.eudat.data.entities.DatasetProfile createNewVersionDatasetProfile(String id, eu.eudat.models.data.admin.composite.DatasetProfile profile) throws Exception {
|
||||||
|
// Getting the DatasetProfile which we will create its new version.
|
||||||
|
eu.eudat.data.entities.DatasetProfile oldDatasetProfile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
|
||||||
|
|
||||||
|
// Getting the DatasetProfile with the latest Version.
|
||||||
|
DatasetProfileCriteria criteria = new DatasetProfileCriteria();
|
||||||
|
LinkedList<UUID> list = new LinkedList<>();
|
||||||
|
list.push(oldDatasetProfile.getGroupId());
|
||||||
|
criteria.setGroupIds(list);
|
||||||
|
criteria.setAllVersions(false);
|
||||||
|
QueryableList<DatasetProfile> datasetProfileQueryableList = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(criteria);
|
||||||
|
eu.eudat.data.entities.DatasetProfile latestVersionDatasetProfile = datasetProfileQueryableList.getSingle();
|
||||||
|
|
||||||
|
if (latestVersionDatasetProfile.getVersion().equals(oldDatasetProfile.getVersion())){
|
||||||
|
eu.eudat.models.data.admin.composite.DatasetProfile sortedProfile = profile.toShort();
|
||||||
|
eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(sortedProfile, apiContext);
|
||||||
|
modelDefinition.setLabel(oldDatasetProfile.getLabel());
|
||||||
|
modelDefinition.setVersion((short) (oldDatasetProfile.getVersion() + 1));
|
||||||
|
modelDefinition.setGroupId(oldDatasetProfile.getGroupId());
|
||||||
|
apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition);
|
||||||
|
return modelDefinition;
|
||||||
|
} else {
|
||||||
|
throw new DatasetProfileNewVersionException("Version to update not the latest.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,19 +13,16 @@ public class DatasetProfile {
|
||||||
private List<Section> sections;
|
private List<Section> sections;
|
||||||
private List<Page> pages;
|
private List<Page> pages;
|
||||||
private Short status;
|
private Short status;
|
||||||
|
private Short version;
|
||||||
|
|
||||||
public List<Section> getSections() {
|
public List<Section> getSections() {
|
||||||
return sections;
|
return sections;
|
||||||
}
|
}
|
||||||
|
public void setSections(List<Section> sections) { this.sections = sections; }
|
||||||
public void setSections(List<Section> sections) {
|
|
||||||
this.sections = sections;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLabel(String label) {
|
public void setLabel(String label) {
|
||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +30,6 @@ public class DatasetProfile {
|
||||||
public List<Page> getPages() {
|
public List<Page> getPages() {
|
||||||
return pages;
|
return pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPages(List<Page> pages) {
|
public void setPages(List<Page> pages) {
|
||||||
this.pages = pages;
|
this.pages = pages;
|
||||||
}
|
}
|
||||||
|
@ -41,11 +37,13 @@ public class DatasetProfile {
|
||||||
public Short getStatus() {
|
public Short getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(Short status) {
|
public void setStatus(Short status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Short getVersion() { return version; }
|
||||||
|
public void setVersion(Short version) { this.version = version; }
|
||||||
|
|
||||||
public void buildProfile(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewStyle) {
|
public void buildProfile(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewStyle) {
|
||||||
this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class);
|
this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class);
|
||||||
this.pages = new ModelBuilder().fromViewStyleDefinition(viewStyle.getPages(), Page.class);
|
this.pages = new ModelBuilder().fromViewStyleDefinition(viewStyle.getPages(), Page.class);
|
||||||
|
@ -62,6 +60,7 @@ public class DatasetProfile {
|
||||||
shortProfile.setSections(shortSection);
|
shortProfile.setSections(shortSection);
|
||||||
shortProfile.setPages(this.pages);
|
shortProfile.setPages(this.pages);
|
||||||
shortProfile.setStatus(this.status);
|
shortProfile.setStatus(this.status);
|
||||||
|
shortProfile.setVersion(this.version);
|
||||||
return shortProfile;
|
return shortProfile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,21 +10,17 @@ import java.util.UUID;
|
||||||
public class DatasetProfileListingModel implements DataModel<DatasetProfile, DatasetProfileListingModel> {
|
public class DatasetProfileListingModel implements DataModel<DatasetProfile, DatasetProfileListingModel> {
|
||||||
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
private String label;
|
private String label;
|
||||||
|
|
||||||
private Short status;
|
private Short status;
|
||||||
|
|
||||||
private Date created;
|
private Date created;
|
||||||
|
|
||||||
private Date modified = new Date();
|
private Date modified = new Date();
|
||||||
|
|
||||||
private String description;
|
private String description;
|
||||||
|
private Short version;
|
||||||
|
private UUID groupId;
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(UUID id) {
|
public void setId(UUID id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +28,6 @@ public class DatasetProfileListingModel implements DataModel<DatasetProfile, Dat
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLabel(String label) {
|
public void setLabel(String label) {
|
||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +35,6 @@ public class DatasetProfileListingModel implements DataModel<DatasetProfile, Dat
|
||||||
public Short getStatus() {
|
public Short getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(Short status) {
|
public void setStatus(Short status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +42,6 @@ public class DatasetProfileListingModel implements DataModel<DatasetProfile, Dat
|
||||||
public Date getCreated() {
|
public Date getCreated() {
|
||||||
return created;
|
return created;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreated(Date created) {
|
public void setCreated(Date created) {
|
||||||
this.created = created;
|
this.created = created;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +49,6 @@ public class DatasetProfileListingModel implements DataModel<DatasetProfile, Dat
|
||||||
public Date getModified() {
|
public Date getModified() {
|
||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModified(Date modified) {
|
public void setModified(Date modified) {
|
||||||
this.modified = modified;
|
this.modified = modified;
|
||||||
}
|
}
|
||||||
|
@ -64,11 +56,16 @@ public class DatasetProfileListingModel implements DataModel<DatasetProfile, Dat
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Short getVersion() { return version; }
|
||||||
|
public void setVersion(Short version) { this.version = version; }
|
||||||
|
|
||||||
|
public UUID getGroupId() { return groupId; }
|
||||||
|
public void setGroupId(UUID groupId) { this.groupId = groupId; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatasetProfileListingModel fromDataModel(DatasetProfile entity) {
|
public DatasetProfileListingModel fromDataModel(DatasetProfile entity) {
|
||||||
this.id = entity.getId();
|
this.id = entity.getId();
|
||||||
|
@ -77,6 +74,8 @@ public class DatasetProfileListingModel implements DataModel<DatasetProfile, Dat
|
||||||
this.created = entity.getCreated();
|
this.created = entity.getCreated();
|
||||||
this.modified = entity.getModified();
|
this.modified = entity.getModified();
|
||||||
this.description = entity.getDescription();
|
this.description = entity.getDescription();
|
||||||
|
this.version = entity.getVersion();
|
||||||
|
this.groupId = entity.getGroupId();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ export interface DatasetProfile {
|
||||||
sections: Section[];
|
sections: Section[];
|
||||||
pages: Page[];
|
pages: Page[];
|
||||||
status: number;
|
status: number;
|
||||||
|
version: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Page {
|
export interface Page {
|
||||||
|
|
|
@ -2,4 +2,6 @@ import { BaseCriteria } from "../base-criteria";
|
||||||
|
|
||||||
export class DatasetProfileCriteria extends BaseCriteria {
|
export class DatasetProfileCriteria extends BaseCriteria {
|
||||||
public id: String;
|
public id: String;
|
||||||
|
public groupIds: string[];
|
||||||
|
public allVersions: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ export class DatasetProfileService {
|
||||||
constructor(private http: BaseHttpService, private httpClient: HttpClient) {
|
constructor(private http: BaseHttpService, private httpClient: HttpClient) {
|
||||||
this.actionUrl = environment.Server + 'admin/';
|
this.actionUrl = environment.Server + 'admin/';
|
||||||
}
|
}
|
||||||
|
|
||||||
createForm(data) {
|
createForm(data) {
|
||||||
return this.http.post<DatasetProfileEditorModel>(this.actionUrl + 'addDmp', data);
|
return this.http.post<DatasetProfileEditorModel>(this.actionUrl + 'addDmp', data);
|
||||||
}
|
}
|
||||||
|
@ -46,18 +47,20 @@ export class DatasetProfileService {
|
||||||
return this.http.post<DatasetProfile>(this.actionUrl + 'datasetprofile/clone/' + id, {});
|
return this.http.post<DatasetProfile>(this.actionUrl + 'datasetprofile/clone/' + id, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newVersion(id, data) {
|
||||||
|
return this.http.post<DatasetProfileEditorModel>(this.actionUrl + 'newVersion/' + id, data);
|
||||||
|
}
|
||||||
|
|
||||||
delete(id: string, data): Observable<DatasetProfile> {
|
delete(id: string, data): Observable<DatasetProfile> {
|
||||||
//return this.http.post<DatasetProfile>(this.actionUrl + 'addDmp/' + id, data);
|
//return this.http.post<DatasetProfile>(this.actionUrl + 'addDmp/' + id, data);
|
||||||
return this.http.delete<DatasetProfile>(this.actionUrl + id, {});
|
return this.http.delete<DatasetProfile>(this.actionUrl + id, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
downloadXML(id: string): Observable<HttpResponse<Blob>> {
|
||||||
public downloadXML(id: string): Observable<HttpResponse<Blob>> {
|
|
||||||
let headerXml: HttpHeaders = this.headers.set('Content-Type', 'application/xml')
|
let headerXml: HttpHeaders = this.headers.set('Content-Type', 'application/xml')
|
||||||
return this.httpClient.get(this.actionUrl + 'getXml/' + id, { responseType: 'blob', observe: 'response', headers: headerXml });
|
return this.httpClient.get(this.actionUrl + 'getXml/' + id, { responseType: 'blob', observe: 'response', headers: headerXml });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uploadFile(file: FileList, labelSent: string): Observable<DataTableData<DatasetListingModel>> {
|
uploadFile(file: FileList, labelSent: string): Observable<DataTableData<DatasetListingModel>> {
|
||||||
const params = new BaseHttpParams();
|
const params = new BaseHttpParams();
|
||||||
params.interceptorContext = {
|
params.interceptorContext = {
|
||||||
|
|
|
@ -16,6 +16,14 @@ const routes: Routes = [
|
||||||
path: 'clone/:cloneid',
|
path: 'clone/:cloneid',
|
||||||
component: DatasetProfileEditorComponent
|
component: DatasetProfileEditorComponent
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'newversion/:newversionid',
|
||||||
|
component: DatasetProfileEditorComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'versions/:groupId',
|
||||||
|
component: DatasetProfileListingComponent,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: DatasetProfileListingComponent,
|
component: DatasetProfileListingComponent,
|
||||||
|
@ -26,4 +34,4 @@ const routes: Routes = [
|
||||||
imports: [RouterModule.forChild(routes)],
|
imports: [RouterModule.forChild(routes)],
|
||||||
exports: [RouterModule]
|
exports: [RouterModule]
|
||||||
})
|
})
|
||||||
export class DatasetProfileRoutingModule { }
|
export class DatasetProfileRoutingModule { }
|
||||||
|
|
|
@ -11,12 +11,14 @@ export class DatasetProfileEditorModel extends BaseFormModel {
|
||||||
public pages: Array<PageEditorModel> = new Array<PageEditorModel>();
|
public pages: Array<PageEditorModel> = new Array<PageEditorModel>();
|
||||||
public label: string;
|
public label: string;
|
||||||
public status: number;
|
public status: number;
|
||||||
|
public version: number;
|
||||||
|
|
||||||
fromModel(item: DatasetProfile): DatasetProfileEditorModel {
|
fromModel(item: DatasetProfile): DatasetProfileEditorModel {
|
||||||
if (item.sections) { this.sections = item.sections.map(x => new SectionEditorModel().fromModel(x)); }
|
if (item.sections) { this.sections = item.sections.map(x => new SectionEditorModel().fromModel(x)); }
|
||||||
if (item.pages) { this.pages = item.pages.map(x => new PageEditorModel().fromModel(x)); }
|
if (item.pages) { this.pages = item.pages.map(x => new PageEditorModel().fromModel(x)); }
|
||||||
this.label = item.label;
|
this.label = item.label;
|
||||||
this.status = item.status;
|
this.status = item.status;
|
||||||
|
this.version = item.version;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +40,7 @@ export class DatasetProfileEditorModel extends BaseFormModel {
|
||||||
formGroup.addControl('pages', this.formBuilder.array(pagesFormArray));
|
formGroup.addControl('pages', this.formBuilder.array(pagesFormArray));
|
||||||
formGroup.addControl('label', new FormControl(this.label, Validators.required));
|
formGroup.addControl('label', new FormControl(this.label, Validators.required));
|
||||||
formGroup.addControl('status', new FormControl(this.status));
|
formGroup.addControl('status', new FormControl(this.status));
|
||||||
|
formGroup.addControl('version', new FormControl(this.version));
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="container" *ngIf="form" [formGroup]='form' class="dataset-profile-editor">
|
<div class="container" *ngIf="form" [formGroup]='form' class="dataset-profile-editor">
|
||||||
<mat-form-field class="full-width">
|
<mat-form-field class="full-width">
|
||||||
<input matInput formControlName="label"
|
<input matInput formControlName="label" [disabled]="newVersionId"
|
||||||
placeholder="{{'DATASET-PROFILE-EDITOR.FIELDS.DATASET-TITLE' | translate}}" required>
|
placeholder="{{'DATASET-PROFILE-EDITOR.FIELDS.DATASET-TITLE' | translate}}" required>
|
||||||
<mat-error *ngIf="form.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
|
<mat-error *ngIf="form.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
|
||||||
</mat-error>
|
</mat-error>
|
||||||
|
@ -73,4 +73,4 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -31,6 +31,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
||||||
form: FormGroup;
|
form: FormGroup;
|
||||||
previewerFormGroup: FormGroup;
|
previewerFormGroup: FormGroup;
|
||||||
private datasetProfileId: string;
|
private datasetProfileId: string;
|
||||||
|
newVersionId: string;
|
||||||
dataWizardModel: DatasetWizardModel;
|
dataWizardModel: DatasetWizardModel;
|
||||||
@ViewChild('stepper') stepper: MatHorizontalStepper;
|
@ViewChild('stepper') stepper: MatHorizontalStepper;
|
||||||
viewOnly = false;
|
viewOnly = false;
|
||||||
|
@ -53,46 +54,66 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
||||||
this.route.paramMap.pipe(takeUntil(this._destroyed)).subscribe((paramMap: ParamMap) => {
|
this.route.paramMap.pipe(takeUntil(this._destroyed)).subscribe((paramMap: ParamMap) => {
|
||||||
this.datasetProfileId = paramMap.get('id');
|
this.datasetProfileId = paramMap.get('id');
|
||||||
const cloneId = paramMap.get('cloneid');
|
const cloneId = paramMap.get('cloneid');
|
||||||
|
this.newVersionId = paramMap.get('newversionid');
|
||||||
|
|
||||||
if (this.datasetProfileId != null) {
|
if (this.datasetProfileId != null) {
|
||||||
this.isNew = false;
|
this.isNew = false;
|
||||||
this.datasetProfileService.getDatasetProfileById(this.datasetProfileId)
|
this.datasetProfileService.getDatasetProfileById(this.datasetProfileId)
|
||||||
.pipe(map(data => data as DatasetProfile), takeUntil(this._destroyed))
|
.pipe(map(data => data as DatasetProfile), takeUntil(this._destroyed))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
data => {
|
data => {
|
||||||
try {
|
try {
|
||||||
this.dataModel = new DatasetProfileEditorModel().fromModel(data);
|
this.dataModel = new DatasetProfileEditorModel().fromModel(data);
|
||||||
// this.isDeleted = this.masterItem.isActive === IsActive.Inactive;
|
// this.isDeleted = this.masterItem.isActive === IsActive.Inactive;
|
||||||
this.form = this.dataModel.buildForm();
|
this.form = this.dataModel.buildForm();
|
||||||
if (this.dataModel.status === DatasetProfileEnum.FINALIZED) {
|
if (this.dataModel.status === DatasetProfileEnum.FINALIZED) {
|
||||||
this.form.disable();
|
this.form.disable();
|
||||||
this.viewOnly = true;
|
this.viewOnly = true;
|
||||||
}
|
|
||||||
this.prepareForm();
|
|
||||||
} catch {
|
|
||||||
this.logger.error('Could not parse MasterItem: ' + data);
|
|
||||||
this.uiNotificationService.snackBarNotification(this.language.instant('NOTIFICATIONS.DEFAULT.ERROR'), SnackBarNotificationLevel.Error);
|
|
||||||
}
|
}
|
||||||
},
|
this.prepareForm();
|
||||||
error => this.onCallbackError(error)
|
} catch {
|
||||||
|
this.logger.error('Could not parse MasterItem: ' + data);
|
||||||
|
this.uiNotificationService.snackBarNotification(this.language.instant('NOTIFICATIONS.DEFAULT.ERROR'), SnackBarNotificationLevel.Error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error => this.onCallbackError(error)
|
||||||
);
|
);
|
||||||
} else if (cloneId != null) {
|
} else if (cloneId != null) {
|
||||||
this.datasetProfileService.clone(cloneId)
|
this.datasetProfileService.clone(cloneId)
|
||||||
.pipe(map(data => data as DatasetProfile), takeUntil(this._destroyed))
|
.pipe(map(data => data as DatasetProfile), takeUntil(this._destroyed))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
data => {
|
data => {
|
||||||
try {
|
try {
|
||||||
this.dataModel = new DatasetProfileEditorModel().fromModel(data);
|
this.dataModel = new DatasetProfileEditorModel().fromModel(data);
|
||||||
// this.isDeleted = this.masterItem.isActive === IsActive.Inactive;
|
// this.isDeleted = this.masterItem.isActive === IsActive.Inactive;
|
||||||
this.dataModel.status = DatasetProfileEnum.SAVED;
|
this.dataModel.status = DatasetProfileEnum.SAVED;
|
||||||
this.form = this.dataModel.buildForm();
|
this.form = this.dataModel.buildForm();
|
||||||
this.prepareForm();
|
this.prepareForm();
|
||||||
} catch {
|
} catch {
|
||||||
this.logger.error('Could not parse MasterItem: ' + data);
|
this.logger.error('Could not parse MasterItem: ' + data);
|
||||||
this.uiNotificationService.snackBarNotification(this.language.instant('NOTIFICATIONS.DEFAULT.ERROR'), SnackBarNotificationLevel.Error);
|
this.uiNotificationService.snackBarNotification(this.language.instant('NOTIFICATIONS.DEFAULT.ERROR'), SnackBarNotificationLevel.Error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error => this.onCallbackError(error)
|
error => this.onCallbackError(error)
|
||||||
|
);
|
||||||
|
} else if (this.newVersionId != null) {
|
||||||
|
this.datasetProfileService.getDatasetProfileById(this.newVersionId)
|
||||||
|
.pipe(map(data => data as DatasetProfile), takeUntil(this._destroyed))
|
||||||
|
.subscribe(
|
||||||
|
data => {
|
||||||
|
try {
|
||||||
|
this.dataModel = new DatasetProfileEditorModel().fromModel(data);
|
||||||
|
// this.isDeleted = this.masterItem.isActive === IsActive.Inactive;
|
||||||
|
this.form = this.dataModel.buildForm();
|
||||||
|
this.form.get('version').setValue(this.form.get('version').value + 1);
|
||||||
|
this.form.controls['label'].disable();
|
||||||
|
this.prepareForm();
|
||||||
|
} catch {
|
||||||
|
this.logger.error('Could not parse MasterItem: ' + data);
|
||||||
|
this.uiNotificationService.snackBarNotification(this.language.instant('NOTIFICATIONS.DEFAULT.ERROR'), SnackBarNotificationLevel.Error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error => this.onCallbackError(error)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.dataModel = new DatasetProfileEditorModel();
|
this.dataModel = new DatasetProfileEditorModel();
|
||||||
|
@ -155,6 +176,14 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.router.navigate(['/dataset-profiles']);
|
this.router.navigate(['/dataset-profiles']);
|
||||||
});
|
});
|
||||||
|
} else if (this.newVersionId) {
|
||||||
|
this.datasetProfileService.newVersion(this.newVersionId, data)
|
||||||
|
.pipe(takeUntil(this._destroyed))
|
||||||
|
.subscribe(() => {
|
||||||
|
this.router.navigate(['/dataset-profiles']);
|
||||||
|
},
|
||||||
|
error => this.onCallbackErrorNewVersion(error)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
this.form.get('status').setValue(0);
|
this.form.get('status').setValue(0);
|
||||||
data = this.form.value;
|
data = this.form.value;
|
||||||
|
@ -182,6 +211,10 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
||||||
this.router.navigate(['/master-items']);
|
this.router.navigate(['/master-items']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onCallbackErrorNewVersion(errorResponse: HttpErrorResponse) {
|
||||||
|
this.uiNotificationService.snackBarNotification(errorResponse.error.message, SnackBarNotificationLevel.Error);
|
||||||
|
}
|
||||||
|
|
||||||
onCallbackError(errorResponse: HttpErrorResponse) {
|
onCallbackError(errorResponse: HttpErrorResponse) {
|
||||||
// const error: HttpError = this.httpErrorHandlingService.getError(errorResponse);
|
// const error: HttpError = this.httpErrorHandlingService.getError(errorResponse);
|
||||||
// if (error.statusCode === 400) {
|
// if (error.statusCode === 400) {
|
||||||
|
@ -208,18 +241,18 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
||||||
this.datasetProfileService.delete(this.datasetProfileId, this.form.value)
|
this.datasetProfileService.delete(this.datasetProfileId, this.form.value)
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
complete => {
|
complete => {
|
||||||
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DATASET-PROFILE-DELETE'), SnackBarNotificationLevel.Success);
|
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DATASET-PROFILE-DELETE'), SnackBarNotificationLevel.Success);
|
||||||
this.router.navigate(['/dataset-profiles']);
|
this.router.navigate(['/dataset-profiles']);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
this.onCallbackError(error);
|
this.onCallbackError(error);
|
||||||
if (error.error.statusCode == 674) {
|
if (error.error.statusCode == 674) {
|
||||||
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DATASET-PROFILE-DELETE'), SnackBarNotificationLevel.Error);
|
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DATASET-PROFILE-DELETE'), SnackBarNotificationLevel.Error);
|
||||||
} else {
|
} else {
|
||||||
this.uiNotificationService.snackBarNotification(this.language.instant(error.message), SnackBarNotificationLevel.Error);
|
this.uiNotificationService.snackBarNotification(this.language.instant(error.message), SnackBarNotificationLevel.Error);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -29,9 +29,15 @@
|
||||||
<mat-header-cell *matHeaderCellDef>{{'DATASET-PROFILE-LISTING.COLUMNS.ACTIONS' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef>{{'DATASET-PROFILE-LISTING.COLUMNS.ACTIONS' | translate}}</mat-header-cell>
|
||||||
<mat-cell *matCellDef="let row" (click)="$event.stopPropagation()">
|
<mat-cell *matCellDef="let row" (click)="$event.stopPropagation()">
|
||||||
<mat-menu #actionsMenu="matMenu">
|
<mat-menu #actionsMenu="matMenu">
|
||||||
|
<button mat-menu-item (click)="newVersion(row.id, row.label)">
|
||||||
|
<mat-icon>queue</mat-icon>{{'DATASET-PROFILE-LISTING.ACTIONS.NEW-VERSION' | translate}}
|
||||||
|
</button>
|
||||||
<button mat-menu-item (click)="clone(row.id)">
|
<button mat-menu-item (click)="clone(row.id)">
|
||||||
<mat-icon>filter_none</mat-icon>{{'DATASET-PROFILE-LISTING.ACTIONS.CLONE' | translate}}
|
<mat-icon>filter_none</mat-icon>{{'DATASET-PROFILE-LISTING.ACTIONS.CLONE' | translate}}
|
||||||
</button>
|
</button>
|
||||||
|
<button mat-menu-item (click)="viewVersions(row.groupId, row.label)">
|
||||||
|
<mat-icon>library_books</mat-icon>{{'DATASET-PROFILE-LISTING.ACTIONS.VIEW-VERSIONS' | translate}}
|
||||||
|
</button>
|
||||||
<!--<button *ngIf="row.status==1" mat-menu-item (click)="makeItPublic(row.id)"><mat-icon>people_outline</mat-icon>{{'DATASET-LISTING.ACTIONS.MAKE-IT-PUBLIC' | translate}}</button> -->
|
<!--<button *ngIf="row.status==1" mat-menu-item (click)="makeItPublic(row.id)"><mat-icon>people_outline</mat-icon>{{'DATASET-LISTING.ACTIONS.MAKE-IT-PUBLIC' | translate}}</button> -->
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
<button mat-icon-button [matMenuTriggerFor]="actionsMenu">
|
<button mat-icon-button [matMenuTriggerFor]="actionsMenu">
|
||||||
|
|
|
@ -12,6 +12,9 @@ import { DatasetProfileCriteria } from '../../../../core/query/dataset-profile/d
|
||||||
import { DatasetProfileService } from '../../../../core/services/dataset-profile/dataset-profile.service';
|
import { DatasetProfileService } from '../../../../core/services/dataset-profile/dataset-profile.service';
|
||||||
import { DmpService } from '../../../../core/services/dmp/dmp.service';
|
import { DmpService } from '../../../../core/services/dmp/dmp.service';
|
||||||
import { DatasetProfileCriteriaComponent } from './criteria/dataset-profile.component';
|
import { DatasetProfileCriteriaComponent } from './criteria/dataset-profile.component';
|
||||||
|
import { error } from 'selenium-webdriver';
|
||||||
|
import { UiNotificationService, SnackBarNotificationLevel } from '../../../../core/services/notification/ui-notification-service';
|
||||||
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dataset-profile-listing-component',
|
selector: 'app-dataset-profile-listing-component',
|
||||||
|
@ -24,32 +27,45 @@ export class DatasetProfileListingComponent extends BaseComponent implements OnI
|
||||||
@ViewChild(MatSort) sort: MatSort;
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
@ViewChild(DatasetProfileCriteriaComponent) criteria: DatasetProfileCriteriaComponent;
|
@ViewChild(DatasetProfileCriteriaComponent) criteria: DatasetProfileCriteriaComponent;
|
||||||
|
|
||||||
|
|
||||||
dataSource: DatasetDataSource | null;
|
dataSource: DatasetDataSource | null;
|
||||||
displayedColumns: String[] = ['label', 'description', 'created', 'actions'];
|
displayedColumns: String[] = ['label', 'description', 'created', 'actions'];
|
||||||
pageEvent: PageEvent;
|
pageEvent: PageEvent;
|
||||||
titlePrefix: String;
|
titlePrefix: String;
|
||||||
dmpId: String;
|
dmpId: String;
|
||||||
|
itemId: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private datasetService: DatasetProfileService,
|
private datasetService: DatasetProfileService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private dmpService: DmpService
|
private dmpService: DmpService,
|
||||||
|
private language: TranslateService,
|
||||||
|
private uiNotificationService: UiNotificationService
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.params
|
this.route.params
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe((params: Params) => {
|
.subscribe((params: Params) => {
|
||||||
this.dmpId = params['dmpId'];
|
if (params['dmpId']) {
|
||||||
if (this.dmpId != null) { this.setDmpTitle(this.dmpId); }
|
this.dmpId = params['dmpId'];
|
||||||
this.criteria.setCriteria(this.getDefaultCriteria(this.dmpId));
|
if (this.dmpId != null) { this.setDmpTitle(this.dmpId); }
|
||||||
this.refresh();
|
this.criteria.setCriteria(this.getDefaultCriteria());
|
||||||
this.criteria.setRefreshCallback(() => this.refresh());
|
this.refresh();
|
||||||
|
this.criteria.setRefreshCallback(() => this.refresh());
|
||||||
|
} else {
|
||||||
|
this.itemId = params['groupId'];
|
||||||
|
|
||||||
|
if (this.itemId) {
|
||||||
|
const datasetProfileLabel = this.route.snapshot.queryParams.groupLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.criteria.setCriteria(this.getDefaultCriteria());
|
||||||
|
this.refresh();
|
||||||
|
this.criteria.setRefreshCallback(() => this.refresh());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,18 +74,19 @@ export class DatasetProfileListingComponent extends BaseComponent implements OnI
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(data => {
|
.subscribe(data => {
|
||||||
this.titlePrefix = data.label;
|
this.titlePrefix = data.label;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
this.dataSource = new DatasetDataSource(this.datasetService, this._paginator, this.sort, this.criteria);
|
this.dataSource = new DatasetDataSource(this.datasetService, this._paginator, this.sort, this.criteria, this.itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
rowClick(rowId: String) {
|
rowClick(rowId: String) {
|
||||||
this.router.navigate(['dataset-profiles/' + rowId]);
|
this.router.navigate(['dataset-profiles/' + rowId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
getDefaultCriteria(dmpId: String): DatasetProfileCriteria {
|
getDefaultCriteria(): DatasetProfileCriteria {
|
||||||
const defaultCriteria = new DatasetProfileCriteria();
|
const defaultCriteria = new DatasetProfileCriteria();
|
||||||
return defaultCriteria;
|
return defaultCriteria;
|
||||||
}
|
}
|
||||||
|
@ -78,6 +95,14 @@ export class DatasetProfileListingComponent extends BaseComponent implements OnI
|
||||||
this.router.navigate(['dataset-profiles/clone/' + id]);
|
this.router.navigate(['dataset-profiles/clone/' + id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newVersion(id: string, label: string) {
|
||||||
|
this.router.navigate(['dataset-profiles/newversion/' + id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
viewVersions(rowId, rowLabel) {
|
||||||
|
this.router.navigate(['/dataset-profiles/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
|
||||||
|
}
|
||||||
|
|
||||||
// makeItPublic(id: String) {
|
// makeItPublic(id: String) {
|
||||||
// debugger;
|
// debugger;
|
||||||
// this.datasetService.makeDatasetPublic(id).pipe(takeUntil(this._destroyed)).subscribe();
|
// this.datasetService.makeDatasetPublic(id).pipe(takeUntil(this._destroyed)).subscribe();
|
||||||
|
@ -92,7 +117,8 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
|
||||||
private _service: DatasetProfileService,
|
private _service: DatasetProfileService,
|
||||||
private _paginator: MatPaginator,
|
private _paginator: MatPaginator,
|
||||||
private _sort: MatSort,
|
private _sort: MatSort,
|
||||||
private _criteria: DatasetProfileCriteriaComponent
|
private _criteria: DatasetProfileCriteriaComponent,
|
||||||
|
private itemId
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
@ -112,6 +138,10 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
|
||||||
if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; }
|
if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; }
|
||||||
const request = new DataTableRequest<DatasetProfileCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
const request = new DataTableRequest<DatasetProfileCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
||||||
request.criteria = this._criteria.criteria;
|
request.criteria = this._criteria.criteria;
|
||||||
|
if (this.itemId) {
|
||||||
|
request.criteria.groupIds = [this.itemId];
|
||||||
|
request.criteria.allVersions = true;
|
||||||
|
}
|
||||||
return this._service.getPaged(request);
|
return this._service.getPaged(request);
|
||||||
})
|
})
|
||||||
/*.catch((error: any) => {
|
/*.catch((error: any) => {
|
||||||
|
|
Loading…
Reference in New Issue