diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/caveat/RMListOfValuesConstraint.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/caveat/RMListOfValuesConstraint.java
index 5538808db8..058b359660 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/caveat/RMListOfValuesConstraint.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/caveat/RMListOfValuesConstraint.java
@@ -36,10 +36,10 @@ import org.springframework.extensions.surf.util.I18NUtil;
/**
* RM Constraint implementation that ensures the value is one of a constrained
* list of values. By default, this constraint is case-sensitive.
- *
+ *
* @see #setAllowedValues(List)
* @see #setCaseSensitive(boolean)
- *
+ *
* @author janv
*/
public class RMListOfValuesConstraint extends ListOfValuesConstraint
@@ -50,23 +50,23 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
private static final String LOV_CONSTRAINT_VALUE = "listconstraint";
private List allowedValues;
private List allowedValuesUpper;
- private MatchLogic matchLogic = MatchLogic.AND; // defined match logic used by caveat matching (default = "AND")
-
+ private MatchLogic matchLogic = MatchLogic.AND; // defined match logic used by caveat matching (default = "AND")
+
public enum MatchLogic
{
AND, // closed marking - all values must match
OR; // open marking - at least one value must match
}
-
+
// note: alternative to static init could be to use 'registered' constraint
private static RMCaveatConfigService caveatConfigService;
-
+
public void setCaveatConfigService(RMCaveatConfigService caveatConfigService)
{
RMListOfValuesConstraint.caveatConfigService = caveatConfigService;
}
-
-
+
+
@Override
public String toString()
{
@@ -79,19 +79,19 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
.append("]");
return sb.toString();
}
-
- public RMListOfValuesConstraint()
+
+ public RMListOfValuesConstraint()
{
super();
-
+
// Set RM list of value constraints to be sorted by default
sorted = true;
}
/**
- * Get the allowed values. Note that these are String instances, but may
+ * Get the allowed values. Note that these are String instances, but may
* represent non-String values. It is up to the caller to distinguish.
- *
+ *
* @return Returns the values allowed
*/
@Override
@@ -101,7 +101,7 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
if ((runAsUser != null) && (! runAsUser.equals(AuthenticationUtil.getSystemUserName())) && (caveatConfigService != null))
{
List allowedForUser = caveatConfigService.getRMAllowedValues(getShortName()); // get allowed values for current user
-
+
List filteredList = new ArrayList(allowedForUser.size());
for (String allowed : allowedForUser)
{
@@ -110,7 +110,7 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
filteredList.add(allowed);
}
}
-
+
return filteredList;
}
else
@@ -118,7 +118,7 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
return this.allowedValues;
}
}
-
+
public String getDisplayLabel(String constraintAllowableValue, MessageLookup messageLookup)
{
if (!this.allowedValues.contains(constraintAllowableValue))
@@ -134,14 +134,14 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
String message = messageLookup.getMessage(key, I18NUtil.getLocale());
return message == null ? constraintAllowableValue : message;
}
-
+
private List getAllowedValuesUpper()
{
String runAsUser = AuthenticationUtil.getRunAsUser();
if ((runAsUser != null) && (! runAsUser.equals(AuthenticationUtil.getSystemUserName())) && (caveatConfigService != null))
{
List allowedForUser = caveatConfigService.getRMAllowedValues(getType()); // get allowed values for current user
-
+
List filteredList = new ArrayList(allowedForUser.size());
for (String allowed : allowedForUser)
{
@@ -150,7 +150,7 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
filteredList.add(allowed);
}
}
-
+
return filteredList;
}
else
@@ -160,7 +160,7 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
}
/**
* Set the values that are allowed by the constraint.
- *
+ *
* @param values a list of allowed values
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@@ -173,7 +173,7 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
}
int valueCount = allowedValues.size();
this.allowedValues = Collections.unmodifiableList(allowedValues);
-
+
// make the upper case versions
this.allowedValuesUpper = new ArrayList(valueCount);
for (String allowedValue : this.allowedValues)
@@ -181,41 +181,41 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
allowedValuesUpper.add(allowedValue.toUpperCase());
}
}
-
+
@Override
public void initialize()
{
checkPropertyNotNull("allowedValues", allowedValues);
}
-
+
@Override
public Map getParameters()
{
Map params = new HashMap(2);
-
+
params.put("caseSensitive", isCaseSensitive());
params.put("allowedValues", getAllowedValues());
params.put("sorted", isSorted());
params.put("matchLogic", getMatchLogic());
-
+
return params;
}
-
+
public MatchLogic getMatchLogicEnum()
{
return matchLogic;
}
-
+
public String getMatchLogic()
{
return matchLogic.toString();
}
-
+
public void setMatchLogic(String matchLogicStr)
{
this.matchLogic = MatchLogic.valueOf(matchLogicStr);
}
-
+
@Override
protected void evaluateSingleValue(Object value)
{
@@ -227,7 +227,7 @@ public class RMListOfValuesConstraint extends ListOfValuesConstraint
}
catch (TypeConversionException e)
{
- throw new ConstraintException(ERR_NON_STRING, value);
+ throw new ConstraintException(ERR_NON_STRING, value, e);
}
// check that the value is in the set of allowed values
if (isCaseSensitive())
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java
index 65577ff6ae..40153ed1a6 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java
@@ -197,7 +197,7 @@ public class BootstrapTestDataGet extends DeclarativeWebScript
}
catch (UnsupportedEncodingException error)
{
- throw new AlfrescoRuntimeException("The Character Encoding '" + charsetName + "' is not supported.");
+ throw new AlfrescoRuntimeException("The Character Encoding '" + charsetName + "' is not supported.", error);
}
Location location = new Location(filePlan);
importerService.importView(viewReader, location, null, null);
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapPost.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapPost.java
index 7b25cd5504..b0482b8a1d 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapPost.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapPost.java
@@ -83,7 +83,7 @@ public class EmailMapPost extends DeclarativeWebScript
catch (AlfrescoRuntimeException are)
{
throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR,
- are.getMessage());
+ are.getMessage(), are);
}
return model;
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/RmActionPost.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/RmActionPost.java
index 3c16f5d5d7..b1f811a8f0 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/RmActionPost.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/RmActionPost.java
@@ -45,7 +45,7 @@ import org.json.JSONTokener;
/**
* This class provides the implementation for the rmaction webscript.
- *
+ *
* @author Neil McErlean
*/
public class RmActionPost extends DeclarativeWebScript
@@ -78,7 +78,7 @@ public class RmActionPost extends DeclarativeWebScript
try
{
reqContentAsString = req.getContent().getContent();
- }
+ }
catch (IOException iox)
{
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
@@ -136,7 +136,7 @@ public class RmActionPost extends DeclarativeWebScript
String dateStringValue = ((JSONObject)nextValue).getString("iso8601");
nextValue = ISO8601DateFormat.parse(dateStringValue);
}
- }
+ }
actionParams.put(nextKeyString, (Serializable)nextValue);
}
@@ -144,7 +144,7 @@ public class RmActionPost extends DeclarativeWebScript
}
catch (JSONException exception)
{
- throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Unable to parse request JSON.");
+ throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Unable to parse request JSON.", exception);
}
// validate input: check for mandatory params.
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventPut.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventPut.java
index a96aeca46c..41898285c2 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventPut.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventPut.java
@@ -43,7 +43,7 @@ public class RmEventPut extends RMEventBase
{
/** Parameter names */
public static final String PARAM_EVENTNAME = "eventname";
-
+
/** Records management event service */
private RecordsManagementEventService rmEventService;
@@ -77,8 +77,8 @@ public class RmEventPut extends RMEventBase
// Check the event name
Map templateVars = req.getServiceMatch().getTemplateVars();
String eventName = templateVars.get(PARAM_EVENTNAME);
- if (eventName == null ||
- eventName.isEmpty() ||
+ if (eventName == null ||
+ eventName.isEmpty() ||
rmEventService.existsEvent(eventName) == false)
{
throw new WebScriptException(Status.STATUS_NOT_FOUND, "No event name was provided.");
@@ -140,7 +140,7 @@ public class RmEventPut extends RMEventBase
}
catch (AlfrescoRuntimeException are)
{
- throw new WebScriptException(Status.STATUS_BAD_REQUEST, are.getLocalizedMessage());
+ throw new WebScriptException(Status.STATUS_BAD_REQUEST, are.getLocalizedMessage(), are);
}
return canEditEvent;