use of org.alfresco.service.cmr.repository.StoreRef in project records-management by Alfresco.
the class HoldsGet method getFilePlan.
/**
* Helper method to get the file plan from the request
*
* @param req The webscript request
* @return The {@link NodeRef} of the file plan
*/
private NodeRef getFilePlan(WebScriptRequest req) {
NodeRef filePlan = null;
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
String storeType = templateVars.get("store_type");
String storeId = templateVars.get("store_id");
String id = templateVars.get("id");
if (StringUtils.isNotBlank(storeType) && StringUtils.isNotBlank(storeId) && StringUtils.isNotBlank(id)) {
filePlan = new NodeRef(new StoreRef(storeType, storeId), id);
// check that this node is actually a file plan
if (!nodeService.exists(filePlan) || !filePlanService.isFilePlan(filePlan)) {
throw new WebScriptException(Status.STATUS_NOT_FOUND, "The file plan provided could not be found.");
}
} else {
filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
if (filePlan == null) {
throw new WebScriptException(Status.STATUS_NOT_FOUND, "The default file plan node could not be found.");
}
}
return filePlan;
}
use of org.alfresco.service.cmr.repository.StoreRef in project records-management by Alfresco.
the class RmAuthoritiesRestApiTest method getFormattedFilePlanString.
/**
* Util method to get a formatted nodeRef string
*
* @return Returns a formatted nodeRef string
*/
private String getFormattedFilePlanString() {
StoreRef storeRef = filePlan.getStoreRef();
String storeType = storeRef.getProtocol();
String storeId = storeRef.getIdentifier();
String id = filePlan.getId();
StringBuffer sb = new StringBuffer(32);
sb.append(storeType);
sb.append("/");
sb.append(storeId);
sb.append("/");
sb.append(id);
return sb.toString();
}
Aggregations