fix typo (semantics)

This commit is contained in:
Bernaldo Mihasi 2023-05-19 12:34:08 +03:00
parent a3ee9dccda
commit 5e764559cf
25 changed files with 62 additions and 67 deletions

View File

@ -191,9 +191,9 @@ public class Admin extends BaseController {
}
@RequestMapping(method = RequestMethod.GET, value = {"/getSchematics"}, produces = "application/json")
public ResponseEntity<ResponseItem<List<String>>> getSchematics(@RequestParam(value = "query", required = false) String query, @ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) {
List<String> schematics = this.datasetProfileManager.getSchematics(query);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<String>>().status(ApiMessageCode.SUCCESS_MESSAGE).payload(schematics));
@RequestMapping(method = RequestMethod.GET, value = {"/getSemantics"}, produces = "application/json")
public ResponseEntity<ResponseItem<List<String>>> getSemantics(@RequestParam(value = "query", required = false) String query, @ClaimedAuthorities(claims = {ADMIN, DATASET_PROFILE_MANAGER}) Principal principal) {
List<String> semantics = this.datasetProfileManager.getSemantics(query);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<String>>().status(ApiMessageCode.SUCCESS_MESSAGE).payload(semantics));
}
}

View File

@ -31,10 +31,10 @@ public class ManagementController extends BaseController {
}
@Transactional
@RequestMapping(method = RequestMethod.POST, value = {"/addSchematics"})
public ResponseEntity addSchematicsInDatasetProfiles(@ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws Exception {
@RequestMapping(method = RequestMethod.POST, value = {"/addSemantics"})
public ResponseEntity addSemanticsInDatasetProfiles(@ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws Exception {
try {
this.datasetProfileManager.addSchematicsInDatasetProfiles();
this.datasetProfileManager.addSemanticsInDatasetProfiles();
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Void>().status(ApiMessageCode.SUCCESS_MESSAGE));
} catch (Exception exception) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<Void>().status(ApiMessageCode.ERROR_MESSAGE).message(exception.getMessage()));
@ -42,10 +42,10 @@ public class ManagementController extends BaseController {
}
@Transactional
@RequestMapping(method = RequestMethod.POST, value = {"/addRdaInSchematics"})
public ResponseEntity addRdaInSchematicsInDatasetProfiles(@ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws Exception {
@RequestMapping(method = RequestMethod.POST, value = {"/addRdaInSemantics"})
public ResponseEntity addRdaInSemanticsInDatasetProfiles(@ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws Exception {
try {
this.datasetProfileManager.addRdaInSchematicsInDatasetProfiles();
this.datasetProfileManager.addRdaInSemanticsInDatasetProfiles();
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Void>().status(ApiMessageCode.SUCCESS_MESSAGE));
} catch (Exception exception) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<Void>().status(ApiMessageCode.ERROR_MESSAGE).message(exception.getMessage()));

View File

@ -10,7 +10,7 @@ import eu.eudat.data.query.items.item.datasetprofile.DatasetProfileAutocompleteR
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.proxy.config.Schematic;
import eu.eudat.logic.proxy.config.Semantic;
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
import eu.eudat.logic.services.ApiContext;
import eu.eudat.logic.services.operations.DatabaseRepository;
@ -18,7 +18,6 @@ import eu.eudat.logic.utilities.builders.XmlBuilder;
import eu.eudat.logic.utilities.documents.helpers.FileEnvelope;
import eu.eudat.logic.utilities.documents.xml.datasetProfileXml.ExportXmlBuilderDatasetProfile;
import eu.eudat.logic.utilities.documents.xml.datasetProfileXml.ImportXmlBuilderDatasetProfile;
import eu.eudat.logic.utilities.helpers.StreamDistinctBy;
import eu.eudat.models.data.components.commons.datafield.AutoCompleteData;
import eu.eudat.models.data.datasetprofile.DatasetProfileAutocompleteItem;
import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel;
@ -36,10 +35,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.http.*;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
@ -60,7 +56,6 @@ import javax.xml.xpath.*;
import java.io.*;
import java.nio.file.Files;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
@ -376,16 +371,16 @@ public class DatasetProfileManager {
}
public List<String> getSchematics(String query) {
List<Schematic> schematics = configLoader.getSchematics();
List<String> filteredSchematics = schematics.stream().map(Schematic::getName).collect(Collectors.toList());
public List<String> getSemantics(String query) {
List<Semantic> semantics = configLoader.getSemantics();
List<String> filteredSemantics = semantics.stream().map(Semantic::getName).collect(Collectors.toList());
if(query != null && !query.isEmpty()){
filteredSchematics = schematics.stream().filter(x -> x.getCategory().contains(query) || x.getName().contains(query)).map(Schematic::getName).collect(Collectors.toList());
filteredSemantics = semantics.stream().filter(x -> x.getCategory().contains(query) || x.getName().contains(query)).map(Semantic::getName).collect(Collectors.toList());
}
return filteredSchematics;
return filteredSemantics;
}
public void addSchematicsInDatasetProfiles() throws XPathExpressionException {
public void addSemanticsInDatasetProfiles() throws XPathExpressionException {
List<DatasetProfile> ids = this.databaseRepository.getDatasetProfileDao().getAllIds();
for(DatasetProfile dp: ids){
DatasetProfile datasetProfile = this.databaseRepository.getDatasetProfileDao().find(dp.getId());
@ -411,7 +406,7 @@ public class DatasetProfileManager {
}
}
public void addRdaInSchematicsInDatasetProfiles() throws XPathExpressionException {
public void addRdaInSemanticsInDatasetProfiles() throws XPathExpressionException {
List<DatasetProfile> ids = this.databaseRepository.getDatasetProfileDao().getAllIds();
for(DatasetProfile dp: ids){
DatasetProfile datasetProfile = this.databaseRepository.getDatasetProfileDao().find(dp.getId());

View File

@ -2,7 +2,7 @@ package eu.eudat.logic.proxy.config;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Schematic {
public class Semantic {
@JsonProperty("category")
private String category;

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.proxy.config.configloaders;
import eu.eudat.logic.proxy.config.ExternalUrls;
import eu.eudat.logic.proxy.config.Schematic;
import eu.eudat.logic.proxy.config.Semantic;
import eu.eudat.logic.security.customproviders.ConfigurableProvider.entities.ConfigurableProviders;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
@ -10,7 +10,7 @@ import java.util.Map;
public interface ConfigLoader {
ExternalUrls getExternalUrls();
List<Schematic> getSchematics();
List<Semantic> getSemantics();
XWPFDocument getDocument();
XWPFDocument getDatasetDocument();
ConfigurableProviders getConfigurableProviders();

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.logic.proxy.config.ExternalUrls;
import eu.eudat.logic.proxy.config.Schematic;
import eu.eudat.logic.proxy.config.Semantic;
import eu.eudat.logic.security.customproviders.ConfigurableProvider.entities.ConfigurableProviders;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.slf4j.Logger;
@ -37,7 +37,7 @@ public class DefaultConfigLoader implements ConfigLoader {
private static final ObjectMapper mapper = new ObjectMapper();
private ExternalUrls externalUrls;
private List<Schematic> schematics;
private List<Semantic> semantics;
private XWPFDocument document;
private XWPFDocument datasetDocument;
private ConfigurableProviders configurableProviders;
@ -66,12 +66,12 @@ public class DefaultConfigLoader implements ConfigLoader {
}
}
private void setSchematics() {
String filePath = environment.getProperty("configuration.schematics");
private void setSemantics() {
String filePath = environment.getProperty("configuration.semantics");
logger.info("Loaded also config file: " + filePath);
if (filePath != null) {
try {
schematics = mapper.readValue(getStreamFromPath(filePath), new TypeReference<List<Schematic>>(){});
semantics = mapper.readValue(getStreamFromPath(filePath), new TypeReference<List<Semantic>>(){});
}
catch (IOException e) {
logger.error(e.getMessage(), e);
@ -166,12 +166,12 @@ public class DefaultConfigLoader implements ConfigLoader {
return externalUrls;
}
public List<Schematic> getSchematics() {
if (schematics == null) {
schematics = new ArrayList<>();
this.setSchematics();
public List<Semantic> getSemantics() {
if (semantics == null) {
semantics = new ArrayList<>();
this.setSemantics();
}
return schematics;
return semantics;
}
public XWPFDocument getDocument() {

View File

@ -23,7 +23,7 @@ pdf.converter.url=http://localhost:3000/
####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS##########
configuration.externalUrls=externalUrls/ExternalUrls.xml
configuration.schematics=Schematics.json
configuration.semantics=Semantics.json
configuration.h2020template=documents/h2020.docx
configuration.h2020datasettemplate=documents/h2020_dataset.docx
configuration.configurable_login_providers=configurableLoginProviders.json

View File

@ -49,7 +49,7 @@ elasticsearch.certKey=
####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS##########
configuration.externalUrls=externalUrls/ExternalUrls.xml
configuration.schematics=Schematics.json
configuration.semantics=Semantics.json
configuration.h2020template=documents/h2020.docx
configuration.h2020datasettemplate=documents/h2020_dataset.docx
configuration.configurable_login_providers=configurableLoginProviders.json

View File

@ -78,7 +78,7 @@ export class DatasetProfileService extends BaseService {
}
searchSchematics(like: string): Observable<String[]> {
return this.http.get<String[]>(this.actionUrl + "getSchematics?query=" + like);
searchSemantics(like: string): Observable<String[]> {
return this.http.get<String[]>(this.actionUrl + "getSemantics?query=" + like);
}
}

View File

@ -14,11 +14,11 @@ export class MaintenanceTasksService extends BaseService {
this.actionUrl = configurationService.server + 'management/';
}
migrateSchematics(): Observable<void> {
return this.http.post<null>(this.actionUrl + 'addSchematics/', null);
migrateSemantics(): Observable<void> {
return this.http.post<null>(this.actionUrl + 'addSemantics/', null);
}
addRdaInSchematics(): Observable<void> {
return this.http.post<null>(this.actionUrl + 'addRdaInSchematics/', null);
addRdaInSemantics(): Observable<void> {
return this.http.post<null>(this.actionUrl + 'addRdaInSemantics/', null);
}
}

View File

@ -227,8 +227,8 @@
</mat-form-field> -->
<mat-form-field class="col-6">
<mat-label>Schematics</mat-label>
<app-multiple-auto-complete placeholder="Schematics" [hidePlaceholder]="true" required='false' [separatorKeysCodes]="separatorKeysCodes" [formControl]="this.form.get('schematics')" [configuration]="schematicsAutoCompleteConfiguration">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.SEMANTICS' | translate}}</mat-label>
<app-multiple-auto-complete placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.SEMANTICS' | translate}}" [hidePlaceholder]="true" required='false' [separatorKeysCodes]="separatorKeysCodes" [formControl]="this.form.get('schematics')" [configuration]="semanticsAutoCompleteConfiguration">
</app-multiple-auto-complete>
</mat-form-field>

View File

@ -75,15 +75,15 @@ export class DatasetProfileEditorFieldComponent extends BaseComponent implements
readonly separatorKeysCodes: number[] = [ENTER, COMMA];
schematicsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
filterFn: this.filterSchematics.bind(this),
initialItems: (excludedItems: any[]) => this.filterSchematics('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x !== resultItem)))),
semanticsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
filterFn: this.filterSemantics.bind(this),
initialItems: (excludedItems: any[]) => this.filterSemantics('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x !== resultItem)))),
displayFn: (item) => item,
titleFn: (item) => item
}
filterSchematics(value: string): Observable<String[]> {
return this.datasetProfileService.searchSchematics(value);
filterSemantics(value: string): Observable<String[]> {
return this.datasetProfileService.searchSemantics(value);
}
constructor(

View File

@ -2,8 +2,8 @@
<mat-card class="col-md-3 offset-md-4">
<div style="color: red;">Warning: Danger zone. Irreversible actions!</div>
<div>
<button mat-raised-button color="primary" (click)="migrateSchematics($event)" class="lightblue-btn button">Migrate schematics</button>
<button mat-raised-button color="primary" (click)="addRdaInSchematics($event)" class="lightblue-btn button">Add rda in schematics</button>
<button mat-raised-button color="primary" (click)="migrateSemantics($event)" class="lightblue-btn button">Migrate semantics</button>
<button mat-raised-button color="primary" (click)="addRdaInSemantics($event)" class="lightblue-btn button">Add rda in semantics</button>
</div>
</mat-card>
</div>

View File

@ -25,9 +25,9 @@ export class MaintenanceTasksComponent extends BaseComponent implements OnInit {
ngOnInit(): void {
}
migrateSchematics(ev: Event) {
migrateSemantics(ev: Event) {
(ev.srcElement as HTMLButtonElement).disabled = true;
this.maintenanceTasksService.migrateSchematics().pipe(takeUntil(this._destroyed)).subscribe(
this.maintenanceTasksService.migrateSemantics().pipe(takeUntil(this._destroyed)).subscribe(
response => {
(ev.srcElement as HTMLButtonElement).disabled = false;
this.onCallbackSuccess();
@ -39,9 +39,9 @@ export class MaintenanceTasksComponent extends BaseComponent implements OnInit {
);
}
addRdaInSchematics(ev: Event) {
addRdaInSemantics(ev: Event) {
(ev.srcElement as HTMLButtonElement).disabled = true;
this.maintenanceTasksService.addRdaInSchematics().pipe(takeUntil(this._destroyed)).subscribe(
this.maintenanceTasksService.addRdaInSemantics().pipe(takeUntil(this._destroyed)).subscribe(
response => {
(ev.srcElement as HTMLButtonElement).disabled = false;
this.onCallbackSuccess();

View File

@ -384,7 +384,7 @@
"ORDER": "Order",
"COMMENT-PLACEHOLDER": "Please Specify",
"COMMENT-HINT": "Provide additional information or justification about your selection",
"RDA-COMMON-STANDARDS": "RDA Common Standards",
"SEMANTICS": "Semantics",
"EXPORT": "Include in Export"
},
"ACTIONS": {

View File

@ -384,7 +384,7 @@
"ORDER": "Order",
"COMMENT-PLACEHOLDER": "Please Specify",
"COMMENT-HINT": "Provide additional information or justification about your selection",
"RDA-COMMON-STANDARDS": "RDA Common Standards",
"SEMANTICS": "Semantics",
"EXPORT": "Include in Export"
},
"ACTIONS": {

View File

@ -384,7 +384,7 @@
"ORDER": "Orden",
"COMMENT-PLACEHOLDER": "Por favir especifique",
"COMMENT-HINT": "Proporcione información adicional o justifique su selección",
"RDA-COMMON-STANDARDS": "RDA Common estándares",
"SEMANTICS": "Semantics",
"EXPORT": "Include in Export"
},
"ACTIONS": {

View File

@ -384,7 +384,7 @@
"ORDER": "Εντολή",
"COMMENT-PLACEHOLDER": "Παρακαλώ προσδιορίστε",
"COMMENT-HINT": "Προσθέστε επιπλέον πληροφορίες ή αιτιολόγηση σχετικά με την επιλογή σας",
"RDA-COMMON-STANDARDS": "RDA Common Standards",
"SEMANTICS": "Semantics",
"EXPORT": "Include in Export"
},
"ACTIONS": {

View File

@ -384,7 +384,7 @@
"ORDER": "Redoslijed",
"COMMENT-PLACEHOLDER": "Navedite",
"COMMENT-HINT": "Navedite dodatne informacije ili obrazložite izbor",
"RDA-COMMON-STANDARDS": "RDA zajednički standardi",
"SEMANTICS": "Semantics",
"EXPORT": "Uključi u izvoz"
},
"ACTIONS": {

View File

@ -384,7 +384,7 @@
"ORDER": "Kolejność",
"COMMENT-PLACEHOLDER": "Proszę doprecyzować",
"COMMENT-HINT": "Podaj dodatkowe informacje lub uzasadnienie swojego wyboru",
"RDA-COMMON-STANDARDS": "Wspólne standardy RDA",
"SEMANTICS": "Semantics",
"EXPORT": "Uwzględnij w eksporcie"
},
"ACTIONS": {

View File

@ -384,7 +384,7 @@
"ORDER": "Ordem",
"COMMENT-PLACEHOLDER": "Por favor especifique",
"COMMENT-HINT": "Disponibilize informação ou justificação adicional sobre a sua seleção",
"RDA-COMMON-STANDARDS": "Normas RDA",
"SEMANTICS": "Semantics",
"EXPORT": "Include in Export"
},
"ACTIONS": {

View File

@ -384,7 +384,7 @@
"ORDER": "Order",
"COMMENT-PLACEHOLDER": "Please Specify",
"COMMENT-HINT": "Provide additional information or justification about your selection",
"RDA-COMMON-STANDARDS": "RDA Common Standards",
"SEMANTICS": "Semantics",
"EXPORT": "Include in Export"
},
"ACTIONS": {

View File

@ -384,7 +384,7 @@
"ORDER": "Redosled",
"COMMENT-PLACEHOLDER": "Navedite",
"COMMENT-HINT": "Navedite dodatne informacije ili obrazložite izbor",
"RDA-COMMON-STANDARDS": "RDA zajednički standardi",
"SEMANTICS": "Semantics",
"EXPORT": "Include in Export"
},
"ACTIONS": {

View File

@ -384,7 +384,7 @@
"ORDER": "Düzen",
"COMMENT-PLACEHOLDER": "Lütfen Belirtiniz",
"COMMENT-HINT": "Seçiminiz hakkında gerekçe veya ek bilgi veriniz",
"RDA-COMMON-STANDARDS": "RDA Ortak Standartları",
"SEMANTICS": "Semantics",
"EXPORT": "Include in Export"
},
"ACTIONS": {