mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merge of all UI clustering changes originally applied to 2.2
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8292 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.web.bean.admin;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -56,6 +56,7 @@ import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.util.ISO9075;
|
||||
import org.alfresco.web.app.servlet.DownloadContentServlet;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
|
||||
|
||||
// TODO: DownloadServlet - use of request parameter for property name?
|
||||
@@ -65,8 +66,10 @@ import org.alfresco.web.app.servlet.DownloadContentServlet;
|
||||
/**
|
||||
* Backing bean to support the Admin Node Browser
|
||||
*/
|
||||
public class AdminNodeBrowseBean
|
||||
{
|
||||
public class AdminNodeBrowseBean implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -8702324672426537379L;
|
||||
|
||||
/** selected query language */
|
||||
private String queryLanguage = null;
|
||||
|
||||
@@ -85,24 +88,24 @@ public class AdminNodeBrowseBean
|
||||
private SearchResults searchResults = new SearchResults((List<NodeRef>)null);
|
||||
|
||||
// stores and node
|
||||
private DataModel stores = null;
|
||||
transient private DataModel stores = null;
|
||||
private NodeRef nodeRef = null;
|
||||
private QName nodeType = null;
|
||||
private Path primaryPath = null;
|
||||
private DataModel parents = null;
|
||||
private DataModel aspects = null;
|
||||
private DataModel properties = null;
|
||||
private DataModel children = null;
|
||||
private DataModel assocs = null;
|
||||
transient private DataModel parents = null;
|
||||
transient private DataModel aspects = null;
|
||||
transient private DataModel properties = null;
|
||||
transient private DataModel children = null;
|
||||
transient private DataModel assocs = null;
|
||||
private Boolean inheritPermissions = null;
|
||||
private DataModel permissions = null;
|
||||
transient private DataModel permissions = null;
|
||||
|
||||
// supporting repository services
|
||||
private NodeService nodeService;
|
||||
private DictionaryService dictionaryService;
|
||||
private SearchService searchService;
|
||||
private NamespaceService namespaceService;
|
||||
private PermissionService permissionService;
|
||||
transient private NodeService nodeService;
|
||||
transient private DictionaryService dictionaryService;
|
||||
transient private SearchService searchService;
|
||||
transient private NamespaceService namespaceService;
|
||||
transient private PermissionService permissionService;
|
||||
|
||||
/**
|
||||
* @param nodeService node service
|
||||
@@ -110,6 +113,15 @@ public class AdminNodeBrowseBean
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
private NodeService getNodeService()
|
||||
{
|
||||
if (nodeService == null)
|
||||
{
|
||||
nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService();
|
||||
}
|
||||
return nodeService;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,6 +130,15 @@ public class AdminNodeBrowseBean
|
||||
public void setSearchService(SearchService searchService)
|
||||
{
|
||||
this.searchService = searchService;
|
||||
}
|
||||
|
||||
private SearchService getSearchService()
|
||||
{
|
||||
if (searchService == null)
|
||||
{
|
||||
searchService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSearchService();
|
||||
}
|
||||
return searchService;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,6 +147,15 @@ public class AdminNodeBrowseBean
|
||||
public void setDictionaryService(DictionaryService dictionaryService)
|
||||
{
|
||||
this.dictionaryService = dictionaryService;
|
||||
}
|
||||
|
||||
private DictionaryService getDictionaryService()
|
||||
{
|
||||
if (dictionaryService == null)
|
||||
{
|
||||
dictionaryService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService();
|
||||
}
|
||||
return dictionaryService;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,6 +164,15 @@ public class AdminNodeBrowseBean
|
||||
public void setNamespaceService(NamespaceService namespaceService)
|
||||
{
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
private NamespaceService getNamespaceService()
|
||||
{
|
||||
if (namespaceService == null)
|
||||
{
|
||||
namespaceService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNamespaceService();
|
||||
}
|
||||
return namespaceService;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,6 +181,15 @@ public class AdminNodeBrowseBean
|
||||
public void setPermissionService(PermissionService permissionService)
|
||||
{
|
||||
this.permissionService = permissionService;
|
||||
}
|
||||
|
||||
private PermissionService getPermissionService()
|
||||
{
|
||||
if (permissionService == null)
|
||||
{
|
||||
permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService();
|
||||
}
|
||||
return permissionService;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,7 +201,7 @@ public class AdminNodeBrowseBean
|
||||
{
|
||||
if (stores == null)
|
||||
{
|
||||
List<StoreRef> storeRefs = nodeService.getStores();
|
||||
List<StoreRef> storeRefs = getNodeService().getStores();
|
||||
stores = new ListDataModel(storeRefs);
|
||||
}
|
||||
return stores;
|
||||
@@ -168,7 +216,7 @@ public class AdminNodeBrowseBean
|
||||
{
|
||||
if (nodeRef == null)
|
||||
{
|
||||
nodeRef = nodeService.getRootNode(new StoreRef("system", "system"));
|
||||
nodeRef = getNodeService().getRootNode(new StoreRef("system", "system"));
|
||||
}
|
||||
return nodeRef;
|
||||
}
|
||||
@@ -203,7 +251,7 @@ public class AdminNodeBrowseBean
|
||||
{
|
||||
if (nodeType == null)
|
||||
{
|
||||
nodeType = nodeService.getType(getNodeRef());
|
||||
nodeType = getNodeService().getType(getNodeRef());
|
||||
}
|
||||
return nodeType;
|
||||
}
|
||||
@@ -217,7 +265,7 @@ public class AdminNodeBrowseBean
|
||||
{
|
||||
if (primaryPath == null)
|
||||
{
|
||||
primaryPath = nodeService.getPath(getNodeRef());
|
||||
primaryPath = getNodeService().getPath(getNodeRef());
|
||||
}
|
||||
return ISO9075.decode(primaryPath.toString());
|
||||
}
|
||||
@@ -244,7 +292,7 @@ public class AdminNodeBrowseBean
|
||||
{
|
||||
if (aspects == null)
|
||||
{
|
||||
List<QName> aspectNames = new ArrayList<QName>(nodeService.getAspects(getNodeRef()));
|
||||
List<QName> aspectNames = new ArrayList<QName>(getNodeService().getAspects(getNodeRef()));
|
||||
aspects = new ListDataModel(aspectNames);
|
||||
}
|
||||
return aspects;
|
||||
@@ -259,7 +307,7 @@ public class AdminNodeBrowseBean
|
||||
{
|
||||
if (parents == null)
|
||||
{
|
||||
List<ChildAssociationRef> parentRefs = nodeService.getParentAssocs(getNodeRef());
|
||||
List<ChildAssociationRef> parentRefs = getNodeService().getParentAssocs(getNodeRef());
|
||||
parents = new ListDataModel(parentRefs);
|
||||
}
|
||||
return parents;
|
||||
@@ -274,7 +322,7 @@ public class AdminNodeBrowseBean
|
||||
{
|
||||
if (properties == null)
|
||||
{
|
||||
Map<QName, Serializable> propertyValues = nodeService.getProperties(getNodeRef());
|
||||
Map<QName, Serializable> propertyValues = getNodeService().getProperties(getNodeRef());
|
||||
List<Property> nodeProperties = new ArrayList<Property>(propertyValues.size());
|
||||
for (Map.Entry<QName, Serializable> property : propertyValues.entrySet())
|
||||
{
|
||||
@@ -294,7 +342,7 @@ public class AdminNodeBrowseBean
|
||||
{
|
||||
if (inheritPermissions == null)
|
||||
{
|
||||
inheritPermissions = permissionService.getInheritParentPermissions(nodeRef);
|
||||
inheritPermissions = this.getPermissionService().getInheritParentPermissions(nodeRef);
|
||||
}
|
||||
return inheritPermissions.booleanValue();
|
||||
}
|
||||
@@ -308,10 +356,10 @@ public class AdminNodeBrowseBean
|
||||
{
|
||||
if (permissions == null)
|
||||
{
|
||||
AccessStatus readPermissions = permissionService.hasPermission(nodeRef, PermissionService.READ_PERMISSIONS);
|
||||
AccessStatus readPermissions = this.getPermissionService().hasPermission(nodeRef, PermissionService.READ_PERMISSIONS);
|
||||
if (readPermissions.equals(AccessStatus.ALLOWED))
|
||||
{
|
||||
List<AccessPermission> nodePermissions = new ArrayList<AccessPermission>(permissionService.getAllSetPermissions(nodeRef));
|
||||
List<AccessPermission> nodePermissions = new ArrayList<AccessPermission>(getPermissionService().getAllSetPermissions(nodeRef));
|
||||
permissions = new ListDataModel(nodePermissions);
|
||||
}
|
||||
else
|
||||
@@ -333,7 +381,7 @@ public class AdminNodeBrowseBean
|
||||
{
|
||||
if (children == null)
|
||||
{
|
||||
List<ChildAssociationRef> assocRefs = nodeService.getChildAssocs(getNodeRef());
|
||||
List<ChildAssociationRef> assocRefs = getNodeService().getChildAssocs(getNodeRef());
|
||||
children = new ListDataModel(assocRefs);
|
||||
}
|
||||
return children;
|
||||
@@ -348,7 +396,7 @@ public class AdminNodeBrowseBean
|
||||
{
|
||||
if (assocs == null)
|
||||
{
|
||||
List<AssociationRef> assocRefs = nodeService.getTargetAssocs(getNodeRef(), RegexQNamePattern.MATCH_ALL);
|
||||
List<AssociationRef> assocRefs = getNodeService().getTargetAssocs(getNodeRef(), RegexQNamePattern.MATCH_ALL);
|
||||
assocs = new ListDataModel(assocRefs);
|
||||
}
|
||||
return assocs;
|
||||
@@ -421,8 +469,8 @@ public class AdminNodeBrowseBean
|
||||
*/
|
||||
public String selectStore()
|
||||
{
|
||||
StoreRef storeRef = (StoreRef)stores.getRowData();
|
||||
NodeRef rootNode = nodeService.getRootNode(storeRef);
|
||||
StoreRef storeRef = (StoreRef)getStores().getRowData();
|
||||
NodeRef rootNode = getNodeService().getRootNode(storeRef);
|
||||
setNodeRef(rootNode);
|
||||
return "success";
|
||||
}
|
||||
@@ -468,7 +516,7 @@ public class AdminNodeBrowseBean
|
||||
*/
|
||||
public String selectParent()
|
||||
{
|
||||
ChildAssociationRef assocRef = (ChildAssociationRef)parents.getRowData();
|
||||
ChildAssociationRef assocRef = (ChildAssociationRef)getParents().getRowData();
|
||||
NodeRef parentRef = assocRef.getParentRef();
|
||||
setNodeRef(parentRef);
|
||||
return "success";
|
||||
@@ -481,7 +529,7 @@ public class AdminNodeBrowseBean
|
||||
*/
|
||||
public String selectToNode()
|
||||
{
|
||||
AssociationRef assocRef = (AssociationRef)assocs.getRowData();
|
||||
AssociationRef assocRef = (AssociationRef)getAssocs().getRowData();
|
||||
NodeRef targetRef = assocRef.getTargetRef();
|
||||
setNodeRef(targetRef);
|
||||
return "success";
|
||||
@@ -494,7 +542,7 @@ public class AdminNodeBrowseBean
|
||||
*/
|
||||
public String selectNodeProperty()
|
||||
{
|
||||
Property property = (Property)properties.getRowData();
|
||||
Property property = (Property)getProperties().getRowData();
|
||||
Property.Value value = (Property.Value)property.getValues().getRowData();
|
||||
NodeRef nodeRef = (NodeRef)value.getValue();
|
||||
setNodeRef(nodeRef);
|
||||
@@ -508,7 +556,7 @@ public class AdminNodeBrowseBean
|
||||
*/
|
||||
public String selectChild()
|
||||
{
|
||||
ChildAssociationRef assocRef = (ChildAssociationRef)children.getRowData();
|
||||
ChildAssociationRef assocRef = (ChildAssociationRef)getChildren().getRowData();
|
||||
NodeRef childRef = assocRef.getChildRef();
|
||||
setNodeRef(childRef);
|
||||
return "success";
|
||||
@@ -540,7 +588,7 @@ public class AdminNodeBrowseBean
|
||||
{
|
||||
// ensure node exists
|
||||
NodeRef nodeRef = new NodeRef(query);
|
||||
boolean exists = nodeService.exists(nodeRef);
|
||||
boolean exists = getNodeService().exists(nodeRef);
|
||||
if (!exists)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Node " + nodeRef + " does not exist.");
|
||||
@@ -550,13 +598,13 @@ public class AdminNodeBrowseBean
|
||||
}
|
||||
else if (queryLanguage.equals("selectnodes"))
|
||||
{
|
||||
List<NodeRef> nodes = searchService.selectNodes(getNodeRef(), query, null, namespaceService, false);
|
||||
List<NodeRef> nodes = getSearchService().selectNodes(getNodeRef(), query, null, namespaceService, false);
|
||||
searchResults = new SearchResults(nodes);
|
||||
return "search";
|
||||
}
|
||||
|
||||
// perform search
|
||||
searchResults = new SearchResults(searchService.query(getNodeRef().getStoreRef(), queryLanguage, query));
|
||||
searchResults = new SearchResults(getSearchService().query(getNodeRef().getStoreRef(), queryLanguage, query));
|
||||
return "search";
|
||||
}
|
||||
catch(Throwable e)
|
||||
@@ -591,7 +639,7 @@ public class AdminNodeBrowseBean
|
||||
{
|
||||
this.name = name;
|
||||
|
||||
PropertyDefinition propDef = dictionaryService.getProperty(name);
|
||||
PropertyDefinition propDef = getDictionaryService().getProperty(name);
|
||||
if (propDef != null)
|
||||
{
|
||||
datatype = propDef.getDataType().getName().toString();
|
||||
@@ -720,10 +768,10 @@ public class AdminNodeBrowseBean
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
DataTypeDefinition dataTypeDefinition = dictionaryService.getDataType(value.getClass());
|
||||
DataTypeDefinition dataTypeDefinition = getDictionaryService().getDataType(value.getClass());
|
||||
if (dataTypeDefinition != null)
|
||||
{
|
||||
datatype = dictionaryService.getDataType(value.getClass()).getName().toString();
|
||||
datatype = getDictionaryService().getDataType(value.getClass()).getName().toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -780,8 +828,10 @@ public class AdminNodeBrowseBean
|
||||
/**
|
||||
* Permission representing the fact that "Read Permissions" has not been granted
|
||||
*/
|
||||
public static class NoReadPermissionGranted
|
||||
{
|
||||
public static class NoReadPermissionGranted implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -6256369557521402921L;
|
||||
|
||||
public String getPermission()
|
||||
{
|
||||
return PermissionService.READ_PERMISSIONS;
|
||||
@@ -801,10 +851,12 @@ public class AdminNodeBrowseBean
|
||||
/**
|
||||
* Wrapper class for Search Results
|
||||
*/
|
||||
public class SearchResults
|
||||
{
|
||||
public class SearchResults implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 7402906720039176001L;
|
||||
|
||||
private int length = 0;
|
||||
private DataModel rows;
|
||||
private SerialListDataModel rows;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
@@ -813,7 +865,7 @@ public class AdminNodeBrowseBean
|
||||
*/
|
||||
public SearchResults(ResultSet resultSet)
|
||||
{
|
||||
rows = new ListDataModel();
|
||||
rows = new SerialListDataModel();
|
||||
if (resultSet != null)
|
||||
{
|
||||
rows.setWrappedData(resultSet.getChildAssocRefs());
|
||||
@@ -828,13 +880,13 @@ public class AdminNodeBrowseBean
|
||||
*/
|
||||
public SearchResults(List<NodeRef> resultSet)
|
||||
{
|
||||
rows = new ListDataModel();
|
||||
rows = new SerialListDataModel();
|
||||
if (resultSet != null)
|
||||
{
|
||||
List<ChildAssociationRef> assocRefs = new ArrayList<ChildAssociationRef>(resultSet.size());
|
||||
for (NodeRef nodeRef : resultSet)
|
||||
{
|
||||
ChildAssociationRef childAssocRef = nodeService.getPrimaryParent(nodeRef);
|
||||
ChildAssociationRef childAssocRef = getNodeService().getPrimaryParent(nodeRef);
|
||||
assocRefs.add(childAssocRef);
|
||||
}
|
||||
rows.setWrappedData(assocRefs);
|
||||
@@ -860,6 +912,11 @@ public class AdminNodeBrowseBean
|
||||
public DataModel getRows()
|
||||
{
|
||||
return rows;
|
||||
}
|
||||
|
||||
private class SerialListDataModel extends ListDataModel implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 4154583769762846020L;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -35,7 +35,6 @@ import org.alfresco.repo.action.executer.RepositoryExporterActionExecuter;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.BrowseBean;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
@@ -50,6 +49,8 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
public class ExportDialog extends BaseDialogBean
|
||||
{
|
||||
private static final long serialVersionUID = -2592252768301728700L;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ExportDialog.class);
|
||||
|
||||
private static final String ALL_SPACES = "all";
|
||||
@@ -58,8 +59,7 @@ public class ExportDialog extends BaseDialogBean
|
||||
private static final String MSG_EXPORT = "export";
|
||||
|
||||
protected BrowseBean browseBean;
|
||||
protected NodeService nodeService;
|
||||
protected ActionService actionService;
|
||||
transient private ActionService actionService;
|
||||
|
||||
private String packageName;
|
||||
private String encoding = "UTF-8";
|
||||
@@ -85,7 +85,7 @@ public class ExportDialog extends BaseDialogBean
|
||||
Map<String, Serializable> params = new HashMap<String, Serializable>(5);
|
||||
params.put(ExporterActionExecuter.PARAM_PACKAGE_NAME, this.packageName);
|
||||
params.put(ExporterActionExecuter.PARAM_DESTINATION_FOLDER, this.destination);
|
||||
action = this.actionService.createAction(RepositoryExporterActionExecuter.NAME, params);
|
||||
action = this.getActionService().createAction(RepositoryExporterActionExecuter.NAME, params);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -96,12 +96,12 @@ public class ExportDialog extends BaseDialogBean
|
||||
params.put(ExporterActionExecuter.PARAM_DESTINATION_FOLDER, this.destination);
|
||||
params.put(ExporterActionExecuter.PARAM_INCLUDE_CHILDREN, Boolean.valueOf(includeChildren));
|
||||
params.put(ExporterActionExecuter.PARAM_INCLUDE_SELF, new Boolean(includeSelf));
|
||||
action = this.actionService.createAction(ExporterActionExecuter.NAME, params);
|
||||
action = this.getActionService().createAction(ExporterActionExecuter.NAME, params);
|
||||
}
|
||||
|
||||
// execute action
|
||||
action.setExecuteAsynchronously(this.runInBackground);
|
||||
this.actionService.executeAction(action, startNode);
|
||||
this.getActionService().executeAction(action, startNode);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
@@ -306,13 +306,12 @@ public class ExportDialog extends BaseDialogBean
|
||||
this.actionService = actionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the node service
|
||||
*
|
||||
* @param nodeService the node service
|
||||
*/
|
||||
public void setNodeService(NodeService nodeService)
|
||||
protected ActionService getActionService()
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
if (actionService == null)
|
||||
{
|
||||
actionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getActionService();
|
||||
}
|
||||
return actionService;
|
||||
}
|
||||
}
|
||||
|
@@ -44,11 +44,9 @@ import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.MimetypeService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.BrowseBean;
|
||||
import org.alfresco.web.bean.FileUploadBean;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
@@ -63,6 +61,8 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
public class ImportDialog extends BaseDialogBean
|
||||
{
|
||||
private static final long serialVersionUID = -8563911447832447065L;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ImportDialog.class);
|
||||
|
||||
private static final String DEFAULT_OUTCOME = "dialog:close";
|
||||
@@ -73,11 +73,9 @@ public class ImportDialog extends BaseDialogBean
|
||||
private static final String MSG_OK = "ok";
|
||||
private static final String MSG_IMPORT = "import";
|
||||
|
||||
protected BrowseBean browseBean;
|
||||
protected NodeService nodeService;
|
||||
protected ActionService actionService;
|
||||
protected ContentService contentService;
|
||||
protected MimetypeService mimetypeService;
|
||||
transient private ActionService actionService;
|
||||
transient private ContentService contentService;
|
||||
transient private MimetypeService mimetypeService;
|
||||
|
||||
private File file;
|
||||
private String fileName;
|
||||
@@ -118,11 +116,11 @@ public class ImportDialog extends BaseDialogBean
|
||||
params.put(ImporterActionExecuter.PARAM_ENCODING, encoding);
|
||||
|
||||
// build the action to execute
|
||||
Action action = actionService.createAction(ImporterActionExecuter.NAME, params);
|
||||
Action action = getActionService().createAction(ImporterActionExecuter.NAME, params);
|
||||
action.setExecuteAsynchronously(runInBackground);
|
||||
|
||||
// execute the action on the ACP file
|
||||
actionService.executeAction(action, acpNodeRef);
|
||||
getActionService().executeAction(action, acpNodeRef);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
@@ -257,16 +255,6 @@ public class ImportDialog extends BaseDialogBean
|
||||
{
|
||||
this.runInBackground = runInBackground;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the BrowseBean instance to use to retrieve the current document
|
||||
*
|
||||
* @param browseBean BrowseBean instance
|
||||
*/
|
||||
public void setBrowseBean(BrowseBean browseBean)
|
||||
{
|
||||
this.browseBean = browseBean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the action service
|
||||
@@ -278,14 +266,13 @@ public class ImportDialog extends BaseDialogBean
|
||||
this.actionService = actionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the node service
|
||||
*
|
||||
* @param nodeService the node service
|
||||
*/
|
||||
public void setNodeService(NodeService nodeService)
|
||||
protected ActionService getActionService()
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
if (actionService == null)
|
||||
{
|
||||
actionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getActionService();
|
||||
}
|
||||
return actionService;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -298,6 +285,15 @@ public class ImportDialog extends BaseDialogBean
|
||||
this.contentService = contentService;
|
||||
}
|
||||
|
||||
protected ContentService getContentService()
|
||||
{
|
||||
if (contentService == null)
|
||||
{
|
||||
contentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentService();
|
||||
}
|
||||
return contentService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the mimetype sevice
|
||||
*
|
||||
@@ -308,6 +304,15 @@ public class ImportDialog extends BaseDialogBean
|
||||
this.mimetypeService = mimetypeService;
|
||||
}
|
||||
|
||||
protected MimetypeService getMimetypeService()
|
||||
{
|
||||
if (mimetypeService == null)
|
||||
{
|
||||
mimetypeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMimetypeService();
|
||||
}
|
||||
return mimetypeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the uploaded ACP/ZIP file to the repository
|
||||
*
|
||||
@@ -322,7 +327,7 @@ public class ImportDialog extends BaseDialogBean
|
||||
|
||||
// create the node to represent the zip file
|
||||
String assocName = QName.createValidLocalName(this.fileName);
|
||||
ChildAssociationRef assocRef = this.nodeService.createNode(
|
||||
ChildAssociationRef assocRef = this.getNodeService().createNode(
|
||||
this.browseBean.getActionSpace().getNodeRef(), ContentModel.ASSOC_CONTAINS,
|
||||
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, assocName),
|
||||
ContentModel.TYPE_CONTENT, contentProps);
|
||||
@@ -330,17 +335,17 @@ public class ImportDialog extends BaseDialogBean
|
||||
NodeRef acpNodeRef = assocRef.getChildRef();
|
||||
|
||||
// apply the titled aspect to behave in the web client
|
||||
String mimetype = this.mimetypeService.guessMimetype(this.fileName);
|
||||
String mimetype = this.getMimetypeService().guessMimetype(this.fileName);
|
||||
Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>(2, 1.0f);
|
||||
titledProps.put(ContentModel.PROP_TITLE, this.fileName);
|
||||
titledProps.put(ContentModel.PROP_DESCRIPTION,
|
||||
MimetypeMap.MIMETYPE_ACP.equals(mimetype) ?
|
||||
Application.getMessage(context, "import_acp_description") :
|
||||
Application.getMessage(context, "import_zip_description"));
|
||||
this.nodeService.addAspect(acpNodeRef, ContentModel.ASPECT_TITLED, titledProps);
|
||||
this.getNodeService().addAspect(acpNodeRef, ContentModel.ASPECT_TITLED, titledProps);
|
||||
|
||||
// add the content to the node
|
||||
ContentWriter writer = this.contentService.getWriter(acpNodeRef, ContentModel.PROP_CONTENT, true);
|
||||
ContentWriter writer = this.getContentService().getWriter(acpNodeRef, ContentModel.PROP_CONTENT, true);
|
||||
writer.setEncoding(this.encoding);
|
||||
writer.setMimetype(mimetype);
|
||||
writer.putContent(this.file);
|
||||
|
Reference in New Issue
Block a user