From 78ee4673eef1683607cde8bb1bc63e3a7d2dbe1f Mon Sep 17 00:00:00 2001 From: George Kalampokis Date: Wed, 3 Jun 2020 12:13:31 +0300 Subject: [PATCH] Add ExtraProperties for DMP and language for Dataset Template --- .../main/java/eu/eudat/data/entities/DMP.java | 12 + .../eudat/data/entities/DatasetProfile.java | 13 +- .../main/java/eu/eudat/controllers/Admin.java | 2 + .../entity/DatasetProfileBuilder.java | 8 + .../eu/eudat/logic/managers/AdminManager.java | 2 +- .../logic/managers/DatasetProfileManager.java | 2 + .../data/admin/composite/DatasetProfile.java | 9 + .../models/data/dmp/DataManagementPlan.java | 15 + .../dmp/DataManagementPlanEditorModel.java | 12 + .../java/eu/eudat/models/rda/Dataset.java | 228 +---- .../main/java/eu/eudat/models/rda/Dmp.java | 228 +---- .../java/eu/eudat/models/rda/Language.java | 229 +++++ .../models/rda/mapper/DatasetRDAMapper.java | 6 +- .../eudat/models/rda/mapper/DmpRDAMapper.java | 23 +- .../models/rda/mapper/LanguageRDAMapper.java | 44 + .../main/resources/internal/rda-lang-map.json | 186 ++++ dmp-db-scema/main/data-dump.sql | 8 +- dmp-db-scema/main/dmp-dump.sql | 294 ++---- ...dd_language_to_dmp_and_dataset_profile.sql | 17 + .../src/app/core/core-service.module.ts | 2 + .../admin/dataset-profile/dataset-profile.ts | 1 + dmp-frontend/src/app/core/model/dmp/dmp.ts | 2 + .../src/app/core/model/language-info.ts | 5 + .../services/culture/language-info-service.ts | 86 ++ .../editor/dataset-profile-editor-model.ts | 3 + .../dataset-profile-editor.component.html | 11 + .../dataset-profile-editor.component.ts | 10 +- .../app/ui/dmp/editor/dmp-editor.component.ts | 3 + .../src/app/ui/dmp/editor/dmp-editor.model.ts | 6 +- .../extra-properties-form.model.ts | 28 + .../general-tab/general-tab.component.html | 16 + .../general-tab/general-tab.component.ts | 10 +- .../src/assets/localization/languages.json | 937 ++++++++++++++++++ 33 files changed, 1779 insertions(+), 679 deletions(-) create mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/Language.java create mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/LanguageRDAMapper.java create mode 100644 dmp-backend/web/src/main/resources/internal/rda-lang-map.json create mode 100644 dmp-db-scema/updates/00.00.004_add_language_to_dmp_and_dataset_profile.sql create mode 100644 dmp-frontend/src/app/core/model/language-info.ts create mode 100644 dmp-frontend/src/app/core/services/culture/language-info-service.ts create mode 100644 dmp-frontend/src/app/ui/dmp/editor/general-tab/extra-properties-form.model.ts create mode 100644 dmp-frontend/src/assets/localization/languages.json diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMP.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMP.java index 58ecc4922..6a44d9339 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMP.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMP.java @@ -174,6 +174,9 @@ public class DMP implements DataEntity { @JoinColumn(name = "\"Project\"") private Project project; + @Column(name = "\"extraProperties\"") + private String extraProperties; + public String getDescription() { return description; @@ -336,6 +339,14 @@ public class DMP implements DataEntity { this.project = project; } + public String getExtraProperties() { + return extraProperties; + } + + public void setExtraProperties(String extraProperties) { + this.extraProperties = extraProperties; + } + @Override public void update(DMP entity) { this.associatedDmps = entity.associatedDmps; @@ -356,6 +367,7 @@ public class DMP implements DataEntity { if (entity.isPublic) this.setPublishedAt(new Date()); if (entity.getUsers() != null) this.users = entity.getUsers(); if (entity.getDoi() != null && entity.getDoi().trim().isEmpty()) this.doi = entity.doi; + this.extraProperties = entity.getExtraProperties(); } @Override diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetProfile.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetProfile.java index b12be8be6..5000b461d 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetProfile.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DatasetProfile.java @@ -86,6 +86,9 @@ public class DatasetProfile implements DataEntity{ ) private List dmps; + @Column(name = "\"Language\"", nullable = false) + private String language; + public String getDescription() { return description; @@ -147,9 +150,17 @@ public class DatasetProfile implements DataEntity{ public Short getVersion() { return version; } public void setVersion(Short version) { this.version = version; } + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + @Override public String toString() { - return "DatasetProfileListingModel [id=" + id + ", label=" + label + ", dataset=" + dataset + ", definition=" + definition + ", version=" + version + "]"; + return "DatasetProfileListingModel [id=" + id + ", label=" + label + ", dataset=" + dataset + ", definition=" + definition + ", version=" + version + ", language=" + language + "]"; } @Override diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/Admin.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/Admin.java index c461906b6..58ce64aae 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/Admin.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/Admin.java @@ -71,6 +71,7 @@ public class Admin extends BaseController { datasetprofile.setStatus(modelDefinition.getStatus()); datasetprofile.setLabel(modelDefinition.getLabel()); datasetprofile.setDescription(modelDefinition.getDescription()); + datasetprofile.setLanguage(modelDefinition.getLanguage()); this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(datasetprofile); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE)); } @@ -114,6 +115,7 @@ public class Admin extends BaseController { eu.eudat.data.entities.DatasetProfile profile = this.datasetProfileManager.clone(id); eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile); datasetprofile.setLabel(profile.getLabel() + " new "); + datasetprofile.setLanguage(profile.getLanguage()); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().payload(datasetprofile)); } diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/DatasetProfileBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/DatasetProfileBuilder.java index a877e850b..add38bb38 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/DatasetProfileBuilder.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/DatasetProfileBuilder.java @@ -29,6 +29,8 @@ public class DatasetProfileBuilder extends Builder { private String description; + private String language; + public DatasetProfileBuilder id(UUID id) { this.id = id; return this; @@ -69,6 +71,11 @@ public class DatasetProfileBuilder extends Builder { return this; } + public DatasetProfileBuilder language(String language) { + this.language = language; + return this; + } + @Override public DatasetProfile build() { DatasetProfile datasetProfile = new DatasetProfile(); @@ -80,6 +87,7 @@ public class DatasetProfileBuilder extends Builder { datasetProfile.setDescription(description); datasetProfile.setModified(modified); datasetProfile.setLabel(label); + datasetProfile.setLanguage(language); return datasetProfile; } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/AdminManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/AdminManager.java index adff4a1fd..751284d68 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/AdminManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/AdminManager.java @@ -27,7 +27,7 @@ public class AdminManager { String xml = XmlBuilder.generateXml(viewStyleDoc); eu.eudat.data.entities.DatasetProfile datasetProfile = apiContext.getOperationsContext().getBuilderFactory().getBuilder(DatasetProfileBuilder.class).definition(xml).label(profile.getLabel()) - .status(profile.getStatus()).created(new Date()).description(profile.getDescription()) + .status(profile.getStatus()).created(new Date()).description(profile.getDescription()).language(profile.getLanguage()) .build(); return datasetProfile; diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetProfileManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetProfileManager.java index 1f2688826..c22bbd666 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetProfileManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetProfileManager.java @@ -63,6 +63,7 @@ public class DatasetProfileManager { datasetprofile.setLabel(profile.getLabel()); datasetprofile.setStatus(profile.getStatus()); datasetprofile.setDescription(profile.getDescription()); + datasetprofile.setLanguage(profile.getLanguage()); return datasetprofile; } @@ -233,6 +234,7 @@ public class DatasetProfileManager { modelDefinition.setLabel(oldDatasetProfile.getLabel()); modelDefinition.setVersion((short) (oldDatasetProfile.getVersion() + 1)); modelDefinition.setGroupId(oldDatasetProfile.getGroupId()); + modelDefinition.setLanguage(oldDatasetProfile.getLanguage()); apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition); return modelDefinition; } else { diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/composite/DatasetProfile.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/composite/DatasetProfile.java index 8adde4152..4f8ada7e4 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/composite/DatasetProfile.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/composite/DatasetProfile.java @@ -15,6 +15,7 @@ public class DatasetProfile { private List
sections; private Short status; private Short version; + private String language; public String getLabel() { @@ -53,6 +54,13 @@ public class DatasetProfile { public Short getVersion() { return version; } public void setVersion(Short version) { this.version = version; } + public String getLanguage() { + return language; + } + public void setLanguage(String language) { + this.language = language; + } + public void buildProfile(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.ViewStyleModel viewStyle) { this.sections = new ModelBuilder().fromViewStyleDefinition(viewStyle.getSections(), Section.class); this.pages = new ModelBuilder().fromViewStyleDefinition(viewStyle.getPages(), Page.class); @@ -71,6 +79,7 @@ public class DatasetProfile { shortProfile.setPages(this.pages); shortProfile.setStatus(this.status); shortProfile.setVersion(this.version); + shortProfile.setLanguage(this.language); return shortProfile; } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlan.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlan.java index a341fa409..f0697e623 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlan.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlan.java @@ -43,6 +43,7 @@ public class DataManagementPlan implements DataModel { private Project project; private Funder funder; private Boolean isPublic; + private Map extraProperties; public UUID getId() { return id; @@ -220,6 +221,14 @@ public class DataManagementPlan implements DataModel { isPublic = aPublic; } + public Map getExtraProperties() { + return extraProperties; + } + + public void setExtraProperties(Map extraProperties) { + this.extraProperties = extraProperties; + } + @Override public DataManagementPlan fromDataModel(DMP entity) { this.id = entity.getId(); @@ -280,6 +289,8 @@ public class DataManagementPlan implements DataModel { } this.isPublic = entity.isPublic(); + this.extraProperties = entity.getExtraProperties() != null ? new org.json.JSONObject(entity.getExtraProperties()).toMap() : null; + return this; } @@ -321,6 +332,8 @@ public class DataManagementPlan implements DataModel { if (this.isPublic != null) { dataManagementPlanEntity.setPublic(this.isPublic); } + + dataManagementPlanEntity.setExtraProperties(this.extraProperties != null ? JSONObject.toJSONString(this.extraProperties) : null); return dataManagementPlanEntity; } @@ -372,6 +385,8 @@ public class DataManagementPlan implements DataModel { } this.isPublic = entity.isPublic(); + this.extraProperties = entity.getExtraProperties() != null ? new org.json.JSONObject(entity.getExtraProperties()).toMap() : null; + return this; } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlanEditorModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlanEditorModel.java index 3be36c2e7..b703c5fd9 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlanEditorModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/DataManagementPlanEditorModel.java @@ -42,6 +42,7 @@ public class DataManagementPlanEditorModel implements DataModel datasetsToBeFinalized; private ProjectDMPEditorModel project; private FunderDMPEditorModel funder; + private Map extraProperties; public UUID getId() { return id; @@ -211,6 +212,14 @@ public class DataManagementPlanEditorModel implements DataModel getExtraProperties() { + return extraProperties; + } + + public void setExtraProperties(Map extraProperties) { + this.extraProperties = extraProperties; + } + @Override public DataManagementPlanEditorModel fromDataModel(DMP entity) { this.id = entity.getId(); @@ -255,6 +264,7 @@ public class DataManagementPlanEditorModel implements DataModel new UserInfoListingModel().fromDataModel(item)).collect(Collectors.toList()); this.funder = new FunderDMPEditorModel(); this.funder.getExistFunder().fromDataModel(entity.getGrant().getFunder()); + this.extraProperties = entity.getExtraProperties() != null ? new org.json.JSONObject(entity.getExtraProperties()).toMap() : null; return this; } @@ -360,6 +370,8 @@ public class DataManagementPlanEditorModel implements DataModel item.getValue() != null).collect(Collectors.toMap(DynamicFieldWithValue::getId, DynamicFieldWithValue::getValue)))); + dataManagementPlanEntity.setExtraProperties(this.extraProperties != null ? JSONObject.toJSONString(this.extraProperties) : null); + return dataManagementPlanEntity; } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Dataset.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/Dataset.java index 3c064965e..5e91de9e3 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Dataset.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/rda/Dataset.java @@ -107,7 +107,7 @@ public class Dataset implements Serializable */ @JsonProperty("language") @JsonPropertyDescription("Language of the dataset expressed using ISO 639-3.") - private Dataset.Language language; + private Language language; /** * The Dataset Metadata Schema *

@@ -328,7 +328,7 @@ public class Dataset implements Serializable * */ @JsonProperty("language") - public Dataset.Language getLanguage() { + public Language getLanguage() { return language; } @@ -339,7 +339,7 @@ public class Dataset implements Serializable * */ @JsonProperty("language") - public void setLanguage(Dataset.Language language) { + public void setLanguage(Language language) { this.language = language; } @@ -535,228 +535,6 @@ public class Dataset implements Serializable this.additionalProperties.put(name, value); } - public enum Language { - - AAR("aar"), - ABK("abk"), - AFR("afr"), - AKA("aka"), - AMH("amh"), - ARA("ara"), - ARG("arg"), - ASM("asm"), - AVA("ava"), - AVE("ave"), - AYM("aym"), - AZE("aze"), - BAK("bak"), - BAM("bam"), - BEL("bel"), - BEN("ben"), - BIH("bih"), - BIS("bis"), - BOD("bod"), - BOS("bos"), - BRE("bre"), - BUL("bul"), - CAT("cat"), - CES("ces"), - CHA("cha"), - CHE("che"), - CHU("chu"), - CHV("chv"), - COR("cor"), - COS("cos"), - CRE("cre"), - CYM("cym"), - DAN("dan"), - DEU("deu"), - DIV("div"), - DZO("dzo"), - ELL("ell"), - ENG("eng"), - EPO("epo"), - EST("est"), - EUS("eus"), - EWE("ewe"), - FAO("fao"), - FAS("fas"), - FIJ("fij"), - FIN("fin"), - FRA("fra"), - FRY("fry"), - FUL("ful"), - GLA("gla"), - GLE("gle"), - GLG("glg"), - GLV("glv"), - GRN("grn"), - GUJ("guj"), - HAT("hat"), - HAU("hau"), - HBS("hbs"), - HEB("heb"), - HER("her"), - HIN("hin"), - HMO("hmo"), - HRV("hrv"), - HUN("hun"), - HYE("hye"), - IBO("ibo"), - IDO("ido"), - III("iii"), - IKU("iku"), - ILE("ile"), - INA("ina"), - IND("ind"), - IPK("ipk"), - ISL("isl"), - ITA("ita"), - JAV("jav"), - JPN("jpn"), - KAL("kal"), - KAN("kan"), - KAS("kas"), - KAT("kat"), - KAU("kau"), - KAZ("kaz"), - KHM("khm"), - KIK("kik"), - KIN("kin"), - KIR("kir"), - KOM("kom"), - KON("kon"), - KOR("kor"), - KUA("kua"), - KUR("kur"), - LAO("lao"), - LAT("lat"), - LAV("lav"), - LIM("lim"), - LIN("lin"), - LIT("lit"), - LTZ("ltz"), - LUB("lub"), - LUG("lug"), - MAH("mah"), - MAL("mal"), - MAR("mar"), - MKD("mkd"), - MLG("mlg"), - MLT("mlt"), - MON("mon"), - MRI("mri"), - MSA("msa"), - MYA("mya"), - NAU("nau"), - NAV("nav"), - NBL("nbl"), - NDE("nde"), - NDO("ndo"), - NEP("nep"), - NLD("nld"), - NNO("nno"), - NOB("nob"), - NOR("nor"), - NYA("nya"), - OCI("oci"), - OJI("oji"), - ORI("ori"), - ORM("orm"), - OSS("oss"), - PAN("pan"), - PLI("pli"), - POL("pol"), - POR("por"), - PUS("pus"), - QUE("que"), - ROH("roh"), - RON("ron"), - RUN("run"), - RUS("rus"), - SAG("sag"), - SAN("san"), - SIN("sin"), - SLK("slk"), - SLV("slv"), - SME("sme"), - SMO("smo"), - SNA("sna"), - SND("snd"), - SOM("som"), - SOT("sot"), - SPA("spa"), - SQI("sqi"), - SRD("srd"), - SRP("srp"), - SSW("ssw"), - SUN("sun"), - SWA("swa"), - SWE("swe"), - TAH("tah"), - TAM("tam"), - TAT("tat"), - TEL("tel"), - TGK("tgk"), - TGL("tgl"), - THA("tha"), - TIR("tir"), - TON("ton"), - TSN("tsn"), - TSO("tso"), - TUK("tuk"), - TUR("tur"), - TWI("twi"), - UIG("uig"), - UKR("ukr"), - URD("urd"), - UZB("uzb"), - VEN("ven"), - VIE("vie"), - VOL("vol"), - WLN("wln"), - WOL("wol"), - XHO("xho"), - YID("yid"), - YOR("yor"), - ZHA("zha"), - ZHO("zho"), - ZUL("zul"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (Dataset.Language c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private Language(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static Dataset.Language fromValue(String value) { - Dataset.Language constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - public enum PersonalData { YES("yes"), diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Dmp.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/Dmp.java index 2d43d0eaa..773ac5f72 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Dmp.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/rda/Dmp.java @@ -138,7 +138,7 @@ public class Dmp implements Serializable */ @JsonProperty("language") @JsonPropertyDescription("Language of the DMP expressed using ISO 639-3.") - private Dmp.Language language; + private Language language; /** * The DMP Modification Schema *

@@ -408,7 +408,7 @@ public class Dmp implements Serializable * */ @JsonProperty("language") - public Dmp.Language getLanguage() { + public Language getLanguage() { return language; } @@ -420,7 +420,7 @@ public class Dmp implements Serializable * */ @JsonProperty("language") - public void setLanguage(Dmp.Language language) { + public void setLanguage(Language language) { this.language = language; } @@ -544,226 +544,4 @@ public class Dmp implements Serializable } - public enum Language { - - AAR("aar"), - ABK("abk"), - AFR("afr"), - AKA("aka"), - AMH("amh"), - ARA("ara"), - ARG("arg"), - ASM("asm"), - AVA("ava"), - AVE("ave"), - AYM("aym"), - AZE("aze"), - BAK("bak"), - BAM("bam"), - BEL("bel"), - BEN("ben"), - BIH("bih"), - BIS("bis"), - BOD("bod"), - BOS("bos"), - BRE("bre"), - BUL("bul"), - CAT("cat"), - CES("ces"), - CHA("cha"), - CHE("che"), - CHU("chu"), - CHV("chv"), - COR("cor"), - COS("cos"), - CRE("cre"), - CYM("cym"), - DAN("dan"), - DEU("deu"), - DIV("div"), - DZO("dzo"), - ELL("ell"), - ENG("eng"), - EPO("epo"), - EST("est"), - EUS("eus"), - EWE("ewe"), - FAO("fao"), - FAS("fas"), - FIJ("fij"), - FIN("fin"), - FRA("fra"), - FRY("fry"), - FUL("ful"), - GLA("gla"), - GLE("gle"), - GLG("glg"), - GLV("glv"), - GRN("grn"), - GUJ("guj"), - HAT("hat"), - HAU("hau"), - HBS("hbs"), - HEB("heb"), - HER("her"), - HIN("hin"), - HMO("hmo"), - HRV("hrv"), - HUN("hun"), - HYE("hye"), - IBO("ibo"), - IDO("ido"), - III("iii"), - IKU("iku"), - ILE("ile"), - INA("ina"), - IND("ind"), - IPK("ipk"), - ISL("isl"), - ITA("ita"), - JAV("jav"), - JPN("jpn"), - KAL("kal"), - KAN("kan"), - KAS("kas"), - KAT("kat"), - KAU("kau"), - KAZ("kaz"), - KHM("khm"), - KIK("kik"), - KIN("kin"), - KIR("kir"), - KOM("kom"), - KON("kon"), - KOR("kor"), - KUA("kua"), - KUR("kur"), - LAO("lao"), - LAT("lat"), - LAV("lav"), - LIM("lim"), - LIN("lin"), - LIT("lit"), - LTZ("ltz"), - LUB("lub"), - LUG("lug"), - MAH("mah"), - MAL("mal"), - MAR("mar"), - MKD("mkd"), - MLG("mlg"), - MLT("mlt"), - MON("mon"), - MRI("mri"), - MSA("msa"), - MYA("mya"), - NAU("nau"), - NAV("nav"), - NBL("nbl"), - NDE("nde"), - NDO("ndo"), - NEP("nep"), - NLD("nld"), - NNO("nno"), - NOB("nob"), - NOR("nor"), - NYA("nya"), - OCI("oci"), - OJI("oji"), - ORI("ori"), - ORM("orm"), - OSS("oss"), - PAN("pan"), - PLI("pli"), - POL("pol"), - POR("por"), - PUS("pus"), - QUE("que"), - ROH("roh"), - RON("ron"), - RUN("run"), - RUS("rus"), - SAG("sag"), - SAN("san"), - SIN("sin"), - SLK("slk"), - SLV("slv"), - SME("sme"), - SMO("smo"), - SNA("sna"), - SND("snd"), - SOM("som"), - SOT("sot"), - SPA("spa"), - SQI("sqi"), - SRD("srd"), - SRP("srp"), - SSW("ssw"), - SUN("sun"), - SWA("swa"), - SWE("swe"), - TAH("tah"), - TAM("tam"), - TAT("tat"), - TEL("tel"), - TGK("tgk"), - TGL("tgl"), - THA("tha"), - TIR("tir"), - TON("ton"), - TSN("tsn"), - TSO("tso"), - TUK("tuk"), - TUR("tur"), - TWI("twi"), - UIG("uig"), - UKR("ukr"), - URD("urd"), - UZB("uzb"), - VEN("ven"), - VIE("vie"), - VOL("vol"), - WLN("wln"), - WOL("wol"), - XHO("xho"), - YID("yid"), - YOR("yor"), - ZHA("zha"), - ZHO("zho"), - ZUL("zul"); - private final String value; - private final static Map CONSTANTS = new HashMap(); - - static { - for (Dmp.Language c: values()) { - CONSTANTS.put(c.value, c); - } - } - - private Language(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static Dmp.Language fromValue(String value) { - Dmp.Language constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/Language.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/Language.java new file mode 100644 index 000000000..b9e85c889 --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/models/rda/Language.java @@ -0,0 +1,229 @@ +package eu.eudat.models.rda; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +import java.util.HashMap; +import java.util.Map; + +public enum Language { + + AAR("aar"), + ABK("abk"), + AFR("afr"), + AKA("aka"), + AMH("amh"), + ARA("ara"), + ARG("arg"), + ASM("asm"), + AVA("ava"), + AVE("ave"), + AYM("aym"), + AZE("aze"), + BAK("bak"), + BAM("bam"), + BEL("bel"), + BEN("ben"), + BIH("bih"), + BIS("bis"), + BOD("bod"), + BOS("bos"), + BRE("bre"), + BUL("bul"), + CAT("cat"), + CES("ces"), + CHA("cha"), + CHE("che"), + CHU("chu"), + CHV("chv"), + COR("cor"), + COS("cos"), + CRE("cre"), + CYM("cym"), + DAN("dan"), + DEU("deu"), + DIV("div"), + DZO("dzo"), + ELL("ell"), + ENG("eng"), + EPO("epo"), + EST("est"), + EUS("eus"), + EWE("ewe"), + FAO("fao"), + FAS("fas"), + FIJ("fij"), + FIN("fin"), + FRA("fra"), + FRY("fry"), + FUL("ful"), + GLA("gla"), + GLE("gle"), + GLG("glg"), + GLV("glv"), + GRN("grn"), + GUJ("guj"), + HAT("hat"), + HAU("hau"), + HBS("hbs"), + HEB("heb"), + HER("her"), + HIN("hin"), + HMO("hmo"), + HRV("hrv"), + HUN("hun"), + HYE("hye"), + IBO("ibo"), + IDO("ido"), + III("iii"), + IKU("iku"), + ILE("ile"), + INA("ina"), + IND("ind"), + IPK("ipk"), + ISL("isl"), + ITA("ita"), + JAV("jav"), + JPN("jpn"), + KAL("kal"), + KAN("kan"), + KAS("kas"), + KAT("kat"), + KAU("kau"), + KAZ("kaz"), + KHM("khm"), + KIK("kik"), + KIN("kin"), + KIR("kir"), + KOM("kom"), + KON("kon"), + KOR("kor"), + KUA("kua"), + KUR("kur"), + LAO("lao"), + LAT("lat"), + LAV("lav"), + LIM("lim"), + LIN("lin"), + LIT("lit"), + LTZ("ltz"), + LUB("lub"), + LUG("lug"), + MAH("mah"), + MAL("mal"), + MAR("mar"), + MKD("mkd"), + MLG("mlg"), + MLT("mlt"), + MON("mon"), + MRI("mri"), + MSA("msa"), + MYA("mya"), + NAU("nau"), + NAV("nav"), + NBL("nbl"), + NDE("nde"), + NDO("ndo"), + NEP("nep"), + NLD("nld"), + NNO("nno"), + NOB("nob"), + NOR("nor"), + NYA("nya"), + OCI("oci"), + OJI("oji"), + ORI("ori"), + ORM("orm"), + OSS("oss"), + PAN("pan"), + PLI("pli"), + POL("pol"), + POR("por"), + PUS("pus"), + QUE("que"), + ROH("roh"), + RON("ron"), + RUN("run"), + RUS("rus"), + SAG("sag"), + SAN("san"), + SIN("sin"), + SLK("slk"), + SLV("slv"), + SME("sme"), + SMO("smo"), + SNA("sna"), + SND("snd"), + SOM("som"), + SOT("sot"), + SPA("spa"), + SQI("sqi"), + SRD("srd"), + SRP("srp"), + SSW("ssw"), + SUN("sun"), + SWA("swa"), + SWE("swe"), + TAH("tah"), + TAM("tam"), + TAT("tat"), + TEL("tel"), + TGK("tgk"), + TGL("tgl"), + THA("tha"), + TIR("tir"), + TON("ton"), + TSN("tsn"), + TSO("tso"), + TUK("tuk"), + TUR("tur"), + TWI("twi"), + UIG("uig"), + UKR("ukr"), + URD("urd"), + UZB("uzb"), + VEN("ven"), + VIE("vie"), + VOL("vol"), + WLN("wln"), + WOL("wol"), + XHO("xho"), + YID("yid"), + YOR("yor"), + ZHA("zha"), + ZHO("zho"), + ZUL("zul"); + private final String value; + private final static Map CONSTANTS = new HashMap<>(); + + static { + for (Language c: values()) { + CONSTANTS.put(c.value, c); + } + } + + private Language(String value) { + this.value = value; + } + + @Override + public String toString() { + return this.value; + } + + @JsonValue + public String value() { + return this.value; + } + + @JsonCreator + public static Language fromValue(String value) { + Language constant = CONSTANTS.get(value); + if (constant == null) { + throw new IllegalArgumentException(value); + } else { + return constant; + } + } + +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetRDAMapper.java index b2def070d..255e344bc 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetRDAMapper.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetRDAMapper.java @@ -9,7 +9,7 @@ import eu.eudat.logic.services.ApiContext; import eu.eudat.logic.utilities.json.JsonSearcher; import eu.eudat.models.data.datasetwizard.DatasetWizardModel; import eu.eudat.models.rda.Dataset; -import eu.eudat.models.rda.DatasetId; +import eu.eudat.models.rda.Language; import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -61,7 +61,9 @@ public class DatasetRDAMapper { } List languageNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.language"); if (!languageNodes.isEmpty()) { - rda.setLanguage(Dataset.Language.fromValue(languageNodes.get(0).get("value").asText())); + rda.setLanguage(Language.fromValue(languageNodes.get(0).get("value").asText())); + } else { + rda.setLanguage(LanguageRDAMapper.mapLanguageIsoToRDAIso(dataset.getProfile().getLanguage())); } List metadataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.metadata"); if (!metadataNodes.isEmpty()) { diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpRDAMapper.java index 94438e084..3e942dd99 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpRDAMapper.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpRDAMapper.java @@ -4,10 +4,12 @@ import eu.eudat.data.entities.*; import eu.eudat.logic.services.ApiContext; import eu.eudat.models.rda.Dmp; import eu.eudat.models.rda.DmpId; +import net.minidev.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.transaction.Transactional; +import java.io.IOException; import java.util.*; import java.util.stream.Collectors; @@ -17,10 +19,12 @@ public class DmpRDAMapper { private DatasetRDAMapper datasetRDAMapper; private ApiContext apiContext; + @Autowired - public DmpRDAMapper(DatasetRDAMapper datasetRDAMapper, ApiContext apiContext) { + public DmpRDAMapper(DatasetRDAMapper datasetRDAMapper, ApiContext apiContext) throws IOException { this.datasetRDAMapper = datasetRDAMapper; this.apiContext = apiContext; + } @Transactional @@ -36,6 +40,9 @@ public class DmpRDAMapper { rda.setModified(dmp.getModified()); rda.setTitle(dmp.getLabel()); + Map extraProperties = new org.json.JSONObject(dmp.getExtraProperties()).toMap(); + rda.setLanguage(LanguageRDAMapper.mapLanguageIsoToRDAIso(extraProperties.get("language").toString())); + UserInfo creator; if (dmp.getCreator() != null) { creator = dmp.getCreator(); @@ -66,9 +73,11 @@ public class DmpRDAMapper { if (entity.getAssociatedDmps() == null) { entity.setAssociatedDmps(new HashSet<>()); } - for (String profile: profiles) { - DatasetProfile exProfile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(profile)); - entity.getAssociatedDmps().add(exProfile); + if (profiles != null) { + for (String profile : profiles) { + DatasetProfile exProfile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(profile)); + entity.getAssociatedDmps().add(exProfile); + } } if (rda.getContributor() != null && !rda.getContributor().isEmpty()) { entity.setResearchers(rda.getContributor().stream().map(ContributorRDAMapper::toEntity).collect(Collectors.toSet())); @@ -81,6 +90,12 @@ public class DmpRDAMapper { Map result = ProjectRDAMapper.toEntity(rda.getProject().get(0), apiContext); entity.setProject((Project) result.get("project")); result.entrySet().stream().filter(entry -> entry.getKey().startsWith("grant")).forEach(entry -> entity.setGrant((Grant) entry.getValue())); + + Map extraProperties = new HashMap<>(); + extraProperties.put("language", LanguageRDAMapper.mapRDAIsoToLanguageIso(rda.getLanguage())); + + entity.setExtraProperties(JSONObject.toJSONString(extraProperties)); + return entity; } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/LanguageRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/LanguageRDAMapper.java new file mode 100644 index 000000000..0dfe20c0e --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/LanguageRDAMapper.java @@ -0,0 +1,44 @@ +package eu.eudat.models.rda.mapper; + +import eu.eudat.models.rda.Language; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +public class LanguageRDAMapper { + private final static Map langMap = new HashMap<>(); + private static final Logger logger = LoggerFactory.getLogger(LanguageRDAMapper.class); + + static { + String json = null; + try { + json = new BufferedReader(new InputStreamReader(LanguageRDAMapper.class.getClassLoader().getResource("internal/rda-lang-map.json").openStream(), StandardCharsets.UTF_8)) + .lines().collect(Collectors.joining("\n")); + langMap.putAll(new org.json.JSONObject(json).toMap()); + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + } + + public static Language mapLanguageIsoToRDAIso(String code) { + return langMap.entrySet().stream().map(entry -> { + if (entry.getValue().toString().equals(code)) { + return Language.fromValue(entry.getKey()); + } else { + return null; + } + }).filter(Objects::nonNull).findFirst().get(); + } + + public static String mapRDAIsoToLanguageIso(Language lang) { + return langMap.get(lang.value()).toString(); + } +} diff --git a/dmp-backend/web/src/main/resources/internal/rda-lang-map.json b/dmp-backend/web/src/main/resources/internal/rda-lang-map.json new file mode 100644 index 000000000..794787f0e --- /dev/null +++ b/dmp-backend/web/src/main/resources/internal/rda-lang-map.json @@ -0,0 +1,186 @@ +{ + "aar": "aa", + "abk": "ab", + "afr": "af", + "aka": "ak", + "amh": "am", + "ara": "ar", + "arg": "an", + "asm": "as", + "ava": "av", + "ave": "ae", + "aym": "ay", + "aze": "az", + "bak": "ba", + "bam": "bm", + "bel": "be", + "ben": "bn", + "bis": "bi", + "bod": "bo", + "bos": "bs", + "bre": "br", + "bul": "bg", + "cat": "ca", + "ces": "cs", + "cha": "ch", + "che": "ce", + "chu": "cu", + "chv": "cv", + "cor": "kw", + "cos": "co", + "cre": "cr", + "cym": "cy", + "dan": "da", + "deu": "de", + "div": "dv", + "dzo": "dz", + "ell": "el", + "eng": "en", + "epo": "eo", + "est": "et", + "eus": "eu", + "ewe": "ee", + "fao": "fo", + "fas": "fa", + "fij": "fj", + "fin": "fi", + "fra": "fr", + "fry": "fy", + "ful": "ff", + "gla": "gd", + "gle": "ga", + "glg": "gl", + "glv": "gv", + "grn": "gn", + "guj": "gu", + "hat": "ht", + "hau": "ha", + "hbs": "sh", + "heb": "he", + "her": "hz", + "hin": "hi", + "hmo": "ho", + "hrv": "hr", + "hun": "hu", + "hye": "hy", + "ibo": "ig", + "ido": "io", + "iii": "ii", + "iku": "iu", + "ile": "ie", + "ina": "ia", + "ind": "id", + "ipk": "ik", + "isl": "is", + "ita": "it", + "jav": "jv", + "jpn": "ja", + "kal": "kl", + "kan": "kn", + "kas": "ks", + "kat": "ka", + "kau": "kr", + "kaz": "kk", + "khm": "km", + "kik": "ki", + "kin": "rw", + "kir": "ky", + "kom": "kv", + "kon": "kg", + "kor": "ko", + "kua": "kj", + "kur": "ku", + "lao": "lo", + "lat": "la", + "lav": "lv", + "lim": "li", + "lin": "ln", + "lit": "lt", + "ltz": "lb", + "lub": "lu", + "lug": "lg", + "mah": "mh", + "mal": "ml", + "mar": "mr", + "mkd": "mk", + "mlg": "mg", + "mlt": "mt", + "mon": "mn", + "mri": "mi", + "msa": "ms", + "mya": "my", + "nau": "na", + "nav": "nv", + "nbl": "nr", + "nde": "nd", + "ndo": "ng", + "nep": "ne", + "nld": "nl", + "nno": "nn", + "nob": "nb", + "nor": "no", + "nya": "ny", + "oci": "oc", + "oji": "oj", + "ori": "or", + "orm": "om", + "oss": "os", + "pan": "pa", + "pli": "pi", + "pol": "pl", + "por": "pt", + "pus": "ps", + "que": "qu", + "roh": "rm", + "ron": "ro", + "run": "rn", + "rus": "ru", + "sag": "sg", + "san": "sa", + "sin": "si", + "slk": "sk", + "slv": "sl", + "sme": "se", + "smo": "sm", + "sna": "sn", + "snd": "sd", + "som": "so", + "sot": "st", + "spa": "es", + "sqi": "sq", + "srd": "sc", + "srp": "sr", + "ssw": "ss", + "sun": "su", + "swa": "sw", + "swe": "sv", + "tah": "ty", + "tam": "ta", + "tat": "tt", + "tel": "te", + "tgk": "tg", + "tgl": "tl", + "tha": "th", + "tir": "ti", + "ton": "to", + "tsn": "tn", + "tso": "ts", + "tuk": "tk", + "tur": "tr", + "twi": "tw", + "uig": "ug", + "ukr": "uk", + "urd": "ur", + "uzb": "uz", + "ven": "ve", + "vie": "vi", + "vol": "vo", + "wln": "wa", + "wol": "wo", + "xho": "xh", + "yid": "yi", + "yor": "yo", + "zha": "za", + "zho": "zh", + "zul": "zu" +} \ No newline at end of file diff --git a/dmp-db-scema/main/data-dump.sql b/dmp-db-scema/main/data-dump.sql index cdb27f077..d7b256abe 100644 --- a/dmp-db-scema/main/data-dump.sql +++ b/dmp-db-scema/main/data-dump.sql @@ -14,4 +14,10 @@ INSERT INTO public."DoiFunder"(name, doi) VALUES ('National Science Foundation', INSERT INTO public."DoiFunder"(name, doi) VALUES ('Nederlandse Organisatie voor Wetenschappelijk Onderzoek', '10.13039/501100003246'); INSERT INTO public."DoiFunder"(name, doi) VALUES ('Wellcome Trust', '10.13039/100004440'); -INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.00.003', '2020-05-06 18:11:00.000000+03', now(), 'Add Doi Funder'); \ No newline at end of file +UPDATE public."DMP" + SET "extraProperties"='{"language": "en"}'; + +UPDATE public."DatasetProfile" + SET "Language"='en'; + +INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.00.004', '2020-06-03 11:40:00.000000+03', now(), 'Add language to DMP and Dataset Template'); \ No newline at end of file diff --git a/dmp-db-scema/main/dmp-dump.sql b/dmp-db-scema/main/dmp-dump.sql index 494e71730..115d52436 100644 --- a/dmp-db-scema/main/dmp-dump.sql +++ b/dmp-db-scema/main/dmp-dump.sql @@ -2,10 +2,8 @@ -- PostgreSQL database dump -- --- Dumped from database version 9.6.10 --- Dumped by pg_dump version 11.2 - --- Started on 2020-05-12 17:07:27 +-- Dumped from database version 9.4.26 +-- Dumped by pg_dump version 11.3 SET statement_timeout = 0; SET lock_timeout = 0; @@ -14,11 +12,11 @@ SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SELECT pg_catalog.set_config('search_path', '', false); SET check_function_bodies = false; +SET xmloption = content; SET client_min_messages = warning; SET row_security = off; -- --- TOC entry 2 (class 3079 OID 18451) -- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: -- @@ -26,8 +24,6 @@ CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public; -- --- TOC entry 2477 (class 0 OID 0) --- Dependencies: 2 -- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: -- @@ -39,7 +35,6 @@ SET default_tablespace = ''; SET default_with_oids = false; -- --- TOC entry 186 (class 1259 OID 37851) -- Name: Content; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -56,7 +51,6 @@ CREATE TABLE public."Content" ( ALTER TABLE public."Content" OWNER TO :POSTGRES_USER; -- --- TOC entry 187 (class 1259 OID 37857) -- Name: Credential; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -66,8 +60,8 @@ CREATE TABLE public."Credential" ( "Provider" numeric NOT NULL, "Public" character varying NOT NULL, "Secret" character varying NOT NULL, - "CreationTime" date NOT NULL, - "LastUpdateTime" date NOT NULL, + "CreationTime" timestamp(4) with time zone NOT NULL, + "LastUpdateTime" timestamp(4) with time zone NOT NULL, "UserId" uuid NOT NULL, "ExternalId" character varying NOT NULL ); @@ -76,7 +70,6 @@ CREATE TABLE public."Credential" ( ALTER TABLE public."Credential" OWNER TO :POSTGRES_USER; -- --- TOC entry 218 (class 1259 OID 46438) -- Name: DBVersion; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -92,7 +85,6 @@ CREATE TABLE public."DBVersion" ( ALTER TABLE public."DBVersion" OWNER TO :POSTGRES_USER; -- --- TOC entry 188 (class 1259 OID 37863) -- Name: DMP; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -105,8 +97,8 @@ CREATE TABLE public."DMP" ( "AssociatedDmps" xml, "Profile" uuid, "Status" smallint DEFAULT 0 NOT NULL, - "Created" timestamp without time zone DEFAULT now() NOT NULL, - "Modified" timestamp without time zone DEFAULT now() NOT NULL, + "Created" timestamp(6) with time zone DEFAULT now() NOT NULL, + "Modified" timestamp(6) with time zone DEFAULT now() NOT NULL, "Description" text, "Creator" uuid, "Properties" text, @@ -115,15 +107,14 @@ CREATE TABLE public."DMP" ( "isPublic" boolean DEFAULT false NOT NULL, "PublishedAt" timestamp(6) with time zone, "DOI" text, - "Project" uuid + "Project" uuid, + "extraProperties" text ); ALTER TABLE public."DMP" OWNER TO :POSTGRES_USER; -- --- TOC entry 2478 (class 0 OID 0) --- Dependencies: 188 -- Name: COLUMN "DMP"."AssociatedDmps"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -131,7 +122,6 @@ COMMENT ON COLUMN public."DMP"."AssociatedDmps" IS 'More data about the DMP as d -- --- TOC entry 212 (class 1259 OID 38303) -- Name: DMPDatasetProfile; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -145,7 +135,6 @@ CREATE TABLE public."DMPDatasetProfile" ( ALTER TABLE public."DMPDatasetProfile" OWNER TO :POSTGRES_USER; -- --- TOC entry 189 (class 1259 OID 37873) -- Name: DMPOrganisation; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -160,8 +149,6 @@ CREATE TABLE public."DMPOrganisation" ( ALTER TABLE public."DMPOrganisation" OWNER TO :POSTGRES_USER; -- --- TOC entry 2479 (class 0 OID 0) --- Dependencies: 189 -- Name: TABLE "DMPOrganisation"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -169,8 +156,6 @@ COMMENT ON TABLE public."DMPOrganisation" IS 'Linking of DMPs to Organisations'; -- --- TOC entry 2480 (class 0 OID 0) --- Dependencies: 189 -- Name: COLUMN "DMPOrganisation"."Role"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -178,7 +163,6 @@ COMMENT ON COLUMN public."DMPOrganisation"."Role" IS 'Enumerator of roles'; -- --- TOC entry 190 (class 1259 OID 37877) -- Name: DMPProfile; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -187,15 +171,14 @@ CREATE TABLE public."DMPProfile" ( "Label" character varying(250) NOT NULL, "Definition" xml, "Status" smallint DEFAULT 0 NOT NULL, - "Created" timestamp without time zone DEFAULT now() NOT NULL, - "Modified" timestamp without time zone DEFAULT now() NOT NULL + "Created" timestamp(6) with time zone DEFAULT now() NOT NULL, + "Modified" timestamp(6) with time zone DEFAULT now() NOT NULL ); ALTER TABLE public."DMPProfile" OWNER TO :POSTGRES_USER; -- --- TOC entry 191 (class 1259 OID 37887) -- Name: DMPResearcher; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -210,8 +193,6 @@ CREATE TABLE public."DMPResearcher" ( ALTER TABLE public."DMPResearcher" OWNER TO :POSTGRES_USER; -- --- TOC entry 2481 (class 0 OID 0) --- Dependencies: 191 -- Name: TABLE "DMPResearcher"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -219,8 +200,6 @@ COMMENT ON TABLE public."DMPResearcher" IS 'Linking of DMPs to researchers'; -- --- TOC entry 2482 (class 0 OID 0) --- Dependencies: 191 -- Name: COLUMN "DMPResearcher"."Role"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -228,7 +207,6 @@ COMMENT ON COLUMN public."DMPResearcher"."Role" IS 'Enumerator of roles'; -- --- TOC entry 192 (class 1259 OID 37891) -- Name: DataRepository; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -249,7 +227,6 @@ CREATE TABLE public."DataRepository" ( ALTER TABLE public."DataRepository" OWNER TO :POSTGRES_USER; -- --- TOC entry 193 (class 1259 OID 37901) -- Name: Dataset; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -262,8 +239,8 @@ CREATE TABLE public."Dataset" ( "Profile" uuid, "Reference" text, "Status" smallint DEFAULT 0 NOT NULL, - "Created" timestamp without time zone DEFAULT now() NOT NULL, - "Modified" timestamp without time zone DEFAULT now() NOT NULL, + "Created" timestamp(6) with time zone DEFAULT now() NOT NULL, + "Modified" timestamp(6) with time zone DEFAULT now() NOT NULL, "Description" text, "Creator" uuid, "FinalizedAt" timestamp(6) with time zone @@ -273,8 +250,6 @@ CREATE TABLE public."Dataset" ( ALTER TABLE public."Dataset" OWNER TO :POSTGRES_USER; -- --- TOC entry 2483 (class 0 OID 0) --- Dependencies: 193 -- Name: COLUMN "Dataset"."Uri"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -282,8 +257,6 @@ COMMENT ON COLUMN public."Dataset"."Uri" IS 'URI of item'; -- --- TOC entry 2484 (class 0 OID 0) --- Dependencies: 193 -- Name: COLUMN "Dataset"."Properties"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -291,7 +264,6 @@ COMMENT ON COLUMN public."Dataset"."Properties" IS 'More data about the dataset -- --- TOC entry 194 (class 1259 OID 37912) -- Name: DatasetDataRepository; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -307,8 +279,6 @@ CREATE TABLE public."DatasetDataRepository" ( ALTER TABLE public."DatasetDataRepository" OWNER TO :POSTGRES_USER; -- --- TOC entry 2485 (class 0 OID 0) --- Dependencies: 194 -- Name: TABLE "DatasetDataRepository"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -316,7 +286,6 @@ COMMENT ON TABLE public."DatasetDataRepository" IS 'Linking Dataset to DataRepos -- --- TOC entry 195 (class 1259 OID 37916) -- Name: DatasetExternalDataset; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -332,7 +301,6 @@ CREATE TABLE public."DatasetExternalDataset" ( ALTER TABLE public."DatasetExternalDataset" OWNER TO :POSTGRES_USER; -- --- TOC entry 196 (class 1259 OID 37923) -- Name: DatasetProfile; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -341,19 +309,18 @@ CREATE TABLE public."DatasetProfile" ( "Label" character varying(250) NOT NULL, "Definition" xml NOT NULL, "Status" smallint DEFAULT 0 NOT NULL, - "Created" timestamp without time zone DEFAULT now() NOT NULL, - "Modified" timestamp without time zone DEFAULT now() NOT NULL, + "Created" timestamp(6) with time zone DEFAULT now() NOT NULL, + "Modified" timestamp(6) with time zone DEFAULT now() NOT NULL, "Description" text NOT NULL, - "GroupId" uuid DEFAULT public.uuid_generate_v1() NOT NULL, - "Version" integer DEFAULT 0 NOT NULL + "GroupId" uuid NOT NULL, + "Version" integer DEFAULT 0 NOT NULL, + "Language" character varying NOT NULL ); ALTER TABLE public."DatasetProfile" OWNER TO :POSTGRES_USER; -- --- TOC entry 2486 (class 0 OID 0) --- Dependencies: 196 -- Name: TABLE "DatasetProfile"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -361,7 +328,6 @@ COMMENT ON TABLE public."DatasetProfile" IS 'Profiles for dmp datasets'; -- --- TOC entry 197 (class 1259 OID 37933) -- Name: DatasetProfileRuleset; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -375,8 +341,6 @@ CREATE TABLE public."DatasetProfileRuleset" ( ALTER TABLE public."DatasetProfileRuleset" OWNER TO :POSTGRES_USER; -- --- TOC entry 2487 (class 0 OID 0) --- Dependencies: 197 -- Name: TABLE "DatasetProfileRuleset"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -384,7 +348,6 @@ COMMENT ON TABLE public."DatasetProfileRuleset" IS 'Sets of Rules for dmp datase -- --- TOC entry 198 (class 1259 OID 37940) -- Name: DatasetProfileViewstyle; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -398,8 +361,6 @@ CREATE TABLE public."DatasetProfileViewstyle" ( ALTER TABLE public."DatasetProfileViewstyle" OWNER TO :POSTGRES_USER; -- --- TOC entry 2488 (class 0 OID 0) --- Dependencies: 198 -- Name: TABLE "DatasetProfileViewstyle"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -407,7 +368,6 @@ COMMENT ON TABLE public."DatasetProfileViewstyle" IS 'Style sets for dmp dataset -- --- TOC entry 199 (class 1259 OID 37947) -- Name: DatasetRegistry; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -423,8 +383,6 @@ CREATE TABLE public."DatasetRegistry" ( ALTER TABLE public."DatasetRegistry" OWNER TO :POSTGRES_USER; -- --- TOC entry 2489 (class 0 OID 0) --- Dependencies: 199 -- Name: TABLE "DatasetRegistry"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -432,7 +390,6 @@ COMMENT ON TABLE public."DatasetRegistry" IS 'Linking Dataset to Registry'; -- --- TOC entry 200 (class 1259 OID 37951) -- Name: DatasetService; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -448,8 +405,6 @@ CREATE TABLE public."DatasetService" ( ALTER TABLE public."DatasetService" OWNER TO :POSTGRES_USER; -- --- TOC entry 2490 (class 0 OID 0) --- Dependencies: 200 -- Name: TABLE "DatasetService"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -457,7 +412,6 @@ COMMENT ON TABLE public."DatasetService" IS 'Linking Dataset to Service'; -- --- TOC entry 220 (class 1259 OID 46459) -- Name: DoiFunder; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -471,7 +425,6 @@ CREATE TABLE public."DoiFunder" ( ALTER TABLE public."DoiFunder" OWNER TO :POSTGRES_USER; -- --- TOC entry 201 (class 1259 OID 37955) -- Name: ExternalDataset; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -480,8 +433,8 @@ CREATE TABLE public."ExternalDataset" ( "Label" character varying NOT NULL, "Abbreviation" character varying, "Reference" character varying NOT NULL, - "Created" date NOT NULL, - "Modified" date NOT NULL, + "Created" timestamp(4) with time zone NOT NULL, + "Modified" timestamp(4) with time zone NOT NULL, "CreationUser" uuid ); @@ -489,7 +442,6 @@ CREATE TABLE public."ExternalDataset" ( ALTER TABLE public."ExternalDataset" OWNER TO :POSTGRES_USER; -- --- TOC entry 214 (class 1259 OID 38352) -- Name: Funder; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -509,7 +461,6 @@ CREATE TABLE public."Funder" ( ALTER TABLE public."Funder" OWNER TO :POSTGRES_USER; -- --- TOC entry 204 (class 1259 OID 37978) -- Name: Grant; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -521,10 +472,10 @@ CREATE TABLE public."Grant" ( "Uri" character varying(250), "Definition" character varying, "Status" smallint DEFAULT 0 NOT NULL, - "Created" timestamp without time zone DEFAULT now() NOT NULL, - "Modified" timestamp without time zone DEFAULT now() NOT NULL, - "StartDate" timestamp without time zone, - "EndDate" timestamp without time zone, + "Created" timestamp(4) with time zone DEFAULT now() NOT NULL, + "Modified" timestamp(4) with time zone DEFAULT now() NOT NULL, + "StartDate" timestamp(4) with time zone, + "EndDate" timestamp(4) with time zone, "Description" text, "CreationUser" uuid DEFAULT '332ffc36-bd51-4d4e-bf9a-ffb01fdee05a'::uuid, "Type" numeric DEFAULT 0 NOT NULL, @@ -536,8 +487,6 @@ CREATE TABLE public."Grant" ( ALTER TABLE public."Grant" OWNER TO :POSTGRES_USER; -- --- TOC entry 2491 (class 0 OID 0) --- Dependencies: 204 -- Name: TABLE "Grant"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -545,8 +494,6 @@ COMMENT ON TABLE public."Grant" IS 'Table of project managed in the system'; -- --- TOC entry 2492 (class 0 OID 0) --- Dependencies: 204 -- Name: COLUMN "Grant"."ID"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -554,8 +501,6 @@ COMMENT ON COLUMN public."Grant"."ID" IS 'Unique identifier and primary key of i -- --- TOC entry 2493 (class 0 OID 0) --- Dependencies: 204 -- Name: COLUMN "Grant"."Label"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -563,8 +508,6 @@ COMMENT ON COLUMN public."Grant"."Label" IS 'A human readable long label of the -- --- TOC entry 2494 (class 0 OID 0) --- Dependencies: 204 -- Name: COLUMN "Grant"."Abbreviation"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -572,8 +515,6 @@ COMMENT ON COLUMN public."Grant"."Abbreviation" IS 'A human readable abbreviatio -- --- TOC entry 2495 (class 0 OID 0) --- Dependencies: 204 -- Name: COLUMN "Grant"."Reference"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -581,8 +522,6 @@ COMMENT ON COLUMN public."Grant"."Reference" IS 'Additional reference data for t -- --- TOC entry 2496 (class 0 OID 0) --- Dependencies: 204 -- Name: COLUMN "Grant"."Uri"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -590,8 +529,6 @@ COMMENT ON COLUMN public."Grant"."Uri" IS 'URI of item'; -- --- TOC entry 2497 (class 0 OID 0) --- Dependencies: 204 -- Name: COLUMN "Grant"."Definition"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -599,7 +536,6 @@ COMMENT ON COLUMN public."Grant"."Definition" IS 'More data about the project su -- --- TOC entry 202 (class 1259 OID 37962) -- Name: Invitation; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -617,7 +553,6 @@ CREATE TABLE public."Invitation" ( ALTER TABLE public."Invitation" OWNER TO :POSTGRES_USER; -- --- TOC entry 216 (class 1259 OID 38423) -- Name: Lock; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -633,7 +568,6 @@ CREATE TABLE public."Lock" ( ALTER TABLE public."Lock" OWNER TO :POSTGRES_USER; -- --- TOC entry 213 (class 1259 OID 38343) -- Name: LoginConfirmationEmail; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -650,7 +584,6 @@ CREATE TABLE public."LoginConfirmationEmail" ( ALTER TABLE public."LoginConfirmationEmail" OWNER TO :POSTGRES_USER; -- --- TOC entry 217 (class 1259 OID 38433) -- Name: Notification; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -673,7 +606,6 @@ CREATE TABLE public."Notification" ( ALTER TABLE public."Notification" OWNER TO :POSTGRES_USER; -- --- TOC entry 203 (class 1259 OID 37968) -- Name: Organisation; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -685,16 +617,14 @@ CREATE TABLE public."Organisation" ( "Uri" character varying(250), "Definition" xml, "Status" smallint DEFAULT 0 NOT NULL, - "Created" timestamp without time zone DEFAULT now() NOT NULL, - "Modified" timestamp without time zone DEFAULT now() NOT NULL + "Created" timestamp(6) with time zone DEFAULT now() NOT NULL, + "Modified" timestamp(6) with time zone DEFAULT now() NOT NULL ); ALTER TABLE public."Organisation" OWNER TO :POSTGRES_USER; -- --- TOC entry 2498 (class 0 OID 0) --- Dependencies: 203 -- Name: TABLE "Organisation"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -702,8 +632,6 @@ COMMENT ON TABLE public."Organisation" IS 'Table of organizations utilized in th -- --- TOC entry 2499 (class 0 OID 0) --- Dependencies: 203 -- Name: COLUMN "Organisation"."ID"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -711,8 +639,6 @@ COMMENT ON COLUMN public."Organisation"."ID" IS 'Unique identifier and primary k -- --- TOC entry 2500 (class 0 OID 0) --- Dependencies: 203 -- Name: COLUMN "Organisation"."Label"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -720,8 +646,6 @@ COMMENT ON COLUMN public."Organisation"."Label" IS 'A human readable long label -- --- TOC entry 2501 (class 0 OID 0) --- Dependencies: 203 -- Name: COLUMN "Organisation"."Abbreviation"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -729,8 +653,6 @@ COMMENT ON COLUMN public."Organisation"."Abbreviation" IS 'A human readable abbr -- --- TOC entry 2502 (class 0 OID 0) --- Dependencies: 203 -- Name: COLUMN "Organisation"."Reference"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -738,8 +660,6 @@ COMMENT ON COLUMN public."Organisation"."Reference" IS 'Reference to the URI of -- --- TOC entry 2503 (class 0 OID 0) --- Dependencies: 203 -- Name: COLUMN "Organisation"."Uri"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -747,8 +667,6 @@ COMMENT ON COLUMN public."Organisation"."Uri" IS 'URI of item'; -- --- TOC entry 2504 (class 0 OID 0) --- Dependencies: 203 -- Name: COLUMN "Organisation"."Definition"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -756,7 +674,6 @@ COMMENT ON COLUMN public."Organisation"."Definition" IS 'More data about the Org -- --- TOC entry 215 (class 1259 OID 38365) -- Name: Project; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -782,7 +699,6 @@ CREATE TABLE public."Project" ( ALTER TABLE public."Project" OWNER TO :POSTGRES_USER; -- --- TOC entry 205 (class 1259 OID 37990) -- Name: Registry; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -794,8 +710,8 @@ CREATE TABLE public."Registry" ( "Uri" character varying(250), "Definition" xml, "Status" smallint DEFAULT 0 NOT NULL, - "Created" timestamp without time zone DEFAULT now() NOT NULL, - "Modified" timestamp without time zone DEFAULT now() NOT NULL, + "Created" timestamp(6) with time zone DEFAULT now() NOT NULL, + "Modified" timestamp(6) with time zone DEFAULT now() NOT NULL, "CreationUser" uuid ); @@ -803,7 +719,6 @@ CREATE TABLE public."Registry" ( ALTER TABLE public."Registry" OWNER TO :POSTGRES_USER; -- --- TOC entry 206 (class 1259 OID 38000) -- Name: Researcher; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -815,8 +730,8 @@ CREATE TABLE public."Researcher" ( "Definition" xml, "Reference" character varying, "Status" smallint DEFAULT 0 NOT NULL, - "Created" timestamp without time zone DEFAULT now() NOT NULL, - "Modified" timestamp without time zone DEFAULT now() NOT NULL, + "Created" timestamp(6) with time zone DEFAULT now() NOT NULL, + "Modified" timestamp(6) with time zone DEFAULT now() NOT NULL, "CreationUser" uuid ); @@ -824,8 +739,6 @@ CREATE TABLE public."Researcher" ( ALTER TABLE public."Researcher" OWNER TO :POSTGRES_USER; -- --- TOC entry 2505 (class 0 OID 0) --- Dependencies: 206 -- Name: TABLE "Researcher"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -833,8 +746,6 @@ COMMENT ON TABLE public."Researcher" IS 'Table of Researcher managed in the syst -- --- TOC entry 2506 (class 0 OID 0) --- Dependencies: 206 -- Name: COLUMN "Researcher"."ID"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -842,8 +753,6 @@ COMMENT ON COLUMN public."Researcher"."ID" IS 'Unique identifier and primary key -- --- TOC entry 2507 (class 0 OID 0) --- Dependencies: 206 -- Name: COLUMN "Researcher"."Label"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -851,8 +760,6 @@ COMMENT ON COLUMN public."Researcher"."Label" IS 'Full name of the researcher (a -- --- TOC entry 2508 (class 0 OID 0) --- Dependencies: 206 -- Name: COLUMN "Researcher"."Uri"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -860,8 +767,6 @@ COMMENT ON COLUMN public."Researcher"."Uri" IS 'URI of item'; -- --- TOC entry 2509 (class 0 OID 0) --- Dependencies: 206 -- Name: COLUMN "Researcher"."Definition"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -869,8 +774,6 @@ COMMENT ON COLUMN public."Researcher"."Definition" IS 'More data about the resea -- --- TOC entry 2510 (class 0 OID 0) --- Dependencies: 206 -- Name: COLUMN "Researcher"."Reference"; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -878,7 +781,6 @@ COMMENT ON COLUMN public."Researcher"."Reference" IS 'Additional reference data -- --- TOC entry 207 (class 1259 OID 38010) -- Name: Service; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -890,8 +792,8 @@ CREATE TABLE public."Service" ( "Uri" character varying(250), "Definition" xml, "Status" smallint DEFAULT 0 NOT NULL, - "Created" timestamp without time zone DEFAULT now() NOT NULL, - "Modified" timestamp without time zone DEFAULT now() NOT NULL, + "Created" timestamp(6) with time zone DEFAULT now() NOT NULL, + "Modified" timestamp(6) with time zone DEFAULT now() NOT NULL, "CreationUser" uuid ); @@ -899,7 +801,6 @@ CREATE TABLE public."Service" ( ALTER TABLE public."Service" OWNER TO :POSTGRES_USER; -- --- TOC entry 219 (class 1259 OID 46444) -- Name: UserAssociation; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -913,7 +814,6 @@ CREATE TABLE public."UserAssociation" ( ALTER TABLE public."UserAssociation" OWNER TO :POSTGRES_USER; -- --- TOC entry 208 (class 1259 OID 38020) -- Name: UserDMP; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -928,7 +828,6 @@ CREATE TABLE public."UserDMP" ( ALTER TABLE public."UserDMP" OWNER TO :POSTGRES_USER; -- --- TOC entry 209 (class 1259 OID 38024) -- Name: UserInfo; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -939,8 +838,8 @@ CREATE TABLE public."UserInfo" ( usertype smallint NOT NULL, verified_email boolean, name character varying(250), - created timestamp without time zone, - lastloggedin timestamp without time zone, + created timestamp(6) with time zone, + lastloggedin timestamp(6) with time zone, additionalinfo json ); @@ -948,8 +847,6 @@ CREATE TABLE public."UserInfo" ( ALTER TABLE public."UserInfo" OWNER TO :POSTGRES_USER; -- --- TOC entry 2511 (class 0 OID 0) --- Dependencies: 209 -- Name: COLUMN "UserInfo".authorization_level; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -957,8 +854,6 @@ COMMENT ON COLUMN public."UserInfo".authorization_level IS 'This stores the auth -- --- TOC entry 2512 (class 0 OID 0) --- Dependencies: 209 -- Name: COLUMN "UserInfo".usertype; Type: COMMENT; Schema: public; Owner: :POSTGRES_USER -- @@ -966,7 +861,20 @@ COMMENT ON COLUMN public."UserInfo".usertype IS 'This stores the type of user: 0 -- --- TOC entry 210 (class 1259 OID 38031) +-- Name: UserPreference; Type: TABLE; Schema: public; Owner: :POSTGRES_USER +-- + +CREATE TABLE public."UserPreference" ( + "Id" uuid NOT NULL, + "UserId" uuid NOT NULL, + "Data" json NOT NULL, + "PreferenceType" smallint NOT NULL +); + + +ALTER TABLE public."UserPreference" OWNER TO :POSTGRES_USER; + +-- -- Name: UserRole; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- @@ -980,22 +888,20 @@ CREATE TABLE public."UserRole" ( ALTER TABLE public."UserRole" OWNER TO :POSTGRES_USER; -- --- TOC entry 211 (class 1259 OID 38039) -- Name: UserToken; Type: TABLE; Schema: public; Owner: :POSTGRES_USER -- CREATE TABLE public."UserToken" ( "Token" uuid NOT NULL, "UserId" uuid NOT NULL, - "IssuedAt" date NOT NULL, - "ExpiresAt" date NOT NULL + "IssuedAt" timestamp(4) with time zone NOT NULL, + "ExpiresAt" timestamp(4) with time zone NOT NULL ); ALTER TABLE public."UserToken" OWNER TO :POSTGRES_USER; -- --- TOC entry 2251 (class 2606 OID 38044) -- Name: Content Content_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1004,7 +910,6 @@ ALTER TABLE ONLY public."Content" -- --- TOC entry 2253 (class 2606 OID 38046) -- Name: Credential Credential_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1013,7 +918,6 @@ ALTER TABLE ONLY public."Credential" -- --- TOC entry 2305 (class 2606 OID 38308) -- Name: DMPDatasetProfile DMPDatasetProfile_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1022,7 +926,6 @@ ALTER TABLE ONLY public."DMPDatasetProfile" -- --- TOC entry 2260 (class 2606 OID 38048) -- Name: DMPProfile DMPPRofile_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1031,7 +934,6 @@ ALTER TABLE ONLY public."DMPProfile" -- --- TOC entry 2255 (class 2606 OID 38050) -- Name: DMP DMP_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1040,7 +942,6 @@ ALTER TABLE ONLY public."DMP" -- --- TOC entry 2269 (class 2606 OID 38246) -- Name: DatasetDataRepository DatasetDataRepository_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1049,7 +950,6 @@ ALTER TABLE ONLY public."DatasetDataRepository" -- --- TOC entry 2271 (class 2606 OID 38052) -- Name: DatasetExternalDataset DatasetExternalDataset_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1058,7 +958,6 @@ ALTER TABLE ONLY public."DatasetExternalDataset" -- --- TOC entry 2275 (class 2606 OID 38054) -- Name: DatasetProfileRuleset DatasetProfileRuleset_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1067,7 +966,6 @@ ALTER TABLE ONLY public."DatasetProfileRuleset" -- --- TOC entry 2277 (class 2606 OID 38056) -- Name: DatasetProfileViewstyle DatasetProfileViewstyle_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1076,7 +974,6 @@ ALTER TABLE ONLY public."DatasetProfileViewstyle" -- --- TOC entry 2273 (class 2606 OID 38058) -- Name: DatasetProfile DatasetProfile_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1085,7 +982,6 @@ ALTER TABLE ONLY public."DatasetProfile" -- --- TOC entry 2279 (class 2606 OID 38249) -- Name: DatasetRegistry DatasetRegistry_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1094,7 +990,6 @@ ALTER TABLE ONLY public."DatasetRegistry" -- --- TOC entry 2281 (class 2606 OID 38252) -- Name: DatasetService DatasetService_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1103,7 +998,6 @@ ALTER TABLE ONLY public."DatasetService" -- --- TOC entry 2266 (class 2606 OID 38060) -- Name: Dataset Dataset_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1112,7 +1006,6 @@ ALTER TABLE ONLY public."Dataset" -- --- TOC entry 2319 (class 2606 OID 46467) -- Name: DoiFunder DoiFunder_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1121,7 +1014,6 @@ ALTER TABLE ONLY public."DoiFunder" -- --- TOC entry 2283 (class 2606 OID 38062) -- Name: ExternalDataset ExternalDataset_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1130,7 +1022,6 @@ ALTER TABLE ONLY public."ExternalDataset" -- --- TOC entry 2309 (class 2606 OID 38364) -- Name: Funder Funder_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1139,7 +1030,6 @@ ALTER TABLE ONLY public."Funder" -- --- TOC entry 2289 (class 2606 OID 38078) -- Name: Grant Grant_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1148,7 +1038,6 @@ ALTER TABLE ONLY public."Grant" -- --- TOC entry 2285 (class 2606 OID 38064) -- Name: Invitation Invitation_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1157,7 +1046,6 @@ ALTER TABLE ONLY public."Invitation" -- --- TOC entry 2313 (class 2606 OID 38427) -- Name: Lock Lock_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1166,7 +1054,6 @@ ALTER TABLE ONLY public."Lock" -- --- TOC entry 2307 (class 2606 OID 38350) -- Name: LoginConfirmationEmail LoginConfirmationEmail_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1175,7 +1062,6 @@ ALTER TABLE ONLY public."LoginConfirmationEmail" -- --- TOC entry 2315 (class 2606 OID 38440) -- Name: Notification Notification_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1184,7 +1070,6 @@ ALTER TABLE ONLY public."Notification" -- --- TOC entry 2287 (class 2606 OID 38066) -- Name: Organisation Organisation_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1193,7 +1078,6 @@ ALTER TABLE ONLY public."Organisation" -- --- TOC entry 2258 (class 2606 OID 38068) -- Name: DMPOrganisation PKey_DMPOrganisation; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1202,7 +1086,6 @@ ALTER TABLE ONLY public."DMPOrganisation" -- --- TOC entry 2262 (class 2606 OID 38070) -- Name: DMPResearcher PKey_DMPResearcher; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1211,7 +1094,6 @@ ALTER TABLE ONLY public."DMPResearcher" -- --- TOC entry 2264 (class 2606 OID 38072) -- Name: DataRepository PKey_DataRepository; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1220,7 +1102,6 @@ ALTER TABLE ONLY public."DataRepository" -- --- TOC entry 2291 (class 2606 OID 38074) -- Name: Registry PKey_Registry; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1229,7 +1110,6 @@ ALTER TABLE ONLY public."Registry" -- --- TOC entry 2295 (class 2606 OID 38076) -- Name: Service PKey_Service; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1238,7 +1118,6 @@ ALTER TABLE ONLY public."Service" -- --- TOC entry 2311 (class 2606 OID 38377) -- Name: Project Project_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1247,7 +1126,6 @@ ALTER TABLE ONLY public."Project" -- --- TOC entry 2293 (class 2606 OID 38080) -- Name: Researcher Researcher_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1256,7 +1134,14 @@ ALTER TABLE ONLY public."Researcher" -- --- TOC entry 2297 (class 2606 OID 38082) +-- Name: UserDMP UserDMP_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER +-- + +ALTER TABLE ONLY public."UserDMP" + ADD CONSTRAINT "UserDMP_pkey" PRIMARY KEY (id); + + +-- -- Name: UserInfo UserInfo_email_key; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1265,7 +1150,6 @@ ALTER TABLE ONLY public."UserInfo" -- --- TOC entry 2299 (class 2606 OID 38084) -- Name: UserInfo UserInfo_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1274,7 +1158,14 @@ ALTER TABLE ONLY public."UserInfo" -- --- TOC entry 2301 (class 2606 OID 38086) +-- Name: UserPreference UserPreference_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER +-- + +ALTER TABLE ONLY public."UserPreference" + ADD CONSTRAINT "UserPreference_pkey" PRIMARY KEY ("Id"); + + +-- -- Name: UserRole UserRole_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1283,7 +1174,6 @@ ALTER TABLE ONLY public."UserRole" -- --- TOC entry 2303 (class 2606 OID 38088) -- Name: UserToken UserToken_pkey; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1292,7 +1182,6 @@ ALTER TABLE ONLY public."UserToken" -- --- TOC entry 2317 (class 2606 OID 46448) -- Name: UserAssociation pk_user_association; Type: CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1301,7 +1190,6 @@ ALTER TABLE ONLY public."UserAssociation" -- --- TOC entry 2256 (class 1259 OID 38089) -- Name: fki_DMPDMPProfileReference; Type: INDEX; Schema: public; Owner: :POSTGRES_USER -- @@ -1309,7 +1197,6 @@ CREATE INDEX "fki_DMPDMPProfileReference" ON public."DMP" USING btree ("Profile" -- --- TOC entry 2267 (class 1259 OID 38090) -- Name: fki_DatasetDatasetProfileReference; Type: INDEX; Schema: public; Owner: :POSTGRES_USER -- @@ -1317,7 +1204,6 @@ CREATE INDEX "fki_DatasetDatasetProfileReference" ON public."Dataset" USING btre -- --- TOC entry 2321 (class 2606 OID 38091) -- Name: DMP DMPDMPProfileReference; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1326,7 +1212,6 @@ ALTER TABLE ONLY public."DMP" -- --- TOC entry 2347 (class 2606 OID 38309) -- Name: DMPDatasetProfile DMPDatasetProfile_datasetprofile_fkey; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1335,7 +1220,6 @@ ALTER TABLE ONLY public."DMPDatasetProfile" -- --- TOC entry 2348 (class 2606 OID 38314) -- Name: DMPDatasetProfile DMPDatasetProfile_dmp_fkey; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1344,7 +1228,6 @@ ALTER TABLE ONLY public."DMPDatasetProfile" -- --- TOC entry 2324 (class 2606 OID 38096) -- Name: DMPOrganisation DMPOrganisationDMPReference; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1353,7 +1236,6 @@ ALTER TABLE ONLY public."DMPOrganisation" -- --- TOC entry 2325 (class 2606 OID 38101) -- Name: DMPOrganisation DMPOrganisationOrganisationReference; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1362,7 +1244,6 @@ ALTER TABLE ONLY public."DMPOrganisation" -- --- TOC entry 2322 (class 2606 OID 38106) -- Name: DMP DMPProjectReference; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1371,7 +1252,6 @@ ALTER TABLE ONLY public."DMP" -- --- TOC entry 2326 (class 2606 OID 38111) -- Name: DMPResearcher DMPResearcherDMPReference; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1380,7 +1260,6 @@ ALTER TABLE ONLY public."DMPResearcher" -- --- TOC entry 2327 (class 2606 OID 38116) -- Name: DMPResearcher DMPResearcherResearcherReference; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1389,7 +1268,6 @@ ALTER TABLE ONLY public."DMPResearcher" -- --- TOC entry 2328 (class 2606 OID 38121) -- Name: Dataset DatasetDMPReference; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1398,7 +1276,6 @@ ALTER TABLE ONLY public."Dataset" -- --- TOC entry 2331 (class 2606 OID 38126) -- Name: DatasetDataRepository DatasetDataRepositoryDataRepositoryReference; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1407,7 +1284,6 @@ ALTER TABLE ONLY public."DatasetDataRepository" -- --- TOC entry 2332 (class 2606 OID 38131) -- Name: DatasetDataRepository DatasetDataRepositoryDatasetReference; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1416,7 +1292,6 @@ ALTER TABLE ONLY public."DatasetDataRepository" -- --- TOC entry 2329 (class 2606 OID 38136) -- Name: Dataset DatasetDatasetProfileReference; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1425,7 +1300,6 @@ ALTER TABLE ONLY public."Dataset" -- --- TOC entry 2335 (class 2606 OID 38141) -- Name: DatasetRegistry DatasetRegistryDatasetReference; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1434,7 +1308,6 @@ ALTER TABLE ONLY public."DatasetRegistry" -- --- TOC entry 2336 (class 2606 OID 38146) -- Name: DatasetRegistry DatasetRegistryRegistryReference; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1443,7 +1316,6 @@ ALTER TABLE ONLY public."DatasetRegistry" -- --- TOC entry 2337 (class 2606 OID 38151) -- Name: DatasetService DatasetServiceDatasetReference; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1452,7 +1324,6 @@ ALTER TABLE ONLY public."DatasetService" -- --- TOC entry 2338 (class 2606 OID 38156) -- Name: DatasetService DatasetServiceServiceReference; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1461,7 +1332,6 @@ ALTER TABLE ONLY public."DatasetService" -- --- TOC entry 2351 (class 2606 OID 38428) -- Name: Lock LockUserReference; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1470,7 +1340,6 @@ ALTER TABLE ONLY public."Lock" -- --- TOC entry 2352 (class 2606 OID 38441) -- Name: Notification NotificationUserReference; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1479,7 +1348,6 @@ ALTER TABLE ONLY public."Notification" -- --- TOC entry 2343 (class 2606 OID 38161) -- Name: UserDMP UserDMP_dmp_fkey; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1488,7 +1356,6 @@ ALTER TABLE ONLY public."UserDMP" -- --- TOC entry 2344 (class 2606 OID 38166) -- Name: UserDMP UserDMP_usr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1497,7 +1364,6 @@ ALTER TABLE ONLY public."UserDMP" -- --- TOC entry 2345 (class 2606 OID 38171) -- Name: UserRole UserRole_userId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1506,7 +1372,6 @@ ALTER TABLE ONLY public."UserRole" -- --- TOC entry 2330 (class 2606 OID 38176) -- Name: Dataset fk_dataset_creator; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1515,7 +1380,6 @@ ALTER TABLE ONLY public."Dataset" -- --- TOC entry 2323 (class 2606 OID 38181) -- Name: DMP fk_dmp_creator; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1524,7 +1388,6 @@ ALTER TABLE ONLY public."DMP" -- --- TOC entry 2342 (class 2606 OID 38196) -- Name: Grant fk_grant_content; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1533,7 +1396,6 @@ ALTER TABLE ONLY public."Grant" -- --- TOC entry 2341 (class 2606 OID 38201) -- Name: Grant fk_grant_creator; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1542,7 +1404,6 @@ ALTER TABLE ONLY public."Grant" -- --- TOC entry 2339 (class 2606 OID 38186) -- Name: Invitation fk_invitation_creator; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1551,7 +1412,6 @@ ALTER TABLE ONLY public."Invitation" -- --- TOC entry 2340 (class 2606 OID 38191) -- Name: Invitation fk_invitation_dmp; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1560,7 +1420,6 @@ ALTER TABLE ONLY public."Invitation" -- --- TOC entry 2349 (class 2606 OID 38378) -- Name: Project fk_project_content; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1569,7 +1428,6 @@ ALTER TABLE ONLY public."Project" -- --- TOC entry 2350 (class 2606 OID 38383) -- Name: Project fk_project_creator; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1578,7 +1436,6 @@ ALTER TABLE ONLY public."Project" -- --- TOC entry 2353 (class 2606 OID 46449) -- Name: UserAssociation fk_userinfo_user_association_1; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1587,7 +1444,6 @@ ALTER TABLE ONLY public."UserAssociation" -- --- TOC entry 2354 (class 2606 OID 46454) -- Name: UserAssociation fk_userinfo_user_association_2; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1596,7 +1452,6 @@ ALTER TABLE ONLY public."UserAssociation" -- --- TOC entry 2320 (class 2606 OID 38206) -- Name: Credential fkey_credential_user; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1605,7 +1460,6 @@ ALTER TABLE ONLY public."Credential" -- --- TOC entry 2333 (class 2606 OID 38211) -- Name: DatasetExternalDataset fkey_datasetexternaldataset_dataset; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1614,7 +1468,6 @@ ALTER TABLE ONLY public."DatasetExternalDataset" -- --- TOC entry 2334 (class 2606 OID 38216) -- Name: DatasetExternalDataset fkey_datasetexternaldataset_externaldataset; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1623,7 +1476,6 @@ ALTER TABLE ONLY public."DatasetExternalDataset" -- --- TOC entry 2346 (class 2606 OID 38221) -- Name: UserToken fkey_usetoken_user; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER -- @@ -1631,6 +1483,18 @@ ALTER TABLE ONLY public."UserToken" ADD CONSTRAINT fkey_usetoken_user FOREIGN KEY ("UserId") REFERENCES public."UserInfo"(id); +-- +-- Name: UserPreference userpreference_user_fk; Type: FK CONSTRAINT; Schema: public; Owner: :POSTGRES_USER +-- + +ALTER TABLE ONLY public."UserPreference" + ADD CONSTRAINT userpreference_user_fk FOREIGN KEY ("UserId") REFERENCES public."UserInfo"(id); + + +-- +-- Name: SCHEMA public; Type: ACL; Schema: -; Owner: postgres +-- + -- -- TOC entry 1827 (class 826 OID 16387) -- Name: DEFAULT PRIVILEGES FOR TYPES; Type: DEFAULT ACL; Schema: -; Owner: :POSTGRES_USER @@ -1649,8 +1513,6 @@ ALTER DEFAULT PRIVILEGES FOR ROLE :POSTGRES_USER REVOKE ALL ON FUNCTIONS FROM : ALTER DEFAULT PRIVILEGES FOR ROLE :POSTGRES_USER GRANT ALL ON FUNCTIONS TO :POSTGRES_USER WITH GRANT OPTION; --- Completed on 2020-05-12 17:07:43 - -- -- PostgreSQL database dump complete -- diff --git a/dmp-db-scema/updates/00.00.004_add_language_to_dmp_and_dataset_profile.sql b/dmp-db-scema/updates/00.00.004_add_language_to_dmp_and_dataset_profile.sql new file mode 100644 index 000000000..0bc6b8929 --- /dev/null +++ b/dmp-db-scema/updates/00.00.004_add_language_to_dmp_and_dataset_profile.sql @@ -0,0 +1,17 @@ +ALTER TABLE public."DMP" + ADD COLUMN "extraProperties" text; + +ALTER TABLE public."DatasetProfile" + ADD COLUMN "Language" character varying; + +UPDATE public."DMP" + SET "extraProperties"='{"language": "en"}'; + +UPDATE public."DatasetProfile" + SET "Language"='en'; + +ALTER TABLE public."DatasetProfile" + ALTER COLUMN "Language" SET NOT NULL; + +INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.00.004', '2020-06-03 12:00:00.000000+03', now(), 'Add language to DMP and Dataset Template'); + \ No newline at end of file diff --git a/dmp-frontend/src/app/core/core-service.module.ts b/dmp-frontend/src/app/core/core-service.module.ts index 0990f14c1..f4b1ebf49 100644 --- a/dmp-frontend/src/app/core/core-service.module.ts +++ b/dmp-frontend/src/app/core/core-service.module.ts @@ -41,6 +41,7 @@ import { LockService } from './services/lock/lock.service'; import { UserGuideService } from './services/user-guide/user-guide.service'; import { ConfigurationService } from './services/configuration/configuration.service'; import { HttpClient } from '@angular/common/http'; +import { LanguageInfoService } from './services/culture/language-info-service'; // // // This is shared module that provides all the services. Its imported only once on the AppModule. @@ -111,6 +112,7 @@ export class CoreServiceModule { deps: [ConfigurationService, HttpClient], multi: true }, + LanguageInfoService ], }; } diff --git a/dmp-frontend/src/app/core/model/admin/dataset-profile/dataset-profile.ts b/dmp-frontend/src/app/core/model/admin/dataset-profile/dataset-profile.ts index 916cf3b28..2bf055029 100644 --- a/dmp-frontend/src/app/core/model/admin/dataset-profile/dataset-profile.ts +++ b/dmp-frontend/src/app/core/model/admin/dataset-profile/dataset-profile.ts @@ -7,6 +7,7 @@ export interface DatasetProfile { status: number; version: number; description: string; + language: string; } export interface Page { diff --git a/dmp-frontend/src/app/core/model/dmp/dmp.ts b/dmp-frontend/src/app/core/model/dmp/dmp.ts index 15f226b0a..bf3112c88 100644 --- a/dmp-frontend/src/app/core/model/dmp/dmp.ts +++ b/dmp-frontend/src/app/core/model/dmp/dmp.ts @@ -10,6 +10,7 @@ import { DatasetModel } from "../dataset/dataset"; import { ProjectModel } from "../project/project"; import { FunderModel } from "../funder/funder"; import { DmpStatus } from '@app/core/common/enum/dmp-status'; +import { ExtraPropertiesFormModel } from '@app/ui/dmp/editor/general-tab/extra-properties-form.model'; export interface DmpModel { id: string; @@ -34,4 +35,5 @@ export interface DmpModel { definition: DmpProfileDefinition; dynamicFields: Array; modified: Date; + extraProperties: Map; } diff --git a/dmp-frontend/src/app/core/model/language-info.ts b/dmp-frontend/src/app/core/model/language-info.ts new file mode 100644 index 000000000..b96100cd2 --- /dev/null +++ b/dmp-frontend/src/app/core/model/language-info.ts @@ -0,0 +1,5 @@ +export interface LanguageInfo { + code: string; + name: string; + native: string; +} diff --git a/dmp-frontend/src/app/core/services/culture/language-info-service.ts b/dmp-frontend/src/app/core/services/culture/language-info-service.ts new file mode 100644 index 000000000..5e7b22481 --- /dev/null +++ b/dmp-frontend/src/app/core/services/culture/language-info-service.ts @@ -0,0 +1,86 @@ +import { registerLocaleData } from '@angular/common'; +import { Injectable } from '@angular/core'; +import { Observable, Subject } from 'rxjs'; +import { LoggingService } from '../logging/logging-service'; +import { TypeUtils } from '../utilities/type-utils.service'; +import { LanguageInfo } from '@app/core/model/language-info'; + +const availableLanguageInfos: LanguageInfo[] = require('../../../../assets/localization/languages.json'); + +@Injectable() +export class LanguageInfoService { + + private languageInfoValues = new Map(); // cultures by name + private languageInfoeChangeSubject = new Subject(); + private currentLanguageInfo: LanguageInfo; + + constructor( + private typeUtils: TypeUtils, + private logger: LoggingService + ) { + if (availableLanguageInfos) { + this.languageInfoValues = new Map(); + availableLanguageInfos.forEach(languageInfo => { + this.languageInfoValues.set(languageInfo.code, languageInfo); + }); + } + } + + getLanguageInfoValues(): LanguageInfo[] { + const values: LanguageInfo[] = []; + this.languageInfoValues.forEach((value) => values.push(value)); + return values; + } + + getLanguageInfoValue(languageInfo: string): LanguageInfo | undefined { + return this.languageInfoValues.get(languageInfo); + } + + languageInfoSelected(languageInfo: string | LanguageInfo) { + let newLanguageInfoName: string; + if (this.typeUtils.isString(languageInfo)) { + if (this.currentLanguageInfo && this.currentLanguageInfo.code === languageInfo) { return; } + newLanguageInfoName = languageInfo; + } else { + if (this.currentLanguageInfo && this.currentLanguageInfo.code === languageInfo.code) { return; } + newLanguageInfoName = languageInfo.code; + } + + const newLanguageInfo = this.languageInfoValues.get(newLanguageInfoName); + if (!newLanguageInfo) { + console.error(`unsupported language given: ${newLanguageInfoName}`); //TODO: throw error? + return; + } + this.currentLanguageInfo = newLanguageInfo; + this.languageInfoeChangeSubject.next(newLanguageInfo); + + // Set angular locale based on user selection. + // This is a very hacky way to map cultures with angular cultures, since there is no mapping. We first try to + // use the culture with the specialization (ex en-US), and if not exists we import the base culture (first part). + let locale = newLanguageInfo.code; + import(`@angular/common/locales/${locale}.js`).catch(reason => { + this.logger.error('Could not load locale: ' + locale); + }).then(selectedLocale => { + if (selectedLocale) { + registerLocaleData(selectedLocale.default); + } else { + // locale = newCulture.code.split('-')[0]; + import(`@angular/common/locales/${locale}.js`).catch(reason => { + this.logger.error('Could not load locale: ' + locale); + }).then(selectedDefaultLocale => { + if (selectedDefaultLocale !== undefined) { + registerLocaleData(selectedDefaultLocale.default); + } + }); + } + }); + } + + getLanguageInfoChangeObservable(): Observable { + return this.languageInfoeChangeSubject.asObservable(); + } + + getCurrentLanguageInfo(): LanguageInfo { + return this.currentLanguageInfo; + } +} diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor-model.ts b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor-model.ts index c29aaae47..700dd4ae7 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor-model.ts +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor-model.ts @@ -13,6 +13,7 @@ export class DatasetProfileEditorModel extends BaseFormModel { public status: number; public version: number; private description: string; + private language: string; fromModel(item: DatasetProfile): DatasetProfileEditorModel { if (item.sections) { this.sections = item.sections.map(x => new SectionEditorModel().fromModel(x)); } @@ -21,6 +22,7 @@ export class DatasetProfileEditorModel extends BaseFormModel { this.status = item.status; this.version = item.version; this.description = item.description; + this.language = item.language; return this; } @@ -28,6 +30,7 @@ export class DatasetProfileEditorModel extends BaseFormModel { const formGroup: FormGroup = new FormBuilder().group({ label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('DatasetProfileEditorModel.label')) }, [Validators.required]], description: [{ value: this.description, disabled: (disabled && !skipDisable.includes('DatasetProfileEditorModel.description')) }, [Validators.required]], + language: [{ value: this.language, disabled: (disabled && !skipDisable.includes('DatasetProfileEditorModel.language')) }, [Validators.required]], status: [{ value: this.status, disabled: (disabled && !skipDisable.includes('DatasetProfileEditorModel.status')) }], version: [{ value: this.version, disabled: (disabled && !skipDisable.includes('DatasetProfileEditorModel.version')) }] }); diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.html b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.html index 210c1cdac..545667566 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.html +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.html @@ -23,6 +23,17 @@ + + + + + {{ lang.name }} + + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + +

diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.ts b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.ts index e27f94cad..020aeb802 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.ts +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.ts @@ -22,6 +22,8 @@ import { SectionEditorModel } from '@app/ui/admin/dataset-profile/admin/section- import { PageEditorModel } from '@app/ui/admin/dataset-profile/admin/page-editor-model'; import { DatasetStatus } from '@app/core/common/enum/dataset-status'; import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; +import { LanguageInfo } from '@app/core/model/language-info'; +import { LanguageInfoService } from '@app/core/services/culture/language-info-service'; const skipDisable: any[] = require('../../../../../assets/resources/skipDisable.json'); @@ -53,7 +55,8 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn private logger: LoggingService, private uiNotificationService: UiNotificationService, private language: TranslateService, - private dialog: MatDialog + private dialog: MatDialog, + private languageInfoService: LanguageInfoService ) { super(); // this.profileID = route.snapshot.params['id']; @@ -126,6 +129,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn this.form.get('version').setValue(this.form.get('version').value + 1); this.form.controls['label'].disable(); this.form.controls['description'].disable(); + this.form.controls['language'].disable(); this.prepareForm(); } catch { this.logger.error('Could not parse MasterItem: ' + data); @@ -322,4 +326,8 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn } return filename; } + + getLanguageInfos(): LanguageInfo[] { + return this.languageInfoService.getLanguageInfoValues(); + } } diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts index 1a03c4a27..33f31b2fe 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts @@ -43,6 +43,7 @@ import { Guid } from '@common/types/guid'; import { isNullOrUndefined } from 'util'; import { environment } from 'environments/environment'; import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; +import { ExtraPropertiesFormModel } from './general-tab/extra-properties-form.model'; @Component({ selector: 'app-dmp-editor-component', @@ -134,6 +135,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC this.dmp.grant = new GrantTabModel(); this.dmp.project = new ProjectFormModel(); this.dmp.funder = new FunderFormModel(); + this.dmp.extraProperties = new ExtraPropertiesFormModel(); this.dmp.fromModel(data); this.formGroup = this.dmp.buildForm(); this.setIsUserOwner(); @@ -190,6 +192,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC this.dmp.grant = new GrantTabModel(); this.dmp.project = new ProjectFormModel(); this.dmp.funder = new FunderFormModel(); + this.dmp.extraProperties = new ExtraPropertiesFormModel(); this.dmp.fromModel(data); this.formGroup = this.dmp.buildForm(); //this.registerFormEventsForDmpProfile(this.dmp.definition); diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.model.ts b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.model.ts index 105747e01..df0079530 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.model.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.model.ts @@ -20,6 +20,7 @@ import { ProjectFormModel } from '@app/ui/dmp/editor/grant-tab/project-form-mode import { BackendErrorValidator } from '@common/forms/validation/custom-validator'; import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model'; import { ValidationContext } from '@common/forms/validation/validation-context'; +import { ExtraPropertiesFormModel } from './general-tab/extra-properties-form.model'; export class DmpEditorModel { public id: string; @@ -45,6 +46,7 @@ export class DmpEditorModel { public dynamicFields: Array = []; public validationErrorModel: ValidationErrorModel = new ValidationErrorModel(); public modified: Date; + public extraProperties: ExtraPropertiesFormModel; fromModel(item: DmpModel): DmpEditorModel { this.id = item.id; @@ -69,6 +71,7 @@ export class DmpEditorModel { if (item.dynamicFields) { item.dynamicFields.map(x => this.dynamicFields.push(new DmpDynamicFieldEditorModel().fromModel(x))); } this.creator = item.creator; this.modified = new Date(item.modified); + this.extraProperties.fromModel(item.extraProperties); return this; } @@ -93,7 +96,8 @@ export class DmpEditorModel { datasetsToBeFinalized: [{ value: this.datasetsToBeFinalized, disabled: disabled }, context.getValidation('datasetsToBeFinalized').validators], associatedUsers: [{ value: this.associatedUsers, disabled: disabled }, context.getValidation('associatedUsers').validators], users: [{ value: this.users, disabled: disabled }, context.getValidation('users').validators], - modified: [{value: this.modified, disabled: disabled}, context.getValidation('modified').validators] + modified: [{value: this.modified, disabled: disabled}, context.getValidation('modified').validators], + extraProperties: this.extraProperties.buildForm(), }); const dynamicFields = new Array(); diff --git a/dmp-frontend/src/app/ui/dmp/editor/general-tab/extra-properties-form.model.ts b/dmp-frontend/src/app/ui/dmp/editor/general-tab/extra-properties-form.model.ts new file mode 100644 index 000000000..5ac10bbf5 --- /dev/null +++ b/dmp-frontend/src/app/ui/dmp/editor/general-tab/extra-properties-form.model.ts @@ -0,0 +1,28 @@ +import { ValidationContext } from '@common/forms/validation/validation-context'; +import { FormGroup, FormBuilder, Validators } from '@angular/forms'; +import { BackendErrorValidator } from '@common/forms/validation/custom-validator'; + +export class ExtraPropertiesFormModel { + public language: string; + + fromModel(item: any): ExtraPropertiesFormModel { + this.language = item.language; + return this; + } + + buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup { + if (context == null) { context = this.createValidationContext(); } + + const formGroup = new FormBuilder().group({ + language: [{ value: this.language, disabled: disabled }, context.getValidation('language').validators] + }); + return formGroup; + } + + createValidationContext(): ValidationContext { + const baseContext: ValidationContext = new ValidationContext(); + baseContext.validation.push({ key: 'language', validators: [] }); + return baseContext; + } + +} diff --git a/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.html b/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.html index 620a27cb4..943ed9ce5 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.html @@ -65,6 +65,22 @@ +
+ + + + + {{ lang.name }} + + + + {{formGroup.get('extraProperties').get('language').getError('backendError').message}} + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + +
diff --git a/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts b/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts index 3f6abf65b..8063f5f60 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts @@ -23,6 +23,8 @@ import { map, takeUntil } from 'rxjs/operators'; import { AddOrganizationComponent } from '../add-organization/add-organization.component'; import { isNullOrUndefined } from 'util'; import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; +import { LanguageInfoService } from '@app/core/services/culture/language-info-service'; +import { LanguageInfo } from '@app/core/model/language-info'; @Component({ selector: 'app-general-tab', @@ -73,13 +75,13 @@ export class GeneralTabComponent extends BaseComponent implements OnInit { private _service: DmpService, private dialog: MatDialog, private language: TranslateService, - private configurationService: ConfigurationService + private configurationService: ConfigurationService, + private languageInfoService: LanguageInfoService ) { super(); } ngOnInit() { - if (this.formGroup.get('definition')) { this.selectedDmpProfileDefinition = this.formGroup.get('definition').value; } this.registerFormEventsForDmpProfile(); @@ -218,4 +220,8 @@ export class GeneralTabComponent extends BaseComponent implements OnInit { return false; } + + getLanguageInfos(): LanguageInfo[] { + return this.languageInfoService.getLanguageInfoValues(); + } } diff --git a/dmp-frontend/src/assets/localization/languages.json b/dmp-frontend/src/assets/localization/languages.json new file mode 100644 index 000000000..76aff168b --- /dev/null +++ b/dmp-frontend/src/assets/localization/languages.json @@ -0,0 +1,937 @@ +[ + { + "code": "aa", + "name": "Afar", + "native": "Afar" + }, + { + "code": "ab", + "name": "Abkhazian", + "native": "Аҧсуа" + }, + { + "code": "af", + "name": "Afrikaans", + "native": "Afrikaans" + }, + { + "code": "ak", + "name": "Akan", + "native": "Akana" + }, + { + "code": "am", + "name": "Amharic", + "native": "አማርኛ" + }, + { + "code": "an", + "name": "Aragonese", + "native": "Aragonés" + }, + { + "code": "ar", + "name": "Arabic", + "native": "العربية", + "rtl": 1 + }, + { + "code": "as", + "name": "Assamese", + "native": "অসমীয়া" + }, + { + "code": "av", + "name": "Avar", + "native": "Авар" + }, + { + "code": "ay", + "name": "Aymara", + "native": "Aymar" + }, + { + "code": "az", + "name": "Azerbaijani", + "native": "Azərbaycanca / آذربايجان" + }, + { + "code": "ba", + "name": "Bashkir", + "native": "Башҡорт" + }, + { + "code": "be", + "name": "Belarusian", + "native": "Беларуская" + }, + { + "code": "bg", + "name": "Bulgarian", + "native": "Български" + }, + { + "code": "bh", + "name": "Bihari", + "native": "भोजपुरी" + }, + { + "code": "bi", + "name": "Bislama", + "native": "Bislama" + }, + { + "code": "bm", + "name": "Bambara", + "native": "Bamanankan" + }, + { + "code": "bn", + "name": "Bengali", + "native": "বাংলা" + }, + { + "code": "bo", + "name": "Tibetan", + "native": "བོད་ཡིག / Bod skad" + }, + { + "code": "br", + "name": "Breton", + "native": "Brezhoneg" + }, + { + "code": "bs", + "name": "Bosnian", + "native": "Bosanski" + }, + { + "code": "ca", + "name": "Catalan", + "native": "Català" + }, + { + "code": "ce", + "name": "Chechen", + "native": "Нохчийн" + }, + { + "code": "ch", + "name": "Chamorro", + "native": "Chamoru" + }, + { + "code": "co", + "name": "Corsican", + "native": "Corsu" + }, + { + "code": "cr", + "name": "Cree", + "native": "Nehiyaw" + }, + { + "code": "cs", + "name": "Czech", + "native": "Česky" + }, + { + "code": "cu", + "name": "Old Church Slavonic / Old Bulgarian", + "native": "словѣньскъ / slověnĭskŭ" + }, + { + "code": "cv", + "name": "Chuvash", + "native": "Чăваш" + }, + { + "code": "cy", + "name": "Welsh", + "native": "Cymraeg" + }, + { + "code": "da", + "name": "Danish", + "native": "Dansk" + }, + { + "code": "de", + "name": "German", + "native": "Deutsch" + }, + { + "code": "dv", + "name": "Divehi", + "native": "ދިވެހިބަސް", + "rtl": 1 + }, + { + "code": "dz", + "name": "Dzongkha", + "native": "ཇོང་ཁ" + }, + { + "code": "ee", + "name": "Ewe", + "native": "Ɛʋɛ" + }, + { + "code": "el", + "name": "Greek", + "native": "Ελληνικά" + }, + { + "code": "en", + "name": "English", + "native": "English" + }, + { + "code": "eo", + "name": "Esperanto", + "native": "Esperanto" + }, + { + "code": "es", + "name": "Spanish", + "native": "Español" + }, + { + "code": "et", + "name": "Estonian", + "native": "Eesti" + }, + { + "code": "eu", + "name": "Basque", + "native": "Euskara" + }, + { + "code": "fa", + "name": "Persian", + "native": "فارسی", + "rtl": 1 + }, + { + "code": "ff", + "name": "Peul", + "native": "Fulfulde" + }, + { + "code": "fi", + "name": "Finnish", + "native": "Suomi" + }, + { + "code": "fj", + "name": "Fijian", + "native": "Na Vosa Vakaviti" + }, + { + "code": "fo", + "name": "Faroese", + "native": "Føroyskt" + }, + { + "code": "fr", + "name": "French", + "native": "Français" + }, + { + "code": "fy", + "name": "West Frisian", + "native": "Frysk" + }, + { + "code": "ga", + "name": "Irish", + "native": "Gaeilge" + }, + { + "code": "gd", + "name": "Scottish Gaelic", + "native": "Gàidhlig" + }, + { + "code": "gl", + "name": "Galician", + "native": "Galego" + }, + { + "code": "gn", + "name": "Guarani", + "native": "Avañe'ẽ" + }, + { + "code": "gu", + "name": "Gujarati", + "native": "ગુજરાતી" + }, + { + "code": "gv", + "name": "Manx", + "native": "Gaelg" + }, + { + "code": "ha", + "name": "Hausa", + "native": "هَوُسَ", + "rtl": 1 + }, + { + "code": "he", + "name": "Hebrew", + "native": "עברית", + "rtl": 1 + }, + { + "code": "hi", + "name": "Hindi", + "native": "हिन्दी" + }, + { + "code": "ho", + "name": "Hiri Motu", + "native": "Hiri Motu" + }, + { + "code": "hr", + "name": "Croatian", + "native": "Hrvatski" + }, + { + "code": "ht", + "name": "Haitian", + "native": "Krèyol ayisyen" + }, + { + "code": "hu", + "name": "Hungarian", + "native": "Magyar" + }, + { + "code": "hy", + "name": "Armenian", + "native": "Հայերեն" + }, + { + "code": "hz", + "name": "Herero", + "native": "Otsiherero" + }, + { + "code": "ia", + "name": "Interlingua", + "native": "Interlingua" + }, + { + "code": "id", + "name": "Indonesian", + "native": "Bahasa Indonesia" + }, + { + "code": "ie", + "name": "Interlingue", + "native": "Interlingue" + }, + { + "code": "ig", + "name": "Igbo", + "native": "Igbo" + }, + { + "code": "ii", + "name": "Sichuan Yi", + "native": "ꆇꉙ / 四川彝语" + }, + { + "code": "ik", + "name": "Inupiak", + "native": "Iñupiak" + }, + { + "code": "io", + "name": "Ido", + "native": "Ido" + }, + { + "code": "is", + "name": "Icelandic", + "native": "Íslenska" + }, + { + "code": "it", + "name": "Italian", + "native": "Italiano" + }, + { + "code": "iu", + "name": "Inuktitut", + "native": "ᐃᓄᒃᑎᑐᑦ" + }, + { + "code": "ja", + "name": "Japanese", + "native": "日本語" + }, + { + "code": "jv", + "name": "Javanese", + "native": "Basa Jawa" + }, + { + "code": "ka", + "name": "Georgian", + "native": "ქართული" + }, + { + "code": "kg", + "name": "Kongo", + "native": "KiKongo" + }, + { + "code": "ki", + "name": "Kikuyu", + "native": "Gĩkũyũ" + }, + { + "code": "kj", + "name": "Kuanyama", + "native": "Kuanyama" + }, + { + "code": "kk", + "name": "Kazakh", + "native": "Қазақша" + }, + { + "code": "kl", + "name": "Greenlandic", + "native": "Kalaallisut" + }, + { + "code": "km", + "name": "Cambodian", + "native": "ភាសាខ្មែរ" + }, + { + "code": "kn", + "name": "Kannada", + "native": "ಕನ್ನಡ" + }, + { + "code": "ko", + "name": "Korean", + "native": "한국어" + }, + { + "code": "kr", + "name": "Kanuri", + "native": "Kanuri" + }, + { + "code": "ks", + "name": "Kashmiri", + "native": "कश्मीरी / كشميري", + "rtl": 1 + }, + { + "code": "ku", + "name": "Kurdish", + "native": "Kurdî / كوردی", + "rtl": 1 + }, + { + "code": "kv", + "name": "Komi", + "native": "Коми" + }, + { + "code": "kw", + "name": "Cornish", + "native": "Kernewek" + }, + { + "code": "ky", + "name": "Kirghiz", + "native": "Kırgızca / Кыргызча" + }, + { + "code": "la", + "name": "Latin", + "native": "Latina" + }, + { + "code": "lb", + "name": "Luxembourgish", + "native": "Lëtzebuergesch" + }, + { + "code": "lg", + "name": "Ganda", + "native": "Luganda" + }, + { + "code": "li", + "name": "Limburgian", + "native": "Limburgs" + }, + { + "code": "ln", + "name": "Lingala", + "native": "Lingála" + }, + { + "code": "lo", + "name": "Laotian", + "native": "ລາວ / Pha xa lao" + }, + { + "code": "lt", + "name": "Lithuanian", + "native": "Lietuvių" + }, + { + "code": "lu", + "name": "Luba-Katanga", + "native": "Tshiluba" + }, + { + "code": "lv", + "name": "Latvian", + "native": "Latviešu" + }, + { + "code": "mg", + "name": "Malagasy", + "native": "Malagasy" + }, + { + "code": "mh", + "name": "Marshallese", + "native": "Kajin Majel / Ebon" + }, + { + "code": "mi", + "name": "Maori", + "native": "Māori" + }, + { + "code": "mk", + "name": "Macedonian", + "native": "Македонски" + }, + { + "code": "ml", + "name": "Malayalam", + "native": "മലയാളം" + }, + { + "code": "mn", + "name": "Mongolian", + "native": "Монгол" + }, + { + "code": "mo", + "name": "Moldovan", + "native": "Moldovenească" + }, + { + "code": "mr", + "name": "Marathi", + "native": "मराठी" + }, + { + "code": "ms", + "name": "Malay", + "native": "Bahasa Melayu" + }, + { + "code": "mt", + "name": "Maltese", + "native": "bil-Malti" + }, + { + "code": "my", + "name": "Burmese", + "native": "မြန်မာစာ" + }, + { + "code": "na", + "name": "Nauruan", + "native": "Dorerin Naoero" + }, + { + "code": "nb", + "name": "Norwegian Bokmål", + "native": "Norsk bokmål" + }, + { + "code": "nd", + "name": "North Ndebele", + "native": "Sindebele" + }, + { + "code": "ne", + "name": "Nepali", + "native": "नेपाली" + }, + { + "code": "ng", + "name": "Ndonga", + "native": "Oshiwambo" + }, + { + "code": "nl", + "name": "Dutch", + "native": "Nederlands" + }, + { + "code": "nn", + "name": "Norwegian Nynorsk", + "native": "Norsk nynorsk" + }, + { + "code": "no", + "name": "Norwegian", + "native": "Norsk" + }, + { + "code": "nr", + "name": "South Ndebele", + "native": "isiNdebele" + }, + { + "code": "nv", + "name": "Navajo", + "native": "Diné bizaad" + }, + { + "code": "ny", + "name": "Chichewa", + "native": "Chi-Chewa" + }, + { + "code": "oc", + "name": "Occitan", + "native": "Occitan" + }, + { + "code": "oj", + "name": "Ojibwa", + "native": "ᐊᓂᔑᓈᐯᒧᐎᓐ / Anishinaabemowin" + }, + { + "code": "om", + "name": "Oromo", + "native": "Oromoo" + }, + { + "code": "or", + "name": "Oriya", + "native": "ଓଡ଼ିଆ" + }, + { + "code": "os", + "name": "Ossetian / Ossetic", + "native": "Иронау" + }, + { + "code": "pa", + "name": "Panjabi / Punjabi", + "native": "ਪੰਜਾਬੀ / पंजाबी / پنجابي" + }, + { + "code": "pi", + "name": "Pali", + "native": "Pāli / पाऴि" + }, + { + "code": "pl", + "name": "Polish", + "native": "Polski" + }, + { + "code": "ps", + "name": "Pashto", + "native": "پښتو", + "rtl": 1 + }, + { + "code": "pt", + "name": "Portuguese", + "native": "Português" + }, + { + "code": "qu", + "name": "Quechua", + "native": "Runa Simi" + }, + { + "code": "rm", + "name": "Raeto Romance", + "native": "Rumantsch" + }, + { + "code": "rn", + "name": "Kirundi", + "native": "Kirundi" + }, + { + "code": "ro", + "name": "Romanian", + "native": "Română" + }, + { + "code": "ru", + "name": "Russian", + "native": "Русский" + }, + { + "code": "rw", + "name": "Rwandi", + "native": "Kinyarwandi" + }, + { + "code": "sa", + "name": "Sanskrit", + "native": "संस्कृतम्" + }, + { + "code": "sc", + "name": "Sardinian", + "native": "Sardu" + }, + { + "code": "sd", + "name": "Sindhi", + "native": "सिनधि" + }, + { + "code": "se", + "name": "Northern Sami", + "native": "Sámegiella" + }, + { + "code": "sg", + "name": "Sango", + "native": "Sängö" + }, + { + "code": "sh", + "name": "Serbo-Croatian", + "native": "Srpskohrvatski / Српскохрватски" + }, + { + "code": "si", + "name": "Sinhalese", + "native": "සිංහල" + }, + { + "code": "sk", + "name": "Slovak", + "native": "Slovenčina" + }, + { + "code": "sl", + "name": "Slovenian", + "native": "Slovenščina" + }, + { + "code": "sm", + "name": "Samoan", + "native": "Gagana Samoa" + }, + { + "code": "sn", + "name": "Shona", + "native": "chiShona" + }, + { + "code": "so", + "name": "Somalia", + "native": "Soomaaliga" + }, + { + "code": "sq", + "name": "Albanian", + "native": "Shqip" + }, + { + "code": "sr", + "name": "Serbian", + "native": "Српски" + }, + { + "code": "ss", + "name": "Swati", + "native": "SiSwati" + }, + { + "code": "st", + "name": "Southern Sotho", + "native": "Sesotho" + }, + { + "code": "su", + "name": "Sundanese", + "native": "Basa Sunda" + }, + { + "code": "sv", + "name": "Swedish", + "native": "Svenska" + }, + { + "code": "sw", + "name": "Swahili", + "native": "Kiswahili" + }, + { + "code": "ta", + "name": "Tamil", + "native": "தமிழ்" + }, + { + "code": "te", + "name": "Telugu", + "native": "తెలుగు" + }, + { + "code": "tg", + "name": "Tajik", + "native": "Тоҷикӣ" + }, + { + "code": "th", + "name": "Thai", + "native": "ไทย / Phasa Thai" + }, + { + "code": "ti", + "name": "Tigrinya", + "native": "ትግርኛ" + }, + { + "code": "tk", + "name": "Turkmen", + "native": "Туркмен / تركمن" + }, + { + "code": "tl", + "name": "Tagalog / Filipino", + "native": "Tagalog" + }, + { + "code": "tn", + "name": "Tswana", + "native": "Setswana" + }, + { + "code": "to", + "name": "Tonga", + "native": "Lea Faka-Tonga" + }, + { + "code": "tr", + "name": "Turkish", + "native": "Türkçe" + }, + { + "code": "ts", + "name": "Tsonga", + "native": "Xitsonga" + }, + { + "code": "tt", + "name": "Tatar", + "native": "Tatarça" + }, + { + "code": "tw", + "name": "Twi", + "native": "Twi" + }, + { + "code": "ty", + "name": "Tahitian", + "native": "Reo Mā`ohi" + }, + { + "code": "ug", + "name": "Uyghur", + "native": "Uyƣurqə / ئۇيغۇرچە" + }, + { + "code": "uk", + "name": "Ukrainian", + "native": "Українська" + }, + { + "code": "ur", + "name": "Urdu", + "native": "اردو", + "rtl": 1 + }, + { + "code": "uz", + "name": "Uzbek", + "native": "Ўзбек" + }, + { + "code": "ve", + "name": "Venda", + "native": "Tshivenḓa" + }, + { + "code": "vi", + "name": "Vietnamese", + "native": "Tiếng Việt" + }, + { + "code": "vo", + "name": "Volapük", + "native": "Volapük" + }, + { + "code": "wa", + "name": "Walloon", + "native": "Walon" + }, + { + "code": "wo", + "name": "Wolof", + "native": "Wollof" + }, + { + "code": "xh", + "name": "Xhosa", + "native": "isiXhosa" + }, + { + "code": "yi", + "name": "Yiddish", + "native": "ייִדיש", + "rtl": 1 + }, + { + "code": "yo", + "name": "Yoruba", + "native": "Yorùbá" + }, + { + "code": "za", + "name": "Zhuang", + "native": "Cuengh / Tôô / 壮语" + }, + { + "code": "zh", + "name": "Chinese", + "native": "中文" + }, + { + "code": "zu", + "name": "Zulu", + "native": "isiZulu" + } +] \ No newline at end of file