Merge branch 'Development' of https://gitlab.eudat.eu/dmp/OpenAIRE-EUDAT-DMP-service-pilot into Development
This commit is contained in:
commit
d4ca651411
|
@ -115,6 +115,8 @@ public class UserManager {
|
||||||
apiContext.getOperationsContext().getDatabaseRepository().detachEntity(userInfo);
|
apiContext.getOperationsContext().getDatabaseRepository().detachEntity(userInfo);
|
||||||
HashMap<String, Object> result =
|
HashMap<String, Object> result =
|
||||||
new ObjectMapper().readValue(userInfo.getAdditionalinfo(), HashMap.class);
|
new ObjectMapper().readValue(userInfo.getAdditionalinfo(), HashMap.class);
|
||||||
|
userInfo.setName(settings.entrySet().stream().filter(entry -> entry.getKey().equals("name")).filter(Objects::nonNull).map(entry -> entry.getValue().toString()).findFirst().orElse(userInfo.getName()));
|
||||||
|
settings.remove("name");
|
||||||
result.putAll(settings);
|
result.putAll(settings);
|
||||||
userInfo.setAdditionalinfo(new JSONObject(result).toString());
|
userInfo.setAdditionalinfo(new JSONObject(result).toString());
|
||||||
apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao()
|
apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao()
|
||||||
|
|
|
@ -4,6 +4,7 @@ import eu.eudat.models.DataModel;
|
||||||
import eu.eudat.logic.utilities.helpers.LabelGenerator;
|
import eu.eudat.logic.utilities.helpers.LabelGenerator;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class Organisation implements DataModel<eu.eudat.data.entities.Organisation, Organisation>, LabelGenerator {
|
public class Organisation implements DataModel<eu.eudat.data.entities.Organisation, Organisation>, LabelGenerator {
|
||||||
|
@ -96,6 +97,18 @@ public class Organisation implements DataModel<eu.eudat.data.entities.Organisati
|
||||||
return organisationEntity;
|
return organisationEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Organisation fromMap(HashMap<String, Object> map) {
|
||||||
|
Organisation model = new Organisation();
|
||||||
|
model.id = (String) map.get("id");
|
||||||
|
model.key = (String) map.get("key");
|
||||||
|
model.label = (String) map.get("label");
|
||||||
|
model.name = (String) map.get("name");
|
||||||
|
model.reference = (String) map.get("reference");
|
||||||
|
model.status = (int) map.get("status");
|
||||||
|
model.tag = (String) map.get("tag");
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String generateLabel() {
|
public String generateLabel() {
|
||||||
return this.getName();
|
return this.getName();
|
||||||
|
|
|
@ -6,6 +6,7 @@ import eu.eudat.data.entities.*;
|
||||||
import eu.eudat.data.entities.UserInfo;
|
import eu.eudat.data.entities.UserInfo;
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
import eu.eudat.models.data.dmp.DataManagementPlan;
|
import eu.eudat.models.data.dmp.DataManagementPlan;
|
||||||
|
import eu.eudat.models.data.dmp.Organisation;
|
||||||
import net.minidev.json.parser.JSONParser;
|
import net.minidev.json.parser.JSONParser;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -32,6 +33,8 @@ public class UserProfile implements DataModel<eu.eudat.data.entities.UserInfo, U
|
||||||
private String timezone;
|
private String timezone;
|
||||||
private Map<String, Object> culture;
|
private Map<String, Object> culture;
|
||||||
private String avatarUrl;
|
private String avatarUrl;
|
||||||
|
private Organisation organization;
|
||||||
|
private String roleOrganization;
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -129,7 +132,25 @@ public class UserProfile implements DataModel<eu.eudat.data.entities.UserInfo, U
|
||||||
this.avatarUrl = avatarUrl;
|
this.avatarUrl = avatarUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
|
|
||||||
|
public Organisation getOrganization() {
|
||||||
|
return organization;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrganization(Organisation organization) {
|
||||||
|
this.organization = organization;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleOrganization() {
|
||||||
|
return roleOrganization;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleOrganization(String roleOrganization) {
|
||||||
|
this.roleOrganization = roleOrganization;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public UserProfile fromDataModel(UserInfo entity) {
|
public UserProfile fromDataModel(UserInfo entity) {
|
||||||
this.id = entity.getId();
|
this.id = entity.getId();
|
||||||
this.email = entity.getEmail();
|
this.email = entity.getEmail();
|
||||||
|
@ -144,6 +165,8 @@ public class UserProfile implements DataModel<eu.eudat.data.entities.UserInfo, U
|
||||||
this.timezone = (String) additionalInfo.get("timezone");
|
this.timezone = (String) additionalInfo.get("timezone");
|
||||||
this.zenodoEmail = (String) additionalInfo.get("zenodoEmail");
|
this.zenodoEmail = (String) additionalInfo.get("zenodoEmail");
|
||||||
this.avatarUrl = (String) additionalInfo.get("avatarUrl");
|
this.avatarUrl = (String) additionalInfo.get("avatarUrl");
|
||||||
|
this.organization = Organisation.fromMap((HashMap<String, Object>) additionalInfo.get("organization"));
|
||||||
|
this.roleOrganization = (String) additionalInfo.get("roleOrganization");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue