mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
. Fix to allow Take Ownership of a Space through the web-client (current you could only Take Ownership of a document!)
- this is required to solve AWC-442 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2258 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -22,9 +22,11 @@ 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.faces.model.SelectItem;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.ForumModel;
|
||||
@@ -33,6 +35,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
||||
import org.alfresco.service.cmr.repository.TemplateNode;
|
||||
import org.alfresco.service.cmr.security.OwnableService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||
@@ -52,6 +55,8 @@ import org.alfresco.web.ui.common.component.UIActionLink;
|
||||
*/
|
||||
public class SpaceDetailsBean
|
||||
{
|
||||
private static final String MSG_SUCCESS_OWNERSHIP = "success_ownership";
|
||||
|
||||
private static final String OUTCOME_RETURN = "showSpaceDetails";
|
||||
|
||||
/** BrowseBean instance */
|
||||
@@ -63,6 +68,9 @@ public class SpaceDetailsBean
|
||||
/** PermissionService bean reference */
|
||||
private PermissionService permissionService;
|
||||
|
||||
/** OwnableService bean reference */
|
||||
private OwnableService ownableService;
|
||||
|
||||
/** NodeServuce bean reference */
|
||||
private NodeService nodeService;
|
||||
|
||||
@@ -107,6 +115,16 @@ public class SpaceDetailsBean
|
||||
this.permissionService = permissionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the ownable service instance the bean should use
|
||||
*
|
||||
* @param ownableService The OwnableService
|
||||
*/
|
||||
public void setOwnableService(OwnableService ownableService)
|
||||
{
|
||||
this.ownableService = ownableService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Space this bean is currently representing
|
||||
*
|
||||
@@ -337,6 +355,37 @@ public class SpaceDetailsBean
|
||||
return OUTCOME_RETURN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Action Handler to take Ownership of the current Space
|
||||
*/
|
||||
public void takeOwnership(ActionEvent event)
|
||||
{
|
||||
UserTransaction tx = null;
|
||||
|
||||
try
|
||||
{
|
||||
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance());
|
||||
tx.begin();
|
||||
|
||||
this.ownableService.takeOwnership(getSpace().getNodeRef());
|
||||
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
String msg = Application.getMessage(context, MSG_SUCCESS_OWNERSHIP);
|
||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
|
||||
context.addMessage(event.getComponent().getClientId(context), facesMsg);
|
||||
|
||||
// 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(
|
||||
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), e.getMessage()), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigates to next item in the list of Spaces
|
||||
*/
|
||||
|
Reference in New Issue
Block a user