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,69 +1,69 @@
|
||||
package org.alfresco.web.bean.trashcan;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.ui.common.ReportedException;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
|
||||
public class TrashcanDeleteAllItemsDialog extends TrashcanDialog
|
||||
{
|
||||
private static final long serialVersionUID = 2537803727179629546L;
|
||||
|
||||
private static final String MSG_YES = "yes";
|
||||
private static final String MSG_NO = "no";
|
||||
|
||||
private String deleteAllItems(FacesContext context, String outcome)
|
||||
{
|
||||
if (property.isInProgress())
|
||||
return null;
|
||||
|
||||
property.setInProgress(true);
|
||||
|
||||
try
|
||||
{
|
||||
property.getNodeArchiveService().purgeAllArchivedNodes(Repository.getStoreRef());
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(context, Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||
ReportedException.throwIfNecessary(err);
|
||||
}
|
||||
finally
|
||||
{
|
||||
property.setInProgress(false);
|
||||
}
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
return deleteAllItems(context, outcome);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCancelButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_NO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFinishButtonDisabled()
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_YES);
|
||||
}
|
||||
|
||||
}
|
||||
package org.alfresco.web.bean.trashcan;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.ui.common.ReportedException;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
|
||||
public class TrashcanDeleteAllItemsDialog extends TrashcanDialog
|
||||
{
|
||||
private static final long serialVersionUID = 2537803727179629546L;
|
||||
|
||||
private static final String MSG_YES = "yes";
|
||||
private static final String MSG_NO = "no";
|
||||
|
||||
private String deleteAllItems(FacesContext context, String outcome)
|
||||
{
|
||||
if (property.isInProgress())
|
||||
return null;
|
||||
|
||||
property.setInProgress(true);
|
||||
|
||||
try
|
||||
{
|
||||
property.getNodeArchiveService().purgeAllArchivedNodes(Repository.getStoreRef());
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(context, Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||
ReportedException.throwIfNecessary(err);
|
||||
}
|
||||
finally
|
||||
{
|
||||
property.setInProgress(false);
|
||||
}
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
return deleteAllItems(context, outcome);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCancelButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_NO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFinishButtonDisabled()
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_YES);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,88 +1,88 @@
|
||||
package org.alfresco.web.bean.trashcan;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.ui.common.ReportedException;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
|
||||
public class TrashcanDeleteItemDialog extends TrashcanDialog
|
||||
{
|
||||
private static final long serialVersionUID = 519967126630923155L;
|
||||
|
||||
private static final String RICHLIST_ID = "trashcan-list";
|
||||
private static final String RICHLIST_MSG_ID = "trashcan" + ':' + RICHLIST_ID;
|
||||
private static final String MSG_YES = "yes";
|
||||
private static final String MSG_NO = "no";
|
||||
private static final String MSG_DELETE_ITEM = "delete_item";
|
||||
private final static String MSG_LEFT_QUOTE = "left_qoute";
|
||||
private final static String MSG_RIGHT_QUOTE = "right_quote";
|
||||
|
||||
private String deleteItem(FacesContext newContext, String newOutcome)
|
||||
{
|
||||
Node item = property.getItem();
|
||||
if (item != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
property.getNodeArchiveService().purgeArchivedNode(item.getNodeRef());
|
||||
|
||||
FacesContext fc = newContext;
|
||||
String msg = MessageFormat.format(Application.getMessage(fc, "delete_item_success"), item.getName());
|
||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
|
||||
fc.addMessage(RICHLIST_MSG_ID, facesMsg);
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(newContext, Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||
ReportedException.throwIfNecessary(err);
|
||||
}
|
||||
}
|
||||
return newOutcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultFinishOutcome()
|
||||
{
|
||||
return "dialog:close[2]";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
return deleteItem(context, outcome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCancelButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_NO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFinishButtonDisabled()
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_YES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContainerTitle()
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
return Application.getMessage(fc, MSG_DELETE_ITEM) + " " + Application.getMessage(fc, MSG_LEFT_QUOTE)
|
||||
+ property.getItem().getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE);
|
||||
}
|
||||
|
||||
}
|
||||
package org.alfresco.web.bean.trashcan;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.ui.common.ReportedException;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
|
||||
public class TrashcanDeleteItemDialog extends TrashcanDialog
|
||||
{
|
||||
private static final long serialVersionUID = 519967126630923155L;
|
||||
|
||||
private static final String RICHLIST_ID = "trashcan-list";
|
||||
private static final String RICHLIST_MSG_ID = "trashcan" + ':' + RICHLIST_ID;
|
||||
private static final String MSG_YES = "yes";
|
||||
private static final String MSG_NO = "no";
|
||||
private static final String MSG_DELETE_ITEM = "delete_item";
|
||||
private final static String MSG_LEFT_QUOTE = "left_qoute";
|
||||
private final static String MSG_RIGHT_QUOTE = "right_quote";
|
||||
|
||||
private String deleteItem(FacesContext newContext, String newOutcome)
|
||||
{
|
||||
Node item = property.getItem();
|
||||
if (item != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
property.getNodeArchiveService().purgeArchivedNode(item.getNodeRef());
|
||||
|
||||
FacesContext fc = newContext;
|
||||
String msg = MessageFormat.format(Application.getMessage(fc, "delete_item_success"), item.getName());
|
||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
|
||||
fc.addMessage(RICHLIST_MSG_ID, facesMsg);
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(newContext, Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||
ReportedException.throwIfNecessary(err);
|
||||
}
|
||||
}
|
||||
return newOutcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultFinishOutcome()
|
||||
{
|
||||
return "dialog:close[2]";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
return deleteItem(context, outcome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCancelButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_NO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFinishButtonDisabled()
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_YES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContainerTitle()
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
return Application.getMessage(fc, MSG_DELETE_ITEM) + " " + Application.getMessage(fc, MSG_LEFT_QUOTE)
|
||||
+ property.getItem().getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,78 +1,78 @@
|
||||
package org.alfresco.web.bean.trashcan;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.ui.common.ReportedException;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
|
||||
public class TrashcanDeleteListedItemsDialog extends TrashcanDialog
|
||||
{
|
||||
private static final long serialVersionUID = 5576836588148974609L;
|
||||
|
||||
private static final String MSG_YES = "yes";
|
||||
private static final String MSG_NO = "no";
|
||||
|
||||
private String deleteListedItems(FacesContext context, String outcome)
|
||||
{
|
||||
if (property.isInProgress())
|
||||
return null;
|
||||
|
||||
property.setInProgress(true);
|
||||
|
||||
try
|
||||
{
|
||||
List<NodeRef> nodeRefs = new ArrayList<NodeRef>(property.getListedItems().size());
|
||||
for (Node node : property.getListedItems())
|
||||
{
|
||||
nodeRefs.add(node.getNodeRef());
|
||||
}
|
||||
property.getNodeArchiveService().purgeArchivedNodes(nodeRefs);
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(context, Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||
ReportedException.throwIfNecessary(err);
|
||||
}
|
||||
finally
|
||||
{
|
||||
property.setInProgress(false);
|
||||
}
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
return deleteListedItems(context, outcome);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCancelButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_NO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFinishButtonDisabled()
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_YES);
|
||||
}
|
||||
|
||||
}
|
||||
package org.alfresco.web.bean.trashcan;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.ui.common.ReportedException;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
|
||||
public class TrashcanDeleteListedItemsDialog extends TrashcanDialog
|
||||
{
|
||||
private static final long serialVersionUID = 5576836588148974609L;
|
||||
|
||||
private static final String MSG_YES = "yes";
|
||||
private static final String MSG_NO = "no";
|
||||
|
||||
private String deleteListedItems(FacesContext context, String outcome)
|
||||
{
|
||||
if (property.isInProgress())
|
||||
return null;
|
||||
|
||||
property.setInProgress(true);
|
||||
|
||||
try
|
||||
{
|
||||
List<NodeRef> nodeRefs = new ArrayList<NodeRef>(property.getListedItems().size());
|
||||
for (Node node : property.getListedItems())
|
||||
{
|
||||
nodeRefs.add(node.getNodeRef());
|
||||
}
|
||||
property.getNodeArchiveService().purgeArchivedNodes(nodeRefs);
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(context, Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||
ReportedException.throwIfNecessary(err);
|
||||
}
|
||||
finally
|
||||
{
|
||||
property.setInProgress(false);
|
||||
}
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
return deleteListedItems(context, outcome);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCancelButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_NO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFinishButtonDisabled()
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_YES);
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,290 +1,290 @@
|
||||
package org.alfresco.web.bean.trashcan;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.repo.node.archive.NodeArchiveService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.ui.common.component.data.UIRichList;
|
||||
|
||||
public class TrashcanDialogProperty implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -8007742798807270570L;
|
||||
|
||||
private static final String FILTER_DATE_ALL = "all";
|
||||
private static final String FILTER_USER_ALL = "all";
|
||||
|
||||
/** NodeArchiveService bean reference */
|
||||
transient private NodeArchiveService nodeArchiveService;
|
||||
|
||||
/** Component reference for Deleted Items RichList control */
|
||||
protected UIRichList itemsRichList;
|
||||
|
||||
/** Search text */
|
||||
private String searchText = null;
|
||||
|
||||
/** We show an empty list until a Search or Show All is executed */
|
||||
private boolean showItems = false;
|
||||
|
||||
private boolean fullTextSearch = false;
|
||||
|
||||
/** Currently listed items */
|
||||
private List<Node> listedItems = Collections.<Node> emptyList();
|
||||
|
||||
private List<Node> successItems = Collections.<Node> emptyList();
|
||||
|
||||
private List<Node> failureItems = Collections.<Node> emptyList();
|
||||
|
||||
/** Current action context Node */
|
||||
private Node actionNode;
|
||||
|
||||
/** Root node to the spaces store archive store */
|
||||
private NodeRef archiveRootRef = null;
|
||||
|
||||
/** Alternative destination for recovered items */
|
||||
private NodeRef destination = null;
|
||||
|
||||
/** Date filter selection */
|
||||
private String dateFilter = FILTER_DATE_ALL;
|
||||
|
||||
/** User filter selection */
|
||||
private String userFilter = FILTER_USER_ALL;
|
||||
|
||||
/** User filter search box text */
|
||||
private String userSearchText = null;
|
||||
|
||||
private boolean inProgress = false;
|
||||
|
||||
/**
|
||||
* @param nodeArchiveService The nodeArchiveService to set.
|
||||
*/
|
||||
public void setNodeArchiveService(NodeArchiveService nodeArchiveService)
|
||||
{
|
||||
this.nodeArchiveService = nodeArchiveService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the itemsRichList.
|
||||
*/
|
||||
public UIRichList getItemsRichList()
|
||||
{
|
||||
return this.itemsRichList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemsRichList The itemsRichList to set.
|
||||
*/
|
||||
public void setItemsRichList(UIRichList itemsRichList)
|
||||
{
|
||||
this.itemsRichList = itemsRichList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the searchText.
|
||||
*/
|
||||
public String getSearchText()
|
||||
{
|
||||
return this.searchText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param searchText The searchText to set.
|
||||
*/
|
||||
public void setSearchText(String searchText)
|
||||
{
|
||||
this.searchText = searchText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the alternative destination to use if recovery fails.
|
||||
*/
|
||||
public NodeRef getDestination()
|
||||
{
|
||||
return this.destination;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param destination The alternative destination to use if recovery fails.
|
||||
*/
|
||||
public void setDestination(NodeRef destination)
|
||||
{
|
||||
this.destination = destination;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the dateFilter.
|
||||
*/
|
||||
public String getDateFilter()
|
||||
{
|
||||
return this.dateFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dateFilter The dateFilter to set.
|
||||
*/
|
||||
public void setDateFilter(String dateFilter)
|
||||
{
|
||||
this.dateFilter = dateFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the userFilter.
|
||||
*/
|
||||
public String getUserFilter()
|
||||
{
|
||||
return this.userFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userFilter The userFilter to set.
|
||||
*/
|
||||
public void setUserFilter(String userFilter)
|
||||
{
|
||||
this.userFilter = userFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the userSearchText.
|
||||
*/
|
||||
public String getUserSearchText()
|
||||
{
|
||||
return this.userSearchText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userSearchText The userSearchText to set.
|
||||
*/
|
||||
public void setUserSearchText(String userSearchText)
|
||||
{
|
||||
this.userSearchText = userSearchText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the listed items.
|
||||
*/
|
||||
public List<Node> getListedItems()
|
||||
{
|
||||
return this.listedItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param listedItems The listed items to set.
|
||||
*/
|
||||
public void setListedItems(List<Node> listedItems)
|
||||
{
|
||||
this.listedItems = listedItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return count of the items that failed to recover
|
||||
*/
|
||||
public int getFailureItemsCount()
|
||||
{
|
||||
return this.failureItems.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param node The item context for the current action
|
||||
*/
|
||||
public void setItem(Node node)
|
||||
{
|
||||
this.actionNode = node;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the item context for the current action
|
||||
*/
|
||||
public Node getItem()
|
||||
{
|
||||
return this.actionNode;
|
||||
}
|
||||
|
||||
public boolean isShowItems()
|
||||
{
|
||||
return showItems;
|
||||
}
|
||||
|
||||
public void setShowItems(boolean showItems)
|
||||
{
|
||||
this.showItems = showItems;
|
||||
}
|
||||
|
||||
public boolean isFullTextSearch()
|
||||
{
|
||||
return fullTextSearch;
|
||||
}
|
||||
|
||||
public void setFullTextSearch(boolean fullTextSearch)
|
||||
{
|
||||
this.fullTextSearch = fullTextSearch;
|
||||
}
|
||||
|
||||
public List<Node> getSuccessItems()
|
||||
{
|
||||
return successItems;
|
||||
}
|
||||
|
||||
public void setSuccessItems(List<Node> successItems)
|
||||
{
|
||||
this.successItems = successItems;
|
||||
}
|
||||
|
||||
public List<Node> getFailureItems()
|
||||
{
|
||||
return failureItems;
|
||||
}
|
||||
|
||||
public void setFailureItems(List<Node> failureItems)
|
||||
{
|
||||
this.failureItems = failureItems;
|
||||
}
|
||||
|
||||
public Node getActionNode()
|
||||
{
|
||||
return actionNode;
|
||||
}
|
||||
|
||||
public void setActionNode(Node actionNode)
|
||||
{
|
||||
this.actionNode = actionNode;
|
||||
}
|
||||
|
||||
public NodeRef getArchiveRootRef()
|
||||
{
|
||||
return archiveRootRef;
|
||||
}
|
||||
|
||||
public void setArchiveRootRef(NodeRef archiveRootRef)
|
||||
{
|
||||
this.archiveRootRef = archiveRootRef;
|
||||
}
|
||||
|
||||
public boolean isInProgress()
|
||||
{
|
||||
return inProgress;
|
||||
}
|
||||
|
||||
public void setInProgress(boolean inProgress)
|
||||
{
|
||||
this.inProgress = inProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
*@return nodeArchiveService
|
||||
*/
|
||||
public NodeArchiveService getNodeArchiveService()
|
||||
{
|
||||
//check for null for cluster environment
|
||||
if (nodeArchiveService == null)
|
||||
{
|
||||
nodeArchiveService = (NodeArchiveService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "nodeArchiveService");
|
||||
}
|
||||
return nodeArchiveService;
|
||||
}
|
||||
|
||||
}
|
||||
package org.alfresco.web.bean.trashcan;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.repo.node.archive.NodeArchiveService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.ui.common.component.data.UIRichList;
|
||||
|
||||
public class TrashcanDialogProperty implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -8007742798807270570L;
|
||||
|
||||
private static final String FILTER_DATE_ALL = "all";
|
||||
private static final String FILTER_USER_ALL = "all";
|
||||
|
||||
/** NodeArchiveService bean reference */
|
||||
transient private NodeArchiveService nodeArchiveService;
|
||||
|
||||
/** Component reference for Deleted Items RichList control */
|
||||
protected UIRichList itemsRichList;
|
||||
|
||||
/** Search text */
|
||||
private String searchText = null;
|
||||
|
||||
/** We show an empty list until a Search or Show All is executed */
|
||||
private boolean showItems = false;
|
||||
|
||||
private boolean fullTextSearch = false;
|
||||
|
||||
/** Currently listed items */
|
||||
private List<Node> listedItems = Collections.<Node> emptyList();
|
||||
|
||||
private List<Node> successItems = Collections.<Node> emptyList();
|
||||
|
||||
private List<Node> failureItems = Collections.<Node> emptyList();
|
||||
|
||||
/** Current action context Node */
|
||||
private Node actionNode;
|
||||
|
||||
/** Root node to the spaces store archive store */
|
||||
private NodeRef archiveRootRef = null;
|
||||
|
||||
/** Alternative destination for recovered items */
|
||||
private NodeRef destination = null;
|
||||
|
||||
/** Date filter selection */
|
||||
private String dateFilter = FILTER_DATE_ALL;
|
||||
|
||||
/** User filter selection */
|
||||
private String userFilter = FILTER_USER_ALL;
|
||||
|
||||
/** User filter search box text */
|
||||
private String userSearchText = null;
|
||||
|
||||
private boolean inProgress = false;
|
||||
|
||||
/**
|
||||
* @param nodeArchiveService The nodeArchiveService to set.
|
||||
*/
|
||||
public void setNodeArchiveService(NodeArchiveService nodeArchiveService)
|
||||
{
|
||||
this.nodeArchiveService = nodeArchiveService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the itemsRichList.
|
||||
*/
|
||||
public UIRichList getItemsRichList()
|
||||
{
|
||||
return this.itemsRichList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemsRichList The itemsRichList to set.
|
||||
*/
|
||||
public void setItemsRichList(UIRichList itemsRichList)
|
||||
{
|
||||
this.itemsRichList = itemsRichList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the searchText.
|
||||
*/
|
||||
public String getSearchText()
|
||||
{
|
||||
return this.searchText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param searchText The searchText to set.
|
||||
*/
|
||||
public void setSearchText(String searchText)
|
||||
{
|
||||
this.searchText = searchText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the alternative destination to use if recovery fails.
|
||||
*/
|
||||
public NodeRef getDestination()
|
||||
{
|
||||
return this.destination;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param destination The alternative destination to use if recovery fails.
|
||||
*/
|
||||
public void setDestination(NodeRef destination)
|
||||
{
|
||||
this.destination = destination;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the dateFilter.
|
||||
*/
|
||||
public String getDateFilter()
|
||||
{
|
||||
return this.dateFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dateFilter The dateFilter to set.
|
||||
*/
|
||||
public void setDateFilter(String dateFilter)
|
||||
{
|
||||
this.dateFilter = dateFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the userFilter.
|
||||
*/
|
||||
public String getUserFilter()
|
||||
{
|
||||
return this.userFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userFilter The userFilter to set.
|
||||
*/
|
||||
public void setUserFilter(String userFilter)
|
||||
{
|
||||
this.userFilter = userFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the userSearchText.
|
||||
*/
|
||||
public String getUserSearchText()
|
||||
{
|
||||
return this.userSearchText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userSearchText The userSearchText to set.
|
||||
*/
|
||||
public void setUserSearchText(String userSearchText)
|
||||
{
|
||||
this.userSearchText = userSearchText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the listed items.
|
||||
*/
|
||||
public List<Node> getListedItems()
|
||||
{
|
||||
return this.listedItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param listedItems The listed items to set.
|
||||
*/
|
||||
public void setListedItems(List<Node> listedItems)
|
||||
{
|
||||
this.listedItems = listedItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return count of the items that failed to recover
|
||||
*/
|
||||
public int getFailureItemsCount()
|
||||
{
|
||||
return this.failureItems.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param node The item context for the current action
|
||||
*/
|
||||
public void setItem(Node node)
|
||||
{
|
||||
this.actionNode = node;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the item context for the current action
|
||||
*/
|
||||
public Node getItem()
|
||||
{
|
||||
return this.actionNode;
|
||||
}
|
||||
|
||||
public boolean isShowItems()
|
||||
{
|
||||
return showItems;
|
||||
}
|
||||
|
||||
public void setShowItems(boolean showItems)
|
||||
{
|
||||
this.showItems = showItems;
|
||||
}
|
||||
|
||||
public boolean isFullTextSearch()
|
||||
{
|
||||
return fullTextSearch;
|
||||
}
|
||||
|
||||
public void setFullTextSearch(boolean fullTextSearch)
|
||||
{
|
||||
this.fullTextSearch = fullTextSearch;
|
||||
}
|
||||
|
||||
public List<Node> getSuccessItems()
|
||||
{
|
||||
return successItems;
|
||||
}
|
||||
|
||||
public void setSuccessItems(List<Node> successItems)
|
||||
{
|
||||
this.successItems = successItems;
|
||||
}
|
||||
|
||||
public List<Node> getFailureItems()
|
||||
{
|
||||
return failureItems;
|
||||
}
|
||||
|
||||
public void setFailureItems(List<Node> failureItems)
|
||||
{
|
||||
this.failureItems = failureItems;
|
||||
}
|
||||
|
||||
public Node getActionNode()
|
||||
{
|
||||
return actionNode;
|
||||
}
|
||||
|
||||
public void setActionNode(Node actionNode)
|
||||
{
|
||||
this.actionNode = actionNode;
|
||||
}
|
||||
|
||||
public NodeRef getArchiveRootRef()
|
||||
{
|
||||
return archiveRootRef;
|
||||
}
|
||||
|
||||
public void setArchiveRootRef(NodeRef archiveRootRef)
|
||||
{
|
||||
this.archiveRootRef = archiveRootRef;
|
||||
}
|
||||
|
||||
public boolean isInProgress()
|
||||
{
|
||||
return inProgress;
|
||||
}
|
||||
|
||||
public void setInProgress(boolean inProgress)
|
||||
{
|
||||
this.inProgress = inProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
*@return nodeArchiveService
|
||||
*/
|
||||
public NodeArchiveService getNodeArchiveService()
|
||||
{
|
||||
//check for null for cluster environment
|
||||
if (nodeArchiveService == null)
|
||||
{
|
||||
nodeArchiveService = (NodeArchiveService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "nodeArchiveService");
|
||||
}
|
||||
return nodeArchiveService;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,69 +1,69 @@
|
||||
package org.alfresco.web.bean.trashcan;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
|
||||
public class TrashcanItemDetailsDialog extends TrashcanDialog
|
||||
{
|
||||
private static final long serialVersionUID = 1767515883530860417L;
|
||||
|
||||
private static final String MSG_DETAILS_OF = "details_of";
|
||||
private static final String MSG_CLOSE = "close";
|
||||
private final static String MSG_LEFT_QUOTE = "left_qoute";
|
||||
private final static String MSG_RIGHT_QUOTE = "right_quote";
|
||||
|
||||
transient private PermissionService permissionService;
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContainerTitle()
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
return Application.getMessage(fc, MSG_DETAILS_OF) + " " + Application.getMessage(fc, MSG_LEFT_QUOTE) +
|
||||
property.getItem().getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCancelButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getActionsContext()
|
||||
{
|
||||
return getItem();
|
||||
}
|
||||
|
||||
public Node getItem()
|
||||
{
|
||||
return property.getItem();
|
||||
}
|
||||
|
||||
public void setPermissionService(PermissionService permissionService)
|
||||
{
|
||||
this.permissionService = permissionService;
|
||||
}
|
||||
|
||||
/**
|
||||
*@return permissionService
|
||||
*/
|
||||
protected PermissionService getPermissionService()
|
||||
{
|
||||
//check for null for cluster environment
|
||||
if (permissionService == null)
|
||||
{
|
||||
permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService();
|
||||
}
|
||||
return permissionService;
|
||||
}
|
||||
}
|
||||
package org.alfresco.web.bean.trashcan;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
|
||||
public class TrashcanItemDetailsDialog extends TrashcanDialog
|
||||
{
|
||||
private static final long serialVersionUID = 1767515883530860417L;
|
||||
|
||||
private static final String MSG_DETAILS_OF = "details_of";
|
||||
private static final String MSG_CLOSE = "close";
|
||||
private final static String MSG_LEFT_QUOTE = "left_qoute";
|
||||
private final static String MSG_RIGHT_QUOTE = "right_quote";
|
||||
|
||||
transient private PermissionService permissionService;
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContainerTitle()
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
return Application.getMessage(fc, MSG_DETAILS_OF) + " " + Application.getMessage(fc, MSG_LEFT_QUOTE) +
|
||||
property.getItem().getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCancelButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getActionsContext()
|
||||
{
|
||||
return getItem();
|
||||
}
|
||||
|
||||
public Node getItem()
|
||||
{
|
||||
return property.getItem();
|
||||
}
|
||||
|
||||
public void setPermissionService(PermissionService permissionService)
|
||||
{
|
||||
this.permissionService = permissionService;
|
||||
}
|
||||
|
||||
/**
|
||||
*@return permissionService
|
||||
*/
|
||||
protected PermissionService getPermissionService()
|
||||
{
|
||||
//check for null for cluster environment
|
||||
if (permissionService == null)
|
||||
{
|
||||
permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService();
|
||||
}
|
||||
return permissionService;
|
||||
}
|
||||
}
|
||||
|
@@ -1,150 +1,150 @@
|
||||
package org.alfresco.web.bean.trashcan;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.repo.node.archive.RestoreNodeReport;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.ui.common.ReportedException;
|
||||
|
||||
public class TrashcanRecoverItemDialog extends TrashcanDialog
|
||||
{
|
||||
private static final long serialVersionUID = -8237457079397611071L;
|
||||
|
||||
private static final String RICHLIST_ID = "trashcan-list";
|
||||
private static final String RICHLIST_MSG_ID = "trashcan" + ':' + RICHLIST_ID;
|
||||
private static final String MSG_RECOVERED_ITEM_SUCCESS = "recovered_item_success";
|
||||
private static final String MSG_RECOVERED_ITEM_DUPLICATE = "recovered_item_duplicate";
|
||||
private static final String MSG_RECOVERED_ITEM_INTEGRITY = "recovered_item_integrity";
|
||||
private static final String MSG_RECOVERED_ITEM_PERMISSION = "recovered_item_permission";
|
||||
private static final String MSG_RECOVERED_ITEM_PARENT = "recovered_item_parent";
|
||||
private static final String MSG_RECOVERED_ITEM_FAILURE = "recovered_item_failure";
|
||||
private final static String MSG_LEFT_QUOTE = "left_qoute";
|
||||
private final static String MSG_RIGHT_QUOTE = "right_quote";
|
||||
|
||||
private static final String MSG_RECOVER_ITEM = "recover_item";
|
||||
private static final String MSG_NO = "no";
|
||||
private static final String MSG_YES = "yes";
|
||||
|
||||
private String recoverItem(FacesContext context, String outcome)
|
||||
{
|
||||
Node item = property.getItem();
|
||||
if (item != null)
|
||||
{
|
||||
FacesContext fc = context;
|
||||
try
|
||||
{
|
||||
String msg;
|
||||
FacesMessage errorfacesMsg = null;
|
||||
|
||||
// restore the node - the user may have requested a restore to a
|
||||
// different parent
|
||||
RestoreNodeReport report;
|
||||
if (property.getDestination() == null)
|
||||
{
|
||||
report = property.getNodeArchiveService().restoreArchivedNode(item.getNodeRef());
|
||||
}
|
||||
else
|
||||
{
|
||||
report = property.getNodeArchiveService().restoreArchivedNode(item.getNodeRef(), property.getDestination(), null, null);
|
||||
}
|
||||
switch (report.getStatus())
|
||||
{
|
||||
case SUCCESS:
|
||||
msg = MessageFormat.format(Application.getMessage(fc, MSG_RECOVERED_ITEM_SUCCESS), item.getName());
|
||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
|
||||
fc.addMessage(RICHLIST_MSG_ID, facesMsg);
|
||||
|
||||
break;
|
||||
|
||||
case FAILURE_INVALID_PARENT:
|
||||
msg = MessageFormat.format(Application.getMessage(fc, MSG_RECOVERED_ITEM_PARENT), item.getName());
|
||||
errorfacesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
|
||||
break;
|
||||
|
||||
case FAILURE_PERMISSION:
|
||||
msg = MessageFormat.format(Application.getMessage(fc, MSG_RECOVERED_ITEM_PERMISSION), item.getName());
|
||||
errorfacesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
|
||||
break;
|
||||
|
||||
case FAILURE_INTEGRITY:
|
||||
msg = MessageFormat.format(Application.getMessage(fc, MSG_RECOVERED_ITEM_INTEGRITY), item.getName());
|
||||
errorfacesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
|
||||
break;
|
||||
|
||||
case FAILURE_DUPLICATE_CHILD_NODE_NAME:
|
||||
msg = MessageFormat.format(Application.getMessage(fc, MSG_RECOVERED_ITEM_DUPLICATE), item.getName());
|
||||
errorfacesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
|
||||
break;
|
||||
|
||||
default:
|
||||
String reason = report.getCause().getMessage();
|
||||
msg = MessageFormat.format(Application.getMessage(fc, MSG_RECOVERED_ITEM_FAILURE), item.getName(), reason);
|
||||
errorfacesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
|
||||
break;
|
||||
}
|
||||
|
||||
// report the failure if one occured we stay on the current
|
||||
// screen
|
||||
if (errorfacesMsg != null)
|
||||
{
|
||||
fc.addMessage(null, errorfacesMsg);
|
||||
}
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
// most exceptions will be caught and returned as
|
||||
// RestoreNodeReport objects by the service
|
||||
String reason = err.getMessage();
|
||||
String msg = MessageFormat.format(Application.getMessage(fc, MSG_RECOVERED_ITEM_FAILURE), item.getName(), reason);
|
||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
|
||||
fc.addMessage(null, facesMsg);
|
||||
ReportedException.throwIfNecessary(err);
|
||||
}
|
||||
}
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultFinishOutcome()
|
||||
{
|
||||
return "dialog:close[2]";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
return recoverItem(context, outcome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContainerTitle()
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
return Application.getMessage(fc, MSG_RECOVER_ITEM) + " " + Application.getMessage(fc, MSG_LEFT_QUOTE)
|
||||
+ property.getItem().getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCancelButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_NO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFinishButtonDisabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_YES);
|
||||
}
|
||||
|
||||
}
|
||||
package org.alfresco.web.bean.trashcan;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.repo.node.archive.RestoreNodeReport;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.ui.common.ReportedException;
|
||||
|
||||
public class TrashcanRecoverItemDialog extends TrashcanDialog
|
||||
{
|
||||
private static final long serialVersionUID = -8237457079397611071L;
|
||||
|
||||
private static final String RICHLIST_ID = "trashcan-list";
|
||||
private static final String RICHLIST_MSG_ID = "trashcan" + ':' + RICHLIST_ID;
|
||||
private static final String MSG_RECOVERED_ITEM_SUCCESS = "recovered_item_success";
|
||||
private static final String MSG_RECOVERED_ITEM_DUPLICATE = "recovered_item_duplicate";
|
||||
private static final String MSG_RECOVERED_ITEM_INTEGRITY = "recovered_item_integrity";
|
||||
private static final String MSG_RECOVERED_ITEM_PERMISSION = "recovered_item_permission";
|
||||
private static final String MSG_RECOVERED_ITEM_PARENT = "recovered_item_parent";
|
||||
private static final String MSG_RECOVERED_ITEM_FAILURE = "recovered_item_failure";
|
||||
private final static String MSG_LEFT_QUOTE = "left_qoute";
|
||||
private final static String MSG_RIGHT_QUOTE = "right_quote";
|
||||
|
||||
private static final String MSG_RECOVER_ITEM = "recover_item";
|
||||
private static final String MSG_NO = "no";
|
||||
private static final String MSG_YES = "yes";
|
||||
|
||||
private String recoverItem(FacesContext context, String outcome)
|
||||
{
|
||||
Node item = property.getItem();
|
||||
if (item != null)
|
||||
{
|
||||
FacesContext fc = context;
|
||||
try
|
||||
{
|
||||
String msg;
|
||||
FacesMessage errorfacesMsg = null;
|
||||
|
||||
// restore the node - the user may have requested a restore to a
|
||||
// different parent
|
||||
RestoreNodeReport report;
|
||||
if (property.getDestination() == null)
|
||||
{
|
||||
report = property.getNodeArchiveService().restoreArchivedNode(item.getNodeRef());
|
||||
}
|
||||
else
|
||||
{
|
||||
report = property.getNodeArchiveService().restoreArchivedNode(item.getNodeRef(), property.getDestination(), null, null);
|
||||
}
|
||||
switch (report.getStatus())
|
||||
{
|
||||
case SUCCESS:
|
||||
msg = MessageFormat.format(Application.getMessage(fc, MSG_RECOVERED_ITEM_SUCCESS), item.getName());
|
||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
|
||||
fc.addMessage(RICHLIST_MSG_ID, facesMsg);
|
||||
|
||||
break;
|
||||
|
||||
case FAILURE_INVALID_PARENT:
|
||||
msg = MessageFormat.format(Application.getMessage(fc, MSG_RECOVERED_ITEM_PARENT), item.getName());
|
||||
errorfacesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
|
||||
break;
|
||||
|
||||
case FAILURE_PERMISSION:
|
||||
msg = MessageFormat.format(Application.getMessage(fc, MSG_RECOVERED_ITEM_PERMISSION), item.getName());
|
||||
errorfacesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
|
||||
break;
|
||||
|
||||
case FAILURE_INTEGRITY:
|
||||
msg = MessageFormat.format(Application.getMessage(fc, MSG_RECOVERED_ITEM_INTEGRITY), item.getName());
|
||||
errorfacesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
|
||||
break;
|
||||
|
||||
case FAILURE_DUPLICATE_CHILD_NODE_NAME:
|
||||
msg = MessageFormat.format(Application.getMessage(fc, MSG_RECOVERED_ITEM_DUPLICATE), item.getName());
|
||||
errorfacesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
|
||||
break;
|
||||
|
||||
default:
|
||||
String reason = report.getCause().getMessage();
|
||||
msg = MessageFormat.format(Application.getMessage(fc, MSG_RECOVERED_ITEM_FAILURE), item.getName(), reason);
|
||||
errorfacesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
|
||||
break;
|
||||
}
|
||||
|
||||
// report the failure if one occured we stay on the current
|
||||
// screen
|
||||
if (errorfacesMsg != null)
|
||||
{
|
||||
fc.addMessage(null, errorfacesMsg);
|
||||
}
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
// most exceptions will be caught and returned as
|
||||
// RestoreNodeReport objects by the service
|
||||
String reason = err.getMessage();
|
||||
String msg = MessageFormat.format(Application.getMessage(fc, MSG_RECOVERED_ITEM_FAILURE), item.getName(), reason);
|
||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
|
||||
fc.addMessage(null, facesMsg);
|
||||
ReportedException.throwIfNecessary(err);
|
||||
}
|
||||
}
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultFinishOutcome()
|
||||
{
|
||||
return "dialog:close[2]";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
return recoverItem(context, outcome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContainerTitle()
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
return Application.getMessage(fc, MSG_RECOVER_ITEM) + " " + Application.getMessage(fc, MSG_LEFT_QUOTE)
|
||||
+ property.getItem().getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCancelButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_NO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFinishButtonDisabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_YES);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,85 +1,85 @@
|
||||
package org.alfresco.web.bean.trashcan;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.repo.node.archive.RestoreNodeReport;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
public class TrashcanRecoverListedItemsDialog extends TrashcanDialog
|
||||
{
|
||||
private static final long serialVersionUID = 5500454626559426051L;
|
||||
|
||||
private static final String OUTCOME_RECOVERY_REPORT = "dialog:recoveryReport";
|
||||
private static final String MSG_NO = "no";
|
||||
private static final String MSG_YES = "yes";
|
||||
|
||||
private String recoverListedItems(FacesContext context, String outcome)
|
||||
{
|
||||
if (property.isInProgress())
|
||||
return null;
|
||||
|
||||
property.setInProgress(true);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
// restore the nodes - the user may have requested a restore to a
|
||||
// different parent
|
||||
List<NodeRef> nodeRefs = new ArrayList<NodeRef>(property.getListedItems().size());
|
||||
for (Node node : property.getListedItems())
|
||||
{
|
||||
nodeRefs.add(node.getNodeRef());
|
||||
}
|
||||
List<RestoreNodeReport> reports;
|
||||
if (property.getDestination() == null)
|
||||
{
|
||||
reports = property.getNodeArchiveService().restoreArchivedNodes(nodeRefs);
|
||||
}
|
||||
else
|
||||
{
|
||||
reports = property.getNodeArchiveService().restoreArchivedNodes(nodeRefs, property.getDestination(), null, null);
|
||||
}
|
||||
|
||||
saveReportDetail(reports);
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
property.setInProgress(false);
|
||||
}
|
||||
|
||||
return OUTCOME_RECOVERY_REPORT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
|
||||
return recoverListedItems(context, outcome);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCancelButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_NO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFinishButtonDisabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_YES);
|
||||
}
|
||||
|
||||
}
|
||||
package org.alfresco.web.bean.trashcan;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.repo.node.archive.RestoreNodeReport;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
public class TrashcanRecoverListedItemsDialog extends TrashcanDialog
|
||||
{
|
||||
private static final long serialVersionUID = 5500454626559426051L;
|
||||
|
||||
private static final String OUTCOME_RECOVERY_REPORT = "dialog:recoveryReport";
|
||||
private static final String MSG_NO = "no";
|
||||
private static final String MSG_YES = "yes";
|
||||
|
||||
private String recoverListedItems(FacesContext context, String outcome)
|
||||
{
|
||||
if (property.isInProgress())
|
||||
return null;
|
||||
|
||||
property.setInProgress(true);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
// restore the nodes - the user may have requested a restore to a
|
||||
// different parent
|
||||
List<NodeRef> nodeRefs = new ArrayList<NodeRef>(property.getListedItems().size());
|
||||
for (Node node : property.getListedItems())
|
||||
{
|
||||
nodeRefs.add(node.getNodeRef());
|
||||
}
|
||||
List<RestoreNodeReport> reports;
|
||||
if (property.getDestination() == null)
|
||||
{
|
||||
reports = property.getNodeArchiveService().restoreArchivedNodes(nodeRefs);
|
||||
}
|
||||
else
|
||||
{
|
||||
reports = property.getNodeArchiveService().restoreArchivedNodes(nodeRefs, property.getDestination(), null, null);
|
||||
}
|
||||
|
||||
saveReportDetail(reports);
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
property.setInProgress(false);
|
||||
}
|
||||
|
||||
return OUTCOME_RECOVERY_REPORT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
|
||||
return recoverListedItems(context, outcome);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCancelButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_NO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFinishButtonDisabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_YES);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,32 +1,32 @@
|
||||
package org.alfresco.web.bean.trashcan;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.web.app.Application;
|
||||
|
||||
public class TrashcanRecoveryReportDialog extends TrashcanDialog
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = -3381444990908748991L;
|
||||
|
||||
private final static String MSG_CLOSE = "close";
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCancelButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultCancelOutcome()
|
||||
{
|
||||
return "dialog:close[2]";
|
||||
}
|
||||
|
||||
}
|
||||
package org.alfresco.web.bean.trashcan;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.web.app.Application;
|
||||
|
||||
public class TrashcanRecoveryReportDialog extends TrashcanDialog
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = -3381444990908748991L;
|
||||
|
||||
private final static String MSG_CLOSE = "close";
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCancelButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultCancelOutcome()
|
||||
{
|
||||
return "dialog:close[2]";
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user