mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-1641 (Create Relationship Service)
* Refactored existing customReference classes git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@85575 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -43,6 +43,7 @@ public abstract class AbstractRmWebScript extends DeclarativeWebScript
|
||||
{
|
||||
/** Constants */
|
||||
protected static final String PATH_SEPARATOR = "/";
|
||||
protected static final String SUCCESS = "success";
|
||||
|
||||
/** Disposition service */
|
||||
protected DispositionService dispositionService;
|
||||
|
@@ -18,14 +18,13 @@
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.script;
|
||||
|
||||
import static org.alfresco.util.WebScriptUtils.getRequestParameterValue;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.rule.RuleService;
|
||||
import org.alfresco.service.cmr.rule.RuleType;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -33,109 +32,125 @@ import org.springframework.extensions.webscripts.Cache;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
import org.springframework.extensions.webscripts.WebScriptException;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Implementation for Java backed webscript to remove RM custom reference instances
|
||||
* from a node.
|
||||
* Implementation for Java backed webscript to remove RM custom reference instances from a node.
|
||||
*
|
||||
* @author Neil McErlean
|
||||
* @author Tuna Aksoy
|
||||
*/
|
||||
public class CustomRefDelete extends AbstractRmWebScript
|
||||
{
|
||||
/** Logger */
|
||||
private static Log logger = LogFactory.getLog(CustomRefDelete.class);
|
||||
/** Constants */
|
||||
private static final String REF_ID = "refId";
|
||||
private static final String ST = "st";
|
||||
private static final String SI = "si";
|
||||
private static final String ID = "id";
|
||||
|
||||
/** RM Admin Service */
|
||||
/** RM admin service */
|
||||
private RecordsManagementAdminService rmAdminService;
|
||||
|
||||
/** Rule Service */
|
||||
/** Rule service */
|
||||
private RuleService ruleService;
|
||||
|
||||
/**
|
||||
* @param rmAdminService RM Admin Service
|
||||
* Sets the RM admin service
|
||||
*
|
||||
* @param rmAdminService RM admin service
|
||||
*/
|
||||
public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService)
|
||||
{
|
||||
this.rmAdminService = rmAdminService;
|
||||
}
|
||||
this.rmAdminService = rmAdminService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ruleService Rule Service
|
||||
* Sets the rule service
|
||||
*
|
||||
* @param ruleService Rule service
|
||||
*/
|
||||
public void setRuleService(RuleService ruleService)
|
||||
{
|
||||
this.ruleService = ruleService;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache)
|
||||
*/
|
||||
@Override
|
||||
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
|
||||
{
|
||||
Map<String, Object> ftlModel;
|
||||
ruleService.disableRuleType(RuleType.OUTBOUND);
|
||||
Map<String, Object> model = new HashMap<String, Object>(1);
|
||||
|
||||
try
|
||||
{
|
||||
ftlModel = removeCustomReferenceInstance(req);
|
||||
ruleService.disableRuleType(RuleType.OUTBOUND);
|
||||
removeCustomReferenceInstance(req);
|
||||
model.put(SUCCESS, true);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ruleService.enableRuleType(RuleType.OUTBOUND);
|
||||
}
|
||||
|
||||
return ftlModel;
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes custom reference.
|
||||
* Removes custom reference instance
|
||||
*
|
||||
* @param req The webscript request
|
||||
*/
|
||||
protected Map<String, Object> removeCustomReferenceInstance(WebScriptRequest req)
|
||||
private void removeCustomReferenceInstance(WebScriptRequest req)
|
||||
{
|
||||
NodeRef fromNodeRef = parseRequestForNodeRef(req);
|
||||
NodeRef fromNode = parseRequestForNodeRef(req);
|
||||
NodeRef toNodeRef = getToNode(req);
|
||||
QName associationQName = getAssociationQName(req);
|
||||
|
||||
rmAdminService.removeCustomReference(fromNode, toNodeRef, associationQName);
|
||||
rmAdminService.removeCustomReference(toNodeRef, fromNode, associationQName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the node from which the reference will be removed
|
||||
*
|
||||
* @param req The webscript request
|
||||
* @return The node from which the reference will be removed
|
||||
*/
|
||||
private NodeRef getToNode(WebScriptRequest req)
|
||||
{
|
||||
// Get the toNode from the URL query string.
|
||||
String storeType = req.getParameter("st");
|
||||
String storeId = req.getParameter("si");
|
||||
String nodeId = req.getParameter("id");
|
||||
String storeType = req.getParameter(ST);
|
||||
String storeId = req.getParameter(SI);
|
||||
String nodeId = req.getParameter(ID);
|
||||
|
||||
// create the NodeRef and ensure it is valid
|
||||
StoreRef storeRef = new StoreRef(storeType, storeId);
|
||||
NodeRef toNodeRef = new NodeRef(storeRef, nodeId);
|
||||
|
||||
if (!this.nodeService.exists(toNodeRef))
|
||||
// Create the NodeRef and ensure it is valid
|
||||
NodeRef toNode = new NodeRef(storeType, storeId, nodeId);
|
||||
if (!nodeService.exists(toNode))
|
||||
{
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find to-node: " +
|
||||
toNodeRef.toString());
|
||||
throw new WebScriptException(Status.STATUS_NOT_FOUND, "Unable to find toNode: '" +
|
||||
toNode.toString() + "'.");
|
||||
}
|
||||
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
return toNode;
|
||||
}
|
||||
|
||||
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
|
||||
String clientsRefId = templateVars.get("refId");
|
||||
QName qn = rmAdminService.getQNameForClientId(clientsRefId);
|
||||
if (qn == null)
|
||||
/**
|
||||
* Gets the QName of the association
|
||||
*
|
||||
* @param req The webscript request
|
||||
* @return QName of the association
|
||||
*/
|
||||
private QName getAssociationQName(WebScriptRequest req)
|
||||
{
|
||||
String clientsRefId = getRequestParameterValue(req, REF_ID);
|
||||
QName qName = rmAdminService.getQNameForClientId(clientsRefId);
|
||||
|
||||
if (qName == null)
|
||||
{
|
||||
throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||
"Unable to find reference type: " + clientsRefId);
|
||||
throw new WebScriptException(Status.STATUS_NOT_FOUND,
|
||||
"Unable to find reference type: '" + clientsRefId + "'.");
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
StringBuilder msg = new StringBuilder();
|
||||
msg.append("Removing reference ").append(qn).append(" from ")
|
||||
.append(fromNodeRef).append(" to ").append(toNodeRef);
|
||||
logger.debug(msg.toString());
|
||||
}
|
||||
|
||||
rmAdminService.removeCustomReference(fromNodeRef, toNodeRef, qn);
|
||||
rmAdminService.removeCustomReference(toNodeRef, fromNodeRef, qn);
|
||||
|
||||
result.put("success", true);
|
||||
|
||||
return result;
|
||||
return qName;
|
||||
}
|
||||
}
|
@@ -18,44 +18,45 @@
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.script;
|
||||
|
||||
import java.io.IOException;
|
||||
import static org.alfresco.util.WebScriptUtils.getRequestContentAsJsonObject;
|
||||
import static org.alfresco.util.WebScriptUtils.getStringValueFromJSONObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.rule.RuleService;
|
||||
import org.alfresco.service.cmr.rule.RuleType;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONTokener;
|
||||
import org.springframework.extensions.webscripts.Cache;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
import org.springframework.extensions.webscripts.WebScriptException;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
|
||||
/**
|
||||
* Implementation for Java backed webscript to add RM custom reference instances
|
||||
* to a node.
|
||||
* Implementation for Java backed webscript to add RM custom reference instances to a node.
|
||||
*
|
||||
* @author Neil McErlean
|
||||
* @author Tuna Aksoy
|
||||
*/
|
||||
public class CustomRefPost extends AbstractRmWebScript
|
||||
{
|
||||
/** Constants */
|
||||
private static final String TO_NODE = "toNode";
|
||||
private static final String REF_ID = "refId";
|
||||
|
||||
/** RM Admin Service */
|
||||
/** RM admin service */
|
||||
private RecordsManagementAdminService rmAdminService;
|
||||
|
||||
/** Rule Service */
|
||||
/** Rule service */
|
||||
private RuleService ruleService;
|
||||
|
||||
/**
|
||||
* @param rmAdminService RM Admin Service
|
||||
* Sets the RM admin service
|
||||
*
|
||||
* @param rmAdminService RM admin service
|
||||
*/
|
||||
public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService)
|
||||
{
|
||||
@@ -63,71 +64,89 @@ public class CustomRefPost extends AbstractRmWebScript
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ruleService Rule Service
|
||||
* Sets the rule service
|
||||
*
|
||||
* @param ruleService Rule service
|
||||
*/
|
||||
public void setRuleService(RuleService ruleService)
|
||||
{
|
||||
this.ruleService = ruleService;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache)
|
||||
*/
|
||||
@Override
|
||||
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
|
||||
{
|
||||
JSONObject json = null;
|
||||
Map<String, Object> ftlModel = null;
|
||||
Map<String, Object> model = new HashMap<String, Object>(1);
|
||||
|
||||
try
|
||||
{
|
||||
ruleService.disableRuleType(RuleType.INBOUND);
|
||||
|
||||
json = new JSONObject(new JSONTokener(req.getContent().getContent()));
|
||||
|
||||
ftlModel = addCustomReferenceInstance(req, json);
|
||||
}
|
||||
catch (IOException iox)
|
||||
{
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||
"Could not read content from req.", iox);
|
||||
}
|
||||
catch (JSONException je)
|
||||
{
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||
"Could not parse JSON from req.", je);
|
||||
addCustomReferenceInstance(req);
|
||||
model.put(SUCCESS, true);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ruleService.enableRuleType(RuleType.INBOUND);
|
||||
}
|
||||
|
||||
return ftlModel;
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies custom reference.
|
||||
* Adds a custom reference instance
|
||||
*
|
||||
* @param req The webscript request
|
||||
*/
|
||||
protected Map<String, Object> addCustomReferenceInstance(WebScriptRequest req, JSONObject json) throws JSONException
|
||||
protected void addCustomReferenceInstance(WebScriptRequest req)
|
||||
{
|
||||
NodeRef fromNode = parseRequestForNodeRef(req);
|
||||
JSONObject json = getRequestContentAsJsonObject(req);
|
||||
NodeRef toNode = getToNode(json);
|
||||
QName associationQName = getAssociationQName(json);
|
||||
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
rmAdminService.addCustomReference(fromNode, toNode, associationQName);
|
||||
}
|
||||
|
||||
String toNodeStg = json.getString(TO_NODE);
|
||||
NodeRef toNode = new NodeRef(toNodeStg);
|
||||
/**
|
||||
* Gets the node to which the reference will be added
|
||||
*
|
||||
* @param json Request content as json object
|
||||
* @return The node to which the reference will be added
|
||||
*/
|
||||
private NodeRef getToNode(JSONObject json)
|
||||
{
|
||||
String toNodeString = getStringValueFromJSONObject(json, TO_NODE);
|
||||
NodeRef toNode = new NodeRef(toNodeString);
|
||||
|
||||
String clientsRefId = json.getString(REF_ID);
|
||||
QName qn = rmAdminService.getQNameForClientId(clientsRefId);
|
||||
if (qn == null)
|
||||
if (!nodeService.exists(toNode))
|
||||
{
|
||||
throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||
"Unable to find reference type: " + clientsRefId);
|
||||
throw new WebScriptException(Status.STATUS_NOT_FOUND, "Unable to find toNode: '" +
|
||||
toNode.toString() + "'.");
|
||||
}
|
||||
|
||||
rmAdminService.addCustomReference(fromNode, toNode, qn);
|
||||
return toNode;
|
||||
}
|
||||
|
||||
result.put("success", true);
|
||||
/**
|
||||
* Gets the QName of the association
|
||||
*
|
||||
* @param json Request content as json object
|
||||
* @return QName of the association
|
||||
*/
|
||||
private QName getAssociationQName(JSONObject json)
|
||||
{
|
||||
String clientsRefId = getStringValueFromJSONObject(json, REF_ID);
|
||||
QName qName = rmAdminService.getQNameForClientId(clientsRefId);
|
||||
|
||||
return result;
|
||||
if (qName == null)
|
||||
{
|
||||
throw new WebScriptException(Status.STATUS_NOT_FOUND,
|
||||
"Unable to find reference type: '" + clientsRefId + "'.");
|
||||
}
|
||||
|
||||
return qName;
|
||||
}
|
||||
}
|
@@ -35,19 +35,19 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.webscripts.Cache;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
|
||||
/**
|
||||
* This class provides the implementation for the customrefs.get webscript.
|
||||
* Implementation for Java backed webscript to get RM custom references for a node.
|
||||
*
|
||||
* @author Neil McErlean
|
||||
* @author Tuna Aksoy
|
||||
*/
|
||||
public class CustomRefsGet extends AbstractRmWebScript
|
||||
{
|
||||
/** Constants */
|
||||
private static final String REFERENCE_TYPE = "referenceType";
|
||||
private static final String REF_ID = "refId";
|
||||
private static final String LABEL = "label";
|
||||
@@ -62,20 +62,18 @@ public class CustomRefsGet extends AbstractRmWebScript
|
||||
private static final String NODE_NAME = "nodeName";
|
||||
private static final String NODE_TITLE = "nodeTitle";
|
||||
|
||||
/** logger */
|
||||
private static Log logger = LogFactory.getLog(CustomRefsGet.class);
|
||||
|
||||
/** records management admin service */
|
||||
/** RM admin service */
|
||||
private RecordsManagementAdminService rmAdminService;
|
||||
|
||||
/** dictionary service */
|
||||
/** Dictionary service */
|
||||
private DictionaryService dictionaryService;
|
||||
|
||||
/** capability service */
|
||||
/** Capability service */
|
||||
private CapabilityService capabilityService;
|
||||
|
||||
/**
|
||||
* @param rmAdminService records management admin service
|
||||
* Sets the RM admin service
|
||||
* @param rmAdminService RM admin service
|
||||
*/
|
||||
public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService)
|
||||
{
|
||||
@@ -83,7 +81,9 @@ public class CustomRefsGet extends AbstractRmWebScript
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dictionaryService dictionary service
|
||||
* Sets the dictionary service
|
||||
*
|
||||
* @param dictionaryService Dictionary service
|
||||
*/
|
||||
public void setDictionaryService(DictionaryService dictionaryService)
|
||||
{
|
||||
@@ -91,7 +91,9 @@ public class CustomRefsGet extends AbstractRmWebScript
|
||||
}
|
||||
|
||||
/**
|
||||
* @param capabilityService capability service
|
||||
* Sets the capability service
|
||||
*
|
||||
* @param capabilityService Capability service
|
||||
*/
|
||||
public void setCapabilityService(CapabilityService capabilityService)
|
||||
{
|
||||
@@ -102,46 +104,53 @@ public class CustomRefsGet extends AbstractRmWebScript
|
||||
* @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache)
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
|
||||
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
|
||||
{
|
||||
Map<String, Object> ftlModel = new HashMap<String, Object>();
|
||||
Map<String, Object> model = new HashMap<String, Object>(4);
|
||||
NodeRef nodeRef = parseRequestForNodeRef(req);
|
||||
model.put(NODE_NAME, nodeService.getProperty(nodeRef, ContentModel.PROP_NAME));
|
||||
model.put(NODE_TITLE, nodeService.getProperty(nodeRef, ContentModel.PROP_TITLE));
|
||||
model.put(CUSTOM_REFS_FROM, getOutwardReferences(nodeRef));
|
||||
model.put(CUSTOM_REFS_TO, getInwardReferenceData(nodeRef));
|
||||
return model;
|
||||
}
|
||||
|
||||
NodeRef node = parseRequestForNodeRef(req);
|
||||
/**
|
||||
* Gets all the references that come 'out' from this node
|
||||
*
|
||||
* @param nodeRef Node reference
|
||||
* @return All the references that come 'out' from this node
|
||||
*/
|
||||
private List<Map<String, String>> getOutwardReferences(NodeRef nodeRef)
|
||||
{
|
||||
List<Map<String, String>> outwardReferenceData = new ArrayList<Map<String, String>>();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Getting custom reference instances for " + node);
|
||||
}
|
||||
List<AssociationRef> assocsFromThisNode = rmAdminService.getCustomReferencesFrom(nodeRef);
|
||||
addBidirectionalReferenceData(outwardReferenceData, assocsFromThisNode);
|
||||
|
||||
// All the references that come 'out' from this node.
|
||||
List<Map<String, String>> listOfOutwardReferenceData = new ArrayList<Map<String, String>>();
|
||||
List<ChildAssociationRef> childAssocs = rmAdminService.getCustomChildReferences(nodeRef);
|
||||
addParentChildReferenceData(outwardReferenceData, childAssocs);
|
||||
|
||||
List<AssociationRef> assocsFromThisNode = this.rmAdminService.getCustomReferencesFrom(node);
|
||||
addBidirectionalReferenceData(listOfOutwardReferenceData, assocsFromThisNode);
|
||||
return outwardReferenceData;
|
||||
}
|
||||
|
||||
List<ChildAssociationRef> childAssocs = this.rmAdminService.getCustomChildReferences(node);
|
||||
addParentChildReferenceData(listOfOutwardReferenceData, childAssocs);
|
||||
/**
|
||||
* Gets all the references that come 'in' to this node
|
||||
*
|
||||
* @param nodeRef Node reference
|
||||
* @return All the references that come 'in' to this node
|
||||
*/
|
||||
private List<Map<String, String>> getInwardReferenceData(NodeRef nodeRef)
|
||||
{
|
||||
List<Map<String, String>> inwardReferenceData = new ArrayList<Map<String, String>>();
|
||||
|
||||
// All the references that come 'in' to this node.
|
||||
List<Map<String, String>> listOfInwardReferenceData = new ArrayList<Map<String, String>>();
|
||||
List<AssociationRef> toAssocs = rmAdminService.getCustomReferencesTo(nodeRef);
|
||||
addBidirectionalReferenceData(inwardReferenceData, toAssocs);
|
||||
|
||||
List<AssociationRef> toAssocs = this.rmAdminService.getCustomReferencesTo(node);
|
||||
addBidirectionalReferenceData(listOfInwardReferenceData, toAssocs);
|
||||
List<ChildAssociationRef> parentAssocs = rmAdminService.getCustomParentReferences(nodeRef);
|
||||
addParentChildReferenceData(inwardReferenceData, parentAssocs);
|
||||
|
||||
List<ChildAssociationRef> parentAssocs = this.rmAdminService.getCustomParentReferences(node);
|
||||
addParentChildReferenceData(listOfInwardReferenceData, parentAssocs);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Retrieved custom reference instances: " + assocsFromThisNode);
|
||||
}
|
||||
|
||||
ftlModel.put(NODE_NAME, nodeService.getProperty(node, ContentModel.PROP_NAME));
|
||||
ftlModel.put(NODE_TITLE, nodeService.getProperty(node, ContentModel.PROP_TITLE));
|
||||
ftlModel.put(CUSTOM_REFS_FROM, listOfOutwardReferenceData);
|
||||
ftlModel.put(CUSTOM_REFS_TO, listOfInwardReferenceData);
|
||||
|
||||
return ftlModel;
|
||||
return inwardReferenceData;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,19 +158,19 @@ public class CustomRefsGet extends AbstractRmWebScript
|
||||
* for each assRef. FTL-relevant data are added to that map. The associationRefs must all be
|
||||
* parent/child references.
|
||||
*
|
||||
* @param listOfReferenceData
|
||||
* @param assocs
|
||||
* @param referenceData Reference data
|
||||
* @param childAssocs Association references
|
||||
*/
|
||||
private void addParentChildReferenceData(List<Map<String, String>> listOfReferenceData,List<ChildAssociationRef> childAssocs)
|
||||
private void addParentChildReferenceData(List<Map<String, String>> referenceData, List<ChildAssociationRef> childAssocs)
|
||||
{
|
||||
for (ChildAssociationRef childAssRef : childAssocs)
|
||||
{
|
||||
Map<String, String> data = new HashMap<String, String>();
|
||||
{
|
||||
Map<String, String> data = new HashMap<String, String>();
|
||||
|
||||
QName typeQName = childAssRef.getTypeQName();
|
||||
QName typeQName = childAssRef.getTypeQName();
|
||||
|
||||
data.put(CHILD_REF, childAssRef.getChildRef().toString());
|
||||
data.put(PARENT_REF, childAssRef.getParentRef().toString());
|
||||
data.put(CHILD_REF, childAssRef.getChildRef().toString());
|
||||
data.put(PARENT_REF, childAssRef.getParentRef().toString());
|
||||
|
||||
AssociationDefinition assDef = rmAdminService.getCustomReferenceDefinitions().get(typeQName);
|
||||
|
||||
@@ -178,7 +187,7 @@ public class CustomRefsGet extends AbstractRmWebScript
|
||||
data.put(TARGET, sourceAndTarget[1]);
|
||||
data.put(REFERENCE_TYPE, CustomReferenceType.PARENT_CHILD.toString());
|
||||
|
||||
listOfReferenceData.add(data);
|
||||
referenceData.add(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -188,16 +197,16 @@ public class CustomRefsGet extends AbstractRmWebScript
|
||||
* for each assRef. FTL-relevant data are added to that map. The associationRefs must all be
|
||||
* bidirectional references.
|
||||
*
|
||||
* @param listOfReferenceData
|
||||
* @param assocs
|
||||
* @param referenceData Reference data
|
||||
* @param assocs Association references
|
||||
*/
|
||||
private void addBidirectionalReferenceData(List<Map<String, String>> listOfReferenceData, List<AssociationRef> assocs)
|
||||
private void addBidirectionalReferenceData(List<Map<String, String>> referenceData, List<AssociationRef> assocs)
|
||||
{
|
||||
for (AssociationRef assRef : assocs)
|
||||
{
|
||||
Map<String, String> data = new HashMap<String, String>();
|
||||
{
|
||||
Map<String, String> data = new HashMap<String, String>();
|
||||
|
||||
QName typeQName = assRef.getTypeQName();
|
||||
QName typeQName = assRef.getTypeQName();
|
||||
AssociationDefinition assDef = rmAdminService.getCustomReferenceDefinitions().get(typeQName);
|
||||
|
||||
if (assDef != null &&
|
||||
@@ -210,16 +219,16 @@ public class CustomRefsGet extends AbstractRmWebScript
|
||||
data.put(SOURCE_REF, assRef.getSourceRef().toString());
|
||||
data.put(TARGET_REF, assRef.getTargetRef().toString());
|
||||
|
||||
listOfReferenceData.add(data);
|
||||
referenceData.add(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the current user has view capabilities on the given node.
|
||||
* Determines whether the current user has view capabilities on the given node.
|
||||
*
|
||||
* @param nodeRef node reference
|
||||
* @return boolean true if current user has view capability, false otherwise
|
||||
* @param nodeRef Node reference
|
||||
* @return boolean <code>true</code> if current user has view capability, <code>false</code> otherwise
|
||||
*/
|
||||
private boolean hasView(NodeRef nodeRef)
|
||||
{
|
||||
@@ -230,6 +239,7 @@ public class CustomRefsGet extends AbstractRmWebScript
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
@@ -94,7 +94,7 @@ public final class WebScriptUtils
|
||||
*
|
||||
* @param req The webscript request
|
||||
* @param parameter The request parameter
|
||||
* @param checkValue FIXME!!!
|
||||
* @param checkValue Determines if the value of the parameter should be checked or not
|
||||
* @return The value of the request parameter
|
||||
*/
|
||||
public static String getRequestParameterValue(WebScriptRequest req, String parameter, boolean checkValue)
|
||||
|
Reference in New Issue
Block a user