<docType>CollectionObject</docType>\r
<singleCSID></singleCSID>\r
<groupCSID></groupCSID>\r
- <listCsids>\r
+ <listCSIDs>\r
<csid>${collectionObject1CSID}</csid>\r
<csid>${collectionObject2CSID}</csid>\r
- </listCsids>\r
+ </listCSIDs>\r
<params>\r
<param>\r
<key>some key</key>\r
<docType>CollectionObject</docType>\r
<singleCSID>${collectionObjectCSID}</singleCSID>\r
<groupCSID></groupCSID>\r
- <listCsids></listCsids>\r
+ <listCSIDs></listCSIDs>\r
<params></params>\r
</ns2:invocationContext>\r
\r
<run controlFile="collectionobject/collectionobject-displayname-update.xml" testGroup="DisplayNameChangesReflectedInRefNames" />\r
\r
<run controlFile="versioning/versioning.xml" testGroup="VersionedRecordFiltering" />\r
-\r
\r
+ <run controlFile="batch/batch-update-object-loc.xml" testGroup="testBatchUpdateComputedCurrentLocationInvModeSingle" />\r
+ <run controlFile="batch/batch-update-object-loc.xml" testGroup="testBatchUpdateComputedCurrentLocationInvModeList" />\r
+\r
<!-- Broken tests -->\r
\r
<!-- After most tests above were re-enabled in August 2012, the Batch test -->\r
this.errorInfo = null;
}
- protected void logInvocationContext() {
- if (logger.isInfoEnabled()) {
- logger.info("Invocation mode=" + this.getInvocationContext().getMode());
- logger.info("Invocation doc type=" + this.getInvocationContext().getDocType());
- logger.info("Invocation single CSID=" + this.getInvocationContext().getSingleCSID());
- logger.info("Invocation group CSID=" + this.getInvocationContext().getGroupCSID());
- InvocationContext.ListCSIDs lcsids = this.getInvocationContext().getListCSIDs();
- if (lcsids == null) {
- logger.info("Invocation list CSIDs are null.");
- } else {
- List<String> csidsList = lcsids.getCsid();
- if (csidsList != null) {
- for (String listcsid : csidsList) {
- logger.info("List CSID=" + listcsid);
- }
- }
- }
- InvocationContext.Params params = this.getInvocationContext().getParams();
- if (params == null) {
- logger.info("Invocation list Params are null.");
- } else {
- List<InvocationContext.Params.Param> paramsList = params.getParam();
- if (paramsList != null) {
- for (InvocationContext.Params.Param param : paramsList) {
- logger.info("Param key=" + param.getKey());
- logger.info("Param value=" + param.getValue());
- }
- }
- }
- }
- }
-
@Override
public List<String> getSupportedInvocationModes() {
return invocationModes;
return (INVOCATION_MODE_NO_CONTEXT.equalsIgnoreCase(getInvocationContext().getMode()) ? true : false);
}
+ protected List<String> getListCsids() {
+ List<String> emptyCsidsList = Collections.emptyList();
+ InvocationContext.ListCSIDs lcsids = getInvocationContext().getListCSIDs();
+ if (lcsids == null) {
+ return emptyCsidsList;
+ } else {
+ List<String> csidsList = lcsids.getCsid();
+ if (csidsList == null) {
+ return emptyCsidsList;
+ } else {
+ return csidsList;
+ }
+ }
+ }
+
+ protected List<InvocationContext.Params.Param> getParams() {
+ List<InvocationContext.Params.Param> emptyParamsList = Collections.emptyList();
+ InvocationContext.Params params = this.getInvocationContext().getParams();
+ if (params == null) {
+ return emptyParamsList;
+ } else {
+ List<InvocationContext.Params.Param> paramsList = params.getParam();
+ if (paramsList == null) {
+ return emptyParamsList;
+ } else {
+ return paramsList;
+ }
+ }
+ }
+
protected void setErrorResult(String message) {
setErrorResult(message, INT_ERROR_STATUS);
}
try {
- logInvocationContext();
-
List<String> csids = new ArrayList<String>();
if (requestIsForInvocationModeSingle()) {
String singleCsid = getInvocationContext().getSingleCSID();
- if (Tools.notBlank(singleCsid)) {
+ if (Tools.isBlank(singleCsid)) {
+ throw new Exception(CSID_VALUES_NOT_PROVIDED_IN_INVOCATION_CONTEXT);
+ } else {
csids.add(singleCsid);
}
} else if (requestIsForInvocationModeList()) {
- InvocationContext.ListCSIDs invListCsids = getInvocationContext().getListCSIDs();
- if (invListCsids == null) {
- throw new Exception(CSID_VALUES_NOT_PROVIDED_IN_INVOCATION_CONTEXT);
- }
- List<String> listCsids = invListCsids.getCsid();
- if (listCsids == null || listCsids.isEmpty()) {
+ List<String> listCsids = getListCsids();
+ if (listCsids.isEmpty()) {
throw new Exception(CSID_VALUES_NOT_PROVIDED_IN_INVOCATION_CONTEXT);
}
csids.addAll(listCsids);
} else if (requestIsForInvocationModeGroup()) {
- String groupCsid = getInvocationContext().getGroupCSID();
- // FIXME: Get individual CSIDs from the group
- // and add them to the list
- }
-
- if (csids.isEmpty()) {
- throw new Exception(CSID_VALUES_NOT_PROVIDED_IN_INVOCATION_CONTEXT);
+ // Currently not supported
+ // FIXME: Get individual CSIDs, if any, from the group
+ // String groupCsid = getInvocationContext().getGroupCSID();
+ // ...
+ } else if (requestIsForInvocationModeNoContext()) {
+ // Currently not supported
+ // FIXME: Add code to invoke batch job on every active CollectionObject
}
// Update the computed current location field for each CollectionObject
getResults().setNumAffected(numAffected);
return getResults();
}
-
}