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 final CatalogueConfiguration configuration;
|
||||||
|
|
||||||
|
protected boolean updateOperation;
|
||||||
|
|
||||||
protected ModerationThread moderationThread;
|
protected ModerationThread moderationThread;
|
||||||
|
|
||||||
public CKANPackage() {
|
public CKANPackage() {
|
||||||
|
@ -142,6 +144,8 @@ public class CKANPackage extends CKAN implements Moderated {
|
||||||
configuration = CatalogueConfigurationFactory.getInstance();
|
configuration = CatalogueConfigurationFactory.getInstance();
|
||||||
|
|
||||||
ckanUser = CKANUserCache.getCurrrentCKANUser();
|
ckanUser = CKANUserCache.getCurrrentCKANUser();
|
||||||
|
|
||||||
|
updateOperation = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,9 +291,13 @@ public class CKANPackage extends CKAN implements Moderated {
|
||||||
if(authorName==null || authorName.compareTo("")==0) {
|
if(authorName==null || authorName.compareTo("")==0) {
|
||||||
authorName = ckanUser.getName();
|
authorName = ckanUser.getName();
|
||||||
}
|
}
|
||||||
objectNode.put(AUTHOR_KEY, authorName);
|
|
||||||
String authorEmail = ckanUser.getEMail();
|
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)) {
|
if(!objectNode.has(MAINTAINER_KEY)) {
|
||||||
|
@ -828,6 +836,8 @@ public class CKANPackage extends CKAN implements Moderated {
|
||||||
@Override
|
@Override
|
||||||
public String update(String json) {
|
public String update(String json) {
|
||||||
try {
|
try {
|
||||||
|
this.updateOperation = true;
|
||||||
|
|
||||||
JsonNode jsonNode = validateJson(json);
|
JsonNode jsonNode = validateJson(json);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -902,6 +912,8 @@ public class CKANPackage extends CKAN implements Moderated {
|
||||||
@Override
|
@Override
|
||||||
public String patch(String json) {
|
public String patch(String json) {
|
||||||
try {
|
try {
|
||||||
|
this.updateOperation = true;
|
||||||
|
|
||||||
readItem();
|
readItem();
|
||||||
|
|
||||||
JsonNode jsonNode = checkBaseInformation(json, true);
|
JsonNode jsonNode = checkBaseInformation(json, true);
|
||||||
|
|
Loading…
Reference in New Issue