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,155 +1,155 @@
|
||||
package org.alfresco.web.bean.content;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.cmr.ml.MultilingualContentService;
|
||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Bean implementation for the "Delete Content" dialog
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class DeleteContentDialog extends BaseDialogBean
|
||||
{
|
||||
private static final long serialVersionUID = 4199496011879649213L;
|
||||
|
||||
transient private MultilingualContentService multilingualContentService;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(DeleteContentDialog.class);
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Dialog implementation
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome)
|
||||
throws Exception
|
||||
{
|
||||
// get the content to delete
|
||||
Node node = this.browseBean.getDocument();
|
||||
if (node != null)
|
||||
{
|
||||
if(ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(node.getType()))
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Trying to delete multilingual container: " + node.getId() + " and its translations" );
|
||||
|
||||
// delete the mlContainer and its translations
|
||||
getMultilingualContentService().deleteTranslationContainer(node.getNodeRef());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Trying to delete content node: " + node.getId());
|
||||
|
||||
// delete the node
|
||||
this.getNodeService().deleteNode(node.getNodeRef());
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.warn("WARNING: delete called without a current Document!");
|
||||
}
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doPostCommitProcessing(FacesContext context, String outcome)
|
||||
{
|
||||
// clear action context
|
||||
this.browseBean.setDocument(null);
|
||||
|
||||
// setting the outcome will show the browse view again
|
||||
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
|
||||
AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browse";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getErrorMessageId()
|
||||
{
|
||||
return "error_delete_file";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFinishButtonDisabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Bean Getters and Setters
|
||||
|
||||
/**
|
||||
* Returns the confirmation to display to the user before deleting the content.
|
||||
*
|
||||
* @return The formatted message to display
|
||||
*/
|
||||
public String getConfirmMessage()
|
||||
{
|
||||
String fileConfirmMsg = null;
|
||||
|
||||
Node document = this.browseBean.getDocument();
|
||||
|
||||
if(document.getType().equals(ContentModel.TYPE_MULTILINGUAL_CONTAINER))
|
||||
{
|
||||
fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"delete_ml_container_confirm");
|
||||
}
|
||||
else if(document.hasAspect(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
|
||||
{
|
||||
fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"delete_empty_translation_confirm");
|
||||
}
|
||||
else if(document.hasAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT))
|
||||
{
|
||||
fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"delete_translation_confirm");
|
||||
}
|
||||
else
|
||||
{
|
||||
String strHasMultipleParents = this.parameters.get("hasMultipleParents");
|
||||
if (strHasMultipleParents != null && "true".equals(strHasMultipleParents))
|
||||
{
|
||||
fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"delete_file_multiple_parents_confirm");
|
||||
}
|
||||
else
|
||||
{
|
||||
fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"delete_file_confirm");
|
||||
}
|
||||
}
|
||||
|
||||
return MessageFormat.format(fileConfirmMsg,
|
||||
new Object[] {document.getName()});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param multilingualContentService the Multilingual Content Service to set
|
||||
*/
|
||||
public void setMultilingualContentService(MultilingualContentService multilingualContentService)
|
||||
{
|
||||
this.multilingualContentService = multilingualContentService;
|
||||
}
|
||||
|
||||
protected MultilingualContentService getMultilingualContentService()
|
||||
{
|
||||
if (multilingualContentService == null)
|
||||
{
|
||||
multilingualContentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMultilingualContentService();
|
||||
}
|
||||
return multilingualContentService;
|
||||
}
|
||||
|
||||
}
|
||||
package org.alfresco.web.bean.content;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.cmr.ml.MultilingualContentService;
|
||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Bean implementation for the "Delete Content" dialog
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class DeleteContentDialog extends BaseDialogBean
|
||||
{
|
||||
private static final long serialVersionUID = 4199496011879649213L;
|
||||
|
||||
transient private MultilingualContentService multilingualContentService;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(DeleteContentDialog.class);
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Dialog implementation
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome)
|
||||
throws Exception
|
||||
{
|
||||
// get the content to delete
|
||||
Node node = this.browseBean.getDocument();
|
||||
if (node != null)
|
||||
{
|
||||
if(ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(node.getType()))
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Trying to delete multilingual container: " + node.getId() + " and its translations" );
|
||||
|
||||
// delete the mlContainer and its translations
|
||||
getMultilingualContentService().deleteTranslationContainer(node.getNodeRef());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Trying to delete content node: " + node.getId());
|
||||
|
||||
// delete the node
|
||||
this.getNodeService().deleteNode(node.getNodeRef());
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.warn("WARNING: delete called without a current Document!");
|
||||
}
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doPostCommitProcessing(FacesContext context, String outcome)
|
||||
{
|
||||
// clear action context
|
||||
this.browseBean.setDocument(null);
|
||||
|
||||
// setting the outcome will show the browse view again
|
||||
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
|
||||
AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browse";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getErrorMessageId()
|
||||
{
|
||||
return "error_delete_file";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFinishButtonDisabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Bean Getters and Setters
|
||||
|
||||
/**
|
||||
* Returns the confirmation to display to the user before deleting the content.
|
||||
*
|
||||
* @return The formatted message to display
|
||||
*/
|
||||
public String getConfirmMessage()
|
||||
{
|
||||
String fileConfirmMsg = null;
|
||||
|
||||
Node document = this.browseBean.getDocument();
|
||||
|
||||
if(document.getType().equals(ContentModel.TYPE_MULTILINGUAL_CONTAINER))
|
||||
{
|
||||
fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"delete_ml_container_confirm");
|
||||
}
|
||||
else if(document.hasAspect(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
|
||||
{
|
||||
fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"delete_empty_translation_confirm");
|
||||
}
|
||||
else if(document.hasAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT))
|
||||
{
|
||||
fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"delete_translation_confirm");
|
||||
}
|
||||
else
|
||||
{
|
||||
String strHasMultipleParents = this.parameters.get("hasMultipleParents");
|
||||
if (strHasMultipleParents != null && "true".equals(strHasMultipleParents))
|
||||
{
|
||||
fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"delete_file_multiple_parents_confirm");
|
||||
}
|
||||
else
|
||||
{
|
||||
fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"delete_file_confirm");
|
||||
}
|
||||
}
|
||||
|
||||
return MessageFormat.format(fileConfirmMsg,
|
||||
new Object[] {document.getName()});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param multilingualContentService the Multilingual Content Service to set
|
||||
*/
|
||||
public void setMultilingualContentService(MultilingualContentService multilingualContentService)
|
||||
{
|
||||
this.multilingualContentService = multilingualContentService;
|
||||
}
|
||||
|
||||
protected MultilingualContentService getMultilingualContentService()
|
||||
{
|
||||
if (multilingualContentService == null)
|
||||
{
|
||||
multilingualContentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMultilingualContentService();
|
||||
}
|
||||
return multilingualContentService;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user