mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-736 (DOD Recert: Bugs on the "List of Values" page)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/DEV/DODRECERT@50975 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -28,29 +28,30 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class ScriptConstraint implements Serializable
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private RMConstraintInfo info;
|
||||
|
||||
|
||||
private RMCaveatConfigService rmCaveatconfigService;
|
||||
|
||||
|
||||
private AuthorityService authorityService;
|
||||
|
||||
|
||||
ScriptConstraint(RMConstraintInfo info, RMCaveatConfigService rmCaveatconfigService, AuthorityService authorityService)
|
||||
{
|
||||
this.info = info;
|
||||
this.rmCaveatconfigService = rmCaveatconfigService;
|
||||
this.rmCaveatconfigService = rmCaveatconfigService;
|
||||
this.authorityService = authorityService;
|
||||
}
|
||||
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
info.setTitle(title);
|
||||
@@ -63,49 +64,49 @@ public class ScriptConstraint implements Serializable
|
||||
{
|
||||
info.setName(name);
|
||||
}
|
||||
|
||||
|
||||
public String getName()
|
||||
{
|
||||
String xxx = info.getName().replace(":", "_");
|
||||
return xxx;
|
||||
}
|
||||
|
||||
|
||||
public boolean isCaseSensitive()
|
||||
{
|
||||
return info.isCaseSensitive();
|
||||
}
|
||||
|
||||
|
||||
public String[] getAllowedValues()
|
||||
{
|
||||
return info.getAllowedValues();
|
||||
}
|
||||
|
||||
|
||||
public ScriptConstraintAuthority[] getAuthorities()
|
||||
{
|
||||
Map<String, List<String>> values = rmCaveatconfigService.getListDetails(info.getName());
|
||||
|
||||
|
||||
if (values == null)
|
||||
{
|
||||
return new ScriptConstraintAuthority[0];
|
||||
}
|
||||
|
||||
|
||||
// Here with some data to return
|
||||
Set<String> authorities = values.keySet();
|
||||
|
||||
|
||||
ArrayList<ScriptConstraintAuthority> constraints = new ArrayList<ScriptConstraintAuthority>(values.size());
|
||||
for(String authority : authorities)
|
||||
{
|
||||
ScriptConstraintAuthority constraint = new ScriptConstraintAuthority();
|
||||
constraint.setAuthorityName(authority);
|
||||
constraint.setValues(values.get(authority));
|
||||
constraints.add(constraint);
|
||||
constraints.add(constraint);
|
||||
}
|
||||
|
||||
|
||||
ScriptConstraintAuthority[] retVal = constraints.toArray(new ScriptConstraintAuthority[constraints.size()]);
|
||||
|
||||
return retVal;
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* updateTitle
|
||||
*/
|
||||
@@ -114,7 +115,7 @@ public class ScriptConstraint implements Serializable
|
||||
info.setTitle(newTitle);
|
||||
rmCaveatconfigService.updateRMConstraintTitle(info.getName(), newTitle) ;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* updateAllowedValues
|
||||
*/
|
||||
@@ -123,7 +124,7 @@ public class ScriptConstraint implements Serializable
|
||||
info.setAllowedValues(allowedValues);
|
||||
rmCaveatconfigService.updateRMConstraintAllowedValues(info.getName(), allowedValues);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update a value
|
||||
* @param values
|
||||
@@ -133,7 +134,7 @@ public class ScriptConstraint implements Serializable
|
||||
{
|
||||
for(int i = 0; i < bodge.length(); i++)
|
||||
{
|
||||
|
||||
|
||||
JSONObject obj = bodge.getJSONObject(i);
|
||||
String value = obj.getString("value");
|
||||
JSONArray authorities = obj.getJSONArray("authorities");
|
||||
@@ -142,10 +143,10 @@ public class ScriptConstraint implements Serializable
|
||||
{
|
||||
aList.add(authorities.getString(j));
|
||||
}
|
||||
rmCaveatconfigService.updateRMConstraintListValue(info.getName(), value, aList);
|
||||
}
|
||||
rmCaveatconfigService.updateRMConstraintListValue(info.getName(), value, aList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update a value
|
||||
* @param values
|
||||
@@ -154,27 +155,27 @@ public class ScriptConstraint implements Serializable
|
||||
public void updateValues(String value, String[] authorities)
|
||||
{
|
||||
List<String> list = Arrays.asList(authorities);
|
||||
rmCaveatconfigService.updateRMConstraintListValue(info.getName(), value, list);
|
||||
rmCaveatconfigService.updateRMConstraintListValue(info.getName(), value, list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cascade delete an authority
|
||||
* @param authority
|
||||
*/
|
||||
public void deleteAuthority(String authority)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cascade delete a value
|
||||
* @param value
|
||||
*/
|
||||
public void deleteValue(String value)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get a single value
|
||||
@@ -184,7 +185,7 @@ public class ScriptConstraint implements Serializable
|
||||
public ScriptConstraintValue getValue(String value)
|
||||
{
|
||||
ScriptConstraintValue[] values = getValues();
|
||||
|
||||
|
||||
for(ScriptConstraintValue val : values)
|
||||
{
|
||||
if(val.getValueName().equalsIgnoreCase(value))
|
||||
@@ -194,39 +195,39 @@ public class ScriptConstraint implements Serializable
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public ScriptConstraintValue[] getValues()
|
||||
{
|
||||
// authority, values
|
||||
Map<String, List<String>> details = rmCaveatconfigService.getListDetails(info.getName());
|
||||
|
||||
|
||||
if (details == null)
|
||||
{
|
||||
details = new HashMap<String, List<String>>();
|
||||
}
|
||||
|
||||
|
||||
// values, authorities
|
||||
Map<String, List<String>> pivot = PivotUtil.getPivot(details);
|
||||
|
||||
|
||||
// Here with some data to return
|
||||
Set<String> values = pivot.keySet();
|
||||
|
||||
|
||||
ArrayList<ScriptConstraintValue> constraints = new ArrayList<ScriptConstraintValue>(pivot.size());
|
||||
for(String value : values)
|
||||
{
|
||||
ScriptConstraintValue constraint = new ScriptConstraintValue();
|
||||
constraint.setValueName(value);
|
||||
constraint.setValueTitle(value);
|
||||
|
||||
|
||||
List<String>authorities = pivot.get(value);
|
||||
List<ScriptAuthority> sauth = new ArrayList<ScriptAuthority>();
|
||||
for(String authority : authorities)
|
||||
{
|
||||
ScriptAuthority a = new ScriptAuthority();
|
||||
a.setAuthorityName(authority);
|
||||
|
||||
|
||||
String displayName = authorityService.getAuthorityDisplayName(authority);
|
||||
if(displayName != null)
|
||||
if(StringUtils.isNotBlank(displayName))
|
||||
{
|
||||
a.setAuthorityTitle(displayName);
|
||||
}
|
||||
@@ -236,10 +237,10 @@ public class ScriptConstraint implements Serializable
|
||||
}
|
||||
sauth.add(a);
|
||||
}
|
||||
constraint.setAuthorities(sauth);
|
||||
constraints.add(constraint);
|
||||
constraint.setAuthorities(sauth);
|
||||
constraints.add(constraint);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Now go through and add any "empty" values
|
||||
*/
|
||||
@@ -251,14 +252,14 @@ public class ScriptConstraint implements Serializable
|
||||
constraint.setValueName(value);
|
||||
constraint.setValueTitle(value);
|
||||
List<ScriptAuthority> sauth = new ArrayList<ScriptAuthority>();
|
||||
constraint.setAuthorities(sauth);
|
||||
constraint.setAuthorities(sauth);
|
||||
constraints.add(constraint);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ScriptConstraintValue[] retVal = constraints.toArray(new ScriptConstraintValue[constraints.size()]);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user