Reorganized code
This commit is contained in:
parent
0cf6e58dd4
commit
ded9f23deb
|
@ -300,6 +300,30 @@ public class CKANPackage extends CKAN implements Moderated {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected ObjectNode checkAndFixAuthorAndMaintainer(ObjectNode objectNode) {
|
||||||
|
String authorName = ckanUser.getSurnameName();
|
||||||
|
|
||||||
|
if(authorName==null || authorName.compareTo("")==0) {
|
||||||
|
authorName = ckanUser.getName();
|
||||||
|
}
|
||||||
|
String authorEmail = ckanUser.getEMail();
|
||||||
|
|
||||||
|
objectNode = checkAuthor(objectNode, authorName, authorEmail);
|
||||||
|
|
||||||
|
if(!objectNode.has(MAINTAINER_KEY)) {
|
||||||
|
if(!objectNode.has(MAINTAINER_EMAIL_KEY)) {
|
||||||
|
objectNode.put(MAINTAINER_KEY, authorName);
|
||||||
|
objectNode.put(MAINTAINER_EMAIL_KEY, authorEmail);
|
||||||
|
}else {
|
||||||
|
// We could try to retrieve Surname and Name of the maintainer if
|
||||||
|
// he/she is present as user in the VRE or in the catalogue.
|
||||||
|
objectNode.put(MAINTAINER_KEY, objectNode.get(MAINTAINER_EMAIL_KEY).toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return objectNode;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param json The json to check
|
* @param json The json to check
|
||||||
* @param allowPartialInfo used for patch method which provide only partial information (i.e. the info to patch)
|
* @param allowPartialInfo used for patch method which provide only partial information (i.e. the info to patch)
|
||||||
|
@ -374,26 +398,7 @@ public class CKANPackage extends CKAN implements Moderated {
|
||||||
objectNode.remove(CAPACITY_KEY);
|
objectNode.remove(CAPACITY_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
String authorName = ckanUser.getSurnameName();
|
objectNode = checkAndFixAuthorAndMaintainer(objectNode);
|
||||||
if(authorName==null || authorName.compareTo("")==0) {
|
|
||||||
authorName = ckanUser.getName();
|
|
||||||
}
|
|
||||||
String authorEmail = ckanUser.getEMail();
|
|
||||||
|
|
||||||
|
|
||||||
objectNode = checkAuthor(objectNode, authorName, authorEmail);
|
|
||||||
|
|
||||||
|
|
||||||
if(!objectNode.has(MAINTAINER_KEY)) {
|
|
||||||
if(!objectNode.has(MAINTAINER_EMAIL_KEY)) {
|
|
||||||
objectNode.put(MAINTAINER_KEY, authorName);
|
|
||||||
objectNode.put(MAINTAINER_EMAIL_KEY, authorEmail);
|
|
||||||
}else {
|
|
||||||
// We could try to retrieve Surname and Name of the maintainer if
|
|
||||||
// he/she is present as user in the VRE or in the catalogue.
|
|
||||||
objectNode.put(MAINTAINER_KEY, objectNode.get(MAINTAINER_EMAIL_KEY).toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getPublishingOrganization(objectNode);
|
getPublishingOrganization(objectNode);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue