|
From: <chr...@us...> - 2018-12-02 23:21:35
|
Revision: 206
http://sourceforge.net/p/andspidclient/code/206
Author: chris-trapani
Date: 2018-12-02 23:21:32 +0000 (Sun, 02 Dec 2018)
Log Message:
-----------
Merge pull request #4 in APPS/ands-pid-client from feature/DMSTECH-9566 to master
* commit '7573721470fc5a2066a00e42d05dc7ce9e455a29':
unused import.
DMSTECH-9566: recreate doi xml metadata on update.
Modified Paths:
--------------
trunk/src/main/java/au/csiro/doiclient/AndsDoiClient.java
trunk/src/main/java/au/csiro/doiclient/utils/ConverterUtils.java
Modified: trunk/src/main/java/au/csiro/doiclient/AndsDoiClient.java
===================================================================
--- trunk/src/main/java/au/csiro/doiclient/AndsDoiClient.java 2018-11-29 02:41:24 UTC (rev 205)
+++ trunk/src/main/java/au/csiro/doiclient/AndsDoiClient.java 2018-12-02 23:21:32 UTC (rev 206)
@@ -46,7 +46,6 @@
import au.csiro.doiclient.business.DoiDTO;
import au.csiro.doiclient.utils.DoiMetaDataGenerator;
import au.csiro.doiclient.utils.HttpUtil;
-import au.csiro.pidclient.AndsPidClient.HandleType;
/**
* This is the main interface to the ANDS DOI Client library. It allows the caller to interact with the <a
@@ -318,7 +317,7 @@
params.put("url", url);
setDebug(params, debug);
- return executeMethod(params, mintMethodName, null, doiDTO);
+ return executeMethod(params, mintMethodName, doiDTO);
}
@@ -439,10 +438,8 @@
}
setDebug(params, debug);
- AndsDoiResponse existingMetaDataXML = requestMetaDataOfDOI(doi);
- return executeMethod(params, updateMethodName,
- existingMetaDataXML.getMessage(), doiDTO);
+ return executeMethod(params, updateMethodName, doiDTO);
}
/**
@@ -487,7 +484,7 @@
setDebug(params, debug);
- return executeMethod(params, methodName, null, null);
+ return executeMethod(params, methodName, null);
}
/**
@@ -547,7 +544,7 @@
params.put("doi", doi);
setDebug(params, debug);
- return executeMethod(params, methodName, null, null);
+ return executeMethod(params, methodName, null);
}
/**
@@ -615,7 +612,7 @@
params.put("doi", doi);
setDebug(params, debug);
- return executeMethod(params, doiMetadataRequestMethodName, null, null);
+ return executeMethod(params, doiMetadataRequestMethodName, null);
}
@@ -699,8 +696,6 @@
* the method to call.
* @param updateURL
* associated with a DOI that needs to be updated.
- * @param existingMetaDataXML
- * meta-data associated with a DOI as held by ANDS.
* @param doiDTO
* holds the objects for constructing / updating the meta-data XML.
* @return a formatted XML response.
@@ -710,7 +705,7 @@
* thrown when attempting to execute method call.
*/
private AndsDoiResponse executeMethod(Map<String,String> queryStringParams, String methodName,
- String existingMetaDataXML, DoiDTO doiDTO) throws HttpException, IOException
+ DoiDTO doiDTO) throws HttpException, IOException
{
String metaDataXML = null;
@@ -745,10 +740,9 @@
// Updates the meta-data xml with the parameters set in the DTO.
if (methodName.equals(updateMethodName) && (doiDTO != null))
{
- metaDataXML = DoiMetaDataGenerator.updateMetaDataXMLFromDTO(existingMetaDataXML, doiDTO);
+ metaDataXML = DoiMetaDataGenerator.generateMetaDataXMLFromDTO(doiDTO);
}
-
return doiRequest(url, metaDataXML, requestType);
}
Modified: trunk/src/main/java/au/csiro/doiclient/utils/ConverterUtils.java
===================================================================
--- trunk/src/main/java/au/csiro/doiclient/utils/ConverterUtils.java 2018-11-29 02:41:24 UTC (rev 205)
+++ trunk/src/main/java/au/csiro/doiclient/utils/ConverterUtils.java 2018-12-02 23:21:32 UTC (rev 206)
@@ -587,7 +587,14 @@
xPath.addNamespace(nameSpace, document.getRootElement().getNamespaceURI());
Element theElement = (Element) xPath.selectSingleNode(document);
Attribute attr = theElement.getAttribute(name);
- attr.setValue(stripNonValidXMLCharacters(value));
+ if(attr == null)
+ {
+ theElement.setAttribute(new Attribute(name, value));
+ }
+ else
+ {
+ attr.setValue(stripNonValidXMLCharacters(value));
+ }
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|