Fixing author rewrite
This commit is contained in:
parent
c23d2fc5b7
commit
f45f30d300
|
@ -125,6 +125,8 @@ public class CKANPackage extends CKAN implements Moderated {
|
|||
|
||||
protected final CatalogueConfiguration configuration;
|
||||
|
||||
protected boolean updateOperation;
|
||||
|
||||
protected ModerationThread moderationThread;
|
||||
|
||||
public CKANPackage() {
|
||||
|
@ -142,6 +144,8 @@ public class CKANPackage extends CKAN implements Moderated {
|
|||
configuration = CatalogueConfigurationFactory.getInstance();
|
||||
|
||||
ckanUser = CKANUserCache.getCurrrentCKANUser();
|
||||
|
||||
updateOperation = false;
|
||||
|
||||
}
|
||||
|
||||
|
@ -287,9 +291,13 @@ public class CKANPackage extends CKAN implements Moderated {
|
|||
if(authorName==null || authorName.compareTo("")==0) {
|
||||
authorName = ckanUser.getName();
|
||||
}
|
||||
objectNode.put(AUTHOR_KEY, authorName);
|
||||
String authorEmail = ckanUser.getEMail();
|
||||
objectNode.put(AUTHOR_EMAIL_KEY, authorEmail);
|
||||
|
||||
|
||||
if(!updateOperation) { // this prevent to change the original author in case of update
|
||||
objectNode.put(AUTHOR_KEY, authorName);
|
||||
objectNode.put(AUTHOR_EMAIL_KEY, authorEmail);
|
||||
}
|
||||
|
||||
|
||||
if(!objectNode.has(MAINTAINER_KEY)) {
|
||||
|
@ -828,6 +836,8 @@ public class CKANPackage extends CKAN implements Moderated {
|
|||
@Override
|
||||
public String update(String json) {
|
||||
try {
|
||||
this.updateOperation = true;
|
||||
|
||||
JsonNode jsonNode = validateJson(json);
|
||||
|
||||
/*
|
||||
|
@ -902,6 +912,8 @@ public class CKANPackage extends CKAN implements Moderated {
|
|||
@Override
|
||||
public String patch(String json) {
|
||||
try {
|
||||
this.updateOperation = true;
|
||||
|
||||
readItem();
|
||||
|
||||
JsonNode jsonNode = checkBaseInformation(json, true);
|
||||
|
|
Loading…
Reference in New Issue