mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. Added unlock action to doc details list of actions.
- fixes AWC-566 and AWC-195 and AWC-221 . Fix for unreported issue where an error would occur when showing the details of a locked doc where it's associated working-copy had been deleted. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2912 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2005 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*/
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import org.alfresco.web.action.ActionEvaluator;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
/**
|
||||
* UI Action Evaluator - Unlock a locked document.
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public final class UnlockDocEvaluator implements ActionEvaluator
|
||||
{
|
||||
/**
|
||||
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||
*/
|
||||
public boolean evaluate(Node node)
|
||||
{
|
||||
return (node.isLocked() == true);
|
||||
}
|
||||
}
|
@@ -334,6 +334,8 @@ public abstract class BaseDetailsBean
|
||||
String formId = Utils.getParentForm(fc, event.getComponent()).getClientId(fc);
|
||||
fc.addMessage(formId + ':' + getPropertiesPanelId(), facesMsg);
|
||||
|
||||
getNode().reset();
|
||||
|
||||
// commit the transaction
|
||||
tx.commit();
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.event.ActionEvent;
|
||||
import javax.transaction.UserTransaction;
|
||||
@@ -64,6 +65,7 @@ public class DocumentDetailsBean extends BaseDetailsBean
|
||||
|
||||
private static final String MSG_HAS_FOLLOWING_CATEGORIES = "has_following_categories";
|
||||
private static final String MSG_NO_CATEGORIES_APPLIED = "no_categories_applied";
|
||||
private static final String MSG_SUCCESS_UNLOCK = "success_unlock";
|
||||
private static final String MSG_ERROR_ASPECT_INLINEEDITABLE = "error_aspect_inlineeditable";
|
||||
private static final String MSG_ERROR_ASPECT_VERSIONING = "error_aspect_versioning";
|
||||
private static final String MSG_ERROR_ASPECT_CLASSIFY = "error_aspect_classify";
|
||||
@@ -820,6 +822,41 @@ public class DocumentDetailsBean extends BaseDetailsBean
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Action Handler to unlock a locked document
|
||||
*/
|
||||
public void unlock(ActionEvent event)
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
|
||||
UserTransaction tx = null;
|
||||
|
||||
try
|
||||
{
|
||||
tx = Repository.getUserTransaction(fc);
|
||||
tx.begin();
|
||||
|
||||
this.lockService.unlock(getNode().getNodeRef());
|
||||
|
||||
String msg = Application.getMessage(fc, MSG_SUCCESS_UNLOCK);
|
||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
|
||||
String formId = Utils.getParentForm(fc, event.getComponent()).getClientId(fc);
|
||||
fc.addMessage(formId + ':' + getPropertiesPanelId(), facesMsg);
|
||||
|
||||
getNode().reset();
|
||||
|
||||
// commit the transaction
|
||||
tx.commit();
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
// rollback the transaction
|
||||
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
|
||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
||||
fc, Repository.ERROR_GENERIC), e.getMessage()), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the inlineeditable aspect to the current document
|
||||
*/
|
||||
|
Reference in New Issue
Block a user