This commit is contained in:
Luca Frosini 2021-04-16 16:14:13 +02:00
parent 98df904693
commit 8cf2e5a3d8
2 changed files with 23 additions and 2 deletions

View File

@ -4,6 +4,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
## [v2.0.0]
- Fixed author and maintainer name and email [#21059] [#21189]
- Improved check on controlled vocabulary to match corner cases [#20742]
- Added PATCH method on Item collection [#19768]
- Switched JSON management to gcube-jackson [#19735]

View File

@ -88,6 +88,10 @@ public class CKANPackage extends CKAN {
protected static final String AUTHOR_KEY = "author";
protected static final String AUTHOR_EMAIL_KEY = "author_email";
protected static final String MAINTAINER_KEY = "maintainer";
protected static final String MAINTAINER_EMAIL_KEY = "maintainer_email";
protected static final String OWNER_ORG_KEY = "owner_org";
protected static final String RESOURCES_KEY = "resources";
protected static final String TITLE_KEY = "title";
@ -306,8 +310,24 @@ public class CKANPackage extends CKAN {
CKANUser ckanUser = CKANUserCache.getCurrrentCKANUser();
objectNode.put(AUTHOR_KEY, ckanUser.getName());
objectNode.put(AUTHOR_EMAIL_KEY, ckanUser.getPortalUser().getEMail());
String authorName = ckanUser.getPortalUser().getFullName();
if(authorName==null || authorName.compareTo("")==0) {
authorName = ckanUser.getName();
}
objectNode.put(AUTHOR_KEY, authorName);
String authorEmail = ckanUser.getPortalUser().getEMail();
objectNode.put(AUTHOR_EMAIL_KEY, authorEmail);
if(!objectNode.has(MAINTAINER_KEY)) {
if(!objectNode.has(MAINTAINER_EMAIL_KEY)) {
objectNode.put(MAINTAINER_KEY, authorName);
objectNode.put(MAINTAINER_EMAIL_KEY, authorEmail);
}else {
objectNode.put(MAINTAINER_KEY, objectNode.get(MAINTAINER_EMAIL_KEY).toString());
}
}
getPublishingOrganization(objectNode);