Add ExtraProperties for DMP and language for Dataset Template

Remove_explore
George Kalampokis 4 years ago
parent 8a34ee6233
commit 78ee4673ee

@ -174,6 +174,9 @@ public class DMP implements DataEntity<DMP, UUID> {
@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<DMP, UUID> {
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<DMP, UUID> {
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

@ -86,6 +86,9 @@ public class DatasetProfile implements DataEntity<DatasetProfile,UUID>{
)
private List<DMP> dmps;
@Column(name = "\"Language\"", nullable = false)
private String language;
public String getDescription() {
return description;
@ -147,9 +150,17 @@ public class DatasetProfile implements DataEntity<DatasetProfile,UUID>{
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

@ -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<UUID>().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<eu.eudat.models.data.admin.composite.DatasetProfile>().payload(datasetprofile));
}

@ -29,6 +29,8 @@ public class DatasetProfileBuilder extends Builder<DatasetProfile> {
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<DatasetProfile> {
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> {
datasetProfile.setDescription(description);
datasetProfile.setModified(modified);
datasetProfile.setLabel(label);
datasetProfile.setLanguage(language);
return datasetProfile;
}
}

@ -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;

@ -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 {

@ -15,6 +15,7 @@ public class DatasetProfile {
private List<Section> 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;
}
}

@ -43,6 +43,7 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
private Project project;
private Funder funder;
private Boolean isPublic;
private Map<String, Object> extraProperties;
public UUID getId() {
return id;
@ -220,6 +221,14 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
isPublic = aPublic;
}
public Map<String, Object> getExtraProperties() {
return extraProperties;
}
public void setExtraProperties(Map<String, Object> extraProperties) {
this.extraProperties = extraProperties;
}
@Override
public DataManagementPlan fromDataModel(DMP entity) {
this.id = entity.getId();
@ -280,6 +289,8 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
}
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<DMP, DataManagementPlan> {
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<DMP, DataManagementPlan> {
}
this.isPublic = entity.isPublic();
this.extraProperties = entity.getExtraProperties() != null ? new org.json.JSONObject(entity.getExtraProperties()).toMap() : null;
return this;
}

@ -42,6 +42,7 @@ public class DataManagementPlanEditorModel implements DataModel<DMP, DataManagem
private List<UUID> datasetsToBeFinalized;
private ProjectDMPEditorModel project;
private FunderDMPEditorModel funder;
private Map<String, Object> extraProperties;
public UUID getId() {
return id;
@ -211,6 +212,14 @@ public class DataManagementPlanEditorModel implements DataModel<DMP, DataManagem
this.funder = funder;
}
public Map<String, Object> getExtraProperties() {
return extraProperties;
}
public void setExtraProperties(Map<String, Object> extraProperties) {
this.extraProperties = extraProperties;
}
@Override
public DataManagementPlanEditorModel fromDataModel(DMP entity) {
this.id = entity.getId();
@ -255,6 +264,7 @@ public class DataManagementPlanEditorModel implements DataModel<DMP, DataManagem
this.users = entity.getUsers().stream().map(item -> 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<DMP, DataManagem
if (this.dynamicFields != null)
dataManagementPlanEntity.setDmpProperties(JSONObject.toJSONString(this.dynamicFields.stream().filter(item -> item.getValue() != null).collect(Collectors.toMap(DynamicFieldWithValue::getId, DynamicFieldWithValue::getValue))));
dataManagementPlanEntity.setExtraProperties(this.extraProperties != null ? JSONObject.toJSONString(this.extraProperties) : null);
return dataManagementPlanEntity;
}

@ -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
* <p>
@ -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<String, Dataset.Language> CONSTANTS = new HashMap<String, Dataset.Language>();
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"),

@ -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
* <p>
@ -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<String, Dmp.Language> CONSTANTS = new HashMap<String, Dmp.Language>();
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;
}
}
}
}

@ -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<String, Language> 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;
}
}
}

@ -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<JsonNode> 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<JsonNode> metadataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.metadata");
if (!metadataNodes.isEmpty()) {

@ -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<String, Object> 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<String, Object> 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<String, Object> extraProperties = new HashMap<>();
extraProperties.put("language", LanguageRDAMapper.mapRDAIsoToLanguageIso(rda.getLanguage()));
entity.setExtraProperties(JSONObject.toJSONString(extraProperties));
return entity;
}

@ -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<String, Object> 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();
}
}

@ -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"
}

@ -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');
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');

File diff suppressed because it is too large Load Diff

@ -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');

@ -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
],
};
}

@ -7,6 +7,7 @@ export interface DatasetProfile {
status: number;
version: number;
description: string;
language: string;
}
export interface Page {

@ -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<DmpDynamicField>;
modified: Date;
extraProperties: Map<String, any>;
}

@ -0,0 +1,5 @@
export interface LanguageInfo {
code: string;
name: string;
native: string;
}

@ -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<string, LanguageInfo>(); // cultures by name
private languageInfoeChangeSubject = new Subject<LanguageInfo>();
private currentLanguageInfo: LanguageInfo;
constructor(
private typeUtils: TypeUtils,
private logger: LoggingService
) {
if (availableLanguageInfos) {
this.languageInfoValues = new Map<string, LanguageInfo>();
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<LanguageInfo> {
return this.languageInfoeChangeSubject.asObservable();
}
getCurrentLanguageInfo(): LanguageInfo {
return this.currentLanguageInfo;
}
}

@ -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')) }]
});

@ -23,6 +23,17 @@
</mat-error>
</mat-form-field>
<mat-form-field class="full-width">
<!-- <input matInput formControlName="description" placeholder="{{'DATASET-PROFILE-EDITOR.FIELDS.DATASET-DESCRIPTION' | translate}}" required> -->
<mat-select formControlName="language">
<mat-option *ngFor="let lang of getLanguageInfos()" [value]="lang.code">
{{ lang.name }}
</mat-option>
</mat-select>
<mat-error *ngIf="form.get('language').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>
</mat-form-field>
<div class="d-flex justify-content-end pb-3" *ngIf="form.get('status').value==1">
<button mat-raised-button color="primary" (click)="downloadXML();" type="button">{{ 'DATASET-WIZARD.ACTIONS.DOWNLOAD-XML' | translate }}</button>
</div>

@ -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();
}
}

@ -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);

@ -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<DmpDynamicFieldEditorModel> = [];
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<FormGroup>();

@ -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;
}
}

@ -65,6 +65,22 @@
</mat-form-field>
<!-- <h4 mat-subheader class="col-12">{{'DMP-EDITOR.FIELDS.PROFILE' | translate}}</h4> -->
</div>
<div class="row pt-3">
<mat-form-field class="col-sm-12 col-md-8">
<!-- <app-multiple-auto-complete [formControl]="formGroup.get('extraProperties').get('language')" placeholder="{{'DMP-EDITOR.FIELDS.RESEARCHERS' | translate}}" [configuration]="researchersAutoCompleteConfiguration">
</app-multiple-auto-complete> -->
<mat-select [formControl]="formGroup.get('extraProperties').get('language')">
<mat-option *ngFor="let lang of getLanguageInfos()" [value]="lang.code">
{{ lang.name }}
</mat-option>
</mat-select>
<mat-error *ngIf="formGroup.get('extraProperties').get('language').hasError('backendError')">
{{formGroup.get('extraProperties').get('language').getError('backendError').message}}</mat-error>
<mat-error *ngIf="formGroup.get('extraProperties').get('language').hasError('required')">
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<!-- <h4 mat-subheader class="col-12">{{'DMP-EDITOR.FIELDS.PROFILE' | translate}}</h4> -->
</div>
<div class="row pt-2">
<mat-form-field class="col-sm-12 col-md-8">
<app-single-auto-complete [required]="false" [formControl]="formGroup.get('profile')" placeholder="{{'DMP-EDITOR.FIELDS.TEMPLATE' | translate}}" [configuration]="dmpProfileAutoCompleteConfiguration">

@ -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();
}
}

@ -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"
}
]
Loading…
Cancel
Save