mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
125605 rmunteanu: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2) 125498 slanglois: MNT-16155 Update source headers - remove svn:eol-style property on Java and JSP source files git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@125783 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,85 +1,85 @@
|
||||
package org.alfresco.web.bean.ajax;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
|
||||
import org.alfresco.model.ApplicationModel;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.service.cmr.model.FileExistsException;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.web.app.servlet.ajax.InvokeCommand;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.spaces.CreateSpaceWizard;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Bean backing the ajax requests from the MySpaces portlet webscript.
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class MySpacesBean implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -5684182834188359483L;
|
||||
|
||||
private static Log logger = LogFactory.getLog(MySpacesBean.class);
|
||||
|
||||
@InvokeCommand.ResponseMimetype(value=MimetypeMap.MIMETYPE_HTML)
|
||||
public void createSpace() throws Exception
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
ResponseWriter out = fc.getResponseWriter();
|
||||
|
||||
Map<String, String> requestMap = fc.getExternalContext().getRequestParameterMap();
|
||||
String path = (String)requestMap.get("path");
|
||||
String name = (String)requestMap.get("name");
|
||||
String title = (String)requestMap.get("title");
|
||||
String description = (String)requestMap.get("description");
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("MySpacesBean.createSpace() path=" + path + " name=" + name +
|
||||
" title=" + title + " description=" + description);
|
||||
|
||||
try
|
||||
{
|
||||
if (path != null && name != null)
|
||||
{
|
||||
NodeRef containerRef = FileUploadBean.pathToNodeRef(fc, path);
|
||||
if (containerRef != null)
|
||||
{
|
||||
NodeService nodeService = Repository.getServiceRegistry(fc).getNodeService();
|
||||
FileFolderService ffService = Repository.getServiceRegistry(fc).getFileFolderService();
|
||||
FileInfo folderInfo = ffService.create(containerRef, name, ContentModel.TYPE_FOLDER);
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Created new folder: " + folderInfo.getNodeRef().toString());
|
||||
|
||||
// apply the uifacets aspect - icon, title and description properties
|
||||
Map<QName, Serializable> uiFacetsProps = new HashMap<QName, Serializable>(4, 1.0f);
|
||||
uiFacetsProps.put(ApplicationModel.PROP_ICON, CreateSpaceWizard.DEFAULT_SPACE_ICON_NAME);
|
||||
uiFacetsProps.put(ContentModel.PROP_TITLE, title);
|
||||
uiFacetsProps.put(ContentModel.PROP_DESCRIPTION, description);
|
||||
nodeService.addAspect(folderInfo.getNodeRef(), ApplicationModel.ASPECT_UIFACETS, uiFacetsProps);
|
||||
|
||||
out.write("OK: " + folderInfo.getNodeRef().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (FileExistsException ferr)
|
||||
{
|
||||
out.write("ERROR: A file with that name already exists.");
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
out.write("ERROR: " + err.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
package org.alfresco.web.bean.ajax;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
|
||||
import org.alfresco.model.ApplicationModel;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.service.cmr.model.FileExistsException;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.web.app.servlet.ajax.InvokeCommand;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.spaces.CreateSpaceWizard;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Bean backing the ajax requests from the MySpaces portlet webscript.
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class MySpacesBean implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -5684182834188359483L;
|
||||
|
||||
private static Log logger = LogFactory.getLog(MySpacesBean.class);
|
||||
|
||||
@InvokeCommand.ResponseMimetype(value=MimetypeMap.MIMETYPE_HTML)
|
||||
public void createSpace() throws Exception
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
ResponseWriter out = fc.getResponseWriter();
|
||||
|
||||
Map<String, String> requestMap = fc.getExternalContext().getRequestParameterMap();
|
||||
String path = (String)requestMap.get("path");
|
||||
String name = (String)requestMap.get("name");
|
||||
String title = (String)requestMap.get("title");
|
||||
String description = (String)requestMap.get("description");
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("MySpacesBean.createSpace() path=" + path + " name=" + name +
|
||||
" title=" + title + " description=" + description);
|
||||
|
||||
try
|
||||
{
|
||||
if (path != null && name != null)
|
||||
{
|
||||
NodeRef containerRef = FileUploadBean.pathToNodeRef(fc, path);
|
||||
if (containerRef != null)
|
||||
{
|
||||
NodeService nodeService = Repository.getServiceRegistry(fc).getNodeService();
|
||||
FileFolderService ffService = Repository.getServiceRegistry(fc).getFileFolderService();
|
||||
FileInfo folderInfo = ffService.create(containerRef, name, ContentModel.TYPE_FOLDER);
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Created new folder: " + folderInfo.getNodeRef().toString());
|
||||
|
||||
// apply the uifacets aspect - icon, title and description properties
|
||||
Map<QName, Serializable> uiFacetsProps = new HashMap<QName, Serializable>(4, 1.0f);
|
||||
uiFacetsProps.put(ApplicationModel.PROP_ICON, CreateSpaceWizard.DEFAULT_SPACE_ICON_NAME);
|
||||
uiFacetsProps.put(ContentModel.PROP_TITLE, title);
|
||||
uiFacetsProps.put(ContentModel.PROP_DESCRIPTION, description);
|
||||
nodeService.addAspect(folderInfo.getNodeRef(), ApplicationModel.ASPECT_UIFACETS, uiFacetsProps);
|
||||
|
||||
out.write("OK: " + folderInfo.getNodeRef().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (FileExistsException ferr)
|
||||
{
|
||||
out.write("ERROR: A file with that name already exists.");
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
out.write("ERROR: " + err.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user