diff --git a/config/alfresco/web-client-application-context.xml b/config/alfresco/web-client-application-context.xml index e1f60687e7..5bfe6e9791 100644 --- a/config/alfresco/web-client-application-context.xml +++ b/config/alfresco/web-client-application-context.xml @@ -15,11 +15,9 @@ classpath:alfresco/web-client-config-wizards.xml classpath:alfresco/web-client-config-properties.xml classpath:alfresco/web-client-config-navigation.xml - classpath:alfresco/web-client-config-wcm.xml classpath:alfresco/web-client-config-actions.xml classpath:alfresco/web-client-config-forum-actions.xml - classpath:alfresco/web-client-config-wcm-actions.xml classpath:alfresco/web-client-config-workflow-actions.xml classpath:alfresco/extension/web-client-config-custom.xml jar:*!/META-INF/web-client-config-custom.xml @@ -114,10 +112,6 @@ - - alfresco:/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.wcm_content_forms.childname}/${form.name}/cm:strings - alfresco:/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.wcm_content_forms.childname}/cm:strings - alfresco:/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.content_forms.childname}/${form.name}/cm:strings alfresco:/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.content_forms.childname}/cm:strings diff --git a/config/alfresco/web-client-config-wcm-actions.xml b/config/alfresco/web-client-config-wcm-actions.xml deleted file mode 100644 index 114e00a8c0..0000000000 --- a/config/alfresco/web-client-config-wcm-actions.xml +++ /dev/null @@ -1,519 +0,0 @@ - - - - - - - - - Write - - org.alfresco.web.action.evaluator.WCMWorkflowEvaluator - edit - /images/icons/edit_icon.gif - #{AVMBrowseBean.setupEditAction} - - #{actionContext.id} - - - - - - - Delete - - org.alfresco.web.action.evaluator.WCMWorkflowEvaluator - delete - /images/icons/delete.gif - #{AVMBrowseBean.setupContentAction} - dialog:deleteAvmFile - - #{actionContext.id} - - - - - - - Delete - - org.alfresco.web.action.evaluator.WCMWorkflowEvaluator - delete - /images/icons/delete.gif - #{AVMBrowseBean.setupContentAction} - dialog:deleteAvmFileBrowse - - #{actionContext.id} - - - - - - - Delete - - org.alfresco.web.action.evaluator.WCMWorkflowEvaluator - delete - /images/icons/delete.gif - #{AVMBrowseBean.setupContentAction} - dialog:deleteAvmFolder - - #{actionContext.id} - - - - - - - Delete - - org.alfresco.web.action.evaluator.WCMWorkflowLayeredFolderEvaluator - delete - /images/icons/delete.gif - #{AVMBrowseBean.setupContentAction} - dialog:deleteAvmFolderBrowse - - #{actionContext.id} - - - - - - - Delete - - org.alfresco.web.action.evaluator.WCMUnlockEvaluator - unlock - /images/icons/unlock.gif - #{AVMBrowseBean.setupContentAction} - dialog:unlockAvmFile - - #{actionContext.id} - - - - - - - Write - - org.alfresco.web.action.evaluator.WCMConflictEvaluator - submit - /images/icons/submit.gif - #{AVMBrowseBean.setupContentAction} - dialog:submitSandboxItems - - #{actionContext.id} - - - - - - - Write - - org.alfresco.web.action.evaluator.WCMWorkflowDeletedEvaluator - revert - /images/icons/revert.gif - #{AVMBrowseBean.revertNode} - - #{actionContext.id} - - - - - - folder_preview - /images/icons/preview_website.gif - #{actionContext.previewUrl} - new - - - - - file_preview - /images/icons/preview_website.gif - #{actionContext.previewUrl} - new - - - - - - CreateChildren - - org.alfresco.web.action.evaluator.WCMStagingReadonlyEvaluator - sandbox_create - /images/icons/new_content.gif - wizard:createWebContent - - - - - - CreateChildren - - org.alfresco.web.action.evaluator.WCMStagingReadonlyEvaluator - create_folder - /images/icons/create_space.gif - dialog:createAvmFolder - - - - - - CreateChildren - - org.alfresco.web.action.evaluator.WCMContentManagerEvaluator - create_webapp - /images/icons/create_webapp.gif - dialog:createWebappFolder - - - - - - CreateChildren - - org.alfresco.web.action.evaluator.WCMStagingReadonlyEvaluator - add_content - /images/icons/add.gif - dialog:addAvmContent - #{AddAvmContentDialog.start} - - - - - - CreateChildren - - org.alfresco.web.action.evaluator.WCMStagingReadonlyEvaluator - import_website_content - /images/icons/import_website.gif - dialog:importContent - #{ImportWebsiteDialog.start} - - - - - - Write - - org.alfresco.web.action.evaluator.WCMWorkflowEvaluator - update - /images/icons/update.gif - #{AVMBrowseBean.setupContentAction} - dialog:updateAvmFile - - #{actionContext.id} - - - - - - - Read - - view_details - /images/icons/View_details.gif - #{AVMBrowseBean.setupContentAction} - dialog:showFileDetails - - #{actionContext.id} - - - - - - - Read - - view_details - /images/icons/View_details.gif - #{AVMBrowseBean.setupContentAction} - dialog:showFolderDetails - - #{actionContext.id} - - - - - - - ChangePermissions - - invite_website_users - /images/icons/invite.gif - wizard:inviteWebUsers - - #{BrowseBean.setupSpaceAction} - - #{actionContext.id} - - - - - - - Write,CreateChildren - - edit_website - /images/icons/edit_website.gif - wizard:editWebsite - #{BrowseBean.setupSpaceAction} - - #{actionContext.id} - - - - - - - Delete - - org.alfresco.web.action.evaluator.WCMWorkflowLayeredFolderEvaluator - cut - /images/icons/cut.gif - #{ClipboardBean.cutNode} - - #{actionContext.nodeRef} - - - - - - - - Read - - org.alfresco.web.action.evaluator.WCMLayeredFolderEvaluator - copy - /images/icons/copy.gif - #{ClipboardBean.copyNode} - - #{actionContext.nodeRef} - - - - - - - - Delete,Write,CreateChildren - - delete_all_deploy_reports - /images/icons/delete_deploy_reports.gif - dialog:deleteDeploymentReports - #{BrowseBean.setupSpaceAction} - - #{actionContext.id} - - - - - - - CreateChildren - - org.alfresco.web.action.evaluator.WCMStagingOnlyEvaluator - create_layered_folder - /images/icons/create_space.gif - dialog:createLayeredFolder - - - - - - Delete - - org.alfresco.web.action.evaluator.WCMDeleteLayeredFolderEvaluator - delete_layered_folder - /images/icons/delete.gif - #{AVMBrowseBean.setupContentAction} - dialog:deleteAvmFolderBrowse - - #{actionContext.id} - - - - - - false - - - - - - - - - - - - - false - - - - - - - - - - - false - - - - - - - - - - - - - false - - - - - - - - - - - false - - - - - - - false - - - - - - - - - - false - - - - - false - - - - - - - - - - false - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - - - - - - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/alfresco/web-client-config-wcm.xml b/config/alfresco/web-client-config-wcm.xml deleted file mode 100644 index 41078f2394..0000000000 --- a/config/alfresco/web-client-config-wcm.xml +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - - wcmwf:submit - - - - wcmwf:changerequest, wcmwf:submitdirect - - - - 25 - - - - - 2 - - - - - 2 - - - - - - - - - bold,italic,underline,separator,forecolor,backcolor,separator,link,unlink,image,code - - - bold,italic,underline,strikethrough,separator,fontselect,fontsizeselect,code - link,unlink,image,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,separator,undo,redo,separator,forecolor,backcolor - 400 - - - - bold,italic,underline,strikethrough,separator,fontselect,fontsizeselect,separator,code - link,unlink,image,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,separator,undo,redo,separator,forecolor,backcolor - 600 - exact - true - p - true - table,paste - tablecontrols - - - - wcm:avmcontent,wcm:avmfolder - table - - - wcm:avmcontent,wcm:avmfolder - - - - - - - wcm:avmcontent - image/* - - - - wcm:avmcontent,wcm:avmfolder - text/html - - - wcm:avmfolder - * - - - wcm:avmcontent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/alfresco/web-client-config-workflow-actions.xml b/config/alfresco/web-client-config-workflow-actions.xml index 065a6a30e9..f9b12876d7 100644 --- a/config/alfresco/web-client-config-workflow-actions.xml +++ b/config/alfresco/web-client-config-workflow-actions.xml @@ -96,20 +96,6 @@ - - - Write - - org.alfresco.web.action.evaluator.WCMWorkflowEvaluator - edit_properties - /images/icons/edit_properties.gif - dialog:editAvmFileProperties - #{AVMBrowseBean.setupContentAction} - - #{actionContext.id} - - - org.alfresco.web.action.evaluator.CheckinDocEvaluator @@ -162,54 +148,6 @@ - - - org.alfresco.web.action.evaluator.WCMWorkflowEvaluator - folder_preview - /images/icons/preview_website.gif - #{actionContext.previewUrl} - new - - - - - org.alfresco.web.action.evaluator.WCMWorkflowEvaluator - file_preview - /images/icons/preview_website.gif - #{actionContext.previewUrl} - new - - - - - - Read - - org.alfresco.web.action.evaluator.WCMWorkflowEvaluator - view_details - /images/icons/View_details.gif - #{AVMBrowseBean.setupContentAction} - dialog:workflowShowFileDetails - - #{actionContext.id} - - - - - - - Read - - org.alfresco.web.action.evaluator.WCMWorkflowEvaluator - view_details - /images/icons/View_details.gif - #{AVMBrowseBean.setupContentAction} - dialog:showFolderDetails - - #{actionContext.id} - - - @@ -237,54 +175,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -337,40 +227,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - activiti$cloudWorkflow diff --git a/source/java/org/alfresco/web/action/evaluator/WCMConflictEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMConflictEvaluator.java deleted file mode 100644 index a7968b378b..0000000000 --- a/source/java/org/alfresco/web/action/evaluator/WCMConflictEvaluator.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.action.evaluator; - -import org.alfresco.service.cmr.avmsync.AVMDifference; -import org.alfresco.web.bean.repository.Node; - -public class WCMConflictEvaluator extends WCMWorkflowDeletedEvaluator -{ - - /* (non-Javadoc) - * @see org.alfresco.web.action.evaluator.WCMWorkflowDeletedEvaluator#evaluate(org.alfresco.web.bean.repository.Node) - */ - public boolean evaluate(final Node node) - { - if (!super.evaluate(node)) - { - return false; - } - Integer diff = (Integer)node.getProperties().get("avmDiff"); - if (diff == null) - { - return true; - } - if (diff == AVMDifference.CONFLICT) - { - return false; - } - return true; - } -} diff --git a/source/java/org/alfresco/web/action/evaluator/WCMContentManagerEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMContentManagerEvaluator.java deleted file mode 100644 index c09c4c55d8..0000000000 --- a/source/java/org/alfresco/web/action/evaluator/WCMContentManagerEvaluator.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.action.evaluator; - -import javax.faces.context.FacesContext; - -import org.alfresco.wcm.webproject.WebProjectService; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; - -/** - * Evaluator to return true if the current user is a content manager for the current website. - * - * @author Gavin Cornwell - */ -public class WCMContentManagerEvaluator extends BaseActionEvaluator -{ - private static final long serialVersionUID = 2588681368739253602L; - - /** - * @return true if the item is not locked by another user - */ - public boolean evaluate(final Node node) - { - FacesContext facesContext = FacesContext.getCurrentInstance(); - WebProjectService webProjectService = Repository.getServiceRegistry(facesContext).getWebProjectService(); - return webProjectService.isContentManager(node.getNodeRef()); - } -} diff --git a/source/java/org/alfresco/web/action/evaluator/WCMDeleteLayeredFolderEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMDeleteLayeredFolderEvaluator.java deleted file mode 100644 index aa8eb6f9d2..0000000000 --- a/source/java/org/alfresco/web/action/evaluator/WCMDeleteLayeredFolderEvaluator.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.action.evaluator; - -import javax.faces.context.FacesContext; - -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.avm.AVMNodeType; -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.util.Pair; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.wcm.AVMUtil; - -/** - * Evaluator to return if an item path is within a staging area sandbox and is a - * layered directory with a primary indirection. - * - * @author Gavin Cornwell - */ -public class WCMDeleteLayeredFolderEvaluator extends BaseActionEvaluator -{ - private static final long serialVersionUID = -130286568044703852L; - - /** - * @return true if the item is not locked by another user - */ - public boolean evaluate(final Node node) - { - FacesContext facesContext = FacesContext.getCurrentInstance(); - AVMService avmService = Repository.getServiceRegistry(facesContext).getAVMService(); - - Pair p = AVMNodeConverter.ToAVMVersionPath(node.getNodeRef()); - AVMNodeDescriptor nodeDesc = avmService.lookup(-1, p.getSecond()); - - // allow delete if we are in the main store and the node is a layeredfolder - // with a primary indirection - return (AVMUtil.isMainStore(AVMUtil.getStoreName(p.getSecond())) && - ((nodeDesc.getType() == AVMNodeType.LAYERED_DIRECTORY && nodeDesc.isPrimary()))); - } -} diff --git a/source/java/org/alfresco/web/action/evaluator/WCMLayeredFolderEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMLayeredFolderEvaluator.java deleted file mode 100644 index b278400378..0000000000 --- a/source/java/org/alfresco/web/action/evaluator/WCMLayeredFolderEvaluator.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.action.evaluator; - -import javax.faces.context.FacesContext; - -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.avm.AVMNodeType; -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.util.Pair; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; - -/** - * UI Action Evaluator - return true if the node is not a layered folder or if - * the layered folder is not a primary indirection - * - * @author Gavin Cornwell - */ -public class WCMLayeredFolderEvaluator extends WCMWorkflowEvaluator -{ - private static final long serialVersionUID = 8507016785287243649L; - - /** - * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) - */ - public boolean evaluate(final Node node) - { - FacesContext facesContext = FacesContext.getCurrentInstance(); - AVMService avmService = Repository.getServiceRegistry(facesContext).getAVMService(); - - Pair p = AVMNodeConverter.ToAVMVersionPath(node.getNodeRef()); - AVMNodeDescriptor nodeDesc = avmService.lookup(-1, p.getSecond()); - - // don't allow action if its a 'layeredfolder' and a primary indirection - return !(nodeDesc.getType() == AVMNodeType.LAYERED_DIRECTORY && nodeDesc.isPrimary()); - } -} diff --git a/source/java/org/alfresco/web/action/evaluator/WCMLockEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMLockEvaluator.java deleted file mode 100644 index 13991506ff..0000000000 --- a/source/java/org/alfresco/web/action/evaluator/WCMLockEvaluator.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.action.evaluator; - -import javax.faces.context.FacesContext; - -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.service.cmr.avm.locking.AVMLockingService; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.wcm.AVMBrowseBean; -import org.alfresco.web.bean.wcm.AVMUtil; -import org.alfresco.web.bean.wcm.WebProject; - -/** - * Evaluator to return if a item is accessable due to a WCM user level lock. - * - * @author Kevin Roast - */ -public class WCMLockEvaluator extends BaseActionEvaluator -{ - private static final long serialVersionUID = -816856825850017138L; - - /** - * @return true if the item is not locked by another user - */ - public boolean evaluate(final Node node) - { - boolean result = false; - final String path = AVMNodeConverter.ToAVMVersionPath(node.getNodeRef()).getSecond(); - if (!AVMUtil.isMainStore(AVMUtil.getStoreName(path))) - { - final FacesContext fc = FacesContext.getCurrentInstance(); - final AVMLockingService avmLockService = Repository.getServiceRegistry(fc).getAVMLockingService(); - final AVMBrowseBean avmBrowseBean = (AVMBrowseBean)FacesHelper.getManagedBean(fc, AVMBrowseBean.BEAN_NAME); - - final String username = Application.getCurrentUser(fc).getUserName(); - - WebProject webProject = avmBrowseBean.getWebProject(); - if (webProject == null) - { - // when in a workflow context, the WebProject may not be accurate on the browsebean - // so get the web project associated with the path - webProject = new WebProject(path); - } - result = avmLockService.hasAccess(webProject.getNodeRef(), path, username); - } - return result; - } -} diff --git a/source/java/org/alfresco/web/action/evaluator/WCMStagingOnlyEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMStagingOnlyEvaluator.java deleted file mode 100644 index 33cbe3a710..0000000000 --- a/source/java/org/alfresco/web/action/evaluator/WCMStagingOnlyEvaluator.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.action.evaluator; - -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.wcm.AVMUtil; - -/** - * Evaluator to return if an item path is within a staging area sandbox. - * - * @author Gavin Cornwell - */ -public class WCMStagingOnlyEvaluator extends BaseActionEvaluator -{ - private static final long serialVersionUID = -130286568044703852L; - - /** - * @return true if the item is not locked by another user - */ - public boolean evaluate(final Node node) - { - String path = AVMNodeConverter.ToAVMVersionPath(node.getNodeRef()).getSecond(); - return AVMUtil.isMainStore(AVMUtil.getStoreName(path)); - } -} diff --git a/source/java/org/alfresco/web/action/evaluator/WCMStagingReadonlyEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMStagingReadonlyEvaluator.java deleted file mode 100644 index 1613e7db7b..0000000000 --- a/source/java/org/alfresco/web/action/evaluator/WCMStagingReadonlyEvaluator.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.action.evaluator; - -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.wcm.AVMUtil; - -/** - * Evaluator to return if a item path is not within a staging area sandbox. - * - * @author Kevin Roast - */ -public class WCMStagingReadonlyEvaluator extends BaseActionEvaluator -{ - private static final long serialVersionUID = 2588681368739253602L; - - /** - * @return true if the item is not locked by another user - */ - public boolean evaluate(final Node node) - { - String path = AVMNodeConverter.ToAVMVersionPath(node.getNodeRef()).getSecond(); - return !AVMUtil.isMainStore(AVMUtil.getStoreName(path)); - } -} diff --git a/source/java/org/alfresco/web/action/evaluator/WCMUnlockEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMUnlockEvaluator.java deleted file mode 100644 index 0dae015053..0000000000 --- a/source/java/org/alfresco/web/action/evaluator/WCMUnlockEvaluator.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.action.evaluator; - -import javax.faces.context.FacesContext; - -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.avm.locking.AVMLockingService; -import org.alfresco.util.Pair; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.wcm.AVMBrowseBean; -import org.alfresco.web.bean.wcm.AVMUtil; -import org.alfresco.web.bean.wcm.WebProject; - -/** - * UI Action Evaluator - return true if the node is not part of an in-progress - * WCM workflow and is locked - * - * @author Gavin Cornwell - */ -public class WCMUnlockEvaluator extends BaseActionEvaluator -{ - /** - * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) - */ - public boolean evaluate(final Node node) - { - boolean proceed = false; - - FacesContext context = FacesContext.getCurrentInstance(); - AVMService avmService = Repository.getServiceRegistry(context).getAVMService(); - AVMLockingService avmLockingService = Repository.getServiceRegistry(context).getAVMLockingService(); - AVMBrowseBean avmBrowseBean = (AVMBrowseBean)FacesHelper.getManagedBean(context, AVMBrowseBean.BEAN_NAME); - - Pair p = AVMNodeConverter.ToAVMVersionPath(node.getNodeRef()); - String path = p.getSecond(); - - if (avmService.lookup(p.getFirst(), path) != null) - { - WebProject webProject = avmBrowseBean.getWebProject(); - if (webProject == null) - { - // when in a workflow context, the WebProject may not be accurate on the browsebean - // so get the web project associated with the path - webProject = new WebProject(path); - } - - // determine if the item is locked - String lockOwner = avmLockingService.getLockOwner(webProject.getStoreId(), AVMUtil.getStoreRelativePath(path)); - proceed = (lockOwner != null); - } - - return proceed; - } -} diff --git a/source/java/org/alfresco/web/action/evaluator/WCMWorkflowDeletedEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMWorkflowDeletedEvaluator.java deleted file mode 100644 index dbc3791cff..0000000000 --- a/source/java/org/alfresco/web/action/evaluator/WCMWorkflowDeletedEvaluator.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.action.evaluator; - -import javax.faces.context.FacesContext; - -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.wcm.AVMBrowseBean; -import org.alfresco.web.bean.wcm.AVMNode; -import org.alfresco.web.bean.wcm.AVMUtil; -import org.alfresco.web.bean.wcm.WebProject; - -/** - * UI Action Evaluator - return true if the node is not part of an in-progress WCM workflow. - * No check for deleted items is made in this evaluator. @see WCMWorkflowEvaluator - * - * @author Kevin Roast - */ -public class WCMWorkflowDeletedEvaluator extends WCMLockEvaluator -{ - private static final long serialVersionUID = -4341942166433855200L; - - /** - * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) - */ - public boolean evaluate(final Node node) - { - boolean proceed = false; - if (super.evaluate(node)) - { - final FacesContext fc = FacesContext.getCurrentInstance(); - final AVMBrowseBean avmBrowseBean = (AVMBrowseBean)FacesHelper.getManagedBean(fc, AVMBrowseBean.BEAN_NAME); - - WebProject webProject = avmBrowseBean.getWebProject(); - if (webProject == null || webProject.hasWorkflow()) - { - String sandbox = AVMUtil.getStoreName(node.getPath()); - - // evaluate to true if we are within a workflow store (i.e. list of resources in the task - // dialog) or not part of an already in-progress workflow - proceed = (AVMUtil.isWorkflowStore(sandbox) || - !((AVMNode)node).isInActiveWorkflow(sandbox)); - } - else - { - // if the WebProject has no workflow then we can proceed without checking further - proceed = true; - } - } - return proceed; - } -} \ No newline at end of file diff --git a/source/java/org/alfresco/web/action/evaluator/WCMWorkflowEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMWorkflowEvaluator.java deleted file mode 100644 index c1e030f0d7..0000000000 --- a/source/java/org/alfresco/web/action/evaluator/WCMWorkflowEvaluator.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.action.evaluator; - -import javax.faces.context.FacesContext; - -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.wcm.AVMBrowseBean; -import org.alfresco.web.bean.wcm.AVMNode; -import org.alfresco.web.bean.wcm.AVMUtil; -import org.alfresco.web.bean.wcm.WebProject; - -/** - * UI Action Evaluator - return true if the node is not part of an in-progress WCM workflow. - * - * @author Kevin Roast - */ -public class WCMWorkflowEvaluator extends WCMLockEvaluator -{ - private static final long serialVersionUID = -5847066921917855781L; - - /** - * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) - */ - public boolean evaluate(final Node node) - { - boolean proceed = false; - if (super.evaluate(node)) - { - final FacesContext fc = FacesContext.getCurrentInstance(); - final AVMBrowseBean avmBrowseBean = (AVMBrowseBean)FacesHelper.getManagedBean(fc, AVMBrowseBean.BEAN_NAME); - - WebProject webProject = avmBrowseBean.getWebProject(); - if (webProject == null || webProject.hasWorkflow()) - { - String sandbox = AVMUtil.getStoreName(node.getPath()); - - proceed = ((AVMUtil.isWorkflowStore(sandbox) || - !((AVMNode)node).isInActiveWorkflow(sandbox)) && - !((AVMNode)node).isDeleted()); - } - else - { - // if the WebProject has no workflow then we can proceed without checking further - proceed = true; - } - } - return proceed; - } -} \ No newline at end of file diff --git a/source/java/org/alfresco/web/action/evaluator/WCMWorkflowLayeredFolderEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMWorkflowLayeredFolderEvaluator.java deleted file mode 100644 index 558803c591..0000000000 --- a/source/java/org/alfresco/web/action/evaluator/WCMWorkflowLayeredFolderEvaluator.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.action.evaluator; - -import javax.faces.context.FacesContext; - -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.avm.AVMNodeType; -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.util.Pair; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; - -/** - * UI Action Evaluator - return true if the node is not a layered folder or if - * the layered folder is not a primary indirection - * - * @author Gavin Cornwell - */ -public class WCMWorkflowLayeredFolderEvaluator extends WCMWorkflowEvaluator -{ - private static final long serialVersionUID = 8507016785287243649L; - - /** - * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) - */ - public boolean evaluate(final Node node) - { - boolean proceed = super.evaluate(node); - - if (proceed) - { - FacesContext facesContext = FacesContext.getCurrentInstance(); - AVMService avmService = Repository.getServiceRegistry(facesContext).getAVMService(); - - Pair p = AVMNodeConverter.ToAVMVersionPath(node.getNodeRef()); - AVMNodeDescriptor nodeDesc = avmService.lookup(-1, p.getSecond()); - int type = nodeDesc.getType(); - - // if the node is a 'layeredfolder' and a primary indirection don't allow - if (type == AVMNodeType.LAYERED_DIRECTORY && nodeDesc.isPrimary()) - { - proceed = false; - } - } - - return proceed; - } -} diff --git a/source/java/org/alfresco/web/bean/clipboard/AVMClipboardItem.java b/source/java/org/alfresco/web/bean/clipboard/AVMClipboardItem.java deleted file mode 100644 index dc88362269..0000000000 --- a/source/java/org/alfresco/web/bean/clipboard/AVMClipboardItem.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.clipboard; - -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; -import javax.transaction.UserTransaction; - -import org.alfresco.model.WCMAppModel; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.service.cmr.avm.AVMExistsException; -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.model.FileExistsException; -import org.alfresco.service.cmr.repository.CrossRepositoryCopyService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.wcm.util.WCMUtil; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.NavigationBean; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.wcm.AVMBrowseBean; - -/** - * Class representing an 'avm' store protocol clipboard item - * - * @author Kevin Roast - */ -public class AVMClipboardItem extends AbstractClipboardItem -{ - private static final long serialVersionUID = 2550867083821268131L; - - private static final String AVM_PASTE_VIEW_ID = "/jsp/wcm/browse-sandbox.jsp"; - private static final String WORKSPACE_PASTE_VIEW_ID = "/jsp/browse/browse.jsp"; - - /** - * @param ref - * @param mode - */ - public AVMClipboardItem(NodeRef ref, ClipboardStatus mode, List customPasteViewIds) - { - super(ref, mode, customPasteViewIds); - } - - /** - * @see org.alfresco.web.bean.clipboard.ClipboardItem#supportsLink() - */ - public boolean supportsLink() - { - return false; - } - - /** - * @see org.alfresco.web.bean.clipboard.ClipboardItem#canCopyToViewId(java.lang.String) - */ - public boolean canCopyToViewId(String viewId) - { - if (super.canCopyToViewId(viewId) || AVM_PASTE_VIEW_ID.equals(viewId)) - { - AVMBrowseBean avmBrowseBean = (AVMBrowseBean)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), AVMBrowseBean.BEAN_NAME); - String destPath = avmBrowseBean.getCurrentPath(); - - if (WCMUtil.isStagingStore(WCMUtil.getStoreName(destPath))) - { - return false; - } - - return true; - } - else - { - return (super.canCopyToViewId(viewId) || WORKSPACE_PASTE_VIEW_ID.equals(viewId)); - } - } - - /** - * @see org.alfresco.web.bean.clipboard.ClipboardItem#canMoveToViewId(java.lang.String) - */ - public boolean canMoveToViewId(String viewId) - { - return (AVM_PASTE_VIEW_ID.equals(viewId)); - } - - /** - * @see org.alfresco.web.bean.clipboard.ClipboardItem#paste(javax.faces.context.FacesContext, java.lang.String, int) - */ - public boolean paste(FacesContext fc, String viewId, int action) throws Throwable - { - if (AVM_PASTE_VIEW_ID.equals(viewId)) - { - AVMBrowseBean avmBrowseBean = (AVMBrowseBean)FacesHelper.getManagedBean(fc, AVMBrowseBean.BEAN_NAME); - - String destPath = avmBrowseBean.getCurrentPath(); - NodeRef destRef = AVMNodeConverter.ToNodeRef(-1, destPath); - String sourcePath = AVMNodeConverter.ToAVMVersionPath(getNodeRef()).getSecond(); - - //FileFolderService fileFolderService = getServiceRegistry().getFileFolderService(); - - // initial name to attempt the copy of the item with - String name = getName(); - - boolean operationComplete = false; - while (operationComplete == false) - { - UserTransaction tx = null; - try - { - // attempt each copy/paste in its own transaction - tx = Repository.getUserTransaction(fc); - tx.begin(); - if (getMode() == ClipboardStatus.COPY) - { - // COPY operation - if (logger.isDebugEnabled()) - logger.debug("Attempting to copy node path: " + sourcePath + " into path: " + destPath); - - // copy the avm path - // first check that we are not attempting to copy a duplicate into the same parent - if (AVMNodeConverter.ExtendAVMPath(destPath, name).equals(sourcePath)) - { - // manually change the name if this occurs - String copyOf = Application.getMessage(fc, MSG_COPY_OF); - name = copyOf + ' ' + name; - } - /*fileFolderService.copy( - getNodeRef(), - destRef, - name);*/ - getAvmService().copy(-1, sourcePath, destPath, name); - - // ETHREEOH-2110 - AVMNodeDescriptor desc = getAvmService().lookup(-1, destPath + "/" + name); - recursiveFormCheck(desc); - - // if we get here without an exception, the clipboard copy operation was successful - operationComplete = true; - } - else - { - // MOVE operation - if (logger.isDebugEnabled()) - logger.debug("Attempting to move node path: " + sourcePath + " into path: " + destRef); - - // move the avm path - /*fileFolderService.move( - getNodeRef(), - destRef, - name);*/ - getAvmService().rename(AVMNodeConverter.SplitBase(sourcePath)[0], getName(), - destPath, name); - - // if we get here without an exception, the clipboard move operation was successful - operationComplete = true; - } - } - catch (FileExistsException fileExistsErr) - { - if (getMode() != ClipboardStatus.COPY) - { - // we should not rename an item when it is being moved - so exit - throw fileExistsErr; - } - } - catch (AVMExistsException avmExistsErr) - { - if (getMode() != ClipboardStatus.COPY) - { - // we should not rename an item when it is being moved - so exit - throw avmExistsErr; - } - } - catch (Throwable e) - { - // some other type of exception occured - rollback and exit - throw e; - } - finally - { - // rollback if the operation didn't complete - if (operationComplete == false) - { - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - String copyOf = Application.getMessage(fc, MSG_COPY_OF); - name = copyOf + ' ' + name; - } - else - { - // commit the transaction - tx.commit(); - } - } - } - return operationComplete; - } - else if (WORKSPACE_PASTE_VIEW_ID.equals(viewId)) - { - NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME); - NodeRef destRef = new NodeRef(Repository.getStoreRef(), navigator.getCurrentNodeId()); - - CrossRepositoryCopyService crossRepoCopyService = getServiceRegistry().getCrossRepositoryCopyService(); - - // initial name to attempt the copy of the item with - String name = getName(); - - boolean operationComplete = false; - while (operationComplete == false) - { - UserTransaction tx = null; - try - { - // attempt each copy/paste in its own transaction - tx = Repository.getUserTransaction(fc); - tx.begin(); - if (getMode() == ClipboardStatus.COPY) - { - // COPY operation - if (logger.isDebugEnabled()) - logger.debug("Attempting to copy node: " + getNodeRef() + " into node ID: " + destRef.toString()); - - // inter-store copy operation - crossRepoCopyService.copy(getNodeRef(), destRef, name); - - if (destRef.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM)) - { - // ETHREEOH-2110 - String destPath = AVMNodeConverter.ToAVMVersionPath(destRef).getSecond(); - AVMNodeDescriptor desc = getAvmService().lookup(-1, destPath + "/" + name); - recursiveFormCheck(desc); - } - - // if we get here without an exception, the clipboard copy operation was successful - operationComplete = true; - } - else - { - // this should not occur as the canMoveToViewId() will return false - throw new Exception("Move operation not supported between stores."); - } - } - catch (FileExistsException fileExistsErr) - { - if (getMode() != ClipboardStatus.COPY) - { - // we should not rename an item when it is being moved - so exit - throw fileExistsErr; - } - } - catch (Throwable e) - { - // some other type of exception occured - rollback and exit - throw e; - } - finally - { - // rollback if the operation didn't complete - if (operationComplete == false) - { - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - String copyOf = Application.getMessage(fc, MSG_COPY_OF); - name = copyOf + ' ' + name; - } - else - { - // commit the transaction - tx.commit(); - } - } - } - return operationComplete; - } - else - { - return false; - } - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java deleted file mode 100644 index 59ed52a7e1..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java +++ /dev/null @@ -1,2180 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.FileNotFoundException; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.ResourceBundle; - -import javax.faces.application.FacesMessage; -import javax.faces.component.UIParameter; -import javax.faces.component.html.HtmlCommandButton; -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; -import javax.faces.model.SelectItem; -import javax.transaction.UserTransaction; - -import org.alfresco.config.JNDIConstants; -import org.alfresco.model.ContentModel; -import org.alfresco.model.WCMAppModel; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.avm.AVMNodeType; -import org.alfresco.repo.web.scripts.FileTypeImageUtils; -import org.alfresco.service.cmr.action.ActionService; -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.avmsync.AVMDifference; -import org.alfresco.service.cmr.avmsync.AVMSyncService; -import org.alfresco.service.cmr.repository.FileTypeImageSize; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.repository.TemplateImageResolver; -import org.alfresco.service.cmr.repository.TemplateService; -import org.alfresco.service.cmr.search.LimitBy; -import org.alfresco.service.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.ResultSetRow; -import org.alfresco.service.cmr.search.SearchParameters; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.workflow.WorkflowService; -import org.alfresco.wcm.asset.AssetInfo; -import org.alfresco.wcm.sandbox.SandboxInfo; -import org.alfresco.wcm.sandbox.SandboxService; -import org.alfresco.wcm.util.WCMUtil; -import org.alfresco.wcm.webproject.WebProjectInfo; -import org.alfresco.wcm.webproject.WebProjectService; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.context.IContextListener; -import org.alfresco.web.app.context.UIContextService; -import org.alfresco.web.app.servlet.DownloadContentServlet; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.BrowseBean; -import org.alfresco.web.bean.NavigationBean; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.repository.User; -import org.alfresco.web.bean.search.SearchContext; -import org.alfresco.web.forms.FormInstanceData; -import org.alfresco.web.forms.FormNotFoundException; -import org.alfresco.web.forms.FormsService; -import org.alfresco.web.forms.Rendition; -import org.alfresco.web.ui.common.Utils; -import org.alfresco.web.ui.common.component.IBreadcrumbHandler; -import org.alfresco.web.ui.common.component.UIActionLink; -import org.alfresco.web.ui.common.component.UIBreadcrumb; -import org.alfresco.web.ui.common.component.UIModeList; -import org.alfresco.web.ui.common.component.data.UIRichList; -import org.alfresco.web.ui.wcm.WebResources; -import org.alfresco.web.ui.wcm.component.UISandboxSnapshots; -import org.alfresco.web.ui.wcm.component.UIUserSandboxes; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.config.ConfigElement; -import org.springframework.extensions.config.ConfigService; - -/** - * Bean backing up the AVM specific browse screens - * - * @author Kevin Roast - */ -public class AVMBrowseBean implements IContextListener -{ - private static final long serialVersionUID = -2310105113473561134L; - - public static final String BEAN_NAME = "AVMBrowseBean"; - - private static final Log logger = LogFactory.getLog(AVMBrowseBean.class); - - public static final String REQUEST_BEEN_DEPLOYED_RESULT = "_alfBeenDeployedResult"; - - private static final String MSG_REVERT_SUCCESS = "revert_success"; - private static final String MSG_REVERT_SANDBOX = "revert_sandbox_success"; - private static final String MSG_SANDBOXTITLE = "sandbox_title"; - private static final String MSG_SANDBOXSTAGING = "sandbox_staging"; - private static final String MSG_CREATED_ON = "store_created_on"; - private static final String MSG_CREATED_BY = "store_created_by"; - private static final String MSG_WORKING_USERS = "store_working_users"; - private static final String MSG_SEARCH_FORM_CONTENT = "search_form_content"; - private static final String MSG_TARGET_IS_DELETED ="target_is_deleted"; - - /** Component id the status messages are tied too */ - static final String COMPONENT_SANDBOXESPANEL = "sandboxes-panel"; - - /** Top-level JSF form ID */ - static final String FORM_ID = "website"; - - /** Snapshot date filter selection */ - private String snapshotDateFilter = UISandboxSnapshots.FILTER_DATE_TODAY; - - /** Current sandbox store context for actions and sandbox view */ - private String sandbox; - - /** Current username context for actions and sandbox view */ - private String username; - - /** Current webapp context for actions and sandbox view */ - private String webapp; - - /** List of top-level webapp directories for the current web project */ - private List webapps; - - /** Sandbox title message */ - private String sandboxTitle = null; - - /** Current AVM path and node representing the current path */ - private String currentPath = null; - private AVMNode currentPathNode = null; - - /** flag to indicate that all items in the sandbox are involved in the current action */ - private boolean allItemsAction = false; - - /** list of the deployment monitor ids currently executing */ - private List deploymentMonitorIds = new ArrayList(); - - /** List of expired paths to submit */ - private List nodesForSubmit = Collections.emptyList(); - - /* component references */ - private UIRichList foldersRichList; - private UIRichList filesRichList; - private UIUserSandboxes userSandboxes; - - /** transient lists of files/folders for a directory */ - private List files = null; - private List folders = null; - - /** Current AVM Node action context */ - private AVMNode avmNode = null; - - /** The last displayed website node id */ - private String lastWebsiteId = null; - - /** The current webProject */ - private WebProject webProject = null; - - /** breadcrumb location */ - private List location = null; - - /** Show all user sandboxes flag */ - private boolean showAllSandboxes = false; - - /** The current view page sizes */ - private int pageSizeFolders; - private int pageSizeFiles; - private String pageSizeFoldersStr; - private String pageSizeFilesStr; - - /** search query string */ - private String websiteQuery; - - private SearchContext searchContext = null; - - private String searchOrigin; - - /** The NodeService to be used by the bean */ - transient private NodeService nodeService; - - /** The WorkflowService bean reference. */ - transient private WorkflowService workflowService; - - /** The NavigationBean bean reference */ - protected NavigationBean navigator; - - /** WebProjectService bean reference */ - transient protected WebProjectService wpService; - - /** SandboxService bean reference */ - transient protected SandboxService sbService; - - /** AVM service bean reference */ - transient protected AVMService avmService; - - /** AVM sync service bean reference */ - transient protected AVMSyncService avmSyncService; - - /** Action service bean reference */ - transient protected ActionService actionService; - - /** The FormsService reference */ - transient protected FormsService formsService; - - /** The SearchService reference */ - transient private SearchService searchService; - - /** The PermissionService reference */ - transient protected PermissionService permissionService; - - /** - * Default Constructor - */ - public AVMBrowseBean() - { - UIContextService.getInstance(FacesContext.getCurrentInstance()).registerBean(this); - - initFromClientConfig(); - } - - - // ------------------------------------------------------------------------------ - // Bean property getters and setters - - /** - * @param wpService The WebProjectService to set. - */ - public void setWebProjectService(WebProjectService wpService) - { - this.wpService = wpService; - } - - protected WebProjectService getWebProjectService() - { - if (wpService == null) - { - wpService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWebProjectService(); - } - return wpService; - } - - /** - * @param sbService The SandboxService to set. - */ - public void setSandboxService(SandboxService sbService) - { - this.sbService = sbService; - } - - protected SandboxService getSandboxService() - { - if (sbService == null) - { - sbService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSandboxService(); - } - return sbService; - } - - /** - * @param avmService The AVMService to set. - */ - public void setAvmService(AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (avmService == null) - { - avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - return avmService; - } - - /** - * @param avmSyncService The AVMSyncService to set. - */ - public void setAvmSyncService(AVMSyncService avmSyncService) - { - this.avmSyncService = avmSyncService; - } - - protected AVMSyncService getAvmSyncService() - { - if (avmSyncService == null) - { - avmSyncService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMSyncService(); - } - return avmSyncService; - } - - /** - * @param nodeService The NodeService to set. - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Getter used by the Inline Edit XML JSP - * - * @return The NodeService - */ - public NodeService getNodeService() - { - if (nodeService == null) - { - nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); - } - return nodeService; - } - - /** - * Set the workflow service - * @param service The workflow service instance. - */ - public void setWorkflowService(WorkflowService service) - { - workflowService = service; - } - - protected WorkflowService getWorkflowService() - { - if (workflowService == null) - { - workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService(); - } - return workflowService; - } - - /** - * @param searchService The Searcher to set. - */ - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - - /** - * @return searchService - */ - public SearchService getSearchService() - { - //check for null for cluster environment - if (searchService == null) - { - searchService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSearchService(); - } - return searchService; - } - - /** - * @param permissionService The PermissionService to set. - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - protected PermissionService getPermissionService() - { - if (permissionService == null) - { - permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService(); - } - return permissionService; - } - - /** - * @param navigator The NavigationBean to set. - */ - public void setNavigationBean(NavigationBean navigator) - { - this.navigator = navigator; - } - - /** - * @param actionService The actionService to set. - */ - public void setActionService(ActionService actionService) - { - this.actionService = actionService; - } - - protected ActionService getActionService() - { - if (actionService == null) - { - actionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getActionService(); - } - return actionService; - } - - /** - * @param formsService The FormsService to set. - */ - public void setFormsService(final FormsService formsService) - { - this.formsService = formsService; - } - - protected FormsService getFormsService() - { - if (formsService == null) - { - formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); - } - return formsService; - } - - public int getPageSizeFiles() - { - return this.pageSizeFiles; - } - - public void setPageSizeFiles(int pageSizeContent) - { - this.pageSizeFiles = pageSizeContent; - this.pageSizeFilesStr = Integer.toString(pageSizeContent); - } - - public int getPageSizeFolders() - { - return this.pageSizeFolders; - } - - public void setPageSizeFolders(int pageSizeSpaces) - { - this.pageSizeFolders = pageSizeSpaces; - this.pageSizeFoldersStr = Integer.toString(pageSizeSpaces); - } - - public String getPageSizeFilesStr() - { - return this.pageSizeFilesStr; - } - - public void setPageSizeFilesStr(String pageSizeContentStr) - { - this.pageSizeFilesStr = pageSizeContentStr; - } - - public String getPageSizeFoldersStr() - { - return this.pageSizeFoldersStr; - } - - public void setPageSizeFoldersStr(String pageSizeSpacesStr) - { - this.pageSizeFoldersStr = pageSizeSpacesStr; - } - - /** - * Summary text for the staging store: - * Created On: xx/yy/zz - * Created By: username - * There are N user(s) working on this website. - * - * @return summary text - */ - public String getStagingSummary() - { - StringBuilder summary = new StringBuilder(128); - FacesContext fc = FacesContext.getCurrentInstance(); - ResourceBundle msg = Application.getBundle(fc); - - NodeRef wpNodeRef = getWebsite().getNodeRef(); - WebProjectInfo wpInfo = getWebProjectService().getWebProject(wpNodeRef); - SandboxInfo sbInfo = getSandboxService().getStagingSandbox(wpInfo.getStoreId()); - - if (sbInfo != null) - { - summary.append(msg.getString(MSG_CREATED_ON)).append(": ") - .append(Utils.getDateFormat(fc).format(sbInfo.getCreatedDate())) - .append("

"); - summary.append(msg.getString(MSG_CREATED_BY)).append(": ") - .append(sbInfo.getCreator()) - .append("

"); - final int numUsers = getWebProjectService().getWebUserCount(wpNodeRef); - summary.append(MessageFormat.format(msg.getString(MSG_WORKING_USERS), numUsers)); - } - - // reset the current path so the context for the Modified File list actions is cleared - this.currentPath = null; - - return summary.toString(); - } - - /** - * @return the current staging store name - */ - public String getStagingStore() - { - return this.getWebProject().getStagingStore(); - } - - /** - * @return Preview URL for the current Staging store and current webapp - */ - public String getStagingPreviewUrl() - { - return(AVMUtil.getPreviewURI(getStagingStore(), '/' + JNDIConstants.DIR_DEFAULT_WWW + '/' + JNDIConstants.DIR_DEFAULT_APPBASE + '/' + getWebapp())); - } - - /** - * @return Preview URL for the current User Sandbox store and current webapp - */ - public String getSandboxPreviewUrl() - { - return(AVMUtil.getPreviewURI(getSandbox(), '/' + JNDIConstants.DIR_DEFAULT_WWW + '/' + JNDIConstants.DIR_DEFAULT_APPBASE + '/' + getWebapp())); - } - - /** - * @param foldersRichList The foldersRichList to set. - */ - public void setFoldersRichList(UIRichList foldersRichList) - { - this.foldersRichList = foldersRichList; - } - - /** - * @return Returns the foldersRichList. - */ - public UIRichList getFoldersRichList() - { - return this.foldersRichList; - } - - /** - * @return Returns the filesRichList. - */ - public UIRichList getFilesRichList() - { - return this.filesRichList; - } - - /** - * @param filesRichList The filesRichList to set. - */ - public void setFilesRichList(UIRichList filesRichList) - { - this.filesRichList = filesRichList; - } - - /** - * @return Returns the userSandboxes. - */ - public UIUserSandboxes getUserSandboxes() - { - return this.userSandboxes; - } - - /** - * @param userSandboxes The userSandboxes to set. - */ - public void setUserSandboxes(UIUserSandboxes userSandboxes) - { - this.userSandboxes = userSandboxes; - } - - /** - * @return Returns the current sandbox context. - */ - public String getSandbox() - { - return this.sandbox; - } - - /** - * @param sandbox The sandbox to set. - */ - public void setSandbox(String sandbox) - { - this.sandbox = sandbox; - } - - /** - * @return Returns the current username context. - */ - public String getUsername() - { - return this.username; - } - - /** - * @param username The username to set. - */ - public void setUsername(String username) - { - this.username = username; - } - - /** - * @return current webapp context - */ - public String getWebapp() - { - if (this.webapp == null) - { - // TODO - temporary, should only be called for WCM forms (not ECM forms) - Node wpNode = getWebsite(); - if (wpNode != null) - { - WebProjectInfo wpInfo = getWebProjectService().getWebProject(wpNode.getNodeRef()); - if (wpInfo != null) - { - this.webapp = wpInfo.getDefaultWebApp(); - } - } - } - return this.webapp; - } - - /** - * @param webapp Webapp folder context - */ - public void setWebapp(String webapp) - { - this.webapp = webapp; - } - - /** - * @return Returns the list of deployment monitor ids currently executing - */ - public List getDeploymentMonitorIds() - { - return this.deploymentMonitorIds; - } - - /** - * @param deploymentMonitorIds Sets the list of deployment monitor ids - */ - public void setDeploymentMonitorIds(List deploymentMonitorIds) - { - this.deploymentMonitorIds = deploymentMonitorIds; - } - - public List getNodesForSubmit() - { - return this.nodesForSubmit; - } - - public void setNodesForSubmit(final List nodesForSubmit) - { - this.nodesForSubmit = nodesForSubmit; - } - - /** - * @return list of available root webapp folders for this Web project - */ - public List getWebapps() - { - if (this.webapps == null) - { - List webAppNames = getWebProjectService().listWebApps(getWebsite().getNodeRef()); - List webAppItems = new ArrayList(webAppNames.size()); - for (String webAppName : webAppNames) - { - webAppItems.add(new SelectItem(webAppName, webAppName)); - } - this.webapps = webAppItems; - } - return this.webapps; - } - - /** - * @return count of the root webapps in the current web project - */ - public int getWebappsSize() - { - return getWebapps().size(); - } - - /** - * @return Returns the sandboxTitle. - */ - public String getSandboxTitle() - { - if (this.sandboxTitle == null) - { - String forUser = username; - if (forUser == null) - { - forUser = Application.getMessage(FacesContext.getCurrentInstance(), MSG_SANDBOXSTAGING); - } - this.sandboxTitle = MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), MSG_SANDBOXTITLE), - getWebsite().getName(), - forUser); - } - return this.sandboxTitle; - } - - /** - * @param sandboxTitle The sandboxTitle to set. - */ - public void setSandboxTitle(String sandboxTitle) - { - this.sandboxTitle = sandboxTitle; - } - - /** - * @return Returns the Snapshot Date Filter. - */ - public String getSnapshotDateFilter() - { - return this.snapshotDateFilter; - } - - /** - * @param snapshotDateFilter The Snapshot Date Filter to set. - */ - public void setSnapshotDateFilter(String snapshotDateFilter) - { - this.snapshotDateFilter = snapshotDateFilter; - } - - /** - * @return the website search query string - */ - public String getWebsiteQuery() - { - return this.websiteQuery; - } - - /** - * @param websiteQuery The website search query string - */ - public void setWebsiteQuery(String websiteQuery) - { - this.websiteQuery = websiteQuery; - } - - /** - * @return icon image for the appropriate sandbox type - */ - public String getIcon() - { - return this.username == null ? WebResources.IMAGE_SANDBOX_32 : WebResources.IMAGE_USERSANDBOX_32; - } - - /** - * @return website node the view is currently within - */ - public Node getWebsite() - { - // check to see if the website we are browsing has changed since the last time - final Node currentNode = this.navigator.getCurrentNode(); - if (!this.navigator.getCurrentNodeId().equals(this.lastWebsiteId) || - !WCMAppModel.TYPE_AVMWEBFOLDER.equals(currentNode.getType())) - { - // clear context when we are browsing a new website - this.lastWebsiteId = this.navigator.getCurrentNodeId(); - this.webapp = null; - this.webapps = null; - this.webProject = null; - } - return WCMAppModel.TYPE_AVMWEBFOLDER.equals(currentNode.getType()) ? currentNode : null; - } - - /** - * @return the web project the view is currently within - */ - public WebProject getWebProject() - { - Node website = this.getWebsite(); - if (this.webProject == null && website != null) - { - this.webProject = new WebProject(website.getNodeRef()); - } - return this.webProject; - } - - /** - * @return Returns the current AVM node action context. - */ - public AVMNode getAvmActionNode() - { - return this.avmNode; - } - - /** - * @param avmNode The AVM node action context to set. - */ - public void setAvmActionNode(AVMNode avmNode) - { - this.avmNode = avmNode; - } - - /** - * @param avmRef The AVMNodeDescriptor action context to set. - */ - public void setAVMActionNodeDescriptor(AVMNodeDescriptor avmRef) - { - if (avmRef == null) - { - throw new NullPointerException(); - } - AVMNode avmNode = new AVMNode(avmRef); - this.avmNode = avmNode; - } - - /** - * @return the internal AVM path to the current folder for browsing - */ - public String getCurrentPath() - { - if (this.currentPath == null) - { - // TODO - temporary, should only be called for WCM forms (not ECM forms) - String webApp = getWebapp(); - if (webApp != null) - { - this.currentPath = AVMUtil.buildStoreWebappPath(getSandbox(), webApp); - } - } - return this.currentPath; - } - - /** - * @param path the internal AVM path to the current folder for browsing - */ - public void setCurrentPath(String path) - { - this.currentPath = path; - if (path == null) - { - // clear dependant objects (recreated when the path is reinitialised) - this.currentPathNode = null; - } - - // clear the search context as we have navigated to a folder path - this.searchContext = null; - - // update UI state ready for screen refresh - UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); - } - - /** - * @return the AVMNode that represents the current browsing path - */ - public AVMNode getCurrentPathNode() - { - if (this.currentPathNode == null) - { - AVMNodeDescriptor node = getAvmService().lookup(-1, getCurrentPath(), true); - this.currentPathNode = new AVMNode(node); - } - return this.currentPathNode; - } - - /** - * @return Breadcrumb location list - */ - public List getLocation() - { - if (this.location == null) - { - List loc = new ArrayList(8); - loc.add(new AVMBreadcrumbHandler(getCurrentPath())); - - this.location = loc; - } - return this.location; - } - - /** - * @param location Breadcrumb location list - */ - public void setLocation(List location) - { - this.location = location; - } - - /** - * @return true if the current node has a custom view available - */ - public boolean getHasCustomView() - { - return getHasWebscriptView() || getHasTemplateView(); - } - - /** - * @return true if the current node has a Template based custom view available - */ - public boolean getHasTemplateView() - { - AVMNode node = getCurrentPathNode(); - if (node.hasAspect(ContentModel.ASPECT_TEMPLATABLE)) - { - NodeRef templateRef = (NodeRef)node.getProperties().get(ContentModel.PROP_TEMPLATE); - return (templateRef != null && this.getNodeService().exists(templateRef) && - getPermissionService().hasPermission(templateRef, PermissionService.READ) == AccessStatus.ALLOWED); - } - return false; - } - - /** - * @return true if the current node has a Webscript based custom view available - */ - public boolean getHasWebscriptView() - { - AVMNode node = getCurrentPathNode(); - if (node.hasAspect(ContentModel.ASPECT_WEBSCRIPTABLE)) - { - return (node.getProperties().get(ContentModel.PROP_WEBSCRIPT) != null); - } - return false; - } - - /** - * @return the NodeRef.toString() for the current node Template custom view if it has one - */ - public String getCurrentNodeTemplate() - { - NodeRef ref = (NodeRef)getCurrentPathNode().getProperties().get(ContentModel.PROP_TEMPLATE); - return ref != null ? ref.toString() : null; - } - - /** - * @return the service url for the current node Webscript custom view if it has one - */ - public String getCurrentNodeWebscript() - { - return (String)getCurrentPathNode().getProperties().get(ContentModel.PROP_WEBSCRIPT); - } - - /** - * Returns a model for use by a template on a space Dashboard page. - * - * @return model containing current current space info. - */ - @SuppressWarnings("unchecked") - public Map getTemplateModel() - { - HashMap model = new HashMap(4, 1.0f); - - model.put("space", getCurrentPathNode().getNodeRef()); - model.put("path", getCurrentPathNode().getPath()); - model.put(TemplateService.KEY_IMAGE_RESOLVER, - new TemplateImageResolver() - { - public String resolveImagePathForName(String filename, FileTypeImageSize size) - { - return FileTypeImageUtils.getFileTypeImage(FacesContext.getCurrentInstance(), filename, size); - } - }); - - return model; - } - - public Map getCustomWebscriptContext() - { - HashMap model = new HashMap(2, 1.0f); - model.put("path", getCurrentPathNode().getPath()); - return model; - } - - /** - * @return true if the current user has the manager role in the current website - */ - public boolean getIsManagerRole() - { - Node wpNode = getWebsite(); - if (wpNode != null && nodeService.exists(wpNode.getNodeRef())) - { - return getWebProjectService().isContentManager(wpNode.getNodeRef()); - } - return false; - } - - public boolean getIsManagerOrPublisherRole() - { - Node wpNode = getWebsite(); - if (wpNode != null && nodeService.exists(wpNode.getNodeRef())) - { - User user = Application.getCurrentUser(FacesContext.getCurrentInstance()); - String userRole = getWebProjectService().getWebUserRole(wpNode.getNodeRef(), user.getUserName()); - return (WCMUtil.ROLE_CONTENT_MANAGER.equals(userRole) || WCMUtil.ROLE_CONTENT_PUBLISHER.equals(userRole)); - } - return false; - } - - /** - * @return true to show all sandboxes visible to this user, false to only show the current user sandbox - */ - public boolean getShowAllSandboxes() - { - return this.showAllSandboxes; - } - - /** - * @param value true to show all sandboxes visible to this user, false to only show the current user sandbox - */ - public void setShowAllSandboxes(boolean value) - { - this.showAllSandboxes = value; - } - - /** - * @return true if the website has had a deployment attempt - */ - @SuppressWarnings("unchecked") - public boolean getHasDeployBeenAttempted() - { - // NOTE: This method is called a lot as it is referenced as a value binding - // expression in a 'rendered' attribute, we therefore cache the result - // on a per request basis - - Boolean result = null; - - FacesContext context = FacesContext.getCurrentInstance(); - Map request = context.getExternalContext().getRequestMap(); - if (request.get(REQUEST_BEEN_DEPLOYED_RESULT) == null) - { - if (!nodeService.exists(this.getWebsite().getNodeRef())) - { - result = false; - } - else - { - // see if there are any deployment attempts for the staging area - NodeRef webProjectRef = this.getWebsite().getNodeRef(); - String store = (String)getNodeService().getProperty(webProjectRef, - WCMAppModel.PROP_AVMSTORE); - List deployAttempts = DeploymentUtil.findDeploymentAttempts(store); - - // add a placeholder object in the request so we don't evaluate this again for this request - result = new Boolean(deployAttempts != null && deployAttempts.size() > 0); - } - request.put(REQUEST_BEEN_DEPLOYED_RESULT, result); - } - else - { - result = (Boolean)request.get(REQUEST_BEEN_DEPLOYED_RESULT); - } - - return result.booleanValue(); - } - - /** - * @return the Search Context object for the current website project - */ - public SearchContext getSearchContext() - { - return this.searchContext; - } - - /** - * @return Map of avm node objects representing the folders with the current website space - */ - public List getFolders() - { - if (this.folders == null) - { - if (this.searchContext == null) - { - buildDirectoryNodes(); - } - else - { - buildSearchNodes(); - } - } - return this.folders; - } - - /** - * @return Map of avm node objects representing the files with the current website space - */ - public List getFiles() - { - if (this.files == null) - { - if (this.searchContext == null) - { - buildDirectoryNodes(); - } - else - { - buildSearchNodes(); - } - } - return this.files; - } - - /** - * Build the lists of files and folders within the current browsing path in a website space - */ - private void buildDirectoryNodes() - { - UserTransaction tx = null; - try - { - FacesContext context = FacesContext.getCurrentInstance(); - tx = Repository.getUserTransaction(context, true); - tx.begin(); - - Map nodes = getAvmService().getDirectoryListing(-1, getCurrentPath()); - this.files = new ArrayList(nodes.size()); - this.folders = new ArrayList(nodes.size()); - for (String name : nodes.keySet()) - { - AVMNodeDescriptor avmRef = nodes.get(name); - - // build and add the client representation of the AVM node - addAVMNodeResult(avmRef); - } - - // commit the transaction - tx.commit(); - } - catch (Throwable err) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); - this.folders = Collections.emptyList(); - this.files = Collections.emptyList(); - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - } - } - - /** - * Build the lists of files and folders from the current search context in a website space - */ - private void buildSearchNodes() - { - String query = this.searchContext.buildQuery(getMinimumSearchLength()); - if (query == null) - { - this.folders = Collections.emptyList(); - this.files = Collections.emptyList(); - return; - } - - UserTransaction tx = null; - ResultSet results = null; - try - { - FacesContext context = FacesContext.getCurrentInstance(); - tx = Repository.getUserTransaction(context, true); - tx.begin(); - - // build up the search parameters - SearchParameters sp = new SearchParameters(); - sp.setLanguage(SearchService.LANGUAGE_LUCENE); - sp.setQuery(query); - // add the Staging Store for this website - it is the only searchable store for now - sp.addStore(new StoreRef(StoreRef.PROTOCOL_AVM, getStagingStore())); - - // limit search results size as configured - int searchLimit = Application.getClientConfig(context).getSearchMaxResults(); - if (searchLimit > 0) - { - sp.setLimitBy(LimitBy.FINAL_SIZE); - sp.setLimit(searchLimit); - } - - results = getSearchService().query(sp); - - if (logger.isDebugEnabled()) - { - logger.debug("Search results returned: " + results.length()); - } - - // filter hidden folders above the web app - boolean isStagingStore = getIsStagingStore(); - int sandboxPathLength = AVMUtil.getSandboxPath(getCurrentPath()).length(); - - this.files = new ArrayList(results.length()); - this.folders = new ArrayList(results.length()); - for (ResultSetRow row : results) - { - NodeRef nodeRef = row.getNodeRef(); - - // Modify the path to point to the current user sandbox - this change is performed so - // that any action permission evaluators will correctly resolve for the current user. - // Therefore deleted node will be filtered out by the lookup() call, but some text based - // results may be incorrect - however a note is provided in the search UI to indicate this. - String path = AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond(); - if (isStagingStore == false) - { - path = getSandbox() + ':' + AVMUtil.getStoreRelativePath(path); - } - if (path.length() > sandboxPathLength) - { - AVMNodeDescriptor avmRef = getAvmService().lookup(-1, path); - if (avmRef != null) - { - AVMNode node = addAVMNodeResult(avmRef); - - // add extra properties for search results lists - node.addPropertyResolver("displayPath", AVMNode.RESOLVER_DISPLAY_PATH); - node.addPropertyResolver("parentPath", AVMNode.RESOLVER_PARENT_PATH); - } - } - } - - // commit the transaction - tx.commit(); - } - catch (Throwable err) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); - this.folders = Collections.emptyList(); - this.files = Collections.emptyList(); - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - } - finally - { - if (results != null) - { - results.close(); - } - } - } - - /** - * Add an AVM node result to the list of files/folders to display. Applies various - * client pseudo properties resolver objects used for list display columns. - */ - private AVMNode addAVMNodeResult(AVMNodeDescriptor avmRef) - { - // build the client representation of the AVM node - AVMNode node = new AVMNode(avmRef); - - // properties specific to folders or files - if (avmRef.isDirectory()) - { - node.getProperties().put("smallIcon", BrowseBean.SPACE_SMALL_DEFAULT); - - String type = ""; - if (avmRef.getType() == AVMNodeType.LAYERED_DIRECTORY && avmRef.isPrimary()) - { - if ((getAvmService().lookup(avmRef.getIndirectionVersion(), avmRef.getIndirection()) != null) || (avmRef.getOpacity())) - { - type = Application.getMessage(FacesContext.getCurrentInstance(), "shared_folder"); - } - else - { - type = Application.getMessage(FacesContext.getCurrentInstance(), "stale_shared_folder"); - } - } - else - { - type = Application.getMessage(FacesContext.getCurrentInstance(), "folder"); - } - node.getProperties().put("folderType", type); - - this.folders.add(node); - } - else - { - String type = ""; - if (avmRef.isLayeredFile()) - { - if (getAvmService().lookup(avmRef.getIndirectionVersion(), avmRef.getIndirection()) != null) - { - type = Application.getMessage(FacesContext.getCurrentInstance(), "shared_file"); - } - else - { - type = Application.getMessage(FacesContext.getCurrentInstance(), "stale_shared_file"); - } - } - else - { - type = Application.getMessage(FacesContext.getCurrentInstance(), "file"); - } - - node.getProperties().put("fileType", type); - node.getProperties().put("fileType16", FileTypeImageUtils.getFileTypeImage(avmRef.getName(), true)); - node.getProperties().put("url", DownloadContentServlet.generateBrowserURL( - AVMNodeConverter.ToNodeRef(-1, avmRef.getPath()), avmRef.getName())); - - this.files.add(node); - } - - // common properties - node.addPropertyResolver("previewUrl", AVMNode.RESOLVER_PREVIEW_URL); - - return node; - } - - /** - * Return the list of selected items for the current user sandbox view - * - * @return List of AVMNodeDescriptor objects representing selected items - */ - public List getSelectedSandboxItems() - { - return this.userSandboxes.getSelectedNodes(this.username); - } - - /** - * @return true if a special All Items action has been initialised - */ - public boolean getAllItemsAction() - { - return this.allItemsAction; - } - - /** - * @return true if the current sandbox is a Staging store, false otherwise - */ - public boolean getIsStagingStore() - { - return AVMUtil.isMainStore(this.sandbox); - } - - // ------------------------------------------------------------------------------ - // Action event handlers - - /** - * Update the UI after a folder click action in the website browsing screens - */ - public void clickFolder(ActionEvent event) - { - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - String path = params.get("id"); - AVMNodeDescriptor avmNode = getAvmService().lookup(-1, path); - - if (avmNode.isLayeredDirectory() && avmNode.isPrimary() && - (getAvmService().lookup(avmNode.getIndirectionVersion(), avmNode.getIndirection()) == null) && - (! avmNode.getOpacity()) && - getAvmService().getDirectoryListingDirect(avmNode, false).isEmpty()) - { - String pattern = Application.getMessage(FacesContext.getCurrentInstance(), MSG_TARGET_IS_DELETED); - String folderName = path.substring(path.lastIndexOf("/") + 1); - Utils.addErrorMessage(MessageFormat.format(pattern, folderName)); - } - else - { - updateUILocation(path); - } - } - - /** - * Action handler called when the Snapshot Date filter is changed by the user - */ - public void snapshotDateFilterChanged(ActionEvent event) - { - UIModeList filterComponent = (UIModeList)event.getComponent(); - setSnapshotDateFilter(filterComponent.getValue().toString()); - } - - /** - * Setup the context for a sandbox browse action - */ - public void setupSandboxAction(final ActionEvent event) - { - final UIActionLink link = (UIActionLink)event.getComponent(); - final Map params = link.getParameterMap(); - this.setupSandboxAction(params.get("store"), params.get("username")); - } - - /** - * Setup the context for a sandbox browse action - * - * @param store The store name for the action - * @param username The authority pertinent to the action (null for staging store actions) - */ - public void setupSandboxAction(String store, String username) - { - this.setupSandboxActionImpl(store, null, username, true); - } - - /** - * Setup the context for a sandbox browse action - * - * @param store The store name for the action - * @param username The authority pertinent to the action (null for staging store actions) - * @param reset True to reset the current path and AVM action node context - */ - private void setupSandboxActionImpl(final String store, - final String webapp, - final String username, - final boolean reset) - { - // can be null if it's the staging store - i.e. not a user specific store - setUsername(username); - - // the store can be either a user store or the staging store if this is null - // get the staging store from the current website node - this.setSandbox(store != null ? store : this.getStagingStore()); - - if (webapp != null) - { - this.setWebapp(webapp); - } - - // update UI state ready for return to the previous screen - if (reset == true) - { - this.sandboxTitle = null; - this.location = null; - setCurrentPath(null); - setAvmActionNode(null); - this.allItemsAction = false; - this.searchOrigin = null; - } - - this.websiteQuery = null; - } - - /** - * Action event called by all actions that need to setup a Content node context on the - * before an action page/wizard is called. The context will be an AVMNodeDescriptor in - * setAVMNode() which can be retrieved on action pages via getAVMNode(). - * - * @param event ActionEvent - */ - public void setupContentAction(ActionEvent event) - { - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - this.setupContentAction(params.get("id"), true); - } - - /*package*/ void setupContentAction(String path, boolean refresh) - { - if (logger.isDebugEnabled()) - { - logger.debug("Setup content action for path: " + path); - } - - if (path == null || path.length() == 0) - { - setAvmActionNode(null); - } - else - { - // calculate username and store name from specified path - String storeName = AVMUtil.getStoreName(path); - String storeId = AVMUtil.getStoreId(storeName); - String webapp = AVMUtil.getWebapp(path); - String username = AVMUtil.getUserName(storeName); - if (username == null) - { - storeName = (AVMUtil.isPreviewStore(storeName) - ? AVMUtil.buildStagingPreviewStoreName(storeId) - : AVMUtil.buildStagingStoreName(storeId)); - this.setupSandboxActionImpl(storeName, webapp, null, false); - } - else - { - storeName = (AVMUtil.isPreviewStore(storeName) - ? AVMUtil.buildUserPreviewStoreName(storeId, username) - : AVMUtil.buildUserMainStoreName(storeId, username)); - this.setupSandboxActionImpl(storeName, webapp, username, false); - } - - if (this.webProject == null) - { - this.webProject = new WebProject(path); - } - - // setup the action node - AVMNodeDescriptor avmNodeDesc = getAvmService().lookup(-1, path, true); - this.setAVMActionNodeDescriptor(avmNodeDesc); - } - - // update UI state ready for return after dialog close - if (refresh) - { - UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); - } - } - - /** - * Action handler called to calculate which editing screen to display based on the mimetype - * of a document. If appropriate, the in-line editing screen will be shown. - */ - public void setupEditAction(ActionEvent event) - { - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - this.setupEditAction(params.get("id")); - } - - /** - * Action handler called to calculate which editing screen to display based on the mimetype - * of a document. If appropriate, the in-line editing screen will be shown. - */ - public void setupEditAction(String path) - { - this.setupContentAction(path, true); - - // retrieve the content reader for this node - String avmPath = this.getAvmActionNode().getPath(); - if (getAvmService().hasAspect(-1, avmPath, WCMAppModel.ASPECT_RENDITION)) - { - if (logger.isDebugEnabled()) - { - logger.debug(avmPath + " is a rendition, editing primary rendition instead"); - } - - try - { - final FormInstanceData fid = this.getFormsService().getRendition(-1, avmPath).getPrimaryFormInstanceData(); - avmPath = fid.getPath(); - - if (logger.isDebugEnabled()) - { - logger.debug("Editing primary form instance data " + avmPath); - } - - this.setAvmActionNode(new AVMNode(getAvmService().lookup(-1, avmPath))); - } - catch (IllegalArgumentException iae) - { - //Utils.addErrorMessage(iae.getMessage(), iae); - logger.warn(iae); - } - catch (FileNotFoundException fnfe) - { - //Utils.addErrorMessage(fnfe.getMessage(), fnfe); - logger.warn(fnfe); - } - } - - if (logger.isDebugEnabled()) - { - logger.debug("Editing AVM node: " + avmPath); - } - - String outcome = null; - // calculate which editor screen to display - if (getAvmService().hasAspect(-1, avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) - { - // make content available to the editing screen - try - { - // make sure the form association works before proceeding to the - // edit web content wizard - this.getFormsService().getFormInstanceData(-1, avmPath).getForm(); - // navigate to appropriate screen - outcome = "wizard:editWebContent"; - } - catch (FormNotFoundException fnfe) - { - //Utils.addErrorMessage(fnfe.getMessage(), fnfe); - logger.warn(fnfe); - - final Map params = new HashMap(2, 1.0f); - params.put("finishOutcome", "wizard:editWebContent"); - params.put("cancelOutcome", "dialog:editAvmFile"); - Application.getDialogManager().setupParameters(params); - - outcome = "dialog:promptForWebForm"; - } - } - else - { - // normal downloadable document - outcome = "dialog:editAvmFile"; - - // we need to mark the file as modified so it gets a lock - this.getAvmService().forceCopy(avmPath); - } - - if (logger.isDebugEnabled()) - { - logger.debug("outcome " + outcome + " for path " + path); - } - - FacesContext fc = FacesContext.getCurrentInstance(); - fc.getApplication().getNavigationHandler().handleNavigation(fc, null, outcome); - } - - /** - * Action handler for all nodes from user sandbox - */ - public void setupAllItemsAction(ActionEvent event) - { - setupSandboxAction(event); - this.allItemsAction = true; - } - - /** - * Refresh Sandbox in the virtualisation server - */ - public void refreshSandbox(ActionEvent event) - { - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - String store = params.get("store"); - - if (store == null) - { - store = getStagingStore(); - } - - // update the specified webapp in the store - String webappPath = AVMUtil.buildStoreWebappPath(store, getWebapp()); - AVMUtil.updateVServerWebapp(webappPath, true); - } - - /** - * Undo changes to a single node - */ - public void revertNode(ActionEvent event) - { - String avmPath = getPathFromEventArgs(event); - String sbStoreId = WCMUtil.getSandboxStoreId(avmPath); - List namesForDisplayMsg = new LinkedList(); - UserTransaction tx = null; - final FacesContext context = FacesContext.getCurrentInstance(); - try - { - tx = Repository.getUserTransaction(context, false); - tx.begin(); - - AVMNodeDescriptor node = getAvmService().lookup(-1, avmPath, true); - if (node != null) - { - FormInstanceData fid = null; - if (getAvmService().hasAspect(-1, avmPath, WCMAppModel.ASPECT_RENDITION)) - { - fid = this.getFormsService().getRendition(-1, avmPath).getPrimaryFormInstanceData(); - } - else if (getAvmService().hasAspect(-1, avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) - { - fid = this.getFormsService().getFormInstanceData(-1, avmPath); - } - List paths = new ArrayList(); - if (fid != null) - { - paths.add(WCMUtil.getStoreRelativePath(fid.getPath())); - namesForDisplayMsg.add(fid.getName()); - for (Rendition r : fid.getRenditions()) - { - paths.add(WCMUtil.getStoreRelativePath(r.getPath())); - namesForDisplayMsg.add(r.getName()); - } - } - else - { - paths.add(WCMUtil.getStoreRelativePath(avmPath)); - namesForDisplayMsg.add(node.getName()); - } - - getSandboxService().revertList(sbStoreId, paths); - } - - // commit the transaction - tx.commit(); - - // if we get here, all was well - output friendly status message to the user - this.displayStatusMessage(context, - MessageFormat.format(Application.getMessage(context, MSG_REVERT_SUCCESS), - StringUtils.join(namesForDisplayMsg.toArray(), ", "), - namesForDisplayMsg.size())); - } - catch (Throwable err) - { - err.printStackTrace(System.err); - Utils.addErrorMessage(MessageFormat.format(Application.getMessage(context, Repository.ERROR_GENERIC), - err.getMessage()), - err); - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - } - } - - /** - * Revert a sandbox to a specific snapshot version ID - */ - public void revertSnapshot(Map params) - { - String sandbox = params.get("sandbox"); - String strVersion = params.get("version"); - if (sandbox != null && strVersion != null && strVersion.length() != 0) - { - try - { - getSandboxService().revertSnapshot(sandbox, Integer.valueOf(strVersion)); - FacesContext context = FacesContext.getCurrentInstance(); - - // if we get here, all was well - output friendly status message to the user - this.displayStatusMessage(context, - MessageFormat.format(Application.getMessage(context, MSG_REVERT_SANDBOX), - sandbox, - strVersion)); - } - catch (Throwable err) - { - err.printStackTrace(System.err); - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); - } - } - } - - /** - * Create web content from a specific Form via the User Sandbox 'Available Forms' panel - */ - public void createFormContent(ActionEvent event) - { - // setup the correct sandbox for the create action - this.setupSandboxAction(event); - - // pass form ID to the wizard - to be picked up in init() - Application.getWizardManager().setupParameters(event); - final FacesContext fc = FacesContext.getCurrentInstance(); - fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "wizard:createWebContent"); - } - - /** - * Perform a canned search for previously generated Form content - */ - public void searchFormContent(ActionEvent event) - { - // setup the correct sandbox for the canned search - this.setupSandboxAction(event); - - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - String formName = params.get(UIUserSandboxes.PARAM_FORM_NAME); - - StringBuilder query = new StringBuilder(256); - query.append("+ASPECT:\"").append(WCMAppModel.ASPECT_FORM_INSTANCE_DATA).append("\""); - query.append(" -ASPECT:\"").append(WCMAppModel.ASPECT_RENDITION).append("\""); - query.append(" +@").append(Repository.escapeQName(WCMAppModel.PROP_PARENT_FORM_NAME)) - .append(":\"").append(formName).append("\""); - FormSearchContext searchContext = new FormSearchContext(); - searchContext.setCannedQuery(query.toString(), formName); - - // set the search context - when the view is refreshed, this will be detected and - // the search results mode of the AVM Browse screen will be displayed - this.searchContext = searchContext; - - // set the search origin so that when the search is closed we know - // to go back to the website view and not the browse view (WCM-1007) - this.searchOrigin = "formContent"; - } - - /** - * Event handler that transitions a 'submitpending' task to effectively - * bypass the lauch date and immediately submit the items. - * - * @param event The event - */ - public void promotePendingSubmission(ActionEvent event) - { - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - String taskId = params.get("taskId"); - - UserTransaction tx = null; - try - { - FacesContext context = FacesContext.getCurrentInstance(); - tx = Repository.getUserTransaction(context, false); - tx.begin(); - - // transition the task - this.getWorkflowService().endTask(taskId, "launch"); - - // commit the transaction - tx.commit(); - } - catch (Throwable err) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - } - } - - /** - * Event handler that cancels a pending submission. - * - * @param event The event - */ - public void cancelPendingSubmission(ActionEvent event) - { - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - String workflowId = params.get("workflowInstanceId"); - - UserTransaction tx = null; - try - { - FacesContext context = FacesContext.getCurrentInstance(); - tx = Repository.getUserTransaction(context, false); - tx.begin(); - - // cancel the workflow - this.getWorkflowService().cancelWorkflow(workflowId); - - // commit the transaction - tx.commit(); - } - catch (Throwable err) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - } - } - - /** - * Update page size based on user selection - */ - public void updateFoldersPageSize(ActionEvent event) - { - try - { - int size = Integer.parseInt(this.pageSizeFoldersStr); - if (size >= 0) - { - this.pageSizeFolders = size; - } - else - { - // reset to known value if this occurs - this.pageSizeFoldersStr = Integer.toString(this.pageSizeFolders); - } - } - catch (NumberFormatException err) - { - // reset to known value if this occurs - this.pageSizeFoldersStr = Integer.toString(this.pageSizeFolders); - } - } - - /** - * Update page size based on user selection - */ - public void updateFilesPageSize(ActionEvent event) - { - try - { - int size = Integer.parseInt(this.pageSizeFilesStr); - if (size >= 0) - { - this.pageSizeFiles = size; - } - else - { - // reset to known value if this occurs - this.pageSizeFilesStr = Integer.toString(this.pageSizeFiles); - } - } - catch (NumberFormatException err) - { - // reset to known value if this occurs - this.pageSizeFilesStr = Integer.toString(this.pageSizeFiles); - } - } - - /** - * Perform a lucene search of the website - */ - public void searchWebsite(ActionEvent event) - { - if (this.websiteQuery != null && this.websiteQuery.length() != 0) - { - SearchContext searchContext = new SearchContext(); - - searchContext.setText(this.websiteQuery); - - // set the search context - when the view is refreshed, this will be detected and - // the search results mode of the AVM Browse screen will be displayed - this.searchContext = searchContext; - - resetFileFolderLists(); - - if (searchContext.buildQuery(getMinimumSearchLength()) == null) - { - // failed to build a valid query, the user probably did not enter the - // minimum text required to construct a valid search - Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), - BrowseBean.MSG_SEARCH_MINIMUM), new Object[] {getMinimumSearchLength()})); - } - } - } - - /** - * Action called to Close the search dialog by returning to the last viewed path - */ - public void closeSearch(ActionEvent event) - { - this.searchContext = null; - resetFileFolderLists(); - - if (this.searchOrigin != null) - { - // if the search was from elsewhere navigate back to the website view - this.searchOrigin = null; - - FacesContext fc = FacesContext.getCurrentInstance(); - fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "browseWebsite"); - } - } - - - // ------------------------------------------------------------------------------ - // Private helpers - - /** - * Display a status message to the user - * - * @param context - * @param msg Text message to display - */ - /*package*/ void displayStatusMessage(FacesContext context, String msg) - { - FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg); - context.addMessage(FORM_ID + ':' + COMPONENT_SANDBOXESPANEL, facesMsg); - } - - /*package*/ boolean isCurrentPathNull() - { - return (this.currentPath == null); - } - - /** - * Initialise default values from client configuration - */ - private void initFromClientConfig() - { - ConfigService config = Application.getConfigService(FacesContext.getCurrentInstance()); - ConfigElement wcmConfig = config.getGlobalConfig().getConfigElement("wcm"); - if (wcmConfig != null) - { - ConfigElement viewsConfig = wcmConfig.getChild("views"); - if (viewsConfig != null) - { - ConfigElement pageConfig = viewsConfig.getChild("browse-page-size"); - if (pageConfig != null) - { - String strPageSize = pageConfig.getValue(); - if (strPageSize != null) - { - int pageSize = Integer.valueOf(strPageSize.trim()); - setPageSizeFiles(pageSize); - setPageSizeFolders(pageSize); - } - } - } - } - } - - /** - * Update the breadcrumb with the clicked Folder path location - */ - private void updateUILocation(String path) - { - // fully update the entire breadcrumb path - i.e. do not append as may - // have navigated from deeper sub-folder (search results) - int sandboxPathLength = AVMUtil.getSandboxPath(path).length(); - String currentPath = path; - this.location.clear(); - while (currentPath.length() != sandboxPathLength) - { - this.location.add(new AVMBreadcrumbHandler(currentPath)); - currentPath = AVMNodeConverter.SplitBase(currentPath)[0]; - } - Collections.reverse(this.location); - - setCurrentPath(path); - } - - /** - * @return the path from the 'id' argument in the specified UIActionLink event - */ - private String getPathFromEventArgs(ActionEvent event) - { - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - return params.get("id"); - } - - /** - * @return Returns the minimum length of a valid search string. - */ - public static int getMinimumSearchLength() - { - return Application.getClientConfig(FacesContext.getCurrentInstance()).getSearchMinimum(); - } - - - // ------------------------------------------------------------------------------ - // IContextListener implementation - - /** - * @see org.alfresco.web.app.context.IContextListener#contextUpdated() - */ - public void contextUpdated() - { - resetFileFolderLists(); - - // clear webapp listing as we may have returned from the Create Webapp dialog - this.webapps = null; - } - - private void resetFileFolderLists() - { - if (this.foldersRichList != null) - { - this.foldersRichList.setValue(null); - } - if (this.filesRichList != null) - { - this.filesRichList.setValue(null); - } - - this.files = null; - this.folders = null; - - // reset the WebProject instance - as values may be cached that have now changed - this.webProject = null; - } - - /** - * @see org.alfresco.web.app.context.IContextListener#areaChanged() - */ - public void areaChanged() - { - // nothing to do - } - - /** - * @see org.alfresco.web.app.context.IContextListener#spaceChanged() - */ - public void spaceChanged() - { - // nothing to do - } - - - // ------------------------------------------------------------------------------ - // Inner classes - - /** - * Class to handle breadcrumb interaction for AVM page - */ - @SuppressWarnings("serial") - private class AVMBreadcrumbHandler implements IBreadcrumbHandler - { - private String path; - - AVMBreadcrumbHandler(String path) - { - this.path = path; - } - - @SuppressWarnings("unchecked") - public String navigationOutcome(UIBreadcrumb breadcrumb) - { - setCurrentPath(path); - setLocation((List)breadcrumb.getValue()); - return null; - } - - @Override - public String toString() - { - if (AVMUtil.buildSandboxRootPath(getSandbox()).equals(path)) - { - // don't display the 'root' webapps path as this will confuse users - // instead display which sandbox we are in - String label = username; - if (label == null) - { - label = Application.getMessage(FacesContext.getCurrentInstance(), MSG_SANDBOXSTAGING); - } - return label; - } - else - { - return path.substring(path.lastIndexOf('/') + 1); - } - } - } - - /** - * Wrap SearchContext to allow prebuilt canned Form query to be apply as search context - */ - public class FormSearchContext extends SearchContext - { - private String cannedQuery = null; - private String formName; - - public void setCannedQuery(String q, String formName) - { - this.cannedQuery = q; - this.formName = formName; - } - - @Override - public String buildQuery(int minimum) - { - return (this.cannedQuery == null ? super.buildQuery(minimum) : this.cannedQuery); - } - - @Override - public String getText() - { - return (this.cannedQuery == null ? - super.getText() : - MessageFormat.format( - Application.getMessage(FacesContext.getCurrentInstance(), MSG_SEARCH_FORM_CONTENT), - this.formName)); - } - } - - /** - * Revert All Conflicts - * - * @param event - */ - public void revertAllConflict(ActionEvent event) - { - final HtmlCommandButton button = (HtmlCommandButton) event.getComponent(); - - List params = button.getChildren(); - String userStorePath = null; - //String stagingStorePath = null; - for (Object obj : params) - { - UIParameter uip = (UIParameter) obj; - if (uip.getName().equals("userStorePath")) - { - userStorePath = (String) uip.getValue(); - } - /* - if (uip.getName().equals("stagingStorePath")) - { - stagingStore = (String) uip.getValue(); - } - */ - } - String[] storePath = WCMUtil.splitPath(userStorePath); - - List assets = sbService.listChanged(storePath[0], storePath[1], true); - - String sbStoreId = storePath[0]; - - List paths = new ArrayList(); - for (AssetInfo asset : assets) - { - if (asset.getDiffCode() == AVMDifference.CONFLICT) - { - if (! AVMWorkflowUtil.isInActiveWorkflow(sbStoreId, asset.getPath())) - { - paths.add(asset.getPath()); - } - } - } - - sbService.revertList(sbStoreId, paths); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/AVMDetailsBean.java b/source/java/org/alfresco/web/bean/wcm/AVMDetailsBean.java deleted file mode 100644 index 2c2975a04b..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/AVMDetailsBean.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (C) 2005-2012 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; - -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.dialog.NavigationSupport; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.ui.common.NodeListUtils; -import org.alfresco.web.ui.common.NodePropertyComparator; -import org.alfresco.web.ui.common.component.UIActionLink; -import org.alfresco.web.ui.common.component.UIPanel.ExpandedEvent; - -/** - * Base backing bean provided access to the details of an AVM item - * - * @author Kevin Roast - */ -public abstract class AVMDetailsBean extends BaseDialogBean implements NavigationSupport -{ - private static final long serialVersionUID = -4895328117656471680L; - - /** NodeService bean reference */ - transient private NodeService nodeService; - - /** AVM service bean reference */ - transient private AVMService avmService; - - /** AVMBrowseBean bean reference */ - protected AVMBrowseBean avmBrowseBean; - - protected Map panels = new HashMap(4, 1.0f); - - - // ------------------------------------------------------------------------------ - // Bean property getters and setters - - /** - * @param nodeService The NodeService to set - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - protected NodeService getNodeService() - { - if (nodeService == null) - { - nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); - } - return nodeService; - } - - /** - * @param avmService The AVMService to set. - */ - public void setAvmService(AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (avmService == null) - { - avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - return avmService; - } - - /** - * @param avmBrowseBean The AVMBrowseBean to set. - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @return Returns the panels expanded state map. - */ - public Map getPanels() - { - return this.panels; - } - - /** - * @param panels The panels expanded state map. - */ - public void setPanels(Map panels) - { - this.panels = panels; - } - - /** - * @return the AVM node to display the details for - */ - public abstract AVMNode getAvmNode(); - - /** - * Returns the Path of the current node - * - * @return The path - */ - public String getPath() - { - return getAvmNode().getPath(); - } - - /** - * Returns the name of the current node - * - * @return Name of the current node - */ - public String getName() - { - return getAvmNode().getName(); - } - - /** - * Return the Alfresco NodeRef URL for the current node - * - * @return the Alfresco NodeRef URL - */ - public String getNodeRefUrl() - { - return getAvmNode().getNodeRef().toString(); - } - - /** - * @return if we are currently within the context of a Browse list (otherwise we are - * probably looking at an item in the Modified File list) - */ - public boolean getIsBrowseList() - { - return !this.avmBrowseBean.isCurrentPathNull(); - } - - /** - * @return the sibling nodes for this item - */ - protected abstract List getNodes(); - - - // ------------------------------------------------------------------------------ - // Action event handlers - - /** - * Save the state of the panel that was expanded/collapsed - */ - public void expandPanel(ActionEvent event) - { - if (event instanceof ExpandedEvent) - { - String id = event.getComponent().getId(); - this.panels.put(id, ((ExpandedEvent)event).State); - } - } - - /** - * Navigates to next item in the list of items for the current folder - */ - public void nextItem(ActionEvent event) - { - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - String path = params.get("id"); - if (path != null && path.length() != 0) - { - this.avmBrowseBean.setupContentAction(getCurrentItemId(), false); - List nodes = getNodes(); - if (nodes.size() > 1) - { - String currentSortColumn; - boolean currentSortDescending; - if (nodes.get(0).isFile()) - { - currentSortColumn = this.avmBrowseBean.getFilesRichList().getCurrentSortColumn(); - currentSortDescending = this.avmBrowseBean.getFilesRichList().isCurrentSortDescending(); - } - else - { - currentSortColumn = this.avmBrowseBean.getFoldersRichList().getCurrentSortColumn(); - currentSortDescending = this.avmBrowseBean.getFoldersRichList().isCurrentSortDescending(); - } - - if (currentSortColumn != null) - { - Collections.sort(nodes, new NodePropertyComparator(currentSortColumn, !currentSortDescending)); - } - - AVMNode next = (AVMNode) NodeListUtils.nextItem(nodes, path); - this.avmBrowseBean.setupContentAction(next.getPath(), false); - } - } - } - - /** - * Navigates to the previous item in the list of items for the current folder - */ - public void previousItem(ActionEvent event) - { - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - String path = params.get("id"); - if (path != null && path.length() != 0) - { - this.avmBrowseBean.setupContentAction(getCurrentItemId(), false); - List nodes = getNodes(); - if (nodes.size() > 1) - { - String currentSortColumn; - boolean currentSortDescending; - if (nodes.get(0).isFile()) - { - currentSortColumn = this.avmBrowseBean.getFilesRichList().getCurrentSortColumn(); - currentSortDescending = this.avmBrowseBean.getFilesRichList().isCurrentSortDescending(); - } - else - { - currentSortColumn = this.avmBrowseBean.getFoldersRichList().getCurrentSortColumn(); - currentSortDescending = this.avmBrowseBean.getFoldersRichList().isCurrentSortDescending(); - } - - if (currentSortColumn != null) - { - Collections.sort(nodes, new NodePropertyComparator(currentSortColumn, !currentSortDescending)); - } - - AVMNode previous = (AVMNode) NodeListUtils.previousItem(nodes, path); - this.avmBrowseBean.setupContentAction(previous.getPath(), false); - } - } - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java b/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java deleted file mode 100644 index 0c75c9e925..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.File; -import java.text.MessageFormat; -import java.util.List; - -import javax.faces.context.FacesContext; -import javax.transaction.UserTransaction; - -import org.alfresco.model.WCMAppModel; -import org.alfresco.repo.web.scripts.FileTypeImageUtils; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.web.app.AlfrescoNavigationHandler; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.FileUploadBean; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.forms.FormInstanceData; -import org.alfresco.web.forms.FormNotFoundException; -import org.alfresco.web.forms.FormsService; -import org.alfresco.web.ui.common.ReportedException; -import org.alfresco.web.ui.common.Utils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Bean backing the edit pages for a AVM node content. - * - * @author Ariel Backenroth - * @author Kevin Roast - */ -public class AVMEditBean extends BaseDialogBean -{ - private static final long serialVersionUID = -6662866123545412556L; - - private static final Log LOGGER = LogFactory.getLog(AVMEditBean.class); - - private static final String MSG_ERROR_UPDATE = "error_update"; - private static final String MSG_UPLOAD_SUCCESS = "file_upload_success"; - private static final String MSG_APPLY_RSS_FEED= "apply_rss_feed"; - private static final String MSG_UPDATE = "update"; - private final static String MSG_LEFT_QUOTE = "left_qoute"; - private final static String MSG_RIGHT_QUOTE = "right_quote"; - - private File file = null; - private String fileName = null; - - transient private AVMService avmService; - protected AVMBrowseBean avmBrowseBean; - transient private FormsService formsService; - - // ------------------------------------------------------------------------------ - // Bean property getters and setters - - /** - * @param avmService The AVMService to set. - */ - public void setAvmService(final AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (avmService == null) - { - avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - return avmService; - } - - /** - * @param avmBrowseBean The AVMBrowseBean to set. - */ - public void setAvmBrowseBean(final AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @param formsService The FormsService to set. - */ - public void setFormsService(final FormsService formsService) - { - this.formsService = formsService; - } - - protected FormsService getFormsService() - { - if (formsService == null) - { - formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); - } - return formsService; - } - - - /** - * @return Returns the current AVM node context. - */ - public AVMNode getAvmNode() - { - return this.avmBrowseBean.getAvmActionNode(); - } - - /** - * @return Large file icon for current AVM node - */ - public String getFileType32() - { - return FileTypeImageUtils.getFileTypeImage(getAvmNode().getName(), false); - } - - /** - * @return Small file icon for current AVM node - */ - public String getFileType16() - { - return FileTypeImageUtils.getFileTypeImage(getAvmNode().getName(), true); - } - - /** - * @return Returns the name of the file - */ - public String getFileName() - { - // try and retrieve the file and filename from the file upload bean - // representing the file we previously uploaded. - final FacesContext ctx = FacesContext.getCurrentInstance(); - final FileUploadBean fileBean = (FileUploadBean) - ctx.getExternalContext().getSessionMap().get(FileUploadBean.FILE_UPLOAD_BEAN_NAME); - if (fileBean != null) - { - this.file = fileBean.getFile(); - this.fileName = fileBean.getFileName(); - } - - return this.fileName; - } - - /** - * @return Returns the message to display when a file has been uploaded - */ - public String getFileUploadSuccessMsg() - { - final String msg = Application.getMessage(FacesContext.getCurrentInstance(), MSG_UPLOAD_SUCCESS); - return MessageFormat.format(msg, new Object[] { Utils.encode(this.getFileName()) }); - } - - // ------------------------------------------------------------------------------ - // Action event handlers - - /** - * Action called upon completion of the Update File page - */ - public String updateFileOK() - { - String outcome = null; - - UserTransaction tx = null; - - AVMNode node = getAvmNode(); - if (node != null && this.getFileName() != null) - { - try - { - FacesContext context = FacesContext.getCurrentInstance(); - tx = Repository.getUserTransaction(context); - tx.begin(); - - // get an updating writer that we can use to modify the content on the current node - final ContentWriter writer = this.getAvmService().getContentWriter(node.getPath(), true); - - // also update the mime type in case a different type of file is uploaded - String mimeType = Repository.getMimeTypeForFileName(context, this.fileName); - writer.setMimetype(mimeType); - writer.putContent(this.file); - - // commit the transaction - tx.commit(); - if (this.getAvmService().hasAspect(-1, node.getPath(), WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) - { - this.regenerateRenditions(); - } - // Possibly notify virt server - AVMUtil.updateVServerWebapp(node.getPath(), false); - - // clear action context - resetState(); - - outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; - } - catch (Throwable err) - { - // rollback the transaction - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - Utils.addErrorMessage(Application.getMessage( - FacesContext.getCurrentInstance(), MSG_ERROR_UPDATE) + err.getMessage(), err); - } - } - - return outcome; - } - - /** - * Deals with the cancel button being pressed on the upload file page - */ - public String cancel() - { - // reset the state - this.resetState(); - - return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; - } - - private void resetState() - { - // clean up and clear action context - removeUploadedFile(); - } - - /** - * Clear form state and upload file bean - */ - public void removeUploadedFile() - { - // delete the temporary file we uploaded earlier - if (this.file != null) - { - this.file.delete(); - } - - this.file = null; - this.fileName = null; - - // remove the file upload bean from the session - FacesContext ctx = FacesContext.getCurrentInstance(); - ctx.getExternalContext().getSessionMap().remove(FileUploadBean.FILE_UPLOAD_BEAN_NAME); - } - - private void regenerateRenditions() - throws FormNotFoundException - { - final String avmPath = this.getAvmNode().getPath(); - final FormInstanceData fid = this.getFormsService().getFormInstanceData(-1, avmPath); - final List result = fid.regenerateRenditions(); - for (FormInstanceData.RegenerateResult rr : result) - { - if (rr.getException() != null) - { - Utils.addErrorMessage("error regenerating rendition using " + rr.getRenderingEngineTemplate().getName() + - ": " + rr.getException().getMessage(), - rr.getException()); - } - } - } - - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - return updateFileOK(); - } - - @Override - public String getContainerTitle() - { - FacesContext fc = FacesContext.getCurrentInstance(); - return Application.getMessage(fc, MSG_UPDATE) + " " + Application.getMessage(fc, MSG_LEFT_QUOTE) + getAvmNode().getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE); - } - - @Override - public boolean getFinishButtonDisabled() - { - return getFileName() == null; - } - - @Override - public String getFinishButtonLabel() - { - // TODO Auto-generated method stub - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_UPDATE); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/AVMNode.java b/source/java/org/alfresco/web/bean/wcm/AVMNode.java deleted file mode 100644 index 871054070f..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/AVMNode.java +++ /dev/null @@ -1,410 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.WCMModel; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.domain.PropertyValue; -import org.alfresco.repo.tenant.TenantService; -import org.alfresco.repo.web.scripts.FileTypeImageUtils; -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.service.cmr.avm.LayeringDescriptor; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.Path; -import org.alfresco.service.cmr.repository.Path.Element; -import org.alfresco.service.cmr.workflow.WorkflowTask; -import org.alfresco.service.namespace.QName; -import org.alfresco.wcm.asset.AssetInfo; -import org.alfresco.wcm.asset.AssetInfoImpl; -import org.alfresco.wcm.util.WCMUtil; -import org.alfresco.web.bean.BrowseBean; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.NodePropertyResolver; - -/** - * Node class representing an AVM specific Node. - * - * Handles AVM related notions such as Path and Version. Provides the usual properties and - * property resolving functions, and appropriate method overrides for the AVM world. - * - * @author Kevin Roast - */ -public class AVMNode extends Node implements Map -{ - private static final long serialVersionUID = 2200295347489543757L; - - public final static NodePropertyResolver RESOLVER_PREVIEW_URL = - new NodePropertyResolver() - { - private static final long serialVersionUID = -8437274476137672895L; - - public Object get(final Node node) - { - if (! (node instanceof AVMNode)) - { - return null; - } - final String storeId = AVMUtil.getStoreName(node.getPath()); - final String assetPath = AVMUtil.getStoreRelativePath(node.getPath()); - return AVMUtil.getPreviewURI(storeId, assetPath); - } - }; - - public final static NodePropertyResolver RESOLVER_SANDBOX_RELATIVE_PATH = - new NodePropertyResolver() - { - private static final long serialVersionUID = -2367701285830581225L; - - public Object get(final Node node) - { - if (! (node instanceof AVMNode)) - { - return null; - } - String s = node.getPath(); - s = AVMUtil.getSandboxRelativePath(s); - final Path result = new Path(); - final String[] parts = s.split("/"); - for (int i = 1; i < parts.length; i++) - { - if (parts[i].length() != 0) - { - final String s2 = parts[i]; - result.append(new Path.Element() - { - public String getElementString() { return s2; } - - @Override - public Element getBaseNameElement(TenantService tenantService) - { - return this; - } - }); - } - } - return result; - } - }; - - public final static NodePropertyResolver RESOLVER_FILE_TYPE_16 = - new NodePropertyResolver() - { - private static final long serialVersionUID = 4300079423348609858L; - - public Object get(final Node node) - { - if (! (node instanceof AVMNode)) - { - return null; - } - if (((AVMNode)node).isDirectory()) - { - return "/images/icons/" + BrowseBean.SPACE_SMALL_DEFAULT + ".gif"; - } - else - { - return FileTypeImageUtils.getFileTypeImage(node.getName(), true); - } - } - }; - - public final static NodePropertyResolver RESOLVER_DISPLAY_PATH = - new NodePropertyResolver() - { - private static final long serialVersionUID = 368552730555134975L; - - public Object get(final Node node) - { - if (! (node instanceof AVMNode)) - { - return null; - } - - // the display path is the parent path to the node - String parentPath = AVMNodeConverter.SplitBase(node.getPath())[0]; - return AVMUtil.getSandboxRelativePath(parentPath); - } - }; - - public final static NodePropertyResolver RESOLVER_PARENT_PATH = - new NodePropertyResolver() - { - private static final long serialVersionUID = -798036430912409497L; - - public Object get(final Node node) - { - if (! (node instanceof AVMNode)) - { - return null; - } - - return AVMNodeConverter.SplitBase(node.getPath())[0]; - } - }; - - private final AVMNodeDescriptor avmRef; - private LayeringDescriptor layeringDesc; - private final int version; - private final boolean deleted; - private Boolean workflowInFlight; - - public AVMNode(final AssetInfo asset) - { - super(AVMNodeConverter.ToNodeRef(-1, asset.getAvmPath())); - - // TODO - refactor !! - this.avmRef = ((AssetInfoImpl)asset).getAVMNodeDescriptor(); - - this.version = -1; // TODO: always -1 for now... - this.id = asset.getAvmPath(); - this.deleted = asset.isDeleted(); - } - - /** - * Constructor - * - * @param avmRef The AVMNodeDescriptor that describes this node - */ - public AVMNode(final AVMNodeDescriptor avmRef) - { - super(AVMNodeConverter.ToNodeRef(-1, avmRef.getPath())); - this.avmRef = avmRef; - this.version = -1; // TODO: always -1 for now... - this.id = avmRef.getPath(); - this.deleted = avmRef.isDeleted(); - } - - @Override - public String getPath() - { - return this.avmRef.getPath(); - } - - public final AVMNodeDescriptor getDescriptor() - { - return avmRef; - } - - public int getVersion() - { - return this.version; - } - - @Override - public String getName() - { - return this.avmRef.getName(); - } - - @Override - public QName getType() - { - if (this.type == null) - { - if (this.deleted == false) - { - this.type = getServiceRegistry().getNodeService().getType(this.nodeRef); - } - else - { - this.type = avmRef.isDeletedDirectory() ? WCMModel.TYPE_AVM_FOLDER : WCMModel.TYPE_AVM_CONTENT; - } - } - - return type; - } - - public final boolean isDirectory() - { - return this.avmRef.isDirectory() || this.avmRef.isDeletedDirectory(); - } - - public final boolean isFile() - { - return this.avmRef.isFile() || this.avmRef.isDeletedFile(); - } - - public final boolean isDeleted() - { - return this.avmRef.isDeleted(); - } - - public final boolean isModified() - { - if (this.layeringDesc == null) - { - this.layeringDesc = getServiceRegistry().getAVMService().getLayeringInfo(this.version, this.id); - } - return !this.layeringDesc.isBackground(); - } - - public final boolean isInActiveWorkflow(String sandbox) - { - if (this.workflowInFlight == null) - { - if (!this.isModified()) - { - this.workflowInFlight = false; - } - else - { - this.workflowInFlight = AVMWorkflowUtil.isInActiveWorkflow(sandbox, this.getDescriptor()); - } - } - return this.workflowInFlight; - } - - /** - * @return All the properties known about this node. - */ - public Map getProperties() - { - if (!this.propsRetrieved) - { - if (!this.deleted) - { - Map props = getServiceRegistry().getAVMService().getNodeProperties(this.version, this.id); - for (QName qname: props.keySet()) - { - PropertyValue propValue = props.get(qname); - this.properties.put(qname.toString(), propValue.getValue(DataTypeDefinition.ANY)); - } - } - - this.properties.put("id", this.id); - this.properties.put("nodeRef", this.nodeRef); - this.properties.put("size", this.avmRef.getLength()); - this.properties.put("name", this.avmRef.getName()); - this.properties.put("created", this.avmRef.getCreateDate()); - this.properties.put("modified", this.avmRef.getModDate()); - this.properties.put("creator", this.avmRef.getCreator()); - this.properties.put("modifier", this.avmRef.getLastModifier()); - this.properties.put("deleted", this.deleted); - - this.propsRetrieved = true; - } - - return this.properties; - } - - - // ------------------------------------------------------------------------------------ - // Map implementation - allows the Node bean to be accessed using JSF expression syntax - - /** - * @see java.util.Map#clear() - */ - public void clear() - { - getProperties().clear(); - } - - /** - * @see java.util.Map#containsKey(java.lang.Object) - */ - public boolean containsKey(Object key) - { - return getProperties().containsKey(key); - } - - /** - * @see java.util.Map#containsValue(java.lang.Object) - */ - public boolean containsValue(Object value) - { - return getProperties().containsKey(value); - } - - /** - * @see java.util.Map#entrySet() - */ - public Set entrySet() - { - return getProperties().entrySet(); - } - - /** - * @see java.util.Map#get(java.lang.Object) - */ - public Object get(Object key) - { - return getProperties().get(key); - } - - /** - * @see java.util.Map#isEmpty() - */ - public boolean isEmpty() - { - return getProperties().isEmpty(); - } - - /** - * @see java.util.Map#keySet() - */ - public Set keySet() - { - return getProperties().keySet(); - } - - /** - * @see java.util.Map#put(java.lang.Object, java.lang.Object) - */ - public Object put(String key, Object value) - { - return getProperties().put(key, value); - } - - /** - * @see java.util.Map#putAll(java.util.Map) - */ - public void putAll(Map t) - { - getProperties().putAll(t); - } - - /** - * @see java.util.Map#remove(java.lang.Object) - */ - public Object remove(Object key) - { - return getProperties().remove(key); - } - - /** - * @see java.util.Map#size() - */ - public int size() - { - return getProperties().size(); - } - - /** - * @see java.util.Map#values() - */ - public Collection values() - { - return getProperties().values(); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/AVMUtil.java b/source/java/org/alfresco/web/bean/wcm/AVMUtil.java deleted file mode 100644 index ee454107fd..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/AVMUtil.java +++ /dev/null @@ -1,520 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.Stack; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.faces.context.FacesContext; - -import org.springframework.extensions.config.ConfigElement; -import org.springframework.extensions.config.ConfigService; -import org.alfresco.config.JNDIConstants; -import org.alfresco.mbeans.VirtServerRegistry; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.service.cmr.avm.AVMNotFoundException; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.wcm.util.WCMUtil; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.wcm.preview.PreviewURIService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.jsf.FacesContextUtils; - -/** - * Helper methods and constants related to AVM directories, paths and store name manipulation. - * - * TODO refactor ... - * - * @author Ariel Backenroth - * @author Kevin Roast - */ -public final class AVMUtil extends WCMUtil -{ - private static Log logger = LogFactory.getLog(AVMUtil.class); - - ///////////////////////////////////////////////////////////////////////////// - - public static enum PathRelation - { - SANDBOX_RELATIVE - { - @Override - protected Pattern pattern() - { - return AVMUtil.SANDBOX_RELATIVE_PATH_PATTERN; - } - }, - WEBAPP_RELATIVE - { - @Override - protected Pattern pattern() - { - return AVMUtil.WEBAPP_RELATIVE_PATH_PATTERN; - } - }; - - protected abstract Pattern pattern(); - } - - ///////////////////////////////////////////////////////////////////////////// - - public static String getStoreName(final String avmPath) - { - return WCMUtil.getSandboxStoreId(avmPath); - } - - public static boolean isPreviewStore(final String storeName) - { - return WCMUtil.isPreviewStore(storeName); - } - - public static boolean isWorkflowStore(String storeName) - { - return WCMUtil.isWorkflowStore(storeName); - } - - public static boolean isUserStore(String storeName) - { - return WCMUtil.isUserStore(storeName); - } - - public static boolean isMainStore(String storeName) - { - return WCMUtil.isStagingStore(storeName); - } - - public static String getUserName(String storeName) - { - return WCMUtil.getUserName(storeName); - } - - public static String getStoreId(final String storeName) - { - return WCMUtil.getWebProjectStoreId(storeName); - } - - public static String getCorrespondingMainStoreName(final String storeName) - { - return WCMUtil.getCorrespondingMainStoreName(storeName); - } - - public static String getCorrespondingPreviewStoreName(final String storeName) - { - return WCMUtil.getCorrespondingPreviewStoreName(storeName); - } - - public static String getCorrespondingPathInMainStore(final String avmPath) - { - return WCMUtil.getCorrespondingPathInMainStore(avmPath); - } - - public static String getCorrespondingPathInPreviewStore(final String avmPath) - { - return WCMUtil.getCorrespondingPathInPreviewStore(avmPath); - } - - public static String getCorrespondingPath(final String avmPath, final String otherStore) - { - return WCMUtil.getCorrespondingPath(avmPath, otherStore); - } - - /** - * Returns the number of seconds between each call back to the server to - * obtain the latest status of an in progress deployment. - *

- * This value is read from the <wcm> config section in - * web-client-config-wcm.xml - *

- * - * @return Number of seconds between each call to the server (in seconds). - * The default is 2. - */ - public static int getRemoteDeploymentPollingFrequency() - { - int pollFreq = 2; - - ConfigElement deploymentConfig = getDeploymentConfig(); - if (deploymentConfig != null) - { - ConfigElement elem = deploymentConfig.getChild("progress-polling-frequency"); - if (elem != null) - { - try - { - int value = Integer.parseInt(elem.getValue()); - if (value > 0) - { - pollFreq = value; - } - } - catch (NumberFormatException nfe) - { - // do nothing, just use the default - } - } - } - - return pollFreq; - } - - /** - * Returns the number of seconds between each call back to the server to - * obtain the latest status of a link validation check. - *

- * This value is read from the <wcm> config section in - * web-client-config-wcm.xml - *

- * - * @return Number of seconds between each call to the server (in seconds). - * The default is 2. - */ - public static int getLinkValidationPollingFrequency() - { - int pollFreq = 2; - - ConfigElement linkMngmtConfig = getLinksManagementConfig(); - if (linkMngmtConfig != null) - { - ConfigElement elem = linkMngmtConfig.getChild("progress-polling-frequency"); - if (elem != null) - { - try - { - int value = Integer.parseInt(elem.getValue()); - if (value > 0) - { - pollFreq = value; - } - } - catch (NumberFormatException nfe) - { - // do nothing, just use the default - } - } - } - - return pollFreq; - } - - public static String buildStagingStoreName(final String storeId) - { - return WCMUtil.buildStagingStoreName(storeId); - } - - public static String buildStagingPreviewStoreName(final String storeId) - { - return WCMUtil.buildStagingPreviewStoreName(storeId); - } - - public static String buildUserMainStoreName(final String storeId, - final String username) - { - return WCMUtil.buildUserMainStoreName(storeId, username); - } - - public static String buildUserPreviewStoreName(final String storeId, - final String username) - { - return WCMUtil.buildUserPreviewStoreName(storeId, username); - } - - public static String buildWorkflowMainStoreName(final String storeId, - final String workflowId) - { - return WCMUtil.buildWorkflowMainStoreName(storeId, workflowId); - } - - public static String buildWorkflowPreviewStoreName(final String storeId, - final String workflowId) - { - return WCMUtil.buildWorkflowPreviewStoreName(storeId, workflowId); - } - - public static String buildStoreRootPath(final String storeName) - { - return WCMUtil.buildStoreRootPath(storeName); - } - - public static String buildSandboxRootPath(final String storeName) - { - return WCMUtil.buildSandboxRootPath(storeName); - } - - public static String buildStoreWebappPath(final String storeName, String webapp) - { - return WCMUtil.buildStoreWebappPath(storeName, webapp); - } - - public static String buildWebappUrl(final String avmPath) - { - if (avmPath == null || avmPath.length() == 0) - { - throw new IllegalArgumentException("AVM path is mandatory."); - } - return AVMUtil.buildWebappUrl(AVMUtil.getStoreName(avmPath), - AVMUtil.getWebapp(avmPath)); - } - - public static String buildWebappUrl(final String store, final String webapp) - { - if (webapp == null || webapp.length() == 0) - { - throw new IllegalArgumentException("Webapp name is mandatory."); - } - return (webapp.equals(DIR_ROOT) - ? getPreviewURI(store) - : getPreviewURI(store) + '/' + webapp); - } - - public static String getPreviewURI(String storeNameOrAvmPath) - { - if (storeNameOrAvmPath == null || storeNameOrAvmPath.length() == 0) - { - throw new IllegalArgumentException("AVM store name or absolute path is mandatory."); - } - final String[] s = storeNameOrAvmPath.split(WCMUtil.AVM_STORE_SEPARATOR); - if (s.length == 1) - { - return getPreviewURI(s[0], null); - } - if (s.length != 2) - { - throw new IllegalArgumentException("expected exactly one ':' in " + storeNameOrAvmPath); - } - return getPreviewURI(s[0], s[1]); - } - - public static String getPreviewURI(String storeId, String assetPath) - { - if (! deprecatedPreviewURIGeneratorChecked) - { - if (deprecatedPreviewURIGenerator == null) - { - // backwards compatibility - will hide new implementation, until custom providers/context are migrated - WebApplicationContext wac = FacesContextUtils.getRequiredWebApplicationContext( - FacesContext.getCurrentInstance()); - - if (wac.containsBean(SPRING_BEAN_NAME_PREVIEW_URI_SERVICE)) - { - // if the bean is present retrieve it - deprecatedPreviewURIGenerator = (PreviewURIService)wac.getBean(SPRING_BEAN_NAME_PREVIEW_URI_SERVICE, - PreviewURIService.class); - - logger.warn("Found deprecated '"+SPRING_BEAN_NAME_PREVIEW_URI_SERVICE+"' config - which will be used instead of new 'WCMPreviewURIService' until migrated (changing web project preview provider will have no effect)"); - } - } - - deprecatedPreviewURIGeneratorChecked = true; - } - - if (deprecatedPreviewURIGenerator != null) - { - return deprecatedPreviewURIGenerator.getPreviewURI(storeId, assetPath); - } - - return getPreviewURIService().getPreviewURI(storeId, assetPath); - } - - /** - * Converts the provided path to an absolute path within the avm. - * - * @param parentAVMPath used as the parent path if the provided path - * is relative, otherwise used to extract the parent path portion up until - * the webapp directory. - * @param path a path relative to the parentAVMPath path, or if it is - * absolute, it is relative to the sandbox used in the parentAVMPath. - * - * @return an absolute path within the avm using the paths provided. - */ - public static String buildPath(final String parentAVMPath, - final String path, - final PathRelation relation) - { - String parent = parentAVMPath; - if (path == null || path.length() == 0 || ".".equals(path) || "./".equals(path)) - { - return parent; - } - - if (path.charAt(0) == '/') - { - final Matcher m = relation.pattern().matcher(parent); - if (m.matches()) - { - parent = m.group(1); - } - } - else if (parent.charAt(parent.length() - 1) != '/') - { - parent = parent + '/'; - } - - return parent + path; - } - - public static String getStoreRelativePath(final String absoluteAVMPath) - { - return WCMUtil.getStoreRelativePath(absoluteAVMPath); - } - - public static String getWebappRelativePath(final String absoluteAVMPath) - { - return WCMUtil.getWebappRelativePath(absoluteAVMPath); - } - - public static String getWebapp(final String absoluteAVMPath) - { - return WCMUtil.getWebapp(absoluteAVMPath); - } - - public static String getWebappPath(final String absoluteAVMPath) - { - return WCMUtil.getWebappPath(absoluteAVMPath); - } - - public static String getSandboxRelativePath(final String absoluteAVMPath) - { - return WCMUtil.getSandboxRelativePath(absoluteAVMPath); - } - - public static String getSandboxPath(final String absoluteAVMPath) - { - return WCMUtil.getSandboxPath(absoluteAVMPath); - } - - /** - * Creates all directories for a path if they do not already exist. - */ - public static void makeAllDirectories(final String avmDirectoryPath) - { - final AVMService avmService = getAVMService(); - // LOGGER.debug("mkdir -p " + avmDirectoryPath); - String s = avmDirectoryPath; - final Stack dirNames = new Stack(); - while (s != null) - { - try - { - if (avmService.lookup(-1, s) != null) - { - // LOGGER.debug("path " + s + " exists"); - break; - } - } - catch (AVMNotFoundException avmfe) - { - } - final String[] sb = AVMNodeConverter.SplitBase(s); - s = sb[0]; - // LOGGER.debug("pushing " + sb[1]); - dirNames.push(sb); - } - - while (!dirNames.isEmpty()) - { - final String[] sb = dirNames.pop(); - // LOGGER.debug("creating " + sb[1] + " in " + sb[0]); - avmService.createDirectory(sb[0], sb[1]); - } - } - - public static void updateVServerWebapp(String path, boolean force) - { - WCMUtil.updateVServerWebapp(getVirtServerRegistry(), path, force); - } - - public static void removeAllVServerWebapps(String path, boolean force) - { - WCMUtil.removeAllVServerWebapps(getVirtServerRegistry(), path, force); - } - - public static void removeVServerWebapp(String path, boolean force) - { - WCMUtil.removeVServerWebapp(getVirtServerRegistry(), path, force); - } - - private static VirtServerRegistry getVirtServerRegistry() - { - return Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getVirtServerRegistry(); - } - - private static AVMService getAVMService() - { - return Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - - private static org.alfresco.wcm.preview.PreviewURIService getPreviewURIService() - { - return Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPreviewURIService(); - } - - private static ConfigElement getDeploymentConfig() - { - if ((deploymentConfig == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) - { - ConfigService cfgService = Application.getConfigService(FacesContext.getCurrentInstance()); - ConfigElement wcmCfg = cfgService.getGlobalConfig().getConfigElement("wcm"); - if (wcmCfg != null) - { - deploymentConfig = wcmCfg.getChild("deployment"); - } - } - - return deploymentConfig; - } - - private static ConfigElement getLinksManagementConfig() - { - if ((linksManagementConfig == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) - { - ConfigService cfgService = Application.getConfigService(FacesContext.getCurrentInstance()); - ConfigElement wcmCfg = cfgService.getGlobalConfig().getConfigElement("wcm"); - if (wcmCfg != null) - { - linksManagementConfig = wcmCfg.getChild("links-management"); - } - } - - return linksManagementConfig; - } - - // pattern for absolute AVM Path - //private final static Pattern STORE_RELATIVE_PATH_PATTERN = - // Pattern.compile("[^:]+:(.+)"); - - private final static Pattern WEBAPP_RELATIVE_PATH_PATTERN = - Pattern.compile("([^:]+:/" + JNDIConstants.DIR_DEFAULT_WWW + - "/" + JNDIConstants.DIR_DEFAULT_APPBASE + "/([^/]+))(.*)"); - - private final static Pattern SANDBOX_RELATIVE_PATH_PATTERN = - Pattern.compile("([^:]+:/" + JNDIConstants.DIR_DEFAULT_WWW + - "/" + JNDIConstants.DIR_DEFAULT_APPBASE + ")(.*)"); - - private static ConfigElement deploymentConfig = null; - private static ConfigElement linksManagementConfig = null; - - // deprecated - private final static String SPRING_BEAN_NAME_PREVIEW_URI_SERVICE = "PreviewURIService"; - private static PreviewURIService deprecatedPreviewURIGenerator = null; - private static boolean deprecatedPreviewURIGeneratorChecked = false; -} diff --git a/source/java/org/alfresco/web/bean/wcm/AVMWorkflowUtil.java b/source/java/org/alfresco/web/bean/wcm/AVMWorkflowUtil.java deleted file mode 100644 index 80c2dbe5f2..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/AVMWorkflowUtil.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - -import javax.faces.context.FacesContext; - -import org.springframework.extensions.config.ConfigElement; -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.WCMAppModel; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.avmsync.AVMSyncService; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.ContentService; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.workflow.WorkflowDefinition; -import org.alfresco.service.cmr.workflow.WorkflowService; -import org.alfresco.service.cmr.workflow.WorkflowTask; -import org.alfresco.wcm.util.WCMUtil; -import org.alfresco.wcm.util.WCMWorkflowUtil; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.workflow.WorkflowUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * AVM Specific workflow related helper methods. - * - * @author Ariel Backenroth - * @author Kevin Roast - */ -public class AVMWorkflowUtil extends WorkflowUtil -{ - private static final Log logger = LogFactory.getLog(AVMWorkflowUtil.class); - - private static final String PATH_CACHE = "_alf_sandbox_path_cache"; - - // cached configured lists - private static List configuredWorkflowDefs = null; - - /** - * Serialize the workflow params to a content stream - * - * @param params Serializable workflow params - * @param workflowRef The noderef to write the property too - */ - public static void serializeWorkflowParams(Serializable params, NodeRef workflowRef) - { - try - { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(params); - oos.close(); - // write the serialized Map as a binary content stream - like database blob! - ContentService cs = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentService(); - ContentWriter writer = cs.getWriter(workflowRef, - WCMAppModel.PROP_WORKFLOW_DEFAULT_PROPERTIES, - true); - writer.setMimetype(MimetypeMap.MIMETYPE_BINARY); - writer.putContent(new ByteArrayInputStream(baos.toByteArray())); - } - catch (IOException ioerr) - { - throw new AlfrescoRuntimeException("Unable to serialize workflow default parameters: " + ioerr.getMessage()); - } - } - - /** - * Deserialize the default workflow params from a content stream - * - * @param workflowRef The noderef to write the property too - * - * @return Serializable workflow params - */ - public static Serializable deserializeWorkflowParams(NodeRef workflowRef) - { - try - { - // restore the serialized Map from a binary content stream - like database blob! - Serializable params = null; - ContentService cs = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentService(); - ContentReader reader = cs.getReader(workflowRef, WCMAppModel.PROP_WORKFLOW_DEFAULT_PROPERTIES); - if (reader != null) - { - ObjectInputStream ois = new ObjectInputStream(reader.getContentInputStream()); - params = (Serializable)ois.readObject(); - ois.close(); - } - return params; - } - catch (IOException ioErr) - { - throw new AlfrescoRuntimeException("Unable to deserialize workflow default parameters: " + ioErr.getMessage()); - } - catch (ClassNotFoundException classErr) - { - throw new AlfrescoRuntimeException("Unable to deserialize workflow default parameters: " + classErr.getMessage()); - } - } - - /** - * @return the list of WorkflowDefinition objects as configured in the wcm/workflows client config. - */ - public static List getConfiguredWorkflows() - { - if ((configuredWorkflowDefs == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) - { - FacesContext fc = FacesContext.getCurrentInstance(); - List defs = Collections.emptyList(); - ConfigElement config = Application.getConfigService(fc).getGlobalConfig().getConfigElement("wcm"); - if (config == null) - { - logger.warn("WARNING: Unable to find 'wcm' config element definition."); - } - else - { - ConfigElement workflowConfig = config.getChild("workflows"); - if (workflowConfig == null) - { - logger.warn("WARNING: Unable to find WCM 'workflows' config element definition."); - } - else - { - WorkflowService service = Repository.getServiceRegistry(fc).getWorkflowService(); - StringTokenizer t = new StringTokenizer(workflowConfig.getValue().trim(), ", "); - defs = new ArrayList(t.countTokens()); - while (t.hasMoreTokens()) - { - String wfName = t.nextToken(); - WorkflowDefinition def = service.getDefinitionByName("jbpm$" + wfName); - if (def != null) - { - defs.add(def); - } - else - { - logger.warn("WARNING: Cannot find WCM workflow def for configured definition name: " + wfName); - } - } - } - } - configuredWorkflowDefs = defs; - } - return configuredWorkflowDefs; - } - - /** - * @deprecated since 3.2 - */ - public static List getAssociatedTasksForSandbox(final String storeName) - { - FacesContext fc = FacesContext.getCurrentInstance(); - WorkflowService workflowService = Repository.getServiceRegistry(fc).getWorkflowService(); - return WCMWorkflowUtil.getAssociatedTasksForSandbox(workflowService, storeName); - } - - /** - * @deprecated since 3.2 - */ - public static List getAssociatedTasksForNode(AVMNodeDescriptor node, List tasks) - { - FacesContext fc = FacesContext.getCurrentInstance(); - AVMService avmService = Repository.getServiceRegistry(fc).getAVMService(); - return WCMWorkflowUtil.getAssociatedTasksForNode(avmService, node, tasks); - } - - public static boolean isInActiveWorkflow(String sandbox, AVMNodeDescriptor node) - { - return isInActiveWorkflow(sandbox, WCMUtil.getStoreRelativePath(node.getPath())); - } - - public static boolean isInActiveWorkflow(String sandbox, String relativePath) - { - List cachedPaths = AVMWorkflowUtil.getAssociatedPathsForSandbox(sandbox); - return (cachedPaths.contains(relativePath)); - } - - private static List getAssociatedPathsForSandbox(String sandbox) - { - FacesContext fc = FacesContext.getCurrentInstance(); - AVMSyncService avmSyncService = Repository.getServiceRegistry(fc).getAVMSyncService(); - WorkflowService workflowService = Repository.getServiceRegistry(fc).getWorkflowService(); - - Map> cachedSandboxPaths = (Map>)fc.getExternalContext().getRequestMap().get(PATH_CACHE); - if (cachedSandboxPaths == null) - { - cachedSandboxPaths = new HashMap>(64, 1.0f); - fc.getExternalContext().getRequestMap().put(PATH_CACHE, cachedSandboxPaths); - } - - List cachedPaths = cachedSandboxPaths.get(sandbox); - if (cachedPaths == null) - { - cachedPaths = WCMWorkflowUtil.getAssociatedPathsForSandbox(avmSyncService, workflowService, sandbox); - cachedSandboxPaths.put(sandbox, cachedPaths); - } - - return cachedPaths; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/AddAvmContentDialog.java b/source/java/org/alfresco/web/bean/wcm/AddAvmContentDialog.java deleted file mode 100644 index dc1a8a407b..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/AddAvmContentDialog.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.File; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import javax.faces.context.FacesContext; - -import org.alfresco.model.ContentModel; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.content.AddContentDialog; -import org.alfresco.web.bean.repository.Repository; - -/** - * Add/upload content dialog for AVM browse screens. - * - * @author Kevin Roast - */ -public class AddAvmContentDialog extends AddContentDialog -{ - private static final long serialVersionUID = 4019639621892035132L; - - private static final String MSG_OK = "ok"; - - /** The AVMService bean reference */ - transient private AVMService avmService; - - /** AVM Browse Bean reference */ - protected AVMBrowseBean avmBrowseBean; - - /** */ - protected String path; - - - /** - * @param avmService The AVMService to set. - */ - public void setAvmService(AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (avmService == null) - { - avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMLockingAwareService(); - } - return avmService; - } - - /** - * @param avmBrowseBean The AVMBrowseBean to set. - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * Save the specified content using the currently set wizard attributes - * - * @param fileContent File content to save - * @param strContent String content to save - */ - protected void saveContent(File fileContent, String strContent) throws Exception - { - // get the AVM path that will contain the content - String parent = this.avmBrowseBean.getCurrentPath(); - - // create the file - this.getAvmService().createFile(parent, this.fileName).close(); - this.path = parent + '/' + this.fileName; - NodeRef fileNodeRef = AVMNodeConverter.ToNodeRef(-1, this.path); - - if (logger.isDebugEnabled()) - logger.debug("Created AVM file: " + this.path); - - // apply the titled aspect - title and description - Map titledProps = new HashMap(2, 1.0f); - titledProps.put(ContentModel.PROP_TITLE, this.title); - titledProps.put(ContentModel.PROP_DESCRIPTION, this.description); - this.getNodeService().addAspect(fileNodeRef, ContentModel.ASPECT_TITLED, titledProps); - - // get a writer for the content and put the file - ContentWriter writer = getContentService().getWriter(fileNodeRef, ContentModel.PROP_CONTENT, true); - writer.setMimetype(this.mimeType); - writer.setEncoding(this.encoding); - if (fileContent != null) - { - writer.putContent(fileContent); - } - else - { - writer.putContent(strContent == null ? "" : strContent); - } - - // remember the created node now - this.createdNode = fileNodeRef; - } - - /** - * @see org.alfresco.web.bean.content.AddContentDialog#doPostCommitProcessing(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String doPostCommitProcessing(FacesContext context, String outcome) - { - clearUpload(); - - // Notify virtualization server - // - // This must be done in doPostCommitProcessing so that the notification - // can only be received by the virtualization server *after* the content - // update transaction within the AVM has completed. Otherwise, there's - // a race condition that can cause the virtualization server to not be - // able to read the new (or modified) web.xml file within the virtual - // webapps being relaoded via the call to updateVServerWebapp. - - if (logger.isDebugEnabled()) - { - logger.debug("Reloading virtualisation server on path: " + this.path); - } - - AVMUtil.updateVServerWebapp(this.path, false); - - return outcome; - } - - /** - * @see org.alfresco.web.bean.content.AddContentDialog#getDefaultFinishOutcome() - */ - @Override - protected String getDefaultFinishOutcome() - { - return "dialog:close"; - } - - @Override - public String cancel() - { - super.cancel(); - return getDefaultCancelOutcome(); - } - - @Override - public String getFinishButtonLabel() - { - - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_OK); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/BasePermissionsDialog.java b/source/java/org/alfresco/web/bean/wcm/BasePermissionsDialog.java deleted file mode 100644 index 84eafea3d4..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/BasePermissionsDialog.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.Map; - -import javax.faces.context.FacesContext; - -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.repository.Repository; - -/** - * Base class for Permissions dialogs - * - * @author Sergei Gavrusev - */ -public class BasePermissionsDialog extends BaseDialogBean -{ - - private static final long serialVersionUID = -1027989430514037278L; - - /** PermissionService bean reference */ - transient protected PermissionService permissionService; - private AVMBrowseBean avmBrowseBean; - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map) - */ - @Override - public void init(Map parameters) - { - - super.init(parameters); - - } - - /** - * Getter for permissionService - * - * @return permissionService - */ - protected PermissionService getPermissionService() - { - if (permissionService == null) - { - permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService(); - } - return permissionService; - } - - /** - * @param permissionService permission service - */ - protected void setPermissionService(final PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - return outcome; - } - - /** - * Getter for avmBrowseBean - * - * @return avmBrowseBean - */ - public AVMBrowseBean getAvmBrowseBean() - { - return avmBrowseBean; - } - - /** - * @param avmBrowseBean The avmBrowseBean to set. - */ - public void setAvmBrowseBean(final AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - -} diff --git a/source/java/org/alfresco/web/bean/wcm/ChangeExpirationDateDialog.java b/source/java/org/alfresco/web/bean/wcm/ChangeExpirationDateDialog.java deleted file mode 100644 index 5eaf792f39..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/ChangeExpirationDateDialog.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.Date; -import java.util.Map; - -import javax.faces.context.FacesContext; - -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.dialog.IDialogBean; - -/** - * Bean implementation for the Change Expiration Date dialog. - * - * @author gavinc - */ -public class ChangeExpirationDateDialog extends BaseDialogBean -{ - private static final long serialVersionUID = 7052061252811577796L; - - private String path; - private Date expirationDate; - private Map expirationDates; - - @Override - public void init(Map parameters) - { - super.init(parameters); - - this.path = parameters.get("avmpath"); - - // get hold of the "SubmitDialog" and retrieve the map of expiration dates - IDialogBean bean = (IDialogBean)FacesHelper.getManagedBean( - FacesContext.getCurrentInstance(), "SubmitDialog"); - if (bean != null) - { - SubmitDialog dialog = (SubmitDialog)bean; - this.expirationDates = dialog.getExpiredDates(); - this.expirationDate = this.expirationDates.get(this.path); - } - } - - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - if (this.expirationDates != null) - { - this.expirationDates.put(this.path, this.expirationDate); - } - - return outcome; - } - - @Override - public boolean getFinishButtonDisabled() - { - return false; - } - - /** - * @return The expiration date - */ - public Date getExpirationDate() - { - return this.expirationDate; - } - - /** - * @param expirationDate The expiration date - */ - public void setExpirationDate(Date expirationDate) - { - this.expirationDate = expirationDate; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/CompareSnapshotDialog.java b/source/java/org/alfresco/web/bean/wcm/CompareSnapshotDialog.java deleted file mode 100644 index 97a981af07..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/CompareSnapshotDialog.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.text.MessageFormat; -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; - -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.avmsync.AVMSyncService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.wcm.sandbox.SandboxService; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.repository.Repository; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Base class for AVMCompare dialogs - * - * @author Dmitry Lazurkin - */ -public abstract class CompareSnapshotDialog extends BaseDialogBean -{ - private static final Log logger = LogFactory.getLog(CompareSnapshotDialog.class); - - private static final long serialVersionUID = 5483551383286687197L; - - private final static String MSG_CLOSE = "close"; - protected AVMBrowseBean avmBrowseBean; - transient private SandboxService sandboxService; - transient private AVMService avmService; - transient private AVMSyncService avmSyncService; - protected NodeRef websiteRef; - protected String store; - protected NodeRef webProjectRef; - protected int version; - protected String sandbox; - protected String storeRoot; - - protected boolean finished = false; - - public abstract List> getComparedNodes(); - - @Override - public void init(Map parameters) - { - super.init(parameters); - - // setup context for dialog - this.sandbox = parameters.get("sandbox"); - - String ver = parameters.get("version"); - if (ver != null && ver.length() > 0) - { - this.version = Integer.parseInt(ver); - } - else - { - this.version = -1; - } - - // get the store - this.store = parameters.get("store"); - this.storeRoot = AVMUtil.buildSandboxRootPath(this.sandbox); - - // get the web project noderef - String webProject = parameters.get("webproject"); - if (webProject == null) - { - this.webProjectRef = this.avmBrowseBean.getWebsite().getNodeRef(); - } - else - { - this.webProjectRef = new NodeRef(webProject); - } - - if (logger.isDebugEnabled()) - { - logger.debug("Initialising dialog compare snapshot: " + this.websiteRef); - } - } - - @Override - public String getContainerDescription() - { - int prev = WCMCompareUtils.getPrevVersionID(getSandboxService(), sandbox, version); - return MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), getDescription()), version, prev); - } - - @Override - public String getCancelButtonLabel() - { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE); - } - - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - return outcome; - } - - /** - * Getter for avmBrowseBean - * - * @return avmBrowseBean - */ - public AVMBrowseBean getAvmBrowseBean() - { - return avmBrowseBean; - } - - /** - * Setter for avmBrowseBean - * - * @param avmBrowseBean avm browse bean - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * Getter for avmService service - * - * @return avmService - */ - public AVMService getAvmService() - { - if (avmService == null) - { - avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - - return avmService; - } - - /** - * Getter for sandboxService service - * - * @return sandboxService - */ - public SandboxService getSandboxService() - { - if (sandboxService == null) - { - sandboxService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSandboxService(); - } - return sandboxService; - } - - /** - * Getter for avmSyncService service - * - * @return avmSyncService - */ - public AVMSyncService getAvmSyncService() - { - if (avmSyncService == null) - { - avmSyncService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMSyncService(); - } - return avmSyncService; - } - - /** - * Returns description message id for AVMCompare dialog - * - * @return description message id for dialog - */ - protected abstract String getDescription(); - - /** - * Returns sandbox name - * - * @return sandbox name - */ - public String getSandbox() - { - return sandbox; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/CompareToAnySnapshotDialog.java b/source/java/org/alfresco/web/bean/wcm/CompareToAnySnapshotDialog.java deleted file mode 100644 index 05c14c3991..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/CompareToAnySnapshotDialog.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; -import javax.faces.model.SelectItem; - -import org.alfresco.web.app.Application; -import org.alfresco.web.ui.common.Utils; - -/** - * Class for compareToAnySnapshot dialog - * - * @author Dmitry Velichkevich - * @author Dmitry Lazurkin - */ -public class CompareToAnySnapshotDialog extends CompareSnapshotDialog -{ - private static final long serialVersionUID = 5483432383286687197L; - - private static final String COMPARE_TO_ANY_SNAPSHOT_DESCRIPTION_MESSAGE_TEXT_ID = "snapshot_compare_to_any_description"; - - public static final String MSG_ERROR_VERSION_NOT_VALID = "error_version_validate"; - - private int userSpecifiedVersion; - - private boolean storeChanged; - private String userSpecifiedStore; - - private String userSpecifiedRoot; - - private List availableVersionNumbers; - private int curAvailableVersionNumber; - - private boolean compare; - - /** - * Builds list of available version numbers - */ - private void buildAvailableVersionNumbers() - { - this.curAvailableVersionNumber = -1; - this.availableVersionNumbers = WCMCompareUtils.getAllVersionID(getSandboxService(), userSpecifiedStore); - Collections.sort(availableVersionNumbers); - } - - @Override - public void init(Map parameters) - { - super.init(parameters); - userSpecifiedStore = sandbox; - userSpecifiedRoot = storeRoot; - userSpecifiedVersion = -1; - buildAvailableVersionNumbers(); - this.compare = true; - this.storeChanged = false; - } - - /** - * @return true if snapshot's version is correct - */ - private boolean isCorrectVersion(int userSpecVersion) - { - return userSpecVersion == -1 || availableVersionNumbers.contains(userSpecVersion); - } - - @Override - public List> getComparedNodes() - { - if (compare) - { - this.compare = false; - - List> nodes = null; - - if (isCorrectVersion(userSpecifiedVersion)) - { - nodes = WCMCompareUtils.getComparedNodes(getAvmSyncService(), version, storeRoot, userSpecifiedVersion, userSpecifiedRoot, null); - } - - return nodes; - } - else - { - return Collections.emptyList(); - } - } - - /** - * @return list of stores select items - */ - public List getStoresList() - { - List stores = WCMCompareUtils.receiveStoresList(getAvmService()); - - List result = new ArrayList(); - - for (String itemValue : stores) - { - result.add(new SelectItem(itemValue, itemValue, itemValue, false)); - } - - return result; - } - - /** - * Action listener method that sets flag for starting compare - * - * @param event action event - */ - public void refreshComparePanel(ActionEvent event) - { - this.compare = true; - } - - /** - * Getter for user specified version - * - * @return userSpecifiedVersion - */ - public int getUserSpecifiedVersion() - { - return userSpecifiedVersion; - } - - /** - * Setter for user specified version - * - * @param userSpecifiedVersion user specified version - */ - public void setUserSpecifiedVersion(int userSpecifiedVersion) - { - if (this.storeChanged == false) - { - if (this.userSpecifiedVersion != userSpecifiedVersion) - { - if (userSpecifiedVersion != -1) - { - int index = availableVersionNumbers.indexOf(userSpecifiedVersion); - if (index != -1) - { - this.curAvailableVersionNumber = index; - this.userSpecifiedVersion = userSpecifiedVersion; - } - else - { - Utils.addErrorMessage(Application.getMessage(FacesContext.getCurrentInstance(), MSG_ERROR_VERSION_NOT_VALID)); - FacesContext.getCurrentInstance().renderResponse(); - } - } - else - { - this.curAvailableVersionNumber = -1; - this.userSpecifiedVersion = -1; - } - } - } - else - { - this.storeChanged = false; - } - } - - /** - * Getter for user specified Store - * - * @return userSpecifiedStore user specified store - */ - public String getUserSpecifiedSnapshot() - { - return userSpecifiedStore; - } - - /** - * Setter for user specified snapshot - * - * @param setUserSpecifiedSnapshot user specified snapshot - */ - public void setUserSpecifiedSnapshot(String userSpecifiedSnapshot) - { - if (userSpecifiedSnapshot.equals(userSpecifiedStore) == false) - { - this.storeChanged = true; - this.userSpecifiedStore = userSpecifiedSnapshot; - this.userSpecifiedRoot = AVMUtil.buildSandboxRootPath(this.userSpecifiedStore); - this.userSpecifiedVersion = -1; - buildAvailableVersionNumbers(); - } - } - - @Override - public String getSandbox() - { - return this.userSpecifiedStore; - } - - @Override - protected String getDescription() - { - return COMPARE_TO_ANY_SNAPSHOT_DESCRIPTION_MESSAGE_TEXT_ID; - } - - /** - * @return true if increment button for version is disabled - */ - public boolean isIncrementVersionButtonDisabled() - { - return (this.curAvailableVersionNumber + 1) == this.availableVersionNumbers.size(); - } - - /** - * @return true if decrement button for version is disabled - */ - public boolean isDecrementVersionButtonDisabled() - { - return this.curAvailableVersionNumber == -1; - } - - /** - * Increments version number - * - * @param event action event - */ - public void incrementVersion(ActionEvent event) - { - this.curAvailableVersionNumber++; - this.userSpecifiedVersion = this.availableVersionNumbers.get(this.curAvailableVersionNumber); - } - - /** - * Decrements version number - * - * @param event action event - */ - public void decrementVersion(ActionEvent event) - { - this.curAvailableVersionNumber--; - this.userSpecifiedVersion = (this.curAvailableVersionNumber != -1) ? (this.availableVersionNumbers.get(this.curAvailableVersionNumber)) : (-1); - } - -} \ No newline at end of file diff --git a/source/java/org/alfresco/web/bean/wcm/CompareToCurrentSnapshotDialog.java b/source/java/org/alfresco/web/bean/wcm/CompareToCurrentSnapshotDialog.java deleted file mode 100644 index 0d176b6bb9..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/CompareToCurrentSnapshotDialog.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.List; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Class for compareToCurrentSnapshot dialog - * - * @author ValerySh - */ -public class CompareToCurrentSnapshotDialog extends CompareSnapshotDialog -{ - - private static final long serialVersionUID = 5483551383286687197L; - /** description for dialog */ - private static final String MSG_COMPARE_TO_CURRENT_DESCRIPTION = "snapshot_compare_to_current_description"; - - @SuppressWarnings("unused") - private static final Log logger = LogFactory.getLog(CompareToPreviousSnapshotDialog.class); - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.wcm.CompareSnapshot#getComparedNodes() - */ - public List> getComparedNodes() - { - if (finished) - { - finished = false; - return null; - } - finished = true; - return WCMCompareUtils.getComparedNodes(getAvmSyncService(), version, storeRoot, -1, storeRoot, null); - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.wcm.CompareSnapshot#getDescription() - */ - protected String getDescription() - { - return MSG_COMPARE_TO_CURRENT_DESCRIPTION; - } - -} diff --git a/source/java/org/alfresco/web/bean/wcm/CompareToPreviousSnapshotDialog.java b/source/java/org/alfresco/web/bean/wcm/CompareToPreviousSnapshotDialog.java deleted file mode 100644 index 2ee22efd30..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/CompareToPreviousSnapshotDialog.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.List; -import java.util.Map; - -/** - * Class for compareToPreviousSnapshot dialog - * - * @author ValerySh - */ -public class CompareToPreviousSnapshotDialog extends CompareSnapshotDialog -{ - private static final long serialVersionUID = 5483551384486687197L; - - /** description for dialog */ - private static final String MSG_COMPARE_TO_PREVIOUS_DESCRIPTION = "snapshot_compare_to_previous_description"; - - public List> getComparedNodes() - { - int prevVersion = WCMCompareUtils.getPrevVersionID(getSandboxService(), sandbox, version); - return WCMCompareUtils.getComparedNodes(getAvmSyncService(), version, storeRoot, prevVersion, storeRoot, null); - } - - protected String getDescription() - { - return MSG_COMPARE_TO_PREVIOUS_DESCRIPTION; - } - -} diff --git a/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java b/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java deleted file mode 100644 index 51b2796994..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import javax.faces.context.FacesContext; - -import org.alfresco.model.ContentModel; -import org.alfresco.service.namespace.QName; -import org.alfresco.wcm.asset.AssetService; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.repository.Repository; - -/** - * Bean implementation for the AVM "Create Folder" dialog. - * - * @author Kevin Roast - */ -public class CreateFolderDialog extends BaseDialogBean -{ - private static final long serialVersionUID = 5501238017264037644L; - - //private static final Log logger = LogFactory.getLog(CreateFolderDialog.class); - - transient private AssetService assetService; - protected AVMBrowseBean avmBrowseBean; - - protected String name; - protected String title; - protected String description; - - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map) - */ - @Override - public void init(Map parameters) - { - super.init(parameters); - this.name = null; - this.description = null; - } - - /** - * @param avmBrowseBean The avmBrowseBean to set. - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @param assetService The assetService to set. - */ - public void setAssetService(AssetService assetService) - { - this.assetService = assetService; - } - - protected AssetService getAssetService() - { - if (assetService == null) - { - assetService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAssetService(); - } - return assetService; - } - - /** - * @return Returns the description. - */ - public String getDescription() - { - return this.description; - } - - /** - * @param description The description to set. - */ - public void setDescription(String description) - { - this.description = description; - } - - /** - * @return Returns the title. - */ - public String getTitle() - { - return this.title; - } - - /** - * @param title The title to set. - */ - public void setTitle(String title) - { - this.title = title; - } - - /** - * @return Returns the name. - */ - public String getName() - { - return this.name; - } - - /** - * @param name The name to set. - */ - public void setName(String name) - { - this.name = name; - } - - - // ------------------------------------------------------------------------------ - // Dialog implementation - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - String parent = this.avmBrowseBean.getCurrentPath(); - - Map properties = new HashMap(2); - if (title != null && title.length() != 0) - { - properties.put(ContentModel.PROP_TITLE, title); - } - if (description != null && description.length() != 0) - { - properties.put(ContentModel.PROP_DESCRIPTION, description); - } - - String[] parts = parent.split(":"); - String sbStoreId = parts[0]; - String path = parts[1]; - - this.getAssetService().createFolder(sbStoreId, path, this.name, properties); - - return outcome; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/CreateFormWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateFormWizard.java deleted file mode 100644 index 575a8ca708..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/CreateFormWizard.java +++ /dev/null @@ -1,1390 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import static org.alfresco.web.bean.wcm.DescriptionAttributeHelper.getDescriptionNotEmpty; -import static org.alfresco.web.bean.wcm.DescriptionAttributeHelper.getTableBegin; -import static org.alfresco.web.bean.wcm.DescriptionAttributeHelper.getTableEnd; -import static org.alfresco.web.bean.wcm.DescriptionAttributeHelper.getTableLine; - -import java.io.File; -import java.io.Serializable; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.ResourceBundle; - -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; -import javax.faces.event.ValueChangeEvent; -import javax.faces.model.DataModel; -import javax.faces.model.ListDataModel; -import javax.faces.model.SelectItem; - -import org.alfresco.model.ContentModel; -import org.alfresco.model.WCMAppModel; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.model.FileExistsException; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.ContentService; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.MimetypeService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.workflow.WorkflowDefinition; -import org.alfresco.service.cmr.workflow.WorkflowService; -import org.alfresco.service.namespace.QName; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.FileUploadBean; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.wizard.BaseWizardBean; -import org.alfresco.web.data.IDataContainer; -import org.alfresco.web.data.QuickSort; -import org.alfresco.web.forms.FormsService; -import org.alfresco.web.forms.RenderingEngine; -import org.alfresco.web.forms.RenderingEngineTemplate; -import org.alfresco.web.forms.RenderingEngineTemplateImpl; -import org.alfresco.util.XMLUtil; -import org.alfresco.web.ui.common.Utils; -import org.alfresco.web.ui.common.component.UIListItem; -import org.alfresco.web.ui.wcm.WebResources; -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chiba.xml.ns.NamespaceConstants; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * Bean implementation for the "Create XML Form" dialog - * - * @author arielb - * @author Arseny Kovalchuk (The fixer of the issue https://issues.alfresco.com/jira/browse/ETWOTWO-600,601) - */ -public class CreateFormWizard extends BaseWizardBean -{ - - ///////////////////////////////////////////////////////////////////////////// - - private static final long serialVersionUID = -7133077371875949483L; - - /** - * Simple wrapper class to represent a form data renderer - */ - public class RenderingEngineTemplateData - implements Serializable - { - private static final long serialVersionUID = -7786031074741795036L; - - private final NodeRef nodeRef; - private final File file; - private final String name; - private final String title; - private final String description; - private final String mimetypeForRendition; - private final String outputPathPatternForRendition; - private final RenderingEngine renderingEngine; - private final String renderingEngineDescriptionAttribute; - - public RenderingEngineTemplateData(final RenderingEngineTemplate ret) - { - this.file = null; - this.nodeRef = ((RenderingEngineTemplateImpl)ret).getNodeRef(); - this.name = ret.getName(); - this.title = ret.getTitle(); - this.description = ret.getDescription(); - this.outputPathPatternForRendition = ret.getOutputPathPattern(); - this.mimetypeForRendition = ret.getMimetypeForRendition(); - this.renderingEngine = ret.getRenderingEngine(); - this.renderingEngineDescriptionAttribute = buildREDescriptionAttribute(); - } - - public RenderingEngineTemplateData(final File file, - final String name, - final String title, - final String description, - final String outputPathPatternForRendition, - final String mimetypeForRendition, - final RenderingEngine renderingEngine) - { - this.nodeRef = null; - this.file = file; - this.name = name; - this.title = title; - this.description = description; - this.outputPathPatternForRendition = outputPathPatternForRendition; - this.mimetypeForRendition = mimetypeForRendition; - this.renderingEngine = renderingEngine; - this.renderingEngineDescriptionAttribute = buildREDescriptionAttribute(); - } - - public String getOutputPathPatternForRendition() - { - return this.outputPathPatternForRendition; - } - - public String getMimetypeForRendition() - { - return this.mimetypeForRendition; - } - - public File getFile() - { - return this.file; - } - - public NodeRef getNodeRef() - { - return this.nodeRef; - } - - public String getName() - { - return this.name; - } - - public String getTitle() - { - return this.title; - } - - public String getDescription() - { - return this.description; - } - - public RenderingEngine getRenderingEngine() - { - return this.renderingEngine; - } - - public String getRenderingEngineDescriptionAttribute() - { - return this.renderingEngineDescriptionAttribute; - } - - public String getRenderingEngineLabelAttribute() - { - StringBuilder builder = new StringBuilder(""); - builder.append(Utils.encode(this.title)); - builder.append(""); - return builder.toString(); - } - - public String toString() - { - return (this.getClass().getName() + "{" + - "name: " + this.getName() + "," + - "mimetypeForRendition: " + this.getMimetypeForRendition() + "," + - "outputPathPatternForRendition: " + this.getOutputPathPatternForRendition() + "," + - "renderingEngine: " + this.getRenderingEngine().getName() + - "}"); - } - - private String buildREDescriptionAttribute() - { - FacesContext fc = FacesContext.getCurrentInstance(); - StringBuilder attribute = new StringBuilder(255); - attribute.append(DescriptionAttributeHelper.getTableBegin()); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "description", - DescriptionAttributeHelper.getDescriptionNotEmpty(fc, this.getDescription()), false)); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "rendering_engine_type", - this.getRenderingEngine().getName())); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "output_path_pattern", - this.getOutputPathPatternForRendition())); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "mimetype_for_renditions", - this.getMimetypeForRendition())); - attribute.append(DescriptionAttributeHelper.getTableEnd()); - return attribute.toString(); - } - } - - ///////////////////////////////////////////////////////////////////////////// - - public static final String FILE_RENDERING_ENGINE_TEMPLATE = "rendering-engine-template"; - - public static final String FILE_SCHEMA = "schema"; - - private final static String DEFAULT_EXTENSION_PATTERN = "${extension}"; - private final static String DEFAULT_NAME_PATTERN = "${name}"; - - private final static Log LOGGER = LogFactory.getLog(CreateFormWizard.class); - - protected String defaultWorkflowName = null; - protected boolean applyDefaultWorkflow = true; - protected List renderingEngineTemplates = null; - transient protected Document schema; - protected String schemaFileName; - protected transient ContentService contentService; - protected transient MimetypeService mimetypeService; - protected transient WorkflowService workflowService; - protected transient FormsService formsService; - - private String schemaRootElementName = null; - private String formName = null; - private String formTitle = null; - private String formDescription = null; - private String outputPathPatternForFormInstanceData = null; - private String renderingEngineTemplateFileName = null; - private String renderingEngineTemplateName = null; - private String renderingEngineTemplateTitle = null; - private String renderingEngineTemplateDescription = null; - private String formDescriptionAttribute = null; - private String workflowDescriptionAttribute = null; - - private RenderingEngine renderingEngine = null; - protected transient DataModel renderingEngineTemplatesDataModel; - - private String outputPathPatternForRendition = null; - private String mimetypeForRendition = null; - private transient List mimetypeChoices = null; - private transient List schemaRootElementNameChoices = null; - private transient List defaultWorkflowChoices = null; - - // ------------------------------------------------------------------------------ - // Wizard implementation - - @Override - protected String finishImpl(final FacesContext context, final String outcome) - throws Exception - { - if (LOGGER.isDebugEnabled()) - LOGGER.debug("creating form " + this.getFormName()); - - // get the node ref of the node that will contain the content - - NodeRef contentFormsNodeRef = null; - if (getIsWebForm() == true) - { - contentFormsNodeRef = this.getFormsService().getWebContentFormsNodeRef(); - } - else - { - contentFormsNodeRef = this.getFormsService().getContentFormsNodeRef(); - } - - final FileInfo folderInfo = - this.getFileFolderService().create(contentFormsNodeRef, - this.getFormName(), - WCMAppModel.TYPE_FORMFOLDER); - - final FileInfo fileInfo = - getFileFolderService().create(folderInfo.getNodeRef(), - this.getSchemaFileName(), - ContentModel.TYPE_CONTENT); - - // get a writer for the content and put the file - final ContentWriter writer = this.getContentService().getWriter(fileInfo.getNodeRef(), - ContentModel.PROP_CONTENT, - true); - // set the mimetype and encoding - writer.setMimetype(MimetypeMap.MIMETYPE_XML); - writer.setEncoding("UTF-8"); - writer.putContent(this.getSchemaFile()); - - // apply the titled aspect - title and description - final Map props = new HashMap(2, 1.0f); - props.put(ContentModel.PROP_TITLE, this.getFormTitle()); - props.put(ContentModel.PROP_DESCRIPTION, this.getFormDescription()); - this.getNodeService().addAspect(folderInfo.getNodeRef(), ContentModel.ASPECT_TITLED, props); - - props.clear(); - props.put(WCMAppModel.PROP_XML_SCHEMA, fileInfo.getNodeRef()); - props.put(WCMAppModel.PROP_XML_SCHEMA_ROOT_ELEMENT_NAME, - this.getSchemaRootElementName()); - this.getNodeService().addAspect(folderInfo.getNodeRef(), WCMAppModel.ASPECT_FORM, props); - if (this.applyDefaultWorkflow) - { - props.clear(); - props.put(WCMAppModel.PROP_WORKFLOW_NAME, this.getDefaultWorkflowName()[0]); - this.getNodeService().createNode(folderInfo.getNodeRef(), - WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS, - WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS, - WCMAppModel.TYPE_WORKFLOW_DEFAULTS, - props); - } - - props.clear(); - props.put(WCMAppModel.PROP_OUTPUT_PATH_PATTERN, - this.getOutputPathPatternForFormInstanceData()); - this.getNodeService().addAspect(folderInfo.getNodeRef(), - WCMAppModel.ASPECT_OUTPUT_PATH_PATTERN, props); - for (RenderingEngineTemplateData retd : this.renderingEngineTemplates) - { - this.saveRenderingEngineTemplate(retd, folderInfo.getNodeRef()); - } - // return the default outcome - return outcome; - } - - protected void saveRenderingEngineTemplate(final RenderingEngineTemplateData retd, - final NodeRef formNodeRef) - { - if (LOGGER.isDebugEnabled()) - LOGGER.debug("adding rendering engine template " + retd + - " to form " + this.getFormName()); - - NodeRef renderingEngineTemplateNodeRef = - this.getFileFolderService().searchSimple(formNodeRef, retd.getName()); - final HashMap props = new HashMap(); - if (renderingEngineTemplateNodeRef == null) - { - try - { - final FileInfo fileInfo = this.getFileFolderService().create(formNodeRef, - retd.getName(), - ContentModel.TYPE_CONTENT); - if (LOGGER.isDebugEnabled()) - LOGGER.debug("Created file node for file: " + retd.getName()); - renderingEngineTemplateNodeRef = fileInfo.getNodeRef(); - } - catch (final FileExistsException fee) - { - LOGGER.error(fee.getName() + " already exists in " + - fee.getParentNodeRef()); - throw fee; - } - - // get a writer for the content and put the file - final ContentWriter writer = this.getContentService().getWriter(renderingEngineTemplateNodeRef, - ContentModel.PROP_CONTENT, - true); - // set the mimetype and encoding - // XXXarielb mime type of template isn't known - // writer.setMimetype("text/xml"); - writer.setEncoding("UTF-8"); - writer.putContent(retd.getFile()); - - this.getNodeService().createAssociation(formNodeRef, - renderingEngineTemplateNodeRef, - WCMAppModel.ASSOC_RENDERING_ENGINE_TEMPLATES); - props.clear(); - props.put(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_NAME, - retd.getRenderingEngine().getName()); - props.put(WCMAppModel.PROP_FORM_SOURCE, formNodeRef); - this.getNodeService().addAspect(renderingEngineTemplateNodeRef, - WCMAppModel.ASPECT_RENDERING_ENGINE_TEMPLATE, - props); - - // apply the titled aspect - title and description - props.clear(); - props.put(ContentModel.PROP_TITLE, retd.getTitle()); - props.put(ContentModel.PROP_DESCRIPTION, retd.getDescription()); - this.getNodeService().addAspect(renderingEngineTemplateNodeRef, - ContentModel.ASPECT_TITLED, - props); - } - - if (LOGGER.isDebugEnabled()) - LOGGER.debug("adding rendition properties to " + renderingEngineTemplateNodeRef); - props.clear(); - props.put(WCMAppModel.PROP_MIMETYPE_FOR_RENDITION, - retd.getMimetypeForRendition()); - - final NodeRef rpNodeRef = this.getNodeService().createNode(renderingEngineTemplateNodeRef, - WCMAppModel.ASSOC_RENDITION_PROPERTIES, - WCMAppModel.ASSOC_RENDITION_PROPERTIES, - WCMAppModel.TYPE_RENDITION_PROPERTIES, - props).getChildRef(); - props.clear(); - props.put(WCMAppModel.PROP_OUTPUT_PATH_PATTERN, - retd.getOutputPathPatternForRendition()); - this.getNodeService().addAspect(rpNodeRef, WCMAppModel.ASPECT_OUTPUT_PATH_PATTERN, props); - } - - @Override - public void init(Map parameters) - { - super.init(parameters); - - this.removeUploadedSchemaFile(); - this.removeUploadedRenderingEngineTemplateFile(); - this.schema = null; - this.schemaFileName = null; - this.schemaRootElementName = null; - this.schemaRootElementNameChoices = null; - this.formName = null; - this.formTitle = null; - this.formDescription = null; - this.renderingEngineTemplateFileName = null; - this.renderingEngineTemplateName = null; - this.renderingEngineTemplateTitle = null; - this.renderingEngineTemplateDescription = null; - this.renderingEngine = null; - this.renderingEngineTemplates = new ArrayList(); - this.renderingEngineTemplatesDataModel = null; - this.outputPathPatternForFormInstanceData = null; - this.outputPathPatternForRendition = null; - this.mimetypeForRendition = null; - this.defaultWorkflowName = null; - this.defaultWorkflowChoices = null; - this.applyDefaultWorkflow = true; - this.formDescriptionAttribute = null; - this.workflowDescriptionAttribute = null; - - } - - @Override - public String cancel() - { - this.removeUploadedSchemaFile(); - this.removeUploadedRenderingEngineTemplateFile(); - return super.cancel(); - } - - @Override - public boolean getNextButtonDisabled() - { - // TODO: Allow the next button state to be configured so that - // wizard implementations don't have to worry about - // checking step numbers - - final int step = Application.getWizardManager().getCurrentStep(); - switch(step) - { - case 1: - { - return (this.getSchemaFileName() == null || - this.getSchemaFileName().length() == 0 || - this.getSchemaRootElementNameChoices().size() == 0); - } - case 2: - { - return this.getRenderingEngineTemplateFileName() != null; - } - default: - { - return false; - } - } - } - - @Override - public boolean getFinishButtonDisabled() - { - final int step = Application.getWizardManager().getCurrentStep(); - final int stepCount = Application.getWizardManager().getStepItems().size(); - - if ((stepCount == 1) && (step == 1)) - { - // assume Create Form Wizard - return false; - } - else - { - return true; - } - } - - @Override - public String getStepDescription() - { - final ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); - final String stepName = Application.getWizardManager().getCurrentStepName(); - if ("configure_rendering_engine_templates".equals(stepName)) - { - return MessageFormat.format(bundle.getString("create_form_configure_rendering_engine_templates_desc"), - this.getFormName()); - } - else if ("select_default_workflow".equals(stepName)) - { - - return MessageFormat.format(bundle.getString("create_form_select_default_workflow_desc"), - this.getFormName()); - } - else - { - return super.getContainerDescription(); - } - } - - /** - * @return true if the Add To List button on the configure rendering engines - * page should be disabled - */ - public boolean getAddToListDisabled() - { - return this.getRenderingEngineTemplateFileName() == null; - } - - /** - * - * @return Returns HTML code of the formDescriptionAttribute - * for the attribute "description" of the tag. - * See create-form-wizard/summary.jsp - */ - public String getFormDescriptionAttribute() - { - if (StringUtils.isEmpty(formDescriptionAttribute)) - { - this.formDescriptionAttribute = buildFormDescriptionAttribute(); - } - return this.formDescriptionAttribute; - } - - /** - * - * @return HTML code for the form label - */ - public String getFormLabelAttribute() - { - StringBuilder builder = new StringBuilder(""); - builder.append(Utils.encode(this.getFormTitle())); - builder.append(""); - return builder.toString(); - } - - /** - * - * @return Returns HTML code of the formDescriptionAttribute - * for the attribute "description" of the tag. - * See create-form-wizard/summary.jsp - */ - public String getWorkflowDescriptionAttribute() - { - if (StringUtils.isEmpty(workflowDescriptionAttribute)) - { - this.workflowDescriptionAttribute = buildWorkflowDescriptionAttribute(); - } - return this.workflowDescriptionAttribute; - } - - /** - * - * @return Returns HTML code of the workflow label - */ - public String getWorkflowLabelAttribute() - { - StringBuilder builder = new StringBuilder(""); - - WorkflowDefinition wkDef = this.getDefaultWorkflowDefinition(); - if (wkDef != null) - { - builder.append(Utils.encode(wkDef.getTitle())); - } - - builder.append(""); - return builder.toString(); - } - - /** - * @return Returns the output path for the rendition. - */ - public String getOutputPathPatternForRendition() - { - return (this.outputPathPatternForRendition == null - ? DEFAULT_NAME_PATTERN + '.' + DEFAULT_EXTENSION_PATTERN - : this.outputPathPatternForRendition); - } - - /** - * @param outputPathPatternForRendition The output path for the rendition. - */ - public void setOutputPathPatternForRendition(final String outputPathPatternForRendition) - { - this.outputPathPatternForRendition = outputPathPatternForRendition; - } - - /** - * @return Returns the mimetype. - */ - public String getMimetypeForRendition() - { - String result = null; - if (this.mimetypeForRendition != null) - { - result = this.mimetypeForRendition; - } - else - { - if (this.outputPathPatternForRendition != null && - !this.outputPathPatternForRendition.endsWith(DEFAULT_EXTENSION_PATTERN)) - { - result = this.getMimetypeService().guessMimetype(this.outputPathPatternForRendition); - } - if (result == null) - { - result = MimetypeMap.MIMETYPE_HTML; - } - } - return result; - } - - /** - * @param mimetypeForRendition The mimetype to set. - */ - public void setMimetypeForRendition(final String mimetypeForRendition) - { - this.mimetypeForRendition = mimetypeForRendition; - } - - /** - * Add the selected rendering engine to the list - */ - public void addSelectedRenderingEngineTemplate(final ActionEvent event) - { - final String name = this.getRenderingEngineTemplateName(); - if (name == null || name.length() == 0) - { - Utils.addErrorMessage("Please provide a name for the rendering engine template."); - return; - } - if (this.renderingEngine == null) - { - Utils.addErrorMessage("Please select the rendering engine to use."); - return; - } - final String opp = this.getOutputPathPatternForRendition(); - final String mimetype = this.getMimetypeForRendition(); - for (RenderingEngineTemplateData retd : this.renderingEngineTemplates) - { - if (name.equals(retd.getName())) - { - Utils.addErrorMessage("A rendering engine template with the name " + name + - " already exists"); - return; - } - if (opp.equals(retd.getOutputPathPatternForRendition()) && - opp.indexOf(DEFAULT_EXTENSION_PATTERN) >= 0 && - mimetype.equals(retd.getMimetypeForRendition())) - { - Utils.addErrorMessage("A rendering engine template with the output path pattern " + opp + - " and mimetype " + mimetype + " already exists"); - return; - } - } - final RenderingEngineTemplateData data = - this.new RenderingEngineTemplateData(this.getRenderingEngineTemplateFile(), - this.getRenderingEngineTemplateName(), - this.getRenderingEngineTemplateTitle(), - this.getRenderingEngineTemplateDescription(), - opp, - mimetype, - this.renderingEngine); - this.renderingEngineTemplates.add(data); - this.removeUploadedRenderingEngineTemplateFile(); - this.renderingEngine = null; - this.outputPathPatternForRendition = null; - this.mimetypeForRendition = null; - this.renderingEngineTemplateFileName = null; - this.renderingEngineTemplateName = null; - this.renderingEngineTemplateTitle = null; - this.renderingEngineTemplateDescription = null; - } - - /** - * Action handler called when the Remove button is pressed to remove a - * rendering engine - */ - public void removeSelectedRenderingEngineTemplate(final ActionEvent event) - { - final RenderingEngineTemplateData wrapper = (RenderingEngineTemplateData) - this.getRenderingEngineTemplatesDataModel().getRowData(); - if (wrapper != null) - { - this.renderingEngineTemplates.remove(wrapper); - } - } - - /** - * Action handler called when the user changes the selected mimetype - */ - public String mimetypeForRenditionChanged(final ValueChangeEvent vce) - { - // refresh the current page - return null; - } - - /** - * Action handler called when the user wishes to remove an uploaded file - */ - public String removeUploadedSchemaFile() - { - LOGGER.debug("removing uploaded rendering engine template file " + - this.getRenderingEngineTemplateFileName()); - this.clearUpload(FILE_SCHEMA); - this.formName = null; - this.formTitle = null; - this.formDescription = null; - this.outputPathPatternForFormInstanceData = null; - this.schemaRootElementNameChoices = null; - this.schema = null; - this.schemaFileName = null; - assert this.getSchemaFileName() == null; - // refresh the current page - return null; - } - - /** - * Action handler called when the user wishes to remove an uploaded file - */ - public String removeUploadedRenderingEngineTemplateFile() - { - LOGGER.debug("removing uploaded rendering engine template file " + - this.getRenderingEngineTemplateFileName()); - this.clearUpload(FILE_RENDERING_ENGINE_TEMPLATE); - this.renderingEngineTemplateFileName = null; - this.renderingEngineTemplateName = null; - this.renderingEngineTemplateTitle = null; - this.renderingEngineTemplateDescription = null; - this.outputPathPatternForRendition = null; - this.mimetypeForRendition = null; - assert this.getRenderingEngineTemplateFileName() == null; - // refresh the current page - return null; - } - - /** - * Action handler called when the schema has been uploaded. - */ - public String schemaFileValueChanged(final ValueChangeEvent vce) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("schemaFileValueChanged(" + this.getFileName(FILE_SCHEMA) + - "[" + this.getSchemaFile() + "])"); - } - if (this.getSchemaFile() != null) - { - try - { - this.schema = XMLUtil.parse(this.getSchemaFile()); - } - catch (Exception e) - { - final String msg = "unable to parse " + this.getFileName(FILE_SCHEMA); - this.removeUploadedSchemaFile(); - Utils.addErrorMessage(msg + ": " + e.getMessage(), e); - } - } - return null; - } - - /** - * Action handler called when a rendering engine template file has been uploaded. - */ - public String renderingEngineTemplateFileValueChanged(final ValueChangeEvent vce) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("renderingEngineTemplateFileValueChanged(" + this.getFileName(FILE_RENDERING_ENGINE_TEMPLATE) + - "[" + this.getRenderingEngineTemplateFile() + "])"); - } - return null; - } - - // ------------------------------------------------------------------------------ - // Bean Getters and Setters - - /** Indicates whether or not the wizard is currently in edit mode */ - public boolean getEditMode() - { - return false; - } - - public List getAssociatedWebProjects() - { - return Collections.emptyList(); - } - - /** - * Returns the properties for current configured output methods JSF DataModel - * - * @return JSF DataModel representing the current configured output methods - */ - public DataModel getRenderingEngineTemplatesDataModel() - { - if (this.renderingEngineTemplatesDataModel == null) - { - this.renderingEngineTemplatesDataModel = new ListDataModel(); - } - - // only set the wrapped data once otherwise the rowindex is reset - if (this.renderingEngineTemplatesDataModel.getWrappedData() == null) - { - this.renderingEngineTemplatesDataModel.setWrappedData(this.renderingEngineTemplates); - } - - return this.renderingEngineTemplatesDataModel; - } - - /** - * Returns all configured rendering engine templates. - */ - public List getRenderingEngineTemplates() - { - return this.renderingEngineTemplates; - } - - /** - * @return Returns the mime type currenty selected - */ - public String getRenderingEngineName() - { - if (this.renderingEngine == null && - this.getRenderingEngineTemplateFileName() != null) - { - this.renderingEngine = - this.getFormsService().guessRenderingEngine(this.getRenderingEngineTemplateFileName()); - } - return (this.renderingEngine == null - ? null - : this.renderingEngine.getName()); - } - - /** - * @param renderingEngineName Sets the currently selected rendering engine name - */ - public void setRenderingEngineName(final String renderingEngineName) - { - this.renderingEngine = (renderingEngineName == null - ? null - : this.getFormsService().getRenderingEngine(renderingEngineName)); - } - - /** - * @return Returns a list of mime types to allow the user to select from - */ - public List getRenderingEngineChoices() - { - final List result = new LinkedList(); - for (RenderingEngine re : this.getFormsService().getRenderingEngines()) - { - result.add(new SelectItem(re.getName(), re.getName())); - } - return result; - } - - /** - * Returns a list of mime types in the system - * - * @return List of mime types - */ - public List getMimeTypeChoices() - { - if (this.mimetypeChoices == null) - { - this.mimetypeChoices = new ArrayList(50); - - final Map mimetypes = this.getMimetypeService().getDisplaysByMimetype(); - for (String mimetype : mimetypes.keySet()) - { - this.mimetypeChoices.add(new SelectItem(mimetype, - mimetypes.get(mimetype))); - } - - // make sure the list is sorted by the values - final QuickSort sorter = new QuickSort(this.mimetypeChoices, - "label", - true, - IDataContainer.SORT_CASEINSENSITIVE); - sorter.sort(); - } - - return this.mimetypeChoices; - } - - /** - * @return Returns the schema file or null - */ - public File getSchemaFile() - { - return this.getFile(FILE_SCHEMA); - } - - /** - * Sets the schema file name - */ - public void setSchemaFileName(final String schemaFileName) - { - this.schemaFileName = (schemaFileName != null && schemaFileName.length() != 0 - ? schemaFileName - : null); - } - - /** - * @return Returns the schema file or null - */ - public String getSchemaFileName() - { - return this.schemaFileName; - } - /** - * Sets the rendering engine template file name - */ - public void setRenderingEngineTemplateFileName(final String renderingEngineTemplateFileName) - { - this.renderingEngineTemplateFileName = - (renderingEngineTemplateFileName != null && renderingEngineTemplateFileName.length() != 0 - ? renderingEngineTemplateFileName - : null); - } - - /** - * @return Returns the rendering engine template file name or null - */ - public String getRenderingEngineTemplateFileName() - { - return this.renderingEngineTemplateFileName; - } - - /** - * @return Returns the rendering engine template file or null - */ - public File getRenderingEngineTemplateFile() - { - return this.getFile(FILE_RENDERING_ENGINE_TEMPLATE); - } - - /** - * Sets the root element name to use when processing the schema. - */ - public void setSchemaRootElementName(final String schemaRootElementName) - { - this.schemaRootElementName = schemaRootElementName; - } - - /** - * Returns the root element name to use when processing the schema. - */ - public String getSchemaRootElementName() - { - return this.schemaRootElementName; - } - - /** - * @return the possible root element names for use with the schema based on - * the element declarations it defines. - */ - public List getSchemaRootElementNameChoices() - { - List result = Collections.EMPTY_LIST; - if (this.schema != null) - { - if (this.schemaRootElementNameChoices == null) - { - this.schemaRootElementNameChoices = new LinkedList(); - NodeList elements = this.schema.getElementsByTagNameNS(NamespaceConstants.XMLSCHEMA_NS, "element"); - - for (int i = 0; i < elements.getLength(); i++) - { - Node current = elements.item(i); - if (current.getParentNode().equals(this.schema.getDocumentElement())) - { - this.schemaRootElementNameChoices.add(new SelectItem(current.getAttributes().getNamedItem("name").getNodeValue(), - current.getAttributes().getNamedItem("name").getNodeValue())); - } - } - } - result = this.schemaRootElementNameChoices; - } - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("getSchemaRootElementNameChoices(" + this.schema + ") = " + result.size()); - } - return result; - } - - /** - * Sets the human friendly name for this form. - */ - public void setFormName(final String formName) - { - this.formName = formName != null && formName.length() != 0 ? formName : null; - } - - /** - * @return the human friendly name for this form. - */ - public String getFormName() - { - return (this.formName == null && this.getSchemaFileName() != null - ? FilenameUtils.removeExtension(this.getSchemaFileName()) - : this.formName); - } - - /** - * @return Returns the output path for form instance data. - */ - public String getOutputPathPatternForFormInstanceData() - { - if (this.outputPathPatternForFormInstanceData == null) - { - this.outputPathPatternForFormInstanceData = DEFAULT_NAME_PATTERN + ".xml"; - } - return this.outputPathPatternForFormInstanceData; - } - - /** - * @param outputPathPatternForFormInstanceData the output path for form instance data - */ - public void setOutputPathPatternForFormInstanceData(final String outputPathPatternForFormInstanceData) - { - this.outputPathPatternForFormInstanceData = outputPathPatternForFormInstanceData; - } - - /** - * Sets the title for this form. - */ - public void setFormTitle(final String formTitle) - { - this.formTitle = formTitle != null && formTitle.length() != 0 ? formTitle : null; - } - - /** - * @return the title for this form. - */ - public String getFormTitle() - { - return (this.formTitle == null && this.getSchemaFileName() != null - ? FilenameUtils.removeExtension(this.getSchemaFileName()) - : this.formTitle); - } - - /** - * Sets the description for this form. - */ - public void setFormDescription(final String formDescription) - { - this.formDescription = formDescription; - } - - /** - * @return the description for this form. - */ - public String getFormDescription() - { - return this.formDescription; - } - - /** - * Sets the name for this renderingEngineTemplate. - */ - public void setRenderingEngineTemplateName(final String renderingEngineTemplateName) - { - this.renderingEngineTemplateName = - (renderingEngineTemplateName != null && renderingEngineTemplateName.length() != 0 - ? renderingEngineTemplateName - : null); - } - - /** - * @return the name for this renderingEngineTemplate. - */ - public String getRenderingEngineTemplateName() - { - return (this.renderingEngineTemplateName == null && this.getRenderingEngineTemplateFileName() != null - ? this.getRenderingEngineTemplateFileName() - : this.renderingEngineTemplateName); - } - - /** - * Sets the title for this renderingEngineTemplate. - */ - public void setRenderingEngineTemplateTitle(final String renderingEngineTemplateTitle) - { - this.renderingEngineTemplateTitle = - (renderingEngineTemplateTitle != null && renderingEngineTemplateTitle.length() != 0 - ? renderingEngineTemplateTitle - : null); - } - - /** - * @return the title for this renderingEngineTemplate. - */ - public String getRenderingEngineTemplateTitle() - { - return (this.renderingEngineTemplateTitle == null && this.getRenderingEngineTemplateFileName() != null - ? FilenameUtils.removeExtension(this.getRenderingEngineTemplateFileName()) - : this.renderingEngineTemplateTitle); - } - - /** - * Sets the description for this renderingEngineTemplate. - */ - public void setRenderingEngineTemplateDescription(final String renderingEngineTemplateDescription) - { - this.renderingEngineTemplateDescription = renderingEngineTemplateDescription; - } - - /** - * @return the description for this renderingEngineTemplate. - */ - public String getRenderingEngineTemplateDescription() - { - return this.renderingEngineTemplateDescription; - } - - /** - * @return the default workflow - */ - public WorkflowDefinition getDefaultWorkflowDefinition() - { - return (this.defaultWorkflowName == null || !this.applyDefaultWorkflow - ? null - : this.getWorkflowService().getDefinitionByName(this.defaultWorkflowName)); - } - - /** - * Sets the default workflow name - */ - public void setDefaultWorkflowName(final String[] defaultWorkflowName) - { - assert defaultWorkflowName.length == 1; - this.defaultWorkflowName = defaultWorkflowName[0]; - } - - /** - * Returns the default workflow name - */ - public String[] getDefaultWorkflowName() - { - if (this.defaultWorkflowName == null && this.getDefaultWorkflowChoices().size() != 0) - { - this.defaultWorkflowName = (String)this.getDefaultWorkflowChoices().get(0).getValue(); - } - return new String[] { this.defaultWorkflowName }; - } - - /** - * Indicates whether or not to configure a default workflow - */ - public void setApplyDefaultWorkflow(final boolean applyDefaultWorkflow) - { - this.applyDefaultWorkflow = applyDefaultWorkflow; - } - - /** - * @return whether or not to configure a default workflow - */ - public boolean getApplyDefaultWorkflow() - { - return this.applyDefaultWorkflow; - } - - /** - * @return List of UI items to represent the available Workflows for all websites - */ - public List getDefaultWorkflowChoices() - { - if (this.defaultWorkflowChoices == null) - { - // get list of workflows from config definitions - final List workflowDefs = AVMWorkflowUtil.getConfiguredWorkflows(); - this.defaultWorkflowChoices = new ArrayList(workflowDefs.size()); - for (WorkflowDefinition workflowDef : workflowDefs) - { - final UIListItem item = new UIListItem(); - item.setValue(workflowDef.getName()); - item.setLabel(workflowDef.getTitle()); - item.setDescription(workflowDef.getDescription()); - item.setImage(WebResources.IMAGE_WORKFLOW_32); - this.defaultWorkflowChoices.add(item); - } - } - return this.defaultWorkflowChoices; - } - - public boolean getIsWebForm() - { - boolean isWebForm = true; - // TODO - need better way to determine WCM vs ECM context - // can create form from CreateWebProject Wizard, or from Forms DataDictionary space or Web Forms DataDictionary space - if (this.navigator.getCurrentNode().getNodeRef().equals(getFormsService().getContentFormsNodeRef())) - { - // ECM form - isWebForm = false; - } - return isWebForm; - } - - // ------------------------------------------------------------------------------ - // Service Injection - - /** - * @param contentService The contentService to set. - */ - public void setContentService(final ContentService contentService) - { - this.contentService = contentService; - } - - protected ContentService getContentService() - { - if (contentService == null) - { - contentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentService(); - } - - return contentService; - } - - /** - * @param mimetypeService The mimetypeService to set. - */ - public void setMimetypeService(final MimetypeService mimetypeService) - { - this.mimetypeService = mimetypeService; - } - - protected MimetypeService getMimetypeService() - { - if (mimetypeService == null) - { - mimetypeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMimetypeService(); - } - return mimetypeService; - } - - /** - * @param workflowService The workflowService to set. - */ - public void setWorkflowService(final WorkflowService workflowService) - { - this.workflowService = workflowService; - } - - protected WorkflowService getWorkflowService() - { - if (workflowService == null) - { - workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService(); - } - return workflowService; - } - - /** - * @param formsService The FormsService to set. - */ - public void setFormsService(final FormsService formsService) - { - this.formsService = formsService; - } - - protected FormsService getFormsService() - { - if (formsService == null) - { - formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); - } - return formsService; - } - - // ------------------------------------------------------------------------------ - // Helper Methods - - /** - * Clear the uploaded form, clearing the specific Upload component by Id - */ - protected void clearUpload(final String id) - { - // remove the file upload bean from the session - final FacesContext ctx = FacesContext.getCurrentInstance(); - FileUploadBean fileBean = (FileUploadBean) - ctx.getExternalContext().getSessionMap().get(FileUploadBean.getKey(id)); - if (fileBean != null) - { - fileBean.setFile(null); - fileBean.setFileName(null); - } - } - - /** - * Gets the file upload bean given with the given id. - * - * @return a file upload bean or null - */ - private FileUploadBean getFileUploadBean(final String id) - { - final FacesContext ctx = FacesContext.getCurrentInstance(); - final Map sessionMap = ctx.getExternalContext().getSessionMap(); - return (FileUploadBean)sessionMap.get(FileUploadBean.getKey(id)); - } - - /** - * @return Returns the name of the file - */ - private String getFileName(final String id) - { - // try and retrieve the file and filename from the file upload bean - // representing the file we previously uploaded. - final FileUploadBean fileBean = this.getFileUploadBean(id); - return fileBean == null ? null : fileBean.getFileName(); - } - - /** - * @return Returns the schema file or null - */ - private File getFile(final String id) - { - // try and retrieve the file and filename from the file upload bean - // representing the file we previously uploaded. - final FileUploadBean fileBean = this.getFileUploadBean(id); - return fileBean != null ? fileBean.getFile() : null; - } - - /** - * - * @return Returns a HTML code for "description" attribute - */ - private String buildFormDescriptionAttribute() - { - FacesContext fc = FacesContext.getCurrentInstance(); - StringBuilder attribute = new StringBuilder(255); - attribute.append(DescriptionAttributeHelper.getTableBegin()); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "description", - DescriptionAttributeHelper.getDescriptionNotEmpty(fc, getFormDescription()), false)); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "schema_root_element_name", - getSchemaRootElementName())); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "output_path_pattern", - getOutputPathPatternForFormInstanceData())); - attribute.append(DescriptionAttributeHelper.getTableEnd()); - return attribute.toString(); - } - /** - * - * @return Returns a HTML code for "description" attribute - */ - private String buildWorkflowDescriptionAttribute() - { - FacesContext fc = FacesContext.getCurrentInstance(); - StringBuilder attribute = new StringBuilder(255); - attribute.append(DescriptionAttributeHelper.getTableBegin()); - - // get workflow description - String desc = null; - WorkflowDefinition def = getDefaultWorkflowDefinition(); - if (def != null) - { - desc = def.getDescription(); - } - - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "description", - DescriptionAttributeHelper.getDescriptionNotEmpty(fc, desc), false)); - attribute.append(DescriptionAttributeHelper.getTableEnd()); - return attribute.toString(); - } - -} diff --git a/source/java/org/alfresco/web/bean/wcm/CreateLayeredFolderDialog.java b/source/java/org/alfresco/web/bean/wcm/CreateLayeredFolderDialog.java deleted file mode 100644 index 4e621b312f..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/CreateLayeredFolderDialog.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; -import javax.faces.model.SelectItem; - -import org.alfresco.model.ApplicationModel; -import org.alfresco.model.ContentModel; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.domain.PropertyValue; -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.wcm.webproject.WebProjectInfo; -import org.alfresco.wcm.webproject.WebProjectService; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.data.IDataContainer; -import org.alfresco.web.data.QuickSort; -import org.alfresco.web.ui.common.Utils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Bean implementation for the AVM "Create Layered Folder" dialog. - * - * @author Gavin Cornwell - */ -public class CreateLayeredFolderDialog extends CreateFolderDialog -{ - private static final long serialVersionUID = -2922225296046521490L; - - private static final Log logger = LogFactory.getLog(CreateLayeredFolderDialog.class); - - protected String targetStore; - protected String targetPath; - protected List webProjects; - - transient protected WebProjectService wpService; - transient protected AVMService avmService; - - /** - * @param wpService The WebProjectService to set. - */ - public void setWebProjectService(WebProjectService wpService) - { - this.wpService = wpService; - } - - protected WebProjectService getWebProjectService() - { - if (wpService == null) - { - wpService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWebProjectService(); - } - return wpService; - } - - /** - * @param avmService The avmService to set. - */ - public void setAvmService(AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (avmService == null) - { - avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - return avmService; - } - - // ------------------------------------------------------------------------------ - // Dialog implementation - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map) - */ - @Override - public void init(Map parameters) - { - super.init(parameters); - - this.targetStore = null; - this.targetPath = null; - this.webProjects = null; - } - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - String parent = this.avmBrowseBean.getCurrentPath(); - - if (this.targetPath.startsWith("/") == false) - { - this.targetPath = "/" + this.targetPath; - } - - String layeredPath = AVMUtil.buildSandboxRootPath(this.targetStore) + this.targetPath; - - if (logger.isDebugEnabled()) - logger.debug("Creating layered folder named '" + this.name + "' in '" + - parent + "' pointing to '" + layeredPath + "'"); - - // Check the target path exists, display warning if not - AVMNodeDescriptor nodeDesc = getAvmService().lookup(-1, layeredPath); - if (nodeDesc != null) - { - // create the layered directory - getAvmService().createLayeredDirectory(layeredPath, parent, this.name); - - // add titled aspect and set the title (if supplied) and description - String newDirPath = parent + "/" + this.name; - NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, newDirPath); - getNodeService().addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, null); - if (this.title != null && this.title.length() != 0) - { - this.getAvmService().setNodeProperty(newDirPath, ContentModel.PROP_TITLE, - new PropertyValue(DataTypeDefinition.TEXT, this.title)); - } - - String desc = MessageFormat.format( - Application.getMessage(FacesContext.getCurrentInstance(), "shared_from"), - layeredPath); - this.getAvmService().setNodeProperty(newDirPath, ContentModel.PROP_DESCRIPTION, - new PropertyValue(DataTypeDefinition.TEXT, desc)); - } - else - { - String pattern = Application.getMessage(context, "target_does_not_exists"); - Utils.addErrorMessage(MessageFormat.format(pattern, this.targetPath)); - } - - return outcome; - } - - // ------------------------------------------------------------------------------ - // Bean getters and setters - - /** - * @return List of UISelectItem objects representing the web projects to select from - */ - public List getWebProjects() - { - if (this.webProjects == null) - { - // get the current web project dns name - String thisStoreName = this.avmBrowseBean.getWebProject().getStagingStore(); - - List wpInfos = getWebProjectService().listWebProjects(); - - this.webProjects = new ArrayList(wpInfos.size()); - for (WebProjectInfo wpInfo : wpInfos) - { - String name = wpInfo.getName(); - String dns = wpInfo.getStoreId(); - - // don't add ourself to the list of projects - if (thisStoreName.equals(dns) == false) - { - this.webProjects.add(new SelectItem(dns, name)); - } - } - - // sort the projects by their name - QuickSort sorter = new QuickSort(this.webProjects, "label", true, IDataContainer.SORT_CASEINSENSITIVE); - sorter.sort(); - } - - return this.webProjects; - } - - /** - * @param targetStore The store the layered folder is in - */ - public void setTargetStore(String targetStore) - { - this.targetStore = targetStore; - } - - /** - * @return The target store the layered folder is in - */ - public String getTargetStore() - { - return this.targetStore; - } - - /** - * @return The target path for the layered folder - */ - public String getTargetPath() - { - return this.targetPath; - } - - /** - * @param targetPath The target path of the layered folder - */ - public void setTargetPath(String targetPath) - { - this.targetPath = targetPath; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java deleted file mode 100644 index 62c1998573..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java +++ /dev/null @@ -1,936 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.ByteArrayInputStream; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.ResourceBundle; -import java.util.StringTokenizer; - -import javax.faces.context.FacesContext; -import javax.faces.event.ValueChangeEvent; -import javax.faces.model.SelectItem; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.model.WCMAppModel; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.domain.PropertyValue; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.repo.web.scripts.FileTypeImageUtils; -import org.alfresco.service.cmr.avm.AVMExistsException; -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.avm.locking.AVMLockingService; -import org.alfresco.service.cmr.avmsync.AVMDifference; -import org.alfresco.service.cmr.avmsync.AVMSyncService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.wcm.util.WCMUtil; -import org.alfresco.web.app.AlfrescoNavigationHandler; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.content.CreateContentWizard; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.data.IDataContainer; -import org.alfresco.web.data.QuickSort; -import org.alfresco.web.forms.Form; -import org.alfresco.web.forms.FormInstanceData; -import org.alfresco.web.forms.FormNotFoundException; -import org.alfresco.web.forms.FormsService; -import org.alfresco.web.forms.RenderingEngineTemplate; -import org.alfresco.web.forms.Rendition; -import org.alfresco.util.XMLUtil; -import org.alfresco.web.forms.xforms.XFormsBean; -import org.alfresco.web.ui.common.Utils; -import org.alfresco.web.ui.common.component.UIListItem; -import org.alfresco.web.ui.wcm.component.UIUserSandboxes; -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.config.Config; -import org.springframework.extensions.config.ConfigElement; -import org.springframework.extensions.config.ConfigService; -import org.w3c.dom.Document; - -/** - * Bean implementation for the "Create Web Content Wizard" dialog - */ -public class CreateWebContentWizard extends CreateContentWizard -{ - private static final long serialVersionUID = -4090370304405270047L; - - private static final Log logger = LogFactory.getLog(CreateWebContentWizard.class); - - private static final String MSG_ERROR_XFORMVALIDATION = "error_validate_xforms"; - - transient private List formChoices; - protected String createdPath = null; - protected List renditions = null; - protected FormInstanceData formInstanceData = null; - protected boolean formSelectDisabled = false; - protected boolean startWorkflow = false; - protected String formDescriptionAttribute; - - transient private AVMLockingService avmLockingService; - transient private AVMService avmService; - transient private AVMSyncService avmSyncService; - protected AVMBrowseBean avmBrowseBean; - protected FilePickerBean filePickerBean; - - /** - * @param avmService The AVMService to set. - */ - public void setAvmService(final AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (avmService == null) - { - avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMLockingAwareService(); - } - return avmService; - } - - /** - * @param avmLockingService The AVMLockingService to set. - */ - public void setAvmLockingService(final AVMLockingService avmLockingService) - { - this.avmLockingService = avmLockingService; - } - - protected AVMLockingService getAvmLockingService() - { - if (avmLockingService == null) - { - avmLockingService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMLockingService(); - } - return avmLockingService; - } - - /** - * @param avmSyncService The AVMSyncService to set. - */ - public void setAvmSyncService(final AVMSyncService avmSyncService) - { - this.avmSyncService = avmSyncService; - } - - protected AVMSyncService getAvmSyncService() - { - if (avmSyncService == null) - { - avmSyncService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMSyncService(); - } - return avmSyncService; - } - - /** - * @param avmBrowseBean The AVMBrowseBean to set. - */ - public void setAvmBrowseBean(final AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @param filePickerBean The FilePickerBean to set. - */ - public void setFilePickerBean(final FilePickerBean filePickerBean) - { - this.filePickerBean = filePickerBean; - } - - /** - * @param formsService The FormsService to set. - */ - public void setFormsService(final FormsService formsService) - { - this.formsService = formsService; - } - - protected FormsService getFormsService() - { - if (formsService == null) - { - formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); - } - return formsService; - } - - // ------------------------------------------------------------------------------ - // Wizard implementation - - @Override - public void init(Map parameters) - { - super.init(parameters); - - this.content = null; - this.inlineEdit = true; - this.formName = null; - this.mimeType = MimetypeMap.MIMETYPE_XML; - this.formInstanceData = null; - - this.renditions = null; - this.startWorkflow = false; - this.formSelectDisabled = false; - this.createMimeTypes = null; - this.formChoices = null; - this.filePickerBean.clearUploadedFiles(); - - // check for a form ID being passed in as a parameter - if (this.parameters.get(UIUserSandboxes.PARAM_FORM_NAME) != null) - { - // it is used to init the dialog to a specific template - final String formName = parameters.get(UIUserSandboxes.PARAM_FORM_NAME); - try - { - final Form form = this.avmBrowseBean.getWebProject().getForm(formName); - if (form != null) - { - this.formName = form.getName(); - this.formSelectDisabled = true; - } - } - catch (FormNotFoundException fnfe) - { - Utils.addErrorMessage(fnfe.getMessage(), fnfe); - } - } - - // this.formDescriptionAttribute = buildFormDescriptionAttribute(); - - // reset the preview layer - String storeName = AVMUtil.getStoreName(this.avmBrowseBean.getCurrentPath()); - storeName = AVMUtil.getCorrespondingPreviewStoreName(storeName); - final String path = AVMUtil.buildStoreRootPath(storeName); - - FacesContext context = FacesContext.getCurrentInstance(); - RetryingTransactionHelper txnHelper = Repository.getRetryingTransactionHelper(context); - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public String execute() throws Throwable - { - if (logger.isDebugEnabled()) - logger.debug("reseting layer " + path); - - // call the actual implementation - getAvmSyncService().resetLayer(path); - return null; - } - }; - - try - { - // Execute - txnHelper.doInTransaction(callback); - } - catch (Exception e) - { - Utils.addErrorMessage(e.getMessage(), e); - } - } - - @Override - public String next() - { - if ("summary".equals(Application.getWizardManager().getCurrentStepName())) - { - // if rendering a form, then save the content now to generate the renditions - if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType)) - { - FacesContext context = FacesContext.getCurrentInstance(); - // ALF-10162 : invoke XForm validation during forced browser submit - Map sessionMap = context.getExternalContext().getSessionMap(); - if (sessionMap.containsKey("XFormsBean")) - { - if (logger.isDebugEnabled()) - logger.debug("XFormsBean found in session, trying to validate the XForm form"); - - XFormsBean xFormsBean = (XFormsBean) context.getExternalContext().getSessionMap().get("XFormsBean"); - if (!xFormsBean.isXformValid()) - { - Application.getWizardManager().getState().setCurrentStep(Application.getWizardManager().getCurrentStep() - 1); - Utils.addErrorMessage(Application.getMessage(context, MSG_ERROR_XFORMVALIDATION)); - return super.next(); - } - } - - RetryingTransactionHelper txnHelper = Repository.getRetryingTransactionHelper(context); - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public String execute() throws Throwable - { - // call the actual implementation - saveContent(); - return null; - } - }; - - try - { - // Execute - txnHelper.doInTransaction(callback); - } - catch (Exception e) - { - Application.getWizardManager().getState().setCurrentStep(Application.getWizardManager().getCurrentStep() - 1); - Utils.addErrorMessage(e.getMessage(), e); - } - } - } - return super.next(); - } - - @Override - public String back() - { - if ("content".equals(Application.getWizardManager().getCurrentStepName())) - { - FacesContext context = FacesContext.getCurrentInstance(); - RetryingTransactionHelper txnHelper = Repository.getRetryingTransactionHelper(context); - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public String execute() throws Throwable - { - if (formInstanceData != null) - { - if (logger.isDebugEnabled()) - logger.debug("clearing form instance data: " + formInstanceData.getPath()); - - getAvmService().removeNode(formInstanceData.getPath()); - } - - if (renditions != null) - { - for (Rendition r : renditions) - { - getAvmService().removeNode(r.getPath()); - } - } - - return null; - } - }; - - try - { - // Execute - txnHelper.doInTransaction(callback); - } - catch (Exception e) - { - Utils.addErrorMessage(e.getMessage(), e); - } - - this.formInstanceData = null; - this.renditions = null; - } - return super.back(); - } - - @Override - protected String finishImpl(final FacesContext context, String outcome) - throws Exception - { - if (this.formInstanceData == null || this.renditions == null) - { - this.saveContent(); - } - - final NodeRef[] uploadedFiles = this.filePickerBean.getUploadedFiles(); - final List diffList = new ArrayList(1 + this.renditions.size() + uploadedFiles.length); - diffList.add(new AVMDifference(-1, this.createdPath, -1, AVMUtil.getCorrespondingPathInMainStore(this.createdPath), AVMDifference.NEWER)); - for (Rendition rendition : this.renditions) - { - final String path = rendition.getPath(); - diffList.add(new AVMDifference(-1, path, -1, AVMUtil.getCorrespondingPathInMainStore(path), AVMDifference.NEWER)); - } - - for (NodeRef uploadedFile : uploadedFiles) - { - final String path = AVMNodeConverter.ToAVMVersionPath(uploadedFile).getSecond(); - diffList.add(new AVMDifference(-1, path, -1, AVMUtil.getCorrespondingPathInMainStore(path), AVMDifference.NEWER)); - } - - if (logger.isDebugEnabled()) - { - for (final AVMDifference diff : diffList) - { - logger.debug("updating main store with " + diff.getSourcePath()); - } - } - this.getAvmSyncService().update(diffList, null, true, true, true, true, null, null); - - for (final AVMDifference diff : diffList) - { - final String path = diff.getDestinationPath(); - String storeId = AVMUtil.getStoreId(path); - String storePath = AVMUtil.getStoreRelativePath(path); - String storeName = AVMUtil.getStoreName(path); - - String lockOwner = getAvmLockingService().getLockOwner(storeId, storePath); - Map lockData = getAvmLockingService().getLockData(storeId, storePath); - String fromStoreName = lockData.get(WCMUtil.LOCK_KEY_STORE_NAME); - lockData.put(WCMUtil.LOCK_KEY_STORE_NAME, storeName); - - if (logger.isDebugEnabled()) - { - logger.debug("modifying lock on " + path + ". chaging store from " + fromStoreName + " to " + storeName); - } - - this.getAvmLockingService().modifyLock(storeId, AVMUtil.getStoreRelativePath(diff.getSourcePath()), lockOwner, storeId, AVMUtil.getStoreRelativePath(path), lockData); - } - - if (this.startWorkflow) - { - final List submitNodes = new ArrayList(1 + this.getUploadedFiles().size() + this.getRenditions().size()); - for (final AVMDifference d : diffList) - { - submitNodes.add(getAvmService().lookup(-1, d.getDestinationPath())); - } - this.avmBrowseBean.setNodesForSubmit(submitNodes); - final Map dialogParams = new HashMap(1); - dialogParams.put(SubmitDialog.PARAM_LOAD_SELECTED_NODES_FROM_BROWSE_BEAN, Boolean.TRUE.toString()); - Application.getDialogManager().setupParameters(dialogParams); - outcome = (outcome + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + AlfrescoNavigationHandler.DIALOG_PREFIX + "submitSandboxItems"); - } - if (this.formProcessorSession != null) - { - this.formProcessorSession.destroy(); - } - this.filePickerBean.clearUploadedFiles(); - - // return the default outcome - return outcome; - } - - @Override - protected String doPostCommitProcessing(final FacesContext facesContext, final String outcome) - { - // reset all paths and structures to the main store - this.createdPath = AVMUtil.getCorrespondingPathInMainStore(this.createdPath); - if (logger.isDebugEnabled()) - logger.debug("reset path " + this.createdPath + " to main store"); - - if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null) - { - try - { - this.formInstanceData = getFormsService().getFormInstanceData(-1, this.createdPath); - this.renditions = this.formInstanceData.getRenditions(); - - if (logger.isDebugEnabled()) - { - logger.debug("reset form instance data " + this.formInstanceData.getName() + - " and " + this.renditions.size() + " rendition(s) to main store"); - } - } - catch (FormNotFoundException fnfe) - { - logger.warn(fnfe); - } - } - - this.avmBrowseBean.setAvmActionNode(new AVMNode(this.getAvmService().lookup(-1, this.createdPath))); - - return outcome; - } - - @Override - public boolean getNextButtonDisabled() - { - // TODO: Allow the next button state to be configured so that - // wizard implementations don't have to worry about - // checking step numbers - - boolean disabled = false; - if ("details".equals(Application.getWizardManager().getCurrentStepName())) - { - disabled = (this.fileName == null || this.fileName.length() == 0); - } - - return disabled; - } - - /** - * Save the specified content using the currently set wizard attributes - */ - @SuppressWarnings("unchecked") - protected void saveContent() throws Exception - { - // get the parent path of the location to save the content - String fileName = this.getFileName(); - String contentName = fileName; - if (logger.isDebugEnabled()) - logger.debug("saving file content to " + fileName); - - final String cwd = AVMUtil.getCorrespondingPathInPreviewStore(this.avmBrowseBean.getCurrentPath()); - final Form form = (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) ? this.getForm() : null); - String path = cwd; - - final Map props = new HashMap(1, 1.0f); - final List aspects = new ArrayList(4); - - if (form != null) - { - path = form.getOutputPathForFormInstanceData(this.getInstanceDataDocument(), fileName, cwd, this.avmBrowseBean.getWebapp()); - this.content = XMLUtil.toString(this.getInstanceDataDocument(), false); - final String[] sb = AVMNodeConverter.SplitBase(path); - path = sb[0]; - fileName = sb[1]; - props.put(WCMAppModel.PROP_PARENT_FORM_NAME, new PropertyValue(null, form.getName())); - props.put(WCMAppModel.PROP_ORIGINAL_PARENT_PATH, new PropertyValue(null, cwd)); - aspects.add(WCMAppModel.ASPECT_FORM_INSTANCE_DATA); - } - props.put(ContentModel.PROP_TITLE, new PropertyValue(null, fileName)); - aspects.add(ContentModel.ASPECT_TITLED); - - if (logger.isDebugEnabled()) - logger.debug("creating all directories in path " + path); - - AVMUtil.makeAllDirectories(path); - - if (logger.isDebugEnabled()) - logger.debug("creating file " + fileName + " in " + path); - - // put the content of the file into the AVM store - String filePath = AVMNodeConverter.ExtendAVMPath(path, fileName); - try - { - /** - * create the new file - */ - getAvmService().createFile(path, fileName, - new ByteArrayInputStream((this.content == null ? "" : this.content).getBytes("UTF-8")), - aspects, - props); - } - catch (AVMExistsException avmee) - { - String msg = Application.getMessage(FacesContext.getCurrentInstance(), "error_exists"); - msg = MessageFormat.format(msg, fileName); - throw new AlfrescoRuntimeException(msg, avmee); - } - - // remember the created path - this.createdPath = filePath; - - // add titled aspect for the read/edit properties screens - final NodeRef formInstanceDataNodeRef = AVMNodeConverter.ToNodeRef(-1, this.createdPath); - - /** - * Generate form renditions. - */ - if (form != null) - { - - this.formInstanceData = getFormsService().getFormInstanceData(formInstanceDataNodeRef); - this.renditions = new LinkedList(); - for (RenderingEngineTemplate ret : form.getRenderingEngineTemplates()) - { - try - { - path = ret.getOutputPathForRendition(this.formInstanceData, cwd, contentName); - - if (logger.isDebugEnabled()) - logger.debug("About to render path: " + path); - - // generate the rendition - this.renditions.add(ret.render(this.formInstanceData, path)); - } - catch (Exception e) - { - // TODO - improve error handling, e.g. render could return list of errors rather than splitting on newline character - StringTokenizer st = new StringTokenizer(e.getMessage(), "\n"); - if (st.hasMoreElements()) - { - Utils.addErrorMessage("Error generating rendition using " + ret.getName() + ": " + st.nextToken(), e); - while (st.hasMoreElements()) - { - Utils.addErrorMessage(st.nextToken(), e); - } - } - else - { - Utils.addErrorMessage("Error generating rendition using " + ret.getName() + - ": " + e.getMessage(), e); - } - } - } - } - else - { - this.renditions = Collections.EMPTY_LIST; - } - } - - // ------------------------------------------------------------------------------ - // Bean Getters and Setters - - /** Overrides in order to strip an xml extension if the user entered it */ - @Override - public String getFileName() - { - final String result = super.getFileName(); - return (result != null && MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.getFormName() != null && "xml".equals(FilenameUtils.getExtension(result).toLowerCase()) ? FilenameUtils - .removeExtension(result) - : result); - } - - /** - * @return Returns the content from the edited form. - */ - public String getContent() - { - return this.content; - } - - /** - * @param content The content to edit (should be clear initially) - */ - public void setContent(String content) - { - this.content = content; - } - - /** - * @return the available forms from this web project that can be created. - */ - public List getFormChoices() - { - if (this.formChoices == null) - { - final List
forms = this.avmBrowseBean.getWebProject().getForms(); - this.formChoices = new ArrayList(forms.size()); - for (final Form f : forms) - { - this.formChoices.add(new SelectItem(f.getName(), f.getTitle())); - } - - final QuickSort sorter = new QuickSort(this.formChoices, "label", true, IDataContainer.SORT_CASEINSENSITIVE); - sorter.sort(); - - } - return this.formChoices; - } - - /** - * @return Returns a list of mime types to allow the user to select from - */ - public List getCreateMimeTypes() - { - if ((this.createMimeTypes == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) - { - final FacesContext context = FacesContext.getCurrentInstance(); - - // add the well known object type to start with - this.createMimeTypes = new ArrayList(5); - - // add the configured create mime types to the list - final ConfigService svc = Application.getConfigService(context); - final Config wizardCfg = svc.getConfig("Content Wizards"); - if (wizardCfg == null) - { - logger.warn("Could not find 'Content Wizards' configuration section"); - } - else - { - final ConfigElement typesCfg = wizardCfg.getConfigElement("create-mime-types"); - if (typesCfg == null) - { - logger.warn("Could not find 'create-mime-types' configuration element"); - } - else - { - for (ConfigElement child : typesCfg.getChildren()) - { - final String currentMimeType = child.getAttribute("name"); - if (currentMimeType == null || (MimetypeMap.MIMETYPE_XML.equals(currentMimeType) && this.getFormChoices().size() == 0)) - { - continue; - } - - final String label = this.getSummaryMimeType(currentMimeType); - this.createMimeTypes.add(new SelectItem(currentMimeType, label)); - } - - // make sure the list is sorted by the label - final QuickSort sorter = new QuickSort(this.objectTypes, "label", true, IDataContainer.SORT_CASEINSENSITIVE); - sorter.sort(); - } - } - } - - return this.createMimeTypes; - } - - /** - * @return the current seleted form's name or null. - */ - public String getFormName() - { - return this.formName; - } - - public Form getForm() throws FormNotFoundException - { - return (this.getFormName() != null ? this.avmBrowseBean.getWebProject().getForm(this.getFormName()) : null); - } - - /** - * @param form Sets the currently selected form - */ - public void setFormName(final String formName) - { - this.formName = formName; - } - - /** - * @return Returns the wrapper instance data for feeding the xml content to the form processor. - */ - public Document getInstanceDataDocument() - { - if (this.instanceDataDocument == null) - { - final String content = this.getContent(); - try - { - this.instanceDataDocument = (content != null ? XMLUtil.parse(content) : XMLUtil.newDocument()); - } - catch (Exception e) - { - Utils.addErrorMessage("error parsing document", e); - this.instanceDataDocument = XMLUtil.newDocument(); - } - } - return this.instanceDataDocument; - } - - /** - * @return List of UI items to represent the full list of available Web Forms - */ - public List getFormsList() - { - Collection forms = getFormsService().getWebForms(); - List items = new ArrayList(forms.size()+1); - items.add(new SelectItem("", "")); - for (Form form : forms) - { - items.add(new SelectItem(form.getName(), form.getTitle())); - } - return items; - } - - /** - * Returns the generated form instance data. - */ - public FormInstanceData getFormInstanceData() - { - return this.formInstanceData; - } - - /** - * Returns the generated renditions - */ - public List getRenditions() - { - return this.renditions; - } - - /** - * Returns the files uploaded using the form - */ - @SuppressWarnings("unchecked") - public List getUploadedFiles() - { - if (this.formProcessorSession == null) - { - return Collections.EMPTY_LIST; - } - - final NodeRef[] uploadedFiles = this.filePickerBean.getUploadedFiles(); - final List result = new ArrayList(uploadedFiles.length); - - for (NodeRef nodeRef : uploadedFiles) - { - final UIListItem item = new UIListItem(); - final String name = (String) this.getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME); - item.setValue(name); - item.setLabel((String) this.getNodeService().getProperty(nodeRef, ContentModel.PROP_TITLE)); - item.setDescription((String) this.getNodeService().getProperty(nodeRef, ContentModel.PROP_DESCRIPTION)); - item.setImage(FileTypeImageUtils.getFileTypeImage(name, false)); - result.add(item); - } - return result; - } - - /** - * Returns the number of submittable files which is the total number of uploaded files, renditions, and the form instance data. - */ - public int getNumberOfSubmittableFiles() - { - return 1 + this.getUploadedFiles().size() + this.getRenditions().size(); - } - - public boolean getFormSelectDisabled() - { - return this.formSelectDisabled; - } - - public void setFormSelectDisabled(boolean formSelectDisabled) - { - this.formSelectDisabled = formSelectDisabled; - } - - public void setStartWorkflow(final boolean startWorkflow) - { - this.startWorkflow = startWorkflow; - } - - public boolean getStartWorkflow() - { - return this.startWorkflow; - } - - public boolean getSubmittable() - { - return true; - } - - /** - * Provides path to current WCM webApp folder. - */ - public String getPreviewSandboxUrl() - { - return AVMUtil.buildWebappUrl(AVMUtil.getCorrespondingPreviewStoreName(this.avmBrowseBean.getSandbox()), this.avmBrowseBean.getWebapp()); - } - - /** - * Provides name of current WCM webApp folder. - */ - - public String getAvmWebappPrefix() - { - return AVMUtil.getPreviewURI(AVMUtil.getCorrespondingPreviewStoreName(this.avmBrowseBean.getSandbox())); - } - - /** - * Provides the url to the preview sandbox containing the asset currently being edited. - */ - public String getAvmWebappName() - { - return this.avmBrowseBean.getWebapp(); - } - - public String getSummary() - { - final ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); - - // TODO: show first few lines of content here? - return this.buildSummary( - new String[] - { - bundle.getString("file_name"), - bundle.getString("type"), - bundle.getString("content_type") - }, - new String[] - { - Utils.encode(this.getFileName()), - this.getSummaryObjectType(), - this.getSummaryMimeType(this.mimeType) - }); - } - - public boolean getEditMode() - { - return false; - } - - public String getFormDescriptionAttribute() - { - this.formDescriptionAttribute = buildFormDescriptionAttribute(); - return this.formDescriptionAttribute; - } - - public String getFormLabelAttribute() - { - StringBuilder builder = new StringBuilder(""); - builder.append(Utils.encode(this.getFormInstanceData().getName())); - builder.append(""); - return builder.toString(); - } - - // ------------------------------------------------------------------------------ - // Action event handlers - - /** - * Create content type value changed by the user - */ - public void createContentChanged(ValueChangeEvent event) - { - // clear the content as HTML is not compatible with the plain text box etc. - this.content = null; - } - - private String buildFormDescriptionAttribute() - { - FacesContext fc = FacesContext.getCurrentInstance(); - String contextPath = fc.getExternalContext().getRequestContextPath(); - StringBuilder attribute = new StringBuilder(255); - attribute.append(""); - attribute.append(""); - attribute.append(""); - attribute.append("\n"); - attribute.append(DescriptionAttributeHelper.getTableBegin()); - String formTitle = null; - try - { - formTitle = getForm().getTitle(); - } - catch (FormNotFoundException e) - { - formTitle = Application.getMessage(FacesContext.getCurrentInstance(),"form_not_found"); - } - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "form", formTitle)); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "location", - getFormInstanceData().getSandboxRelativePath())); - attribute.append(DescriptionAttributeHelper.getTableEnd()); - return attribute.toString(); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebappDialog.java b/source/java/org/alfresco/web/bean/wcm/CreateWebappDialog.java deleted file mode 100644 index 4245294e12..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebappDialog.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import javax.faces.context.FacesContext; - -import org.alfresco.wcm.webproject.WebProjectService; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; - -/** - * Bean implementation for the AVM "Create Webapp Folder" dialog. - * - * @author Kevin Roast - */ -public class CreateWebappDialog extends CreateFolderDialog -{ - // ------------------------------------------------------------------------------ - // Dialog implementation - - private static final long serialVersionUID = -3883601909422422829L; - - transient private WebProjectService wpService; - - // ------------------------------------------------------------------------------ - // Bean property getters and setters - - public void setWebProjectService(WebProjectService wpService) - { - this.wpService = wpService; - } - - protected WebProjectService getWebProjectService() - { - if (wpService == null) - { - wpService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWebProjectService(); - } - return wpService; - } - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - Node websiteNode = this.avmBrowseBean.getWebsite(); - - if (websiteNode != null) - { - getWebProjectService().createWebApp(websiteNode.getNodeRef(), this.name, this.description); - } - - return outcome; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java deleted file mode 100644 index 2768468491..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java +++ /dev/null @@ -1,1969 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.Serializable; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; -import javax.faces.model.DataModel; -import javax.faces.model.ListDataModel; -import javax.faces.model.SelectItem; - -import org.alfresco.model.ContentModel; -import org.alfresco.model.WCMAppModel; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.service.cmr.workflow.WorkflowDefinition; -import org.alfresco.service.cmr.workflow.WorkflowService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.ExpiringValueCache; -import org.alfresco.wcm.preview.PreviewURIService; -import org.alfresco.wcm.util.WCMUtil; -import org.alfresco.wcm.webproject.WebProjectInfo; -import org.alfresco.wcm.webproject.WebProjectInfoImpl; -import org.alfresco.wcm.webproject.WebProjectService; -import org.alfresco.web.app.AlfrescoNavigationHandler; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.wizard.BaseWizardBean; -import org.alfresco.web.bean.wizard.BaseInviteUsersWizard.UserGroupRole; -import org.alfresco.web.forms.Form; -import org.alfresco.web.forms.FormNotFoundException; -import org.alfresco.web.forms.FormsService; -import org.alfresco.web.forms.RenderingEngineTemplate; -import org.alfresco.web.ui.common.Utils; -import org.alfresco.web.ui.common.component.UIActionLink; -import org.alfresco.web.ui.common.component.UIListItem; -import org.alfresco.web.ui.common.component.UISelectList; -import org.alfresco.web.ui.wcm.WebResources; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Backing bean for the Create Web Project wizard. - * - * @author Kevin Roast - * @author Arseny Kovalchuk (The fixer of the issue https://issues.alfresco.com/jira/browse/ETWOTWO-600,601) - */ -public class CreateWebsiteWizard extends BaseWizardBean -{ - private static final long serialVersionUID = 6480869380508635173L; - - private static final String MSG_USERROLES = "create_website_summary_users"; - private static final String MSG_SERVER_ALREADY_EXIST = "server_already_exist"; - - private static final String COMPONENT_FORMLIST = "form-list"; - private static final String COMPONENT_WORKFLOWLIST = "workflow-list"; - - // wizard step names (that are referenced) - private static final String STEP_DETAILS = "details"; - private static final String STEP_DEPLOYMENT = "deployment"; - - private static final String MATCH_DEFAULT = ".*"; - - private static final String WEBAPP_DEFAULT = "ROOT"; - - // Create From drop-down control selection values - private static final String CREATE_EMPTY = "empty"; - private static final String CREATE_EXISTING = "existing"; - - protected final static Log logger = LogFactory.getLog(CreateWebsiteWizard.class); - - protected boolean editMode = false; - - // TODO refactor to WebProjectInfo - protected String dnsName; - protected String title; - protected String name; - protected String description; - protected String webapp = WEBAPP_DEFAULT; - protected String createFrom = null; - protected boolean isSource; - protected String previewProvider; - protected NodeRef wpNodeRef; - - protected String[] sourceWebProject = null; - protected ExpiringValueCache> webProjectsList; - protected List webappsList; - protected List previewProvidersList; - protected boolean showAllSourceProjects; - protected String websiteDescriptionAttribute; - - transient private WorkflowService workflowService; - transient private PersonService personService; - transient private FormsService formsService; - transient private WebProjectService wpService; - transient private PreviewURIService previewURIService; - - /** set true when an option in the Create From screen is changed - this is used as an - indicator to reload the wizard data model from the selected source web project */ - private boolean createFromValueChanged; - - /** datamodel for table of selected forms */ - transient private DataModel formsDataModel = null; - - /** transient list of form UIListItem objects */ - protected List formsList = null; - - /** list of form wrapper objects */ - protected List forms = null; - - /** Current form for dialog context */ - protected FormWrapper actionForm = null; - - /** datamodel for table of selected workflows */ - transient private DataModel workflowsDataModel = null; - - /** list of workflow wrapper objects */ - protected List workflows = null; - - /** Current workflow for dialog context */ - protected WorkflowConfiguration actionWorkflow = null; - - /** Map and list of deployment servers */ - protected Map deployServersMap = null; - protected List deployServersList = null; - - /** Current state of deploy server editing */ - protected DeploymentServerConfig currentDeployServer = null; - protected Map editedDeployServerProps = null; - protected boolean inAddDeployServerMode = false; - protected String addDeployServerType = WCMAppModel.CONSTRAINT_FILEDEPLOY; - - // ------------------------------------------------------------------------------ - // Wizard implementation - - /** - * Initialises the wizard - */ - public void init(Map parameters) - { - super.init(parameters); - - this.name = null; - this.dnsName = null; - this.title = null; - this.description = null; - this.isSource = false; - clearFormsWorkflowsDeploymentAndUsers(); - this.createFrom = CREATE_EMPTY; - // requry existing web projects list every 10 seconds - this.webProjectsList = new ExpiringValueCache>(1000L*10L); - this.sourceWebProject = null; - this.createFromValueChanged = false; - this.showAllSourceProjects = false; - this.websiteDescriptionAttribute = null; - } - - private void clearFormsWorkflowsDeploymentAndUsers() - { - this.formsDataModel = null; - this.forms = new ArrayList(8); - this.workflowsDataModel = null; - this.workflows = new ArrayList(4); - - // reset all deployment data - this.deployServersMap = new HashMap(4, 1.0f); - this.deployServersList = new ArrayList(4); - this.currentDeployServer = null; - this.editedDeployServerProps = new HashMap(12, 1.0f); - this.inAddDeployServerMode = false; - this.addDeployServerType = WCMAppModel.CONSTRAINT_FILEDEPLOY; - - // init the dependant bean we are using for the invite users pages - InviteWebsiteUsersWizard wiz = getInviteUsersWizard(); - wiz.init(null); - } - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - // the Finish button can be pressed early in the steps - ensure the model is up-to-date - updateModelOnCreateFromChange(); - - // if the user selected Create From existing web project we will branch from it - NodeRef sourceNodeRef = null; - if (CREATE_EXISTING.equals(this.createFrom) && - (this.sourceWebProject != null && this.sourceWebProject.length != 0)) - { - sourceNodeRef = new NodeRef(this.sourceWebProject[0]); - } - - WebProjectInfo wpInfo = getWebProjectService().createWebProject(new WebProjectInfoImpl(this.dnsName, this.name, this.title, this.description, this.webapp, this.isSource, sourceNodeRef, this.previewProvider)); - - String avmStore = wpInfo.getStoreId(); - NodeRef wpNodeRef = wpInfo.getNodeRef(); - - final NodeRef websiteParent = getWebProjectService().getWebProjectsRoot(); - - // call a delegate wizard bean to provide invite user functionality - InviteWebsiteUsersWizard wiz = getInviteUsersWizard(); - wiz.reset(); - wiz.setNode(new Node(wpNodeRef)); - wiz.setAvmStore(avmStore); - wiz.setStandalone(false); - // the wizard is responsible for notifying the invited users, setting the appropriate - // node permissions and also for creating user sandboxes and associations to the web folder node - outcome = wiz.finishImpl(context, outcome); - if (outcome != null) - { - // persist the forms, templates, workflows, workflow defaults and deployment - // config to the model for this web project - saveWebProjectModel(wpNodeRef); - - // navigate to the Websites folder so we can see the newly created folder - this.navigator.setCurrentNodeId(websiteParent.getId()); - - outcome = AlfrescoNavigationHandler.CLOSE_WIZARD_OUTCOME; - } - - return outcome; - } - - @Override - public boolean getFinishButtonDisabled() - { - // allow finish from any step other than the initial details page - String stepName = Application.getWizardManager().getCurrentStepName(); - return (STEP_DETAILS.equals(stepName)); - } - - /** - * Persist the forms, templates, workflows, workflow defaults and deployment config - * to the model for this web project - * - * @param nodeRef NodeRef to the web project - */ - protected void saveWebProjectModel(NodeRef nodeRef) - { - Map props = new HashMap(4, 1.0f); - - // first walk each form object, saving templates and workflow defaults for each - for (FormWrapper form : this.forms) - { - // create web form with name as per the name of the form object in the DD - props.put(WCMAppModel.PROP_FORMNAME, form.getName()); - NodeRef formRef = getNodeService().createNode(nodeRef, - WCMAppModel.ASSOC_WEBFORM, - WCMAppModel.ASSOC_WEBFORM, - WCMAppModel.TYPE_WEBFORM, - props).getChildRef(); - - // add title aspect for user defined title and description labels - props.clear(); - props.put(ContentModel.PROP_TITLE, form.getTitle()); - props.put(ContentModel.PROP_DESCRIPTION, form.getDescription()); - getNodeService().addAspect(formRef, ContentModel.ASPECT_TITLED, props); - - // add filename pattern aspect if a filename pattern has been applied - if (form.getOutputPathPattern() != null) - { - props.clear(); - props.put(WCMAppModel.PROP_OUTPUT_PATH_PATTERN, form.getOutputPathPattern()); - getNodeService().addAspect(formRef, WCMAppModel.ASPECT_OUTPUT_PATH_PATTERN, props); - } - - // associate to workflow defaults if any are present - if (form.getWorkflow() != null) - { - WorkflowWrapper workflow = form.getWorkflow(); - props.clear(); - props.put(WCMAppModel.PROP_WORKFLOW_NAME, workflow.getName()); - NodeRef workflowRef = getNodeService().createNode(formRef, - WCMAppModel.ASSOC_WORKFLOWDEFAULTS, - WCMAppModel.ASSOC_WORKFLOWDEFAULTS, - WCMAppModel.TYPE_WORKFLOW_DEFAULTS, - props).getChildRef(); - - // persist workflow default params - if (workflow.getParams() != null) - { - AVMWorkflowUtil.serializeWorkflowParams((Serializable)workflow.getParams(), workflowRef); - } - } - - // associate to a web form template for each template applied to the form - for (PresentationTemplate template : form.getTemplates()) - { - props.clear(); - props.put(WCMAppModel.PROP_BASE_RENDERING_ENGINE_TEMPLATE_NAME, - template.getRenderingEngineTemplate().getName()); - NodeRef templateRef = getNodeService().createNode(formRef, - WCMAppModel.ASSOC_WEBFORMTEMPLATE, - WCMAppModel.ASSOC_WEBFORMTEMPLATE, - WCMAppModel.TYPE_WEBFORMTEMPLATE, - props).getChildRef(); - - // add filename pattern aspect if a filename pattern has been applied - if (template.getOutputPathPattern() != null) - { - props.clear(); - props.put(WCMAppModel.PROP_OUTPUT_PATH_PATTERN, template.getOutputPathPattern()); - getNodeService().addAspect(templateRef, WCMAppModel.ASPECT_OUTPUT_PATH_PATTERN, props); - } - } - } - - // walk each web project workflow definition and save defaults for each - for (WorkflowWrapper workflow : this.workflows) - { - props.clear(); - props.put(WCMAppModel.PROP_WORKFLOW_NAME, workflow.getName()); - NodeRef workflowRef = getNodeService().createNode(nodeRef, - WCMAppModel.ASSOC_WEBWORKFLOWDEFAULTS, - WCMAppModel.ASSOC_WEBWORKFLOWDEFAULTS, - WCMAppModel.TYPE_WEBWORKFLOWDEFAULTS, - props).getChildRef(); - - // persist workflow default params - if (workflow.getParams() != null) - { - AVMWorkflowUtil.serializeWorkflowParams((Serializable)workflow.getParams(), workflowRef); - } - - // add filename pattern aspect if a filename pattern has been applied - if (workflow.getFilenamePattern() != null) - { - props.clear(); - props.put(WCMAppModel.PROP_FILENAMEPATTERN, workflow.getFilenamePattern()); - getNodeService().addAspect(workflowRef, WCMAppModel.ASPECT_FILENAMEPATTERN, props); - } - } - - // finally walk through the deployment config and save - for (DeploymentServerConfig server : this.deployServersList) - { - Map repoProps = server.getRepoProps(); - - getNodeService().createNode(nodeRef, WCMAppModel.ASSOC_DEPLOYMENTSERVER, - WCMAppModel.ASSOC_DEPLOYMENTSERVER, WCMAppModel.TYPE_DEPLOYMENTSERVER, - repoProps); - - if (logger.isDebugEnabled()) - { - // overwrite the password property before logging - Map tempProps = new HashMap(repoProps.size()); - tempProps.putAll(repoProps); - tempProps.put(WCMAppModel.PROP_DEPLOYSERVERPASSWORD, "*****"); - - logger.debug("Saved deploymentserver node using repo props: " + tempProps); - } - } - } - - /** - * Restore the forms, templates, workflows and deployment config from the model for a web project. - * Can also optionally restore the basic node propetries and user details. - * - * @param nodeRef NodeRef to the web project to load model from - * @param loadProperties Load the basic properties such as name, title, DNS. - * @param loadUsers Load the user details. - */ - @SuppressWarnings("unchecked") - protected void loadWebProjectModel(NodeRef nodeRef, boolean loadProperties, boolean loadUsers) - { - // simple properties are optionally loaded - if (loadProperties) - { - WebProjectInfo wpInfo = getWebProjectService().getWebProject(nodeRef); - this.name = wpInfo.getName(); - this.title = wpInfo.getTitle(); - this.description = wpInfo.getDescription(); - this.dnsName = wpInfo.getStoreId(); - this.webapp = wpInfo.getDefaultWebApp(); - this.isSource = wpInfo.isTemplate(); - this.wpNodeRef = wpInfo.getNodeRef(); - this.previewProvider = wpInfo.getPreviewProviderName(); - } - - if (loadUsers) - { - InviteWebsiteUsersWizard wiz = getInviteUsersWizard(); - wiz.reset(); - - // load the users assigned to the web project - Map userRoles = getWebProjectService().listWebUsers(nodeRef); - for (Map.Entry userRole : userRoles.entrySet()) - { - String username = userRole.getKey(); - String userrole = userRole.getValue(); - wiz.addAuthorityWithRole(username, userrole); - } - } - - // load the form templates - List webFormRefs = getNodeService().getChildAssocs( - nodeRef, WCMAppModel.ASSOC_WEBFORM, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef ref : webFormRefs) - { - NodeRef formRef = ref.getChildRef(); - - String name = (String)getNodeService().getProperty(formRef, WCMAppModel.PROP_FORMNAME); - try - { - Form formImpl = getFormsService().getWebForm(name); - FormWrapper form = new FormWrapper(formImpl); - form.setTitle((String)getNodeService().getProperty(formRef, ContentModel.PROP_TITLE)); - form.setDescription((String)getNodeService().getProperty(formRef, ContentModel.PROP_DESCRIPTION)); - form.setOutputPathPattern((String)getNodeService().getProperty(formRef, WCMAppModel.PROP_OUTPUT_PATH_PATTERN)); - - // the single workflow attached to the form - List workflowRefs = getNodeService().getChildAssocs( - formRef, WCMAppModel.ASSOC_WORKFLOWDEFAULTS, RegexQNamePattern.MATCH_ALL); - if (workflowRefs.size() == 1) - { - NodeRef wfRef = workflowRefs.get(0).getChildRef(); - String wfName = (String)getNodeService().getProperty(wfRef, WCMAppModel.PROP_WORKFLOW_NAME); - WorkflowDefinition wfDef = getWorkflowService().getDefinitionByName(wfName); - if (wfDef != null) - { - WorkflowWrapper wfWrapper = new WorkflowWrapper(wfName, wfDef.getTitle(), wfDef.getDescription()); - wfWrapper.setParams((Map)AVMWorkflowUtil.deserializeWorkflowParams(wfRef)); - if (wfDef.getStartTaskDefinition() != null) - { - wfWrapper.setType(wfDef.getStartTaskDefinition().metadata.getName()); - } - form.setWorkflow(wfWrapper); - } - } - - // the templates attached to the form - List templateRefs = getNodeService().getChildAssocs( - formRef, WCMAppModel.ASSOC_WEBFORMTEMPLATE, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef tChildRef : templateRefs) - { - NodeRef templateRef = tChildRef.getChildRef(); - String renderingEngineTemplateName = (String)getNodeService().getProperty( - templateRef, WCMAppModel.PROP_BASE_RENDERING_ENGINE_TEMPLATE_NAME); - RenderingEngineTemplate ret = formImpl.getRenderingEngineTemplate(renderingEngineTemplateName); - if (ret != null) - { - String outputPathPattern = (String)getNodeService().getProperty( - templateRef, WCMAppModel.PROP_OUTPUT_PATH_PATTERN); - form.addTemplate(new PresentationTemplate(ret, outputPathPattern)); - } - } - - this.forms.add(form); - } - catch (FormNotFoundException fnfe) - { - // ignore as we cannot do anything about a missing form - if (logger.isDebugEnabled()) - logger.debug("Unable to find Web Form named '" + fnfe.getFormName() + - "' as referenced in web project: " + nodeRef.toString()); - } - } - - // load the workflows associated with the website - List workflowRefs = getNodeService().getChildAssocs( - nodeRef, WCMAppModel.ASSOC_WEBWORKFLOWDEFAULTS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef wChildRef : workflowRefs) - { - NodeRef wfRef = wChildRef.getChildRef(); - String wfName = (String)getNodeService().getProperty(wfRef, WCMAppModel.PROP_WORKFLOW_NAME); - WorkflowDefinition wfDef = getWorkflowService().getDefinitionByName(wfName); - if (wfDef != null) - { - WorkflowWrapper wfWrapper = new WorkflowWrapper(wfName, wfDef.getTitle(), wfDef.getDescription()); - wfWrapper.setParams((Map)AVMWorkflowUtil.deserializeWorkflowParams(wfRef)); - wfWrapper.setFilenamePattern((String)getNodeService().getProperty(wfRef, - WCMAppModel.PROP_FILENAMEPATTERN)); - if (wfDef.getStartTaskDefinition() != null) - { - wfWrapper.setType(wfDef.getStartTaskDefinition().metadata.getName()); - } - this.workflows.add(wfWrapper); - } - } - - // load the deployment server config objects - List serverRefs = getNodeService().getChildAssocs( - nodeRef, WCMAppModel.ASSOC_DEPLOYMENTSERVER, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef sChildRef : serverRefs) - { - NodeRef serverRef = sChildRef.getChildRef(); - DeploymentServerConfig server = new DeploymentServerConfig( - serverRef, getNodeService().getProperties(serverRef)); - - this.deployServersList.add(server); - this.deployServersMap.put(server.getId(), server); - - if (logger.isDebugEnabled()) - logger.debug("Loaded deploy server config: " + server); - } - } - - - // ------------------------------------------------------------------------------ - // Service setters - - /** - * @param workflowService The WorkflowService to set. - */ - public void setWorkflowService(WorkflowService workflowService) - { - this.workflowService = workflowService; - } - - protected WorkflowService getWorkflowService() - { - if (workflowService == null) - { - workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService(); - } - return workflowService; - } - - /** - * @param personService The PersonService to set. - */ - public void setPersonService(PersonService personService) - { - this.personService = personService; - } - - protected PersonService getPersonService() - { - if (personService == null) - { - personService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPersonService(); - } - return personService; - } - - /** - * @param formsService The FormsService to set. - */ - public void setFormsService(final FormsService formsService) - { - this.formsService = formsService; - } - - protected FormsService getFormsService() - { - if (formsService == null) - { - formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); - } - return formsService; - } - - /** - * @param wpService The WebProjectService to set. - */ - public void setWebProjectService(final WebProjectService wpService) - { - this.wpService = wpService; - } - - protected WebProjectService getWebProjectService() - { - if (wpService == null) - { - wpService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWebProjectService(); - } - return wpService; - } - - /** - * @param previewURIService The PreviewURIService to set. - */ - public void setPreviewURIService(final PreviewURIService previewURIService) - { - this.previewURIService = previewURIService; - } - - protected PreviewURIService getPreviewURIService() - { - if (previewURIService == null) - { - previewURIService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPreviewURIService(); - } - return previewURIService; - } - - // ------------------------------------------------------------------------------ - // Bean getters and setters - - /** - * @return Returns the wizard Edit Mode. - */ - public boolean getEditMode() - { - return this.editMode; - } - - /** - * @param editMode The wizard Edit Mode to set. - */ - public void setEditMode(boolean editMode) - { - this.editMode = editMode; - } - - /** - * @return Returns the web project node ref. - */ - protected NodeRef getWebProjectNodeRef() - { - return wpNodeRef; - } - - /** - * @return Returns the name. - */ - public String getName() - { - return name; - } - - /** - * @param name The name to set. - */ - public void setName(String name) - { - this.name = name; - } - - /** - * @return DNS name - */ - public String getDnsName() - { - return this.dnsName; - } - - /** - * @param dnsName DNS name - */ - public void setDnsName(String dnsName) - { - this.dnsName = dnsName; - } - - /** - * @return Returns the title. - */ - public String getTitle() - { - return title; - } - - /** - * @param title The title to set. - */ - public void setTitle(String title) - { - this.title = title; - } - - /** - * @return Returns the description. - */ - public String getDescription() - { - return description; - } - - /** - * @param description The description to set. - */ - public void setDescription(String description) - { - this.description = description; - } - - /** - * @return the default webapp name for the project - */ - public String getWebapp() - { - return this.webapp; - } - - /** - * @param webapp The default webapp name for the project - */ - public void setWebapp(String webapp) - { - this.webapp = webapp; - } - - public String getPreviewProvider() - { - return this.previewProvider; - } - - public void setPreviewProvider(String previewProvider) - { - this.previewProvider = previewProvider; - } - - /** - * @return the create from selection value - */ - public String getCreateFrom() - { - return this.createFrom; - } - - /** - * @param createFrom the create from selection value - */ - public void setCreateFrom(String createFrom) - { - if (createFrom != null && createFrom.equals(this.createFrom) == false) - { - this.createFromValueChanged = true; - } - this.createFrom = createFrom; - } - - /** - * @return the existing Web Project to use - */ - public String[] getSourceWebProject() - { - return this.sourceWebProject; - } - - /** - * @param existingWebProject the existing Web Project to set - */ - public void setSourceWebProject(String[] existingWebProject) - { - if (this.sourceWebProject != null && this.sourceWebProject.length != 0) - { - if ((existingWebProject == null || existingWebProject.length == 0) || - (existingWebProject[0].equals(this.sourceWebProject[0]) == false)) - { - this.createFromValueChanged = true; - } - } - else - { - if (existingWebProject != null && existingWebProject.length != 0) - { - this.createFromValueChanged = true; - } - } - this.sourceWebProject = existingWebProject; - } - - /** - * @return name of the source web project selected - or null if none set - */ - public String getSourceWebProjectName() - { - String name = null; - if (CREATE_EXISTING.equals(this.createFrom) && - (this.sourceWebProject != null && this.sourceWebProject.length != 0)) - { - NodeRef sourceNodeRef = new NodeRef(this.sourceWebProject[0]); - name = (String)getNodeService().getProperty(sourceNodeRef, ContentModel.PROP_NAME); - } - return name; - } - - /** - * @return true if this website is set to be a template source website for future web projects - */ - public boolean isSource() - { - return this.isSource; - } - - /** - * @param isSource true if this website is set to be a template source website for future web projects - */ - public void setSource(boolean isSource) - { - this.isSource = isSource; - } - - /** - * @return the existingWebProjects - */ - public List getWebProjectsList() - { - List webProjects = this.webProjectsList.get(); - if (webProjects == null) - { - List wps = getWebProjectService().listWebProjects(); - webProjects = new ArrayList(wps.size()); - for (WebProjectInfo wpInfo : wps) - { - if ((this.showAllSourceProjects == false) && (! wpInfo.isTemplate())) - { - // only query for web project templates by default - continue; - } - - UIListItem item = new UIListItem(); - item.setLabel(wpInfo.getName()); - item.setDescription(wpInfo.getDescription()); - item.setValue(wpInfo.getNodeRef().toString()); - item.setImage(WebResources.IMAGE_WEBPROJECT_32); - webProjects.add(item); - } - - this.webProjectsList.put(webProjects); - } - return webProjects; - } - - /** - * Action handler called when toggle Show All/Show Template Web Projects link is clicked - */ - public void toggleWebProjectsList(ActionEvent event) - { - this.showAllSourceProjects = !this.showAllSourceProjects; - this.webProjectsList.clear(); - this.createFromValueChanged = true; - } - - /** - * @return true to show all Web Projects in the Create From list, - * false to only show those marked as templates - */ - public boolean getShowAllSourceProjects() - { - return this.showAllSourceProjects; - } - - /** - * @return List of SelectItem objects representing the webapp folders present in the project - */ - public List getWebappsList() - { - if (this.webappsList == null) - { - this.webappsList = new ArrayList(1); - - this.webappsList.add(new SelectItem(WEBAPP_DEFAULT, WEBAPP_DEFAULT)); - } - - return this.webappsList; - } - - public List getPreviewProvidersList() - { - if (this.previewProvidersList == null) - { - // create list of preview providers - - String defaultPreviewProvider = getPreviewURIService().getDefaultProviderName(); - Set previewProviders = getPreviewURIService().getProviderNames(); - - this.previewProvidersList = new ArrayList(previewProviders.size()); - - this.previewProvidersList.add(new SelectItem(defaultPreviewProvider, defaultPreviewProvider)); - - for (String previewProvider : previewProviders) - { - if (! previewProvider.equals(defaultPreviewProvider)) - { - this.previewProvidersList.add(new SelectItem(previewProvider, previewProvider)); - } - } - } - - return this.previewProvidersList; - } - - /** - * @see org.alfresco.web.bean.wizard.BaseWizardBean#next() - */ - @Override - public String next() - { - String stepName = Application.getWizardManager().getCurrentStepName(); - if (STEP_DEPLOYMENT.equals(stepName)) - { - // if we have just entered the deployment page and the Create From page data has changed - // then we need to pre-populate the Forms etc. from the template web project - updateModelOnCreateFromChange(); - } - return super.next(); - } - - /** - * Update the wizard model when the value in the Create From page changes - */ - private void updateModelOnCreateFromChange() - { - if (this.createFromValueChanged) - { - if (CREATE_EXISTING.equals(this.createFrom)) - { - if (this.sourceWebProject != null && this.sourceWebProject.length != 0) - { - clearFormsWorkflowsDeploymentAndUsers(); - loadWebProjectModel(new NodeRef(this.sourceWebProject[0]), false, true); - } - } - else - { - clearFormsWorkflowsDeploymentAndUsers(); - } - - this.createFromValueChanged = false; - } - } - - /** - * @return summary text for the wizard - */ - @SuppressWarnings("unchecked") - public String getSummary() - { - FacesContext fc = FacesContext.getCurrentInstance(); - - // build a summary section to list the invited users and there roles - StringBuilder buf = new StringBuilder(128); - List invitedUserRoles = - (List)getInviteUsersWizard().getUserRolesDataModel().getWrappedData(); - String currentUser = Application.getCurrentUser(fc).getUserName(); - boolean foundCurrentUser = false; - for (UserGroupRole userRole : invitedUserRoles) - { - if (currentUser.equals(userRole.getAuthority())) - { - foundCurrentUser = true; - } - buf.append(Utils.encode(userRole.getLabel())); - buf.append("
"); - } - if (foundCurrentUser == false) - { - buf.append(getInviteUsersWizard().buildLabelForUserAuthorityRole( - currentUser, WCMUtil.ROLE_CONTENT_MANAGER)); - } - - return buildSummary( - new String[] {Application.getMessage(fc, MSG_USERROLES)}, - new String[] {buf.toString()}); - } - - /** - * @return the invited users for the project - as UserWrapper instances - */ - @SuppressWarnings("unchecked") - public List getInvitedUsers() - { - final FacesContext fc = FacesContext.getCurrentInstance(); - List invitedUserRoles = (List) - getInviteUsersWizard().getUserRolesDataModel().getWrappedData(); - List result = new LinkedList(); - String currentUser = Application.getCurrentUser(fc).getUserName(); - boolean foundCurrentUser = false; - for (UserGroupRole userRole : invitedUserRoles) - { - if (currentUser.equals(userRole.getAuthority())) - { - foundCurrentUser = true; - } - result.add(new UserWrapper(userRole.getAuthority(), userRole.getRole())); - } - if (foundCurrentUser == false) - { - result.add(new UserWrapper(currentUser, WCMUtil.ROLE_CONTENT_MANAGER)); - } - return result; - } - - // ------------------------------------------------------------------------------ - // Deployment server configuration - - /** - * @return Determines whether a deployment server is being added - */ - public boolean isInAddDeployServerMode() - { - return this.inAddDeployServerMode; - } - - /** - * @return The type of server receiver to add, either 'alfresco' or 'file' - */ - public String getAddDeployServerType() - { - return this.addDeployServerType; - } - - /** - * @return The deploy server currently being added or edited - */ - public DeploymentServerConfig getCurrentDeployServer() - { - return this.currentDeployServer; - } - - /** - * @return The properties of the deploy server currently being added or edited - */ - public Map getEditedDeployServerProperties() - { - return this.editedDeployServerProps; - } - - /** - * @return Map of the deployment servers currently configured for the web project - */ - public List getDeployServers() - { - return this.deployServersList; - } - - /** - * Sets up the wizard for adding a new Alfresco Server Receiver - * - * @return null outcome to stay on same page - */ - public String addAlfrescoServerReceiver() - { - this.addDeployServerType = WCMAppModel.CONSTRAINT_ALFDEPLOY; - this.inAddDeployServerMode = true; - - // create an empty server config - this.currentDeployServer = new DeploymentServerConfig(this.addDeployServerType); - this.editedDeployServerProps.clear(); - - // refresh the current page - return null; - } - - /** - * Sets up the wizard for adding a new File System Receiver - * - * @return null outcome to stay on same page - */ - public String addFileSystemReceiver() - { - this.addDeployServerType = WCMAppModel.CONSTRAINT_FILEDEPLOY; - this.inAddDeployServerMode = true; - - // create an empty server config - this.currentDeployServer = new DeploymentServerConfig(this.addDeployServerType); - this.editedDeployServerProps.clear(); - - // refresh the current page - return null; - } - - public void editDeploymentServerConfig(ActionEvent event) - { - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - String id = params.get("id"); - if (id != null && id.length() != 0) - { - this.inAddDeployServerMode = false; - - // setup the config object to edit - this.currentDeployServer = this.deployServersMap.get(id); - this.editedDeployServerProps.clear(); - this.editedDeployServerProps.putAll(this.currentDeployServer.getProperties()); - - if (logger.isDebugEnabled()) - logger.debug("Set current deploy server to: " + this.currentDeployServer); - } - } - - public void deleteDeploymentServerConfig(ActionEvent event) - { - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - String id = params.get("id"); - if (id != null && id.length() != 0) - { - this.currentDeployServer = null; - this.editedDeployServerProps.clear(); - this.inAddDeployServerMode = false; - - // remove the config object from the list and map - DeploymentServerConfig dsc = this.deployServersMap.get(id); - if (dsc != null) - { - this.deployServersList.remove(dsc); - this.deployServersMap.remove(dsc.getId()); - - if (logger.isDebugEnabled()) - logger.debug("Removed deploy server config with id: " + id); - } - } - } - - public String addDeploymentServerConfig() - { - // add the new config to the list and map - this.deployServersList.add(this.currentDeployServer); - this.deployServersMap.put(this.currentDeployServer.getId(), - this.currentDeployServer); - - // save the changes - return saveDeploymentServerConfig(); - } - - public String saveDeploymentServerConfig() - { - String currentServerName = (String) editedDeployServerProps.get(DeploymentServerConfig.PROP_NAME); - if (currentServerName == null ||currentServerName.length() == 0) - { - currentServerName = "" + editedDeployServerProps.get(DeploymentServerConfig.PROP_HOST)+ ":" + editedDeployServerProps.get(DeploymentServerConfig.PROP_PORT); - } - for (DeploymentServerConfig server: deployServersList) - { - if (!server.getId().equals(currentDeployServer.getId())) - { - Map serverProps = server.getProperties(); - String serverName = (String) serverProps.get(DeploymentServerConfig.PROP_NAME); - if (serverName == null ||serverName.length() == 0) - { - serverName = "" + serverProps.get(DeploymentServerConfig.PROP_HOST)+ ":" + serverProps.get(DeploymentServerConfig.PROP_PORT); - } - - if (currentServerName.equals(serverName)) - { - if (this.inAddDeployServerMode) - { - this.deployServersList.remove(this.currentDeployServer); - this.deployServersMap.remove(this.currentDeployServer.getId()); - } - - Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), MSG_SERVER_ALREADY_EXIST), currentServerName)); - - return null; - } - } - } - // set the edited properties - this.currentDeployServer.setProperties(this.editedDeployServerProps); - - if (logger.isDebugEnabled()) - logger.debug("Saved transient deploy server config: " + this.currentDeployServer); - - // reset state - this.currentDeployServer = null; - this.editedDeployServerProps.clear(); - this.inAddDeployServerMode = false; - - // refresh the current page - return null; - } - - public String cancelDeploymentServerConfig() - { - this.currentDeployServer = null; - this.editedDeployServerProps.clear(); - this.inAddDeployServerMode = false; - - return null; - } - - // ------------------------------------------------------------------------------ - // Define Web Content Workflows page - - /** - * @return JSF data model for the Form templates - */ - public DataModel getFormsDataModel() - { - if (this.formsDataModel == null) - { - this.formsDataModel = new ListDataModel(); - } - - // only set the wrapped data once otherwise the row index gets reset - if (this.formsDataModel.getWrappedData() == null) - { - this.formsDataModel.setWrappedData(this.forms); - } - - return this.formsDataModel; - } - - /** - * @return the List of selected and configured Form objects (for summary screen) - */ - public List getForms() - { - return this.forms; - } - - /** - * @param formsDataModel JSF data model for the Form templates - */ - public void setFormsDataModel(DataModel formsDataModel) - { - this.formsDataModel = formsDataModel; - } - - /** - * @return List of UI items to represent the available Web Forms for all websites - */ - public List getFormsList() - { - Collection forms = this.getFormsService().getWebForms(); - List items = new ArrayList(forms.size()); - for (Form form : forms) - { - UIListItem item = new UIListItem(); - item.setValue(form); - String forItemName = new StringBuilder().append(form.getTitle()).append(" (").append(form.getName()).append(")").toString(); - item.setLabel(forItemName); - item.setDescription(form.getDescription()); - item.setImage(WebResources.IMAGE_WEBFORM_32); - boolean skip = false; - String formName = form.getName(); - for (FormWrapper formWrapper : this.forms) - { - if (formWrapper.getName().equals(formName)) - { - skip = true; - break; - } - } - if (!skip) - { - items.add(item); - } - } - this.formsList = items; - return items; - } - - /** - * Action handler called when the Add to List button is pressed for a form template - */ - public void addForm(ActionEvent event) - { - UISelectList selectList = (UISelectList)event.getComponent().findComponent(COMPONENT_FORMLIST); - int index = selectList.getRowIndex(); - if (index != -1 && index < this.formsList.size()) - { - Form form = (Form)this.formsList.get(index).getValue(); - FormWrapper wrapper = new FormWrapper(form); - wrapper.setTitle(form.getTitle()); - wrapper.setDescription(form.getDescription()); - this.forms.add(wrapper); - } - } - - /** - * Remove a template form from the selected list - */ - public void removeForm(ActionEvent event) - { - FormWrapper wrapper = (FormWrapper)this.getFormsDataModel().getRowData(); - if (wrapper != null) - { - this.forms.remove(wrapper); - } - } - - /** - * Action handler to setup a form for dialog context for the current row - */ - public void setupFormAction(ActionEvent event) - { - setActionForm( (FormWrapper)this.getFormsDataModel().getRowData() ); - } - - /** - * @return the current action form for dialog context - */ - public FormWrapper getActionForm() - { - return this.actionForm; - } - - /** - * @param actionForm For dialog context - */ - public void setActionForm(FormWrapper actionForm) - { - this.actionForm = actionForm; - if (actionForm != null) - { - setActionWorkflow(actionForm.getWorkflow()); - } - else - { - setActionWorkflow(null); - } - } - - /** - * Action method to setup a workflow for dialog context for the current row - */ - public void setupWorkflowAction(ActionEvent event) - { - setActionWorkflow( (WorkflowConfiguration)this.getWorkflowsDataModel().getRowData()); - } - - /** - * @return Returns the action Workflow for dialog context - */ - public WorkflowConfiguration getActionWorkflow() - { - return this.actionWorkflow; - } - - /** - * @param actionWorkflow The action Workflow to set for dialog context - */ - public void setActionWorkflow(WorkflowConfiguration actionWorkflow) - { - this.actionWorkflow = actionWorkflow; - } - - - // ------------------------------------------------------------------------------ - // Specify Settings (ah-hoc Workflows) page - - /** - * @return JSF data model for the Workflow templates - */ - public DataModel getWorkflowsDataModel() - { - if (this.workflowsDataModel == null) - { - this.workflowsDataModel = new ListDataModel(); - } - - // only set the wrapped data once otherwise the row index gets reset - if (this.workflowsDataModel.getWrappedData() == null) - { - this.workflowsDataModel.setWrappedData(this.workflows); - } - - return this.workflowsDataModel; - } - - /** - * @param workflowsDataModel JSF data model for the Workflow templates - */ - public void setWorkflowsDataModel(DataModel workflowsDataModel) - { - this.workflowsDataModel = workflowsDataModel; - } - - /** - * @return the list of workflows (for the summary screen) - */ - public List getWorkflows() - { - return this.workflows; - } - - /** - * @return List of UI items to represent the available Workflows for all websites - */ - public List getWorkflowList() - { - // get list of workflows from config definitions - List workflowDefs = AVMWorkflowUtil.getConfiguredWorkflows(); - List items = new ArrayList(workflowDefs.size()); - for (WorkflowDefinition workflowDef : workflowDefs) - { - UIListItem item = new UIListItem(); - item.setValue(workflowDef); - item.setLabel(workflowDef.title); - item.setDescription(workflowDef.description); - item.setImage(WebResources.IMAGE_WORKFLOW_32); - boolean skip = false; - for (WorkflowWrapper workflowWrapper : this.workflows) - { - if (workflowWrapper.getTitle().equals(workflowDef.getTitle())) - { - skip = true; - break; - } - } - if (!skip) - { - items.add(item); - } - } - - return items; - } - - /** - * Action handler called when the Add to List button is pressed for a workflow - */ - public void addWorkflow(ActionEvent event) - { - UISelectList selectList = (UISelectList)event.getComponent().findComponent(COMPONENT_WORKFLOWLIST); - int index = selectList.getRowIndex(); - - List workflowsList = this.getWorkflowList(); - - if (index != -1 && index < workflowsList.size()) - { - WorkflowDefinition workflow = (WorkflowDefinition)workflowsList.get(index).getValue(); - this.workflows.add(new WorkflowWrapper( - workflow.getName(), workflow.getTitle(), workflow.getDescription(), MATCH_DEFAULT)); - } - } - - /** - * Remove a workflow from the selected list - */ - public void removeWorkflow(ActionEvent event) - { - WorkflowWrapper wrapper = (WorkflowWrapper)this.getWorkflowsDataModel().getRowData(); - if (wrapper != null) - { - this.workflows.remove(wrapper); - } - } - - /** - * - * @return Returns a websiteDescriptionAttribute - */ - public String getWebsiteDescriptionAttribute() - { - if (this.websiteDescriptionAttribute == null) - { - this.websiteDescriptionAttribute = buildWebsiteDescriptionAttribute(); - } - return this.websiteDescriptionAttribute; - } - - /** - * - * @return Returns HTML for website label - */ - public String getWebsiteLabelAttribute() - { - StringBuilder builder = new StringBuilder(""); - builder.append(Utils.encode(this.name)); - builder.append(""); - return builder.toString(); - } - - /** - * - * @return Returns a HTML code for "description" attribute - */ - private String buildWebsiteDescriptionAttribute() - { - FacesContext fc = FacesContext.getCurrentInstance(); - StringBuilder attribute = new StringBuilder(255); - String sourceWebProjectName = getSourceWebProjectName(); - sourceWebProjectName = StringUtils.isEmpty(sourceWebProjectName) ? - DescriptionAttributeHelper.BLANK : DescriptionAttributeHelper.TRTD_BEGIN + - Application.getMessage(fc, "website_sourcewebsite") + DescriptionAttributeHelper.TD_TD + - sourceWebProjectName + DescriptionAttributeHelper.TDTR_END; - attribute.append(DescriptionAttributeHelper.getTableBegin()); - attribute.append(sourceWebProjectName); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "website_dnsname", getDnsName())); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "website_webapp", getWebapp())); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "title", getTitle())); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "description", - DescriptionAttributeHelper.getDescriptionNotEmpty(fc, getDescription()), false)); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "website_preview_provider", getPreviewProvider())); - attribute.append(DescriptionAttributeHelper.getTableEnd()); - return attribute.toString(); - } - - // ------------------------------------------------------------------------------ - // Invite users page - - /** - * @return the InviteWebsiteUsersWizard delegate bean - */ - private InviteWebsiteUsersWizard getInviteUsersWizard() - { - return (InviteWebsiteUsersWizard)FacesHelper.getManagedBean( - FacesContext.getCurrentInstance(), "InviteWebsiteUsersWizard"); - } - - - // ------------------------------------------------------------------------------ - // Inner classes - - /** - * Wrapper class for a configurable template Form instance - */ - public static class FormWrapper implements Serializable - { - private static final long serialVersionUID = -1452145043222643362L; - - private Form form; - private String name; - private String title; - private String description; - private String formDescriptionAttribute; - private WorkflowWrapper workflow; - private String outputPathPattern; - private List templates = null; - - FormWrapper(Form form) - { - this.form = form; - this.name = form.getName(); - this.title = form.getName(); - this.description = form.getDescription(); - } - - public Form getForm() - { - return this.form; - } - - public String getName() - { - return this.name; - } - - public String getTitle() - { - return this.title; - } - - public void setTitle(String title) - { - this.title = title; - } - - public String getDescription() - { - return this.description; - } - - public void setDescription(String description) - { - this.description = description; - } - - public String getFormDescriptionAttribute() - { - if (StringUtils.isEmpty(this.formDescriptionAttribute)) - { - this.formDescriptionAttribute = this.buildFormDescriptionAttribute(); - } - return this.formDescriptionAttribute; - } - - public String getFormLabelAttribute() - { - StringBuilder builder = new StringBuilder(""); - builder.append(Utils.encode(this.getName())); - builder.append(""); - return builder.toString(); - } - - /** - * @return Returns the workflow. - */ - public WorkflowWrapper getWorkflow() - { - WorkflowDefinition wf = this.form.getDefaultWorkflow(); - if (this.workflow == null && wf != null) - { - this.workflow = new WorkflowWrapper(wf.name, wf.getTitle(), wf.getDescription()); - } - return this.workflow; - } - - /** - * @param workflow The workflow to set. - */ - public void setWorkflow(WorkflowWrapper workflow) - { - this.workflow = workflow; - } - - /** - * @return Returns the output path pattern. - */ - public String getOutputPathPattern() - { - if (this.outputPathPattern == null) - { - this.outputPathPattern = this.form.getOutputPathPattern(); - } - return this.outputPathPattern; - } - - /** - * @param outputPathPattern The output path pattern to set. - */ - public void setOutputPathPattern(String outputPathPattern) - { - this.outputPathPattern = outputPathPattern; - } - - /** - * @return Returns the presentation templates. - */ - public List getTemplates() - { - if (this.templates == null) - { - List templates = this.form.getRenderingEngineTemplates(); - this.templates = new ArrayList(templates.size()); - for (RenderingEngineTemplate template : templates) - { - this.templates.add(new PresentationTemplate(template)); - } - } - return this.templates; - } - - public int getTemplatesSize() - { - return getTemplates() != null ? getTemplates().size() : 0; - } - - /** - * @param template to add to the list of PresentationTemplate - */ - public void addTemplate(PresentationTemplate template) - { - if (this.templates == null) - { - this.templates = new ArrayList(4); - } - this.templates.add(template); - } - - /** - * @param templates The presentation templates to set. - */ - public void setTemplates(List templates) - { - this.templates = templates; - } - - private String buildFormDescriptionAttribute() - { - FacesContext fc = FacesContext.getCurrentInstance(); - StringBuilder attribute = new StringBuilder(255); - String formDescription = DescriptionAttributeHelper.getDescriptionNotEmpty(fc, this.getDescription()); - String workflowTitle = getWorkflow() == null ? - DescriptionAttributeHelper.SPAN_ITALIC_BEGIN + Application.getMessage(fc, "none") + - DescriptionAttributeHelper.SPAN_END : Utils.encode(getWorkflow().getTitle()); - attribute.append(DescriptionAttributeHelper.getTableBegin()); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "name", this.getName())); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "title", this.getTitle())); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "output_path_pattern", this.getOutputPathPattern())); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "description", formDescription, false)); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "workflow", workflowTitle, false)); - attribute.append(DescriptionAttributeHelper.getTableEnd()); - return attribute.toString(); - } - } - - - /** - * Class to represent a single configured Presentation Template instance - */ - public static class PresentationTemplate implements Serializable - { - private static final long serialVersionUID = 5148139895329524483L; - - private RenderingEngineTemplate ret; - private String title; - private String description; - private String outputPathPattern; - - public PresentationTemplate(RenderingEngineTemplate ret) - { - this(ret, null); - } - - public PresentationTemplate(RenderingEngineTemplate ret, String outputPathPattern) - { - this.ret = ret; - this.outputPathPattern = outputPathPattern; - } - - public RenderingEngineTemplate getRenderingEngineTemplate() - { - return this.ret; - } - - public String getTitle() - { - if (this.title == null) - { - this.title = ret.getName(); - } - return this.title; - } - - public String getDescription() - { - if (this.description == null) - { - this.description = ret.getDescription(); - } - return this.description; - } - - /** - * @return Returns the output path pattern. - */ - public String getOutputPathPattern() - { - if (this.outputPathPattern == null) - { - this.outputPathPattern = ret.getOutputPathPattern(); - } - return this.outputPathPattern; - } - - /** - * @param outputPathPattern The output path pattern to set. - */ - public void setOutputPathPattern(String outputPathPattern) - { - this.outputPathPattern = outputPathPattern; - } - } - - - /** - * Class to represent a single configured Workflow instance - */ - public static class WorkflowWrapper implements WorkflowConfiguration - { - private static final long serialVersionUID = -5570490335442743685L; - - private String name; - private String title; - private String description; - private String filenamePattern; - private String workflowDescriptionAttribute; - private QName type; - private Map params; - - public WorkflowWrapper(String name, String title, String description) - { - this.name = name; - this.title = title; - this.description = description; - this.workflowDescriptionAttribute = this.buildWorkflowDescriptionAttribute(); - } - - public WorkflowWrapper(String name, String title, String description, String filenamePattern) - { - this.name = name; - this.title = title; - this.description = description; - this.filenamePattern = filenamePattern; - this.workflowDescriptionAttribute = this.buildWorkflowDescriptionAttribute(); - } - - /** - * @return Returns the name key of the workflow. - */ - public String getName() - { - return this.name; - } - - /** - * @return the display label of the workflow. - */ - public String getTitle() - { - return this.title; - } - - /** - * @return the display label of the workflow. - */ - public String getDescription() - { - return this.description; - } - - /** - * @return Returns the filename pattern. - */ - public String getFilenamePattern() - { - return this.filenamePattern; - } - - /** - * @param filenamePattern The filename pattern to set. - */ - public void setFilenamePattern(String filenamePattern) - { - this.filenamePattern = filenamePattern; - } - - /** - * @return Returns the workflow params. - */ - public Map getParams() - { - return this.params; - } - - /** - * @param params The workflow params to set. - */ - public void setParams(Map params) - { - this.params = params; - } - - /** - * @return Returns the type. - */ - public QName getType() - { - return this.type; - } - - /** - * @param type The type to set. - */ - public void setType(QName type) - { - this.type = type; - } - - /** - * - * @return Returns workflowDescriptionAttribute in HTML format (TABLE tag) - */ - public String getWorkflowDescriptionAttribute() - { - if (StringUtils.isEmpty(this.workflowDescriptionAttribute)) - { - this.workflowDescriptionAttribute = this.buildWorkflowDescriptionAttribute(); - } - return this.workflowDescriptionAttribute; - } - - /** - * - * @return Returns HTML for the workflow label - */ - public String getWorkflowLabelAttribute() - { - StringBuilder builder = new StringBuilder(""); - builder.append(Utils.encode(this.title)); - builder.append(""); - return builder.toString(); - } - - /** - * - * @return Returns HTML representation of the "description" attribute - */ - private String buildWorkflowDescriptionAttribute() - { - FacesContext fc = FacesContext.getCurrentInstance(); - String workflowDescription = DescriptionAttributeHelper.getDescriptionNotEmpty(fc, getDescription()); - StringBuilder attribute = new StringBuilder(255); - attribute.append(DescriptionAttributeHelper.getTableBegin()); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "description", workflowDescription, false)); - attribute.append(DescriptionAttributeHelper.getTableLine(fc, "website_filename_pattern", this.getFilenamePattern())); - attribute.append(DescriptionAttributeHelper.getTableEnd()); - return attribute.toString(); - } - } - - - public class UserWrapper implements Serializable - { - private static final long serialVersionUID = 6546685548198253273L; - - private final String name, role; - private String userDescriptionAttribute; - - public UserWrapper(final String authority, final String role) - { - - if (AuthorityType.getAuthorityType(authority) == AuthorityType.USER || - AuthorityType.getAuthorityType(authority) == AuthorityType.GUEST) - { - NodeRef ref = getPersonService().getPerson(authority); - String firstName = (String)getNodeService().getProperty(ref, ContentModel.PROP_FIRSTNAME); - String lastName = (String)getNodeService().getProperty(ref, ContentModel.PROP_LASTNAME); - this.name = firstName + (lastName != null ? " " + lastName : ""); - } - else - { - this.name = authority.substring(PermissionService.GROUP_PREFIX.length()); - } - this.role = Application.getMessage(FacesContext.getCurrentInstance(), role); - this.userDescriptionAttribute = this.buildUserDescriptionAttribute(); - } - - public String getName() { return this.name; } - public String getRole() { return this.role; } - public String getUserDescriptionAttribute() - { - if (StringUtils.isEmpty(this.userDescriptionAttribute)) - { - this.userDescriptionAttribute = buildUserDescriptionAttribute(); - } - return this.userDescriptionAttribute; - } - - public String getUserLabelAttribute() - { - StringBuilder builder = new StringBuilder(""); - builder.append(Utils.encode(this.name)); - builder.append(""); - return builder.toString(); - } - - private String buildUserDescriptionAttribute() - { - FacesContext fc = FacesContext.getCurrentInstance(); - StringBuilder attribute = new StringBuilder(128); - attribute.append(DescriptionAttributeHelper.getTableBegin()).append( - DescriptionAttributeHelper.getTableLine(fc, "roles", this.getRole())).append( - DescriptionAttributeHelper.getTableEnd()); - return attribute.toString(); - } - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteDeploymentReportsDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteDeploymentReportsDialog.java deleted file mode 100644 index 33d0fe384b..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/DeleteDeploymentReportsDialog.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; - -import org.alfresco.model.WCMAppModel; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.web.app.AlfrescoNavigationHandler; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Bean implementation for the "Delete Deployment Reports" dialog - * - * @author gavinc - */ -public class DeleteDeploymentReportsDialog extends BaseDialogBean -{ - protected AVMBrowseBean avmBrowseBean; - - private static final long serialVersionUID = -3702005115210010993L; - - private static final Log logger = LogFactory.getLog(DeleteDeploymentReportsDialog.class); - - // ------------------------------------------------------------------------------ - // Dialog implementation - - @SuppressWarnings("unchecked") - @Override - protected String finishImpl(FacesContext context, String outcome) - throws Exception - { - // get the node service and the website we are deleting reports for - NodeService nodeService = this.getNodeService(); - NodeRef websiteRef = this.avmBrowseBean.getWebsite().getNodeRef(); - - // just in case there are any left, iterate through any old deploymentreport - // associations from the current web project and delete them. - List deployReportRefs = nodeService.getChildAssocs( - websiteRef, WCMAppModel.ASSOC_DEPLOYMENTREPORT, - RegexQNamePattern.MATCH_ALL); - int count = deployReportRefs.size(); - for (ChildAssociationRef ref : deployReportRefs) - { - NodeRef report = ref.getChildRef(); - if (report != null) - { - // remove the node - nodeService.deleteNode(report); - } - } - - // iterate through all deploymentattempt associations from the current - // web project and delete them. - List deployAttemptRefs = nodeService.getChildAssocs( - websiteRef, WCMAppModel.ASSOC_DEPLOYMENTATTEMPT, - RegexQNamePattern.MATCH_ALL); - count += deployAttemptRefs.size(); - for (ChildAssociationRef ref : deployAttemptRefs) - { - NodeRef attempt = ref.getChildRef(); - if (attempt != null) - { - // remove the node - nodeService.deleteNode(attempt); - } - } - - // remove the old properties in case they are still present - nodeService.removeProperty(websiteRef, - WCMAppModel.PROP_DEPLOYTO); - nodeService.removeProperty(websiteRef, - WCMAppModel.PROP_SELECTEDDEPLOYTO); - nodeService.removeProperty(websiteRef, - WCMAppModel.PROP_SELECTEDDEPLOYVERSION); - - // remove the hasBeenDeployed object from the session so it gets - // re-evaluated (and disappears) - Map request = FacesContext.getCurrentInstance(). - getExternalContext().getRequestMap(); - request.remove(AVMBrowseBean.REQUEST_BEEN_DEPLOYED_RESULT); - - if (logger.isDebugEnabled()) - logger.debug("Removed " + count + " previous deployment attempts"); - - // close dialog and refresh website view - return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + - AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browseWebsite"; - } - - @Override - public boolean getFinishButtonDisabled() - { - return false; - } - - @Override - public String getFinishButtonLabel() - { - return Application.getMessage(FacesContext.getCurrentInstance(), "yes"); - } - - @Override - public String getCancelButtonLabel() - { - return Application.getMessage(FacesContext.getCurrentInstance(), "no"); - } - - // ------------------------------------------------------------------------------ - // Bean Getters and Setters - - /** - * @param avmBrowseBean The AVM BrowseBean to set - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * Returns the confirmation to display to the user before deleting the reports. - * - * @return The message to display - */ - public String getConfirmMessage() - { - return Application.getMessage(FacesContext.getCurrentInstance(), "delete_reports_confirm"); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteFileBrowseDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteFileBrowseDialog.java deleted file mode 100644 index 12de0e2287..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/DeleteFileBrowseDialog.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import javax.faces.context.FacesContext; - -import org.alfresco.web.app.AlfrescoNavigationHandler; - -/** - * @author Kevin Roast - */ -public class DeleteFileBrowseDialog extends DeleteFileDialog -{ - private static final long serialVersionUID = 8731204315036822222L; - - @Override - protected String doPostCommitProcessing(FacesContext context, String outcome) - { - return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + - AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browseSandbox"; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteFileDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteFileDialog.java deleted file mode 100644 index 8ba3b37734..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/DeleteFileDialog.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.FileNotFoundException; -import java.util.List; -import java.text.MessageFormat; - -import javax.faces.context.FacesContext; - -import org.alfresco.model.WCMAppModel; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.web.app.AlfrescoNavigationHandler; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.forms.*; -import org.alfresco.web.ui.common.Utils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Bean implementation for the AVM "Delete File" dialog - * - * @author kevinr - */ -public class DeleteFileDialog extends BaseDialogBean -{ - private static final long serialVersionUID = -3962232696127851920L; - - private static final Log logger = LogFactory.getLog(DeleteFileDialog.class); - - transient private AVMService avmService; - protected AVMBrowseBean avmBrowseBean; - transient private FormsService formsService; - - /** - * @param avmBrowseBean The avmBrowseBean to set. - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @param avmService The avmService to set. - */ - public void setAvmService(AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (avmService == null) - { - avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - return avmService; - } - - /** - * @param formsService The FormsService to set. - */ - public void setFormsService(final FormsService formsService) - { - this.formsService = formsService; - } - - protected FormsService getFormsService() - { - if (formsService == null) - { - formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); - } - return formsService; - } - - - // ------------------------------------------------------------------------------ - // Dialog implementation - - @Override - protected String finishImpl(final FacesContext context, final String outcome) - throws Exception - { - // get the content to delete - final AVMNode node = this.avmBrowseBean.getAvmActionNode(); - if (node == null) - { - logger.warn("WARNING: delete called without a current AVM Node!"); - } - else - { - if (logger.isDebugEnabled()) - logger.debug("Trying to delete AVM node: " + node.getPath()); - FormInstanceData fid = null; - if (node.hasAspect(WCMAppModel.ASPECT_RENDITION)) - { - try - { - fid = this.getFormsService().getRendition(node.getNodeRef()).getPrimaryFormInstanceData(); - } - catch (FileNotFoundException fnfe) - { - //ignore - } - } - else if (node.hasAspect(WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) - { - fid = this.getFormsService().getFormInstanceData(node.getNodeRef()); - } - if (fid != null) - { - final List renditions = fid.getRenditions(); - for (final Rendition r : renditions) - { - this.getAvmService().removeNode(AVMNodeConverter.SplitBase(r.getPath())[0], - AVMNodeConverter.SplitBase(r.getPath())[1]); - } - this.getAvmService().removeNode(AVMNodeConverter.SplitBase(fid.getPath())[0], - AVMNodeConverter.SplitBase(fid.getPath())[1]); - } - else - { - // delete the node - this.getAvmService().removeNode(AVMNodeConverter.SplitBase(node.getPath())[0], - AVMNodeConverter.SplitBase(node.getPath())[1]); - } - } - return outcome; - } - - @Override - protected String doPostCommitProcessing(final FacesContext context, - final String outcome) - { - return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; - } - - @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() - { - final AVMNode node = this.avmBrowseBean.getAvmActionNode(); - if (node.hasAspect(WCMAppModel.ASPECT_RENDITION)) - { - try - { - final FormInstanceData fid = this.getFormsService().getRendition(node.getNodeRef()).getPrimaryFormInstanceData(); - return MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), - "delete_rendition_confirm"), - node.getName(), - fid.getName(), - fid.getRenditions().size() - 1); - } - catch (FileNotFoundException fnfe) - { - //ignore - } - } - else if (node.hasAspect(WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) - { - try - { - final FormInstanceData fid = this.getFormsService().getFormInstanceData(node.getNodeRef()); - return MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), - "delete_form_instance_data_confirm"), - fid.getName(), - fid.getRenditions().size()); - } - catch (FormNotFoundException fnfe) - { - // ignore - } - } - return MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), - "delete_avm_file_confirm"), - node.getName()); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteFolderBrowseDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteFolderBrowseDialog.java deleted file mode 100644 index eb7937989b..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/DeleteFolderBrowseDialog.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import javax.faces.context.FacesContext; - -import org.alfresco.web.app.AlfrescoNavigationHandler; - -/** - * @author Kevin Roast - */ -public class DeleteFolderBrowseDialog extends DeleteFolderDialog -{ - private static final long serialVersionUID = -8223178194058011913L; - - @Override - protected String doPostCommitProcessing(FacesContext context, String outcome) - { - return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + - AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browseSandbox"; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteFolderDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteFolderDialog.java deleted file mode 100644 index 2ff0a7f6bb..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/DeleteFolderDialog.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.text.MessageFormat; - -import javax.faces.context.FacesContext; - -import org.alfresco.service.cmr.avm.AVMService; -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.Repository; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Bean implementation for the AVM "Delete Folder" dialog - * - * @author kevinr - */ -public class DeleteFolderDialog extends BaseDialogBean -{ - private static final long serialVersionUID = 4188977806570877462L; - - private static final Log logger = LogFactory.getLog(DeleteFolderDialog.class); - - transient private AVMService avmService; - protected AVMBrowseBean avmBrowseBean; - - - /** - * @param avmBrowseBean The avmBrowseBean to set. - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @param avmService The avmService to set. - */ - public void setAvmService(AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (avmService == null) - { - avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - return avmService; - } - - - // ------------------------------------------------------------------------------ - // Dialog implementation - - @Override - protected String finishImpl(FacesContext context, String outcome) - throws Exception - { - // get the content to delete - AVMNode node = this.avmBrowseBean.getAvmActionNode(); - if (node != null) - { - if (logger.isDebugEnabled()) - logger.debug("Trying to delete AVM node: " + node.getPath()); - - // delete the node - this.getAvmService().removeNode( - node.getPath().substring(0, node.getPath().lastIndexOf('/')), - node.getPath().substring(node.getPath().lastIndexOf('/') + 1)); - } - else - { - logger.warn("WARNING: delete called without a current AVM Node!"); - } - - return outcome; - } - - @Override - protected String doPostCommitProcessing(FacesContext context, String outcome) - { - return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; - } - - @Override - protected String getErrorMessageId() - { - return "error_delete_folder"; - } - - @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 = Application.getMessage(FacesContext.getCurrentInstance(), - "delete_avm_folder_confirm"); - - return MessageFormat.format(fileConfirmMsg, - new Object[] {this.avmBrowseBean.getAvmActionNode().getName()}); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteLayeredFolderBrowseDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteLayeredFolderBrowseDialog.java deleted file mode 100644 index 4c23d87569..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/DeleteLayeredFolderBrowseDialog.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.text.MessageFormat; - -import javax.faces.context.FacesContext; - -import org.alfresco.web.app.Application; - -/** - * Dialog implementation for deleting layered folders. - * - * @author Gavin Cornwell - */ -public class DeleteLayeredFolderBrowseDialog extends DeleteFolderBrowseDialog -{ - private static final long serialVersionUID = -9108783368135918603L; - - // ------------------------------------------------------------------------------ - // Bean Getters and Setters - - /** - * Returns the confirmation to display to the user before deleting the folder. - * - * @return The formatted message to display - */ - @Override - public String getConfirmMessage() - { - String fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(), - "delete_layered_folder_confirm"); - - return MessageFormat.format(fileConfirmMsg, - new Object[] {this.avmBrowseBean.getAvmActionNode().getName()}); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteSandboxDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteSandboxDialog.java deleted file mode 100644 index 385061c457..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/DeleteSandboxDialog.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.text.MessageFormat; -import java.util.List; - -import javax.faces.context.FacesContext; - -import org.alfresco.model.WCMAppModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.wcm.webproject.WebProjectService; -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 AVM "Delete Sandbox" dialog - * - * @author kevinr - */ -public class DeleteSandboxDialog extends BaseDialogBean -{ - private static final long serialVersionUID = 6139801947722234685L; - - private static final Log logger = LogFactory.getLog(DeleteSandboxDialog.class); - - protected AVMBrowseBean avmBrowseBean; - transient private WebProjectService wpService; - - // ------------------------------------------------------------------------------ - // Bean property getters and setters - - /** - * @param avmBrowseBean The avmBrowseBean to set. - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - public void setWebProjectService(WebProjectService wpService) - { - this.wpService = wpService; - } - - protected WebProjectService getWebProjectService() - { - if (wpService == null) - { - wpService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWebProjectService(); - } - return wpService; - } - - // ------------------------------------------------------------------------------ - // Dialog implementation - - @Override - protected String finishImpl(FacesContext context, String outcome) - throws Exception - { - // the username for the sandbox to delete (also uninvites from the web project) - String username = this.avmBrowseBean.getUsername(); - if (username != null) - { - Node website = this.avmBrowseBean.getWebsite(); - getWebProjectService().uninviteWebUser(website.getNodeRef(), username, true); - - String wpStoreId = getWebProjectService().getWebProject(website.getNodeRef()).getStoreId(); - String mainStore = AVMUtil.buildUserMainStoreName(wpStoreId, username); - - // if the sandbox is allocated to a test server release it - List testServers = DeploymentUtil.findAllocatedTestServers(mainStore); - for(NodeRef testServer : testServers) - { - getNodeService().setProperty(testServer, WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO, null); - - if (logger.isDebugEnabled()) - { - logger.debug("Released test server from user sandbox: " + mainStore); - } - } - } - - return outcome; - } - - @Override - protected String doPostCommitProcessing(FacesContext context, String outcome) - { - return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; - } - - @Override - protected String getErrorMessageId() - { - return "error_delete_sandbox"; - } - - @Override - public boolean getFinishButtonDisabled() - { - return false; - } - - - // ------------------------------------------------------------------------------ - // Bean Getters and Setters - - /** - * Returns the confirmation to display to the user before deleting the user sandbox. - * - * @return The formatted message to display - */ - public String getConfirmMessage() - { - String fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(), - "delete_sandbox_confirm"); - - return MessageFormat.format(fileConfirmMsg, - new Object[] {this.avmBrowseBean.getUsername()}); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteWebsiteDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteWebsiteDialog.java deleted file mode 100644 index e245db7633..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/DeleteWebsiteDialog.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import javax.faces.context.FacesContext; - -import org.alfresco.wcm.webproject.WebProjectService; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.spaces.DeleteSpaceDialog; - -/** - * Bean implementation for the "Delete Website" dialog. Removes all user stores and the main staging and preview stores. - * - * @author kevinr - */ -public class DeleteWebsiteDialog extends DeleteSpaceDialog -{ - private static final long serialVersionUID = -3598950865168230942L; - - transient private WebProjectService wpService; - - // ------------------------------------------------------------------------------ - // Bean property getters and setters - - public void setWebProjectService(WebProjectService wpService) - { - this.wpService = wpService; - } - - protected WebProjectService getWebProjectService() - { - if (wpService == null) - { - wpService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWebProjectService(); - } - return wpService; - } - - // ------------------------------------------------------------------------------ - // Dialog implementation - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - Node websiteNode = this.browseBean.getActionSpace(); - - if (websiteNode != null) - { - getWebProjectService().deleteWebProject(websiteNode.getNodeRef()); - } - - return super.finishImpl(context, outcome); - } - - /** - * Returns the message bundle id of the confirmation message to display to the user before deleting the website. - * - * @return The message bundle id - */ - @Override - protected String getConfirmMessageId() - { - return "delete_website_confirm"; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/DeployWebsiteDialog.java b/source/java/org/alfresco/web/bean/wcm/DeployWebsiteDialog.java deleted file mode 100644 index 768365d741..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/DeployWebsiteDialog.java +++ /dev/null @@ -1,421 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.ResourceBundle; - -import javax.faces.context.FacesContext; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.WCMAppModel; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.avm.actions.AVMDeployWebsiteAction; -import org.alfresco.repo.domain.PropertyValue; -import org.alfresco.wcm.sandbox.SandboxConstants; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ActionService; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.repository.Repository; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.jsf.FacesContextUtils; - -/** - * Deploys a website to one or more remote servers. - * - * @author gavinc - */ -public class DeployWebsiteDialog extends BaseDialogBean -{ - private static final long serialVersionUID = 62702082716235924L; - - protected int versionToDeploy; - protected String[] deployTo; - protected String store; - protected String deployMode; - protected String calledFromTaskDialog; - protected NodeRef websiteRef; - protected NodeRef webProjectRef; - protected boolean updateTestServer; - - protected AVMBrowseBean avmBrowseBean; - transient private AVMService avmService; - transient private ActionService actionService; - - private static final Log logger = LogFactory.getLog(DeployWebsiteDialog.class); - - // ------------------------------------------------------------------------------ - // Dialog implementation - - @Override - public void init(Map parameters) - { - super.init(parameters); - - // setup context for dialog - this.deployTo = null; - String ver = parameters.get("version"); - if (ver != null && ver.length() > 0) - { - this.versionToDeploy = Integer.parseInt(ver); - } - else - { - this.versionToDeploy = -1; - } - - // get the store - this.store = parameters.get("store"); - String storeRoot = AVMUtil.buildSandboxRootPath(this.store); - this.websiteRef = AVMNodeConverter.ToNodeRef(this.versionToDeploy, storeRoot); - - // get the web project noderef - String webProject = parameters.get("webproject"); - if (webProject == null) - { - this.webProjectRef = this.avmBrowseBean.getWebsite().getNodeRef(); - } - else - { - this.webProjectRef = new NodeRef(webProject); - } - - this.deployMode = (this.versionToDeploy == -1) ? - WCMAppModel.CONSTRAINT_TESTSERVER : WCMAppModel.CONSTRAINT_LIVESERVER; - - this.updateTestServer = false; - String updateTestServerParam = parameters.get("updateTestServer"); - if (updateTestServerParam != null) - { - this.updateTestServer = Boolean.parseBoolean(updateTestServerParam); - } - - this.calledFromTaskDialog = parameters.get("calledFromTaskDialog"); - this.avmBrowseBean.getDeploymentMonitorIds().clear(); - - if (logger.isDebugEnabled()) - logger.debug("Initialising dialog to deploy: " + this.websiteRef.toString()); - } - - @SuppressWarnings("unchecked") - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - if (logger.isDebugEnabled()) - logger.debug("Requesting deployment of: " + this.websiteRef.toString()); - - if (this.deployTo != null && this.deployTo.length > 0) - { - // get the unprotected NodeService and PermissionService for this dialog otherwise - // 'AddChildren' permission would be required on the web project node for all users - WebApplicationContext wac = FacesContextUtils.getRequiredWebApplicationContext(context); - NodeService unprotectedNodeService = (NodeService)wac.getBean("nodeService"); - PermissionService unprotectedPermissionService = (PermissionService)wac.getBean("permissionService"); - - List selectedDeployToNames = new ArrayList(); - - // create a deploymentattempt node to represent this deployment - String attemptId = GUID.generate(); - Map props = new HashMap(8, 1.0f); - props.put(WCMAppModel.PROP_DEPLOYATTEMPTID, attemptId); - props.put(WCMAppModel.PROP_DEPLOYATTEMPTTYPE, this.deployMode); - props.put(WCMAppModel.PROP_DEPLOYATTEMPTSTORE, this.store); - props.put(WCMAppModel.PROP_DEPLOYATTEMPTVERSION, this.versionToDeploy); - props.put(WCMAppModel.PROP_DEPLOYATTEMPTTIME, new Date()); - NodeRef attempt = unprotectedNodeService.createNode(this.webProjectRef, - WCMAppModel.ASSOC_DEPLOYMENTATTEMPT, WCMAppModel.ASSOC_DEPLOYMENTATTEMPT, - WCMAppModel.TYPE_DEPLOYMENTATTEMPT, props).getChildRef(); - - // allow anyone to add child nodes to the deploymentattempt node - unprotectedPermissionService.setPermission(attempt, PermissionService.ALL_AUTHORITIES, - PermissionService.ADD_CHILDREN, true); - - // execute a deploy action for each of the selected remote servers asynchronously - for (String targetServer : this.deployTo) - { - if (targetServer.length() > 0) - { - NodeRef serverRef = new NodeRef(targetServer); - if (unprotectedNodeService.exists(serverRef)) - { - // get all properties of the target server - Map serverProps = unprotectedNodeService.getProperties(serverRef); - - String url = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERURL); - String serverUri = AVMDeployWebsiteAction.calculateServerUri(serverProps); - String serverName = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERNAME); - if (serverName == null || serverName.length() == 0) - { - serverName = serverUri; - } - - // if this is a test server deployment we need to allocate the - // test server to the current sandbox so it can re-use it and - // more importantly, no one else can. Before doing that however, - // we need to make sure no one else has taken the server since - // we selected it. - if (WCMAppModel.CONSTRAINT_TESTSERVER.equals(this.deployMode) && - this.updateTestServer == false) - { - String allocatedTo = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO); - if (allocatedTo != null) - { - throw new AlfrescoRuntimeException("testserver.taken", new Object[] {serverName}); - } - else - { - unprotectedNodeService.setProperty(serverRef, WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO, - this.store); - } - } - - if (logger.isDebugEnabled()) - logger.debug("Issuing deployment request for: " + serverName); - - // remember the servers deployed to - selectedDeployToNames.add(serverName); - - // create a deployment monitor object, store in the session, - // add to avm browse bean and pass to action - DeploymentMonitor monitor = new DeploymentMonitor( - this.websiteRef, serverRef, versionToDeploy, serverName, attemptId, url); - context.getExternalContext().getSessionMap().put(monitor.getId(), monitor); - this.avmBrowseBean.getDeploymentMonitorIds().add(monitor.getId()); - - // create and execute the action asynchronously - Map args = new HashMap(1, 1.0f); - args.put(AVMDeployWebsiteAction.PARAM_WEBPROJECT, webProjectRef); - args.put(AVMDeployWebsiteAction.PARAM_SERVER, serverRef); - args.put(AVMDeployWebsiteAction.PARAM_ATTEMPT, attempt); - args.put(AVMDeployWebsiteAction.PARAM_CALLBACK, monitor); - Action action = getActionService().createAction(AVMDeployWebsiteAction.NAME, args); - getActionService().executeAction(action, this.websiteRef, false, true); - } - else if (logger.isWarnEnabled()) - { - logger.warn("target server '" + targetServer + "' was ignored as it no longer exists!"); - } - } - } - - // now we know the list of selected servers set the property on the attempt node - unprotectedNodeService.setProperty(attempt, WCMAppModel.PROP_DEPLOYATTEMPTSERVERS, - (Serializable)selectedDeployToNames); - - // set the deploymentattempid property on the store this deployment was for - getAvmService().deleteStoreProperty(this.store, SandboxConstants.PROP_LAST_DEPLOYMENT_ID); - getAvmService().setStoreProperty(this.store, SandboxConstants.PROP_LAST_DEPLOYMENT_ID, - new PropertyValue(DataTypeDefinition.TEXT, attemptId)); - - // close this dialog and immediately open the monitorDeployment dialog - Map params = new HashMap(2); - params.put("webproject", this.webProjectRef.toString()); - params.put("calledFromTaskDialog", this.calledFromTaskDialog); - Application.getDialogManager().setupParameters(params); - return "dialog:monitorDeployment"; - } - else - { - if (logger.isWarnEnabled()) - logger.warn("Deployment of '" + this.websiteRef.toString() + "' skipped as no servers were selected"); - - return outcome; - } - } - - @Override - public boolean getFinishButtonDisabled() - { - return false; - } - - @Override - public String getCancelButtonLabel() - { - return super.getCancelButtonLabel(); - } - - @Override - public String getContainerDescription() - { - String desc = null; - - FacesContext context = FacesContext.getCurrentInstance(); - ResourceBundle bundle = Application.getBundle(context); - - if (WCMAppModel.CONSTRAINT_LIVESERVER.equals(this.deployMode)) - { - desc = bundle.getString("deploy_snapshot_desc"); - } - else - { - if (this.updateTestServer) - { - desc = bundle.getString("redeploy_sandbox_desc"); - } - else - { - desc = bundle.getString("deploy_sandbox_desc"); - } - } - - return desc; - } - - @Override - public String getContainerTitle() - { - String title = null; - - FacesContext context = FacesContext.getCurrentInstance(); - ResourceBundle bundle = Application.getBundle(context); - - if (WCMAppModel.CONSTRAINT_LIVESERVER.equals(this.deployMode)) - { - title = bundle.getString("deploy_snapshot_title"); - } - else - { - if (this.updateTestServer) - { - title = bundle.getString("redeploy_sandbox_title"); - } - else - { - title = bundle.getString("deploy_sandbox_title"); - } - } - - return title; - } - - // ------------------------------------------------------------------------------ - // Bean getters and setters - - /** - * @param avmBrowseBean The AVM BrowseBean to set - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @param avmService The AVMService to set. - */ - public void setAvmService(AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (avmService == null) - { - avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - return avmService; - } - - /** - * @param actionService The actionService to set. - */ - public void setActionService(ActionService actionService) - { - this.actionService = actionService; - } - - protected ActionService getActionService() - { - if (actionService == null) - { - actionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getActionService(); - } - return actionService; - } - - /** - * Sets the list of remote servers to deploy to - * - * @param deployTo String array of servers to deploy to - */ - public void setDeployTo(String[] deployTo) - { - this.deployTo = deployTo; - } - - /** - * Returns the remote servers to deploy to as an array - * - * @return String array of servers to deploy to - */ - public String[] getDeployTo() - { - return this.deployTo; - } - - /** - * Returns the type of server to deploy to, either 'live' or 'test'. - * - * @return The type of server to deploy to - */ - public String getDeployMode() - { - return this.deployMode; - } - - /** - * @return The NodeRef of the web project the deployment reports are being shown for - */ - public NodeRef getWebProjectRef() - { - return this.webProjectRef; - } - - /** - * @return The store being deployed - */ - public String getStore() - { - return this.store; - } - - /** - * @return The version of the snapshot to deploy - */ - public int getSnapshotVersion() - { - return this.versionToDeploy; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/DeploymentMonitor.java b/source/java/org/alfresco/web/bean/wcm/DeploymentMonitor.java deleted file mode 100644 index a3ec36cd67..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/DeploymentMonitor.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.Serializable; - -import org.alfresco.service.cmr.avm.deploy.DeploymentCallback; -import org.alfresco.service.cmr.avm.deploy.DeploymentEvent; -import org.alfresco.service.cmr.avm.deploy.DeploymentEvent.Type; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.web.ui.common.Utils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Object used to monitor the deployment of a snapshot to a remote - * server. These objects are typically stored in the HTTP session - * and accessed by an AJAX callback to provide progress feedback - * for the deployment. - * - * @author gavinc - */ - -public class DeploymentMonitor implements DeploymentCallback, Serializable -{ - private static final long serialVersionUID = 8167554931073708558L; - - private String id; - private NodeRef website; - private NodeRef targetServer; - private String targetServerName; - private String deployAttemptId; - private String url; - private String reason; - private int snapshotVersion; - private boolean started = false; - private boolean finished = false; - private boolean successful = false; - - private static Log logger = LogFactory.getLog(DeploymentMonitor.class); - private static final String ID_PREFIX = "_depmon_"; - - /** - * Default constructor - */ - public DeploymentMonitor(NodeRef website, NodeRef server, int snapshotVersion, - String serverName, String deployAttemptId, String url) - { - this.id = ID_PREFIX + Long.toString(System.currentTimeMillis()) + this.hashCode(); - this.website = website; - this.targetServer = server; - this.snapshotVersion = snapshotVersion; - this.targetServerName = serverName; - this.deployAttemptId = deployAttemptId; - this.url = url; - } - - // ------------------------------------------------------------------------------ - // DeploymentCallback implementation - - public void eventOccurred(DeploymentEvent event) - { - // we're only interested in the start and end event for the time - // being, we'll add support for returning item by item progress - // at a later date. - if (event.getType().equals(Type.START)) - { - this.started = true; - } - else if (event.getType().equals(Type.END)) - { - // if we get the END event the deployment was successful - this.successful = true; - this.finished = true; - } - else if (event.getType().equals(Type.FAILED)) - { - // if we get the FAILED event the deployment was unsuccessful - this.successful = false; - this.finished = true; - - this.reason = event.getMessage(); - - if (logger.isDebugEnabled()) - logger.debug(this.targetServerName + ": ERROR: " + this.reason); - } - - if (logger.isDebugEnabled()) - logger.debug(this.targetServerName + ": " + event.getType() + - " " + event.getDestination()); - } - - @Override - public String toString() - { - StringBuilder buffer = new StringBuilder(super.toString()); - buffer.append(" (id=").append(this.id); - buffer.append(" website=").append(this.website); - buffer.append(" targetServer=").append(this.targetServer); - buffer.append(" targetServerName=").append(this.targetServerName); - buffer.append(" snapshotVersion=").append(this.snapshotVersion); - buffer.append(" deployAttemptId=").append(this.deployAttemptId); - buffer.append(" url=").append(this.url); - buffer.append(" reason=").append(this.reason); - buffer.append(" started=").append(this.started); - buffer.append(" finished=").append(this.finished); - buffer.append(" successful=").append(this.successful).append(")"); - return buffer.toString(); - } - - public String toXML() - { - StringBuilder buffer = new StringBuilder(""); - return buffer.toString(); - } - - // ------------------------------------------------------------------------------ - // Getters and setters - - /** - * @return The id for this deployment monitor - */ - public String getId() - { - return this.id; - } - - /** - * @return The NodeRef representation of the website being deployed - */ - public NodeRef getWebsite() - { - return this.website; - } - - /** - * @return The target server for this deployment - */ - public NodeRef getTargetServer() - { - return this.targetServer; - } - - /** - * @return The target server display name for this deployment - */ - public String getTargetServerName() - { - return this.targetServerName; - } - - /** - * @return The snapshot version being deployed - */ - public int getSnapshotVersion() - { - return this.snapshotVersion; - } - - /** - * @return The deploy attempt id for this deployment - */ - public String getDeployAttemptId() - { - return this.deployAttemptId; - } - - /** - * @return The URL of the server being deployed - */ - public String getUrl() - { - return this.url; - } - - /** - * @return The reason for the error, null if an error has not occurred - */ - public String getReason() - { - return this.reason; - } - - /** - * @return true if the deployment has started - */ - public boolean isStarted() - { - return this.started; - } - - /** - * @return true if the deployment has finished - */ - public boolean isFinished() - { - return this.finished; - } - - /** - * @return true if the deployment was successful, - * only reliable once isFinished returns true. - */ - public boolean isSuccessful() - { - return this.successful; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/DeploymentProgressBean.java b/source/java/org/alfresco/web/bean/wcm/DeploymentProgressBean.java deleted file mode 100644 index 0f56620499..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/DeploymentProgressBean.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.IOException; -import java.io.Serializable; -import java.util.Map; -import java.util.StringTokenizer; - -import javax.faces.context.FacesContext; -import javax.faces.context.ResponseWriter; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Bean used by the AJAX callback from the monitor deployment dialog - * to track progress of deployments. - * - * @author gavinc - */ -public class DeploymentProgressBean implements Serializable -{ - private static final long serialVersionUID = 3940559099944268131L; - - private static Log logger = LogFactory.getLog(DeploymentProgressBean.class); - - public void getStatus() throws IOException - { - FacesContext context = FacesContext.getCurrentInstance(); - ResponseWriter out = context.getResponseWriter(); - - Map params = context.getExternalContext().getRequestParameterMap(); - String monitorIds = (String)params.get("ids"); - - if (logger.isDebugEnabled()) - logger.debug("Retrieving progress status for ids: " + monitorIds); - - if (monitorIds != null && monitorIds.length() > 0) - { - StringBuilder xml = new StringBuilder(""); - xml.append(""); - - StringTokenizer tokenizer = new StringTokenizer(monitorIds, ","); - while (tokenizer.hasMoreTokens()) - { - String id = tokenizer.nextToken().trim(); - - // try and find the deployment monitor object in the session - DeploymentMonitor monitor = (DeploymentMonitor)context.getExternalContext(). - getSessionMap().get(id); - - if (monitor != null) - { - if (logger.isDebugEnabled()) - logger.debug("Found monitor object for id '" + id + "': " + monitor); - - xml.append(monitor.toXML()); - - // cleanup the monitor object from the session if it has completed - if (monitor.isFinished()) - { - context.getExternalContext().getSessionMap().remove(id); - } - } - } - - xml.append(""); - - // send the generated XML back to the tree - out.write(xml.toString()); - - if (logger.isDebugEnabled()) - logger.debug("returning XML: " + xml.toString()); - } - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/DeploymentServerConfig.java b/source/java/org/alfresco/web/bean/wcm/DeploymentServerConfig.java deleted file mode 100644 index 6422b5f214..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/DeploymentServerConfig.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.WCMAppModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; - -/** - * Object holding the configuration for a deployment server. - * - * @author Gavin Cornwell - */ -public final class DeploymentServerConfig implements Serializable -{ - public static final String PROP_TYPE = "type"; - public static final String PROP_NAME = "name"; - public static final String PROP_HOST = "host"; - public static final String PROP_PORT = "port"; - public static final String PROP_USER = "username"; - public static final String PROP_PASSWORD = "password"; - public static final String PROP_URL = "url"; - public static final String PROP_SOURCE_PATH = "sourcePath"; - public static final String PROP_TARGET_NAME = "targetName"; - public static final String PROP_EXCLUDES = "excludes"; - public static final String PROP_ALLOCATED_TO = "allocatedTo"; - public static final String PROP_ON_APPROVAL = "onApproval"; - public static final String PROP_GROUP = "group"; - public static final String PROP_ADAPTER_NAME = "adapterName"; - - protected String id; - protected NodeRef serverRef; - protected String deployType; - protected Map props; - - private static final long serialVersionUID = -8894113751463815194L; - - public DeploymentServerConfig(String deployType) - { - this.id = GUID.generate(); - this.deployType = deployType; - this.props = new HashMap(12, 1.0f); - } - - public DeploymentServerConfig(NodeRef serverRef, Map repoProps) - { - this.id = GUID.generate(); - this.serverRef = serverRef; - this.deployType = (String)repoProps.get(WCMAppModel.PROP_DEPLOYTYPE); - - populateFromRepoProps(repoProps); - } - - public String toString() - { - StringBuilder buffer = new StringBuilder(super.toString()); - buffer.append(" (id=").append(this.id); - buffer.append(" serverRef=").append(this.serverRef); - buffer.append(" deployType=").append(this.deployType); - - // copy the properties map and overwrite the password (if password is present) - Map tempProps = new HashMap(this.props.size()); - tempProps.putAll(this.props); - if (tempProps.containsKey(PROP_PASSWORD)) - { - tempProps.put(PROP_PASSWORD, "*****"); - } - - buffer.append(" props=").append(tempProps).append(")"); - - return buffer.toString(); - } - - public String getId() - { - return this.id; - } - - public NodeRef getServerRef() - { - return this.serverRef; - } - - public String getDeployType() - { - return this.deployType; - } - - public Map getProperties() - { - return this.props; - } - - public void setProperties(Map props) - { - this.props = new HashMap(props.size()); - this.props.putAll(props); - } - - public Map getRepoProps() - { - Map repoProps = new HashMap(8); - - repoProps.put(WCMAppModel.PROP_DEPLOYTYPE, this.deployType); - repoProps.put(WCMAppModel.PROP_DEPLOYSERVERTYPE, (Serializable)this.props.get(PROP_TYPE)); - - if (this.props.get(PROP_HOST) != null && ((String)this.props.get(PROP_HOST)).length() > 0) - { - repoProps.put(WCMAppModel.PROP_DEPLOYSERVERHOST, (Serializable)this.props.get(PROP_HOST)); - } - - if (this.props.get(PROP_PORT) != null && ((String)this.props.get(PROP_PORT)).length() > 0) - { - try - { - repoProps.put(WCMAppModel.PROP_DEPLOYSERVERPORT, new Integer((String)this.props.get(PROP_PORT))); - } - catch (NumberFormatException ne) - { - // ignore invalid numbers - } - } - - if (this.props.get(PROP_NAME) != null && ((String)this.props.get(PROP_NAME)).length() > 0) - { - repoProps.put(WCMAppModel.PROP_DEPLOYSERVERNAME, (Serializable)this.props.get(PROP_NAME)); - } - - if (this.props.get(PROP_USER) != null && ((String)this.props.get(PROP_USER)).length() > 0) - { - repoProps.put(WCMAppModel.PROP_DEPLOYSERVERUSERNAME, (Serializable)this.props.get(PROP_USER)); - } - - if (this.props.get(PROP_PASSWORD) != null && ((String)this.props.get(PROP_PASSWORD)).length() > 0) - { - repoProps.put(WCMAppModel.PROP_DEPLOYSERVERPASSWORD, (Serializable)this.props.get(PROP_PASSWORD)); - } - - if (this.props.get(PROP_URL) != null && ((String)this.props.get(PROP_URL)).length() > 0) - { - repoProps.put(WCMAppModel.PROP_DEPLOYSERVERURL, (Serializable)this.props.get(PROP_URL)); - } - - if (this.props.get(PROP_SOURCE_PATH) != null && ((String)this.props.get(PROP_SOURCE_PATH)).length() > 0) - { - repoProps.put(WCMAppModel.PROP_DEPLOYSOURCEPATH, (Serializable)this.props.get(PROP_SOURCE_PATH)); - } - - if (this.props.get(PROP_EXCLUDES) != null && ((String)this.props.get(PROP_EXCLUDES)).length() > 0) - { - repoProps.put(WCMAppModel.PROP_DEPLOYEXCLUDES, (Serializable)this.props.get(PROP_EXCLUDES)); - } - - if (this.props.get(PROP_ALLOCATED_TO) != null && ((String)this.props.get(PROP_ALLOCATED_TO)).length() > 0) - { - repoProps.put(WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO, (Serializable)this.props.get(PROP_ALLOCATED_TO)); - } - - // only save the target if it's an FSR (File System Receiver) - if (WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(this.deployType)) - { - if (this.props.get(PROP_TARGET_NAME) != null && ((String)this.props.get(PROP_TARGET_NAME)).length() > 0) - { - repoProps.put(WCMAppModel.PROP_DEPLOYSERVERTARGET, (Serializable)this.props.get(PROP_TARGET_NAME)); - } - } - - // only save the approval flag if the server type is a 'live' server - if (WCMAppModel.CONSTRAINT_LIVESERVER.equals(this.props.get(PROP_TYPE))) - { - if (this.props.get(PROP_ON_APPROVAL) != null) - { - repoProps.put(WCMAppModel.PROP_DEPLOYONAPPROVAL, (Serializable)this.props.get(PROP_ON_APPROVAL)); - } - } - - if (this.props.get(PROP_GROUP) != null && ((String)this.props.get(PROP_GROUP)).length() > 0) - { - repoProps.put(WCMAppModel.PROP_DEPLOYSERVERGROUP, (Serializable)this.props.get(PROP_GROUP)); - } - - if (this.props.get(PROP_ADAPTER_NAME) != null && ((String)this.props.get(PROP_ADAPTER_NAME)).length() > 0) - { - repoProps.put(WCMAppModel.PROP_DEPLOYSERVERADPTERNAME, (Serializable)this.props.get(PROP_ADAPTER_NAME)); - } - - - return repoProps; - } - - protected void populateFromRepoProps(Map repoProps) - { - this.props = new HashMap(repoProps.size()); - - this.props.put(PROP_TYPE, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERTYPE)); - this.props.put(PROP_HOST, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERHOST)); - - if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERNAME) != null) - { - this.props.put(PROP_NAME, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERNAME)); - } - - if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERPORT) != null) - { - Integer port = (Integer)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERPORT); - this.props.put(PROP_PORT, port.toString()); - } - - if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERUSERNAME) != null) - { - this.props.put(PROP_USER, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERUSERNAME)); - } - - if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERPASSWORD) != null) - { - this.props.put(PROP_PASSWORD, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERPASSWORD)); - } - - if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERURL) != null) - { - this.props.put(PROP_URL, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERURL)); - } - - if (repoProps.get(WCMAppModel.PROP_DEPLOYSOURCEPATH) != null) - { - this.props.put(PROP_SOURCE_PATH, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSOURCEPATH)); - } - - if (repoProps.get(WCMAppModel.PROP_DEPLOYEXCLUDES) != null) - { - this.props.put(PROP_EXCLUDES, (String)repoProps.get(WCMAppModel.PROP_DEPLOYEXCLUDES)); - } - - if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO) != null) - { - this.props.put(PROP_ALLOCATED_TO, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO)); - } - - if (WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(this.deployType)) - { - if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERTARGET) != null) - { - this.props.put(PROP_TARGET_NAME, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERTARGET)); - } - } - - if (WCMAppModel.CONSTRAINT_LIVESERVER.equals(this.props.get(PROP_TYPE))) - { - Boolean onApproval = null; - if (repoProps.get(WCMAppModel.PROP_DEPLOYONAPPROVAL) != null) - { - onApproval = (Boolean)repoProps.get(WCMAppModel.PROP_DEPLOYONAPPROVAL); - } - else - { - onApproval = Boolean.FALSE; - } - - this.props.put(PROP_ON_APPROVAL, onApproval); - } - - if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERGROUP) != null) - { - this.props.put(PROP_GROUP, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERGROUP)); - } - else - { - // Default the group to blank - this.props.put(PROP_GROUP, ""); - } - if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERADPTERNAME) != null) - { - this.props.put(PROP_ADAPTER_NAME, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERADPTERNAME)); - } - else - { - // Default the adapter name to "default" - this.props.put(PROP_ADAPTER_NAME, "default"); - } - - - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/DeploymentUtil.java b/source/java/org/alfresco/web/bean/wcm/DeploymentUtil.java deleted file mode 100644 index 8fcf8345ea..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/DeploymentUtil.java +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.List; - -import javax.faces.context.FacesContext; - -import org.alfresco.model.WCMAppModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.SearchParameters; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.web.bean.repository.Repository; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - - -/** - * Helper methods for deployment - * - * @author Gavin Cornwell - */ -public final class DeploymentUtil -{ - private static final Log logger = LogFactory.getLog(DeploymentUtil.class); - - /** - * Returns all deployment attempts for the given store - * - * @param store The store to get the deployment attempts for - * @return List of NodeRef's representing the deployment attempts - */ - public static List findDeploymentAttempts(String store) - { - // return all deployment attempts - return findDeploymentAttempts(store, null, null); - } - - /** - * Returns all deployment attempts for the given store - * - * @param store The store to get the deployment attempts for - * @param fromDate If present only attempts after the given date are returned - * @param toDate If present only attempts before the given date are returned, if null - * toDate defaults to today's date - * @return List of NodeRef's representing the deployment attempts - */ - public static List findDeploymentAttempts(String store, Date fromDate, Date toDate) - { - FacesContext fc = FacesContext.getCurrentInstance(); - SearchService searchService = Repository.getServiceRegistry(fc).getSearchService(); - - // query for all deploymentattempt nodes with the deploymentattemptstore - // set to the given store id - StringBuilder query = new StringBuilder("@"); - query.append(NamespaceService.WCMAPP_MODEL_PREFIX); - query.append("\\:"); - query.append(WCMAppModel.PROP_DEPLOYATTEMPTSTORE.getLocalName()); - query.append(":\""); - query.append(store); - query.append("\""); - - // constrain the search by date if a fromDate is applied - if (fromDate != null) - { - if (toDate == null) - { - toDate = new Date(); - } - - // see if the dates are the same (ignoring the time) - boolean sameDate = false; - Calendar fromCal = new GregorianCalendar(); - fromCal.setTime(fromDate); - Calendar toCal = new GregorianCalendar(); - toCal.setTime(toDate); - if ((fromCal.get(Calendar.YEAR) == toCal.get(Calendar.YEAR)) && - (fromCal.get(Calendar.MONTH) == toCal.get(Calendar.MONTH)) && - (fromCal.get(Calendar.DAY_OF_MONTH) == toCal.get(Calendar.DAY_OF_MONTH))) - { - sameDate = true; - } - - // add date to query - query.append(" AND @"); - query.append(NamespaceService.WCMAPP_MODEL_PREFIX); - query.append("\\:"); - query.append(WCMAppModel.PROP_DEPLOYATTEMPTTIME.getLocalName()); - query.append(":"); - - if (sameDate) - { - // convert date into format needed for range query - String queryDate = formatLuceneQueryDate(fromDate, false); - - // query for exact date - query.append("\""); - query.append(queryDate); - query.append("\""); - } - else - { - // convert to date into format needed for range query - String queryFromDate = formatLuceneQueryDate(fromDate, true); - String queryToDate = formatLuceneQueryDate(toDate, true); - - // create a date range query - query.append("["); - query.append(queryFromDate); - query.append(" TO "); - query.append(queryToDate); - query.append("]"); - } - } - - if (logger.isDebugEnabled()) - logger.debug("Finding deploymentattempt nodes using query: " + query.toString()); - - ResultSet results = null; - List attempts = new ArrayList(); - try - { - // sort the results by deploymentattempttime - SearchParameters sp = new SearchParameters(); - sp.addStore(Repository.getStoreRef()); - sp.setLanguage(SearchService.LANGUAGE_LUCENE); - sp.setQuery(query.toString()); - sp.addSort("@" + WCMAppModel.PROP_DEPLOYATTEMPTTIME, false); - - // execute the query - results = searchService.query(sp); - - if (logger.isDebugEnabled()) - logger.debug("Found " + results.length() + " deployment attempts"); - - for (NodeRef attempt : results.getNodeRefs()) - { - attempts.add(attempt); - } - } - finally - { - if (results != null) - { - results.close(); - } - } - - return attempts; - } - - /** - * Retrieves the NodeRef of the deploymentattempt node with the given id - * - * @param attemptId The deployattemptid of the node to be found - * @return The NodeRef of the deploymentattempt node or null if not found - */ - public static NodeRef findDeploymentAttempt(String attemptId) - { - FacesContext fc = FacesContext.getCurrentInstance(); - SearchService searchService = Repository.getServiceRegistry(fc).getSearchService(); - - // construct the query - StringBuilder query = new StringBuilder("@"); - query.append(NamespaceService.WCMAPP_MODEL_PREFIX); - query.append("\\:"); - query.append(WCMAppModel.PROP_DEPLOYATTEMPTID.getLocalName()); - query.append(":\""); - query.append(attemptId); - query.append("\""); - - ResultSet results = null; - NodeRef attempt = null; - try - { - // execute the query - results = searchService.query(Repository.getStoreRef(), - SearchService.LANGUAGE_LUCENE, query.toString()); - - if (results.length() == 1) - { - attempt = results.getNodeRef(0); - } - else if (results.length() > 1) - { - throw new IllegalStateException( - "More than one deployment attempt node was found, there should only be one!"); - } - } - finally - { - if (results != null) - { - results.close(); - } - } - - return attempt; - } - - /** - * Returns the test servers allocated to the given store. - * - * @param store The store to get the test server for - * @return The allocated server(s), an empty list if there isn't one - */ - public static List findAllocatedTestServers(String store) - { - ListserverList = new ArrayList(); - - FacesContext fc = FacesContext.getCurrentInstance(); - SearchService searchService = Repository.getServiceRegistry(fc).getSearchService(); - - // construct the query - StringBuilder query = new StringBuilder("@"); - query.append(NamespaceService.WCMAPP_MODEL_PREFIX); - query.append("\\:"); - query.append(WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO.getLocalName()); - query.append(":\""); - query.append(store); - query.append("\""); - - ResultSet results = null; - try - { - // execute the query - results = searchService.query(Repository.getStoreRef(), - SearchService.LANGUAGE_LUCENE, query.toString()); - - if (results.length() > 0) - { - for(int i = 0; i < results.length(); i++) - { - serverList.add(results.getNodeRef(i)); - } - } - } - finally - { - if (results != null) - { - results.close(); - } - } - - return serverList; - } - - private static String formatLuceneQueryDate(Date date, boolean range) - { - Calendar cal = new GregorianCalendar(); - cal.setTime(date); - - StringBuilder queryDate = new StringBuilder(); - queryDate.append(cal.get(Calendar.YEAR)); - if (range) - { - queryDate.append("\\"); - } - queryDate.append("-"); - queryDate.append((cal.get(Calendar.MONTH)+1)); - if (range) - { - queryDate.append("\\"); - } - queryDate.append("-"); - queryDate.append(cal.get(Calendar.DAY_OF_MONTH)); - queryDate.append("T00:00:00"); - - return queryDate.toString(); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/DescriptionAttributeHelper.java b/source/java/org/alfresco/web/bean/wcm/DescriptionAttributeHelper.java deleted file mode 100644 index 41dcce9276..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/DescriptionAttributeHelper.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import javax.faces.context.FacesContext; - -import org.alfresco.web.app.Application; -import org.alfresco.web.ui.common.Utils; -import org.apache.commons.lang.StringUtils; - -/** - * Helper class to build a HTML description attribute for the tag. - * - * @author Arseny Kovalchuk - * - * @see org.alfresco.web.bean.wcm.CreateWebsiteWizard - * @see org.alfresco.web.bean.wcm.CreateFormWizard - */ -public class DescriptionAttributeHelper -{ - static final String BLANK = ""; - static final String TABLE_BEGIN = ""; - static final String TABLE_END = "
"; - static final String TRTD_BEGIN = ""; - static final String TD_TD = ":"; - static final String TDTR_END = ""; - static final String SPAN_ITALIC_BEGIN = ""; - static final String SPAN_END = ""; - - /** - * - * @return Returns beginning tags of the HTML table - * @see org.alfresco.web.bean.wcm.DescriptionAttributeConstants - */ - public static String getTableBegin() - { - return TABLE_BEGIN; - } - - /** - * - * @param fc Current FacesContext - * @param fieldName Field name - * @param fieldValue Field value - * @return Returns a table line Localised field name:Field value - */ - public static String getTableLine(FacesContext fc, String fieldName, String fieldValue) - { - return getTableLine(fc, fieldName, fieldValue, true); - } - - /** - * - * @param fc Current FacesContext - * @param fieldName Field name - * @param fieldValue Field value - * @param encode Whether to encode the given value or not - * @return Returns a table line Localised field name:Field value - */ - public static String getTableLine(FacesContext fc, String fieldName, String fieldValue, boolean encode) - { - StringBuilder line = new StringBuilder(128); - line.append(TRTD_BEGIN).append(Application.getMessage(fc, fieldName)).append(TD_TD); - if (encode) - { - line.append(Utils.encode(fieldValue)); - } - else - { - line.append(fieldValue); - } - line.append(TDTR_END); - return line.toString(); - } - - /** - * - * @return Returns an ending HTML table tags - */ - public static String getTableEnd() - { - return TABLE_END; - } - - /** - * - * @param fc Current FacesContext - * @param fieldValue Field value - * @return Returns localised "description_not_set" message if fieldValue is empty. - */ - public static String getDescriptionNotEmpty(FacesContext fc, String fieldValue) - { - return StringUtils.isEmpty(fieldValue) ? - SPAN_ITALIC_BEGIN + Application.getMessage(fc, "description_not_set") + SPAN_END : - Utils.encode(fieldValue); - } - -} diff --git a/source/java/org/alfresco/web/bean/wcm/EditAvmFileDialog.java b/source/java/org/alfresco/web/bean/wcm/EditAvmFileDialog.java deleted file mode 100644 index 3e3350838f..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/EditAvmFileDialog.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.Map; - -import javax.faces.context.FacesContext; - -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.web.scripts.FileTypeImageUtils; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.web.app.AlfrescoNavigationHandler; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.servlet.DownloadContentServlet; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.repository.Repository; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * @author arielb - */ -public class EditAvmFileDialog - extends BaseDialogBean -{ - private static final long serialVersionUID = 3099172372971422442L; - - private static final Log LOGGER = LogFactory.getLog(EditAvmFileDialog.class); - - /** AVM service reference */ - transient private AVMService avmService; - - /** AVM Browse Bean reference */ - protected AVMBrowseBean avmBrowseBean; - - // ------------------------------------------------------------------------------ - // Bean property getters and setters - - /** - * @param avmService The avmService to set. - */ - public void setAvmService(AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (avmService == null) - { - avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - return avmService; - } - - /** - * @param avmBrowseBean The AVMBrowseBean to set. - */ - public void setAvmBrowseBean(final AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @return Returns the current AVM node context. - */ - public AVMNode getAvmNode() - { - return this.avmBrowseBean.getAvmActionNode(); - } - - /** - * @return Large file icon for current AVM node - */ - public String getFileType32() - { - return FileTypeImageUtils.getFileTypeImage(getAvmNode().getName(), false); - } - - /** - * @return Content URL for current AVM node - */ - public String getUrl() - { - return DownloadContentServlet.generateDownloadURL(AVMNodeConverter.ToNodeRef(-1, getAvmNode().getPath()), - getAvmNode().getName()); - } - - // ------------------------------------------------------------------------------ - // Dialog implementation - - @Override - public void init(final Map parameters) - { - super.init(parameters); - - } - - @Override - protected String finishImpl(final FacesContext context, String outcome) - throws Exception - { - AVMNode node = getAvmNode(); - if (node != null) - { - // Possibly notify virt server - AVMUtil.updateVServerWebapp(node.getPath(), false); - outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; - } - - return outcome; - } - - @Override - public String getContainerTitle() - { - return this.getAvmNode().getName(); - } - - @Override - public String getCancelButtonLabel() - { - return Application.getMessage(FacesContext.getCurrentInstance(), "close"); - } -} \ No newline at end of file diff --git a/source/java/org/alfresco/web/bean/wcm/EditFilePropertiesDialog.java b/source/java/org/alfresco/web/bean/wcm/EditFilePropertiesDialog.java deleted file mode 100644 index 5798059dd0..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/EditFilePropertiesDialog.java +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.Serializable; -import java.text.MessageFormat; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import javax.faces.context.FacesContext; - -import org.alfresco.model.ContentModel; -import org.alfresco.model.WCMAppModel; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.domain.PropertyValue; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.model.FileExistsException; -import org.alfresco.service.cmr.repository.ContentData; -import org.alfresco.service.cmr.repository.InvalidNodeRefException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.content.EditContentPropertiesDialog; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.forms.FormInstanceData; -import org.alfresco.web.forms.FormsService; -import org.alfresco.web.forms.Rendition; -import org.alfresco.web.ui.common.Utils; - -/** - * Backing bean for the Edit File Properties dialog. - * - * @author Kevin Roast - */ -public class EditFilePropertiesDialog extends EditContentPropertiesDialog -{ - private static final long serialVersionUID = 635722726225138092L; - - protected AVMBrowseBean avmBrowseBean; - transient private AVMService avmService; - transient private FormsService formsService; - - - // ------------------------------------------------------------------------------ - // Bean property getters and setters - - /** - * @param avmBrowseBean The AVMBrowseBean to set. - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @param avmService The AVMService to set. - */ - public void setAvmService(AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (avmService == null) - { - avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - return avmService; - } - - /** - * @param formsService The FormsService to set. - */ - public void setFormsService(final FormsService formsService) - { - this.formsService = formsService; - } - - protected FormsService getFormsService() - { - if (formsService == null) - { - formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); - } - return formsService; - } - - - - // ------------------------------------------------------------------------------ - // Dialog implementation - - /** - * @see org.alfresco.web.bean.content.EditContentPropertiesDialog#initEditableNode() - */ - protected Node initEditableNode() - { - return new Node(this.avmBrowseBean.getAvmActionNode().getNodeRef()); - } - - @Override - protected String finishImpl(FacesContext context, String outcome) - throws Exception - { - NodeRef nodeRef = this.editableNode.getNodeRef(); - Map editedProps = this.editableNode.getProperties(); - - // handle the name property separately, it is a special case for AVM nodes - String name = (String)editedProps.get(ContentModel.PROP_NAME); - if (name != null) - { - editedProps.remove(ContentModel.PROP_NAME); - } - - // we need to put all the properties from the editable bag back into - // the format expected by the repository - Map repoProps = this.getNodeService().getProperties(nodeRef); - - // but first extract and deal with the special mimetype property for ContentData - String mimetype = (String)editedProps.get(TEMP_PROP_MIMETYPE); - if (mimetype != null) - { - // remove temporary prop from list so it isn't saved with the others - editedProps.remove(TEMP_PROP_MIMETYPE); - ContentData contentData = (ContentData)editedProps.get(ContentModel.PROP_CONTENT); - if (contentData != null) - { - contentData = ContentData.setMimetype(contentData, mimetype); - editedProps.put(ContentModel.PROP_CONTENT.toString(), contentData); - } - } - - // add the "titled" aspect if required, properties will get set below - if (this.getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_TITLED) == false) - { - getNodeService().addAspect(nodeRef, ContentModel.ASPECT_TITLED, null); - } - - // add the remaining properties - Iterator iterProps = editedProps.keySet().iterator(); - while (iterProps.hasNext()) - { - String propName = iterProps.next(); - QName qname = QName.createQName(propName); - - // make sure the property is represented correctly - Serializable propValue = (Serializable)editedProps.get(propName); - - // check for empty strings when using number types, set to null in this case - if ((propValue != null) && (propValue instanceof String) && - (propValue.toString().length() == 0)) - { - PropertyDefinition propDef = this.getDictionaryService().getProperty(qname); - if (propDef != null) - { - if (propDef.getDataType().getName().equals(DataTypeDefinition.DOUBLE) || - propDef.getDataType().getName().equals(DataTypeDefinition.FLOAT) || - propDef.getDataType().getName().equals(DataTypeDefinition.INT) || - propDef.getDataType().getName().equals(DataTypeDefinition.LONG)) - { - propValue = null; - } - } - } - - repoProps.put(qname, propValue); - } - - // Translate to what AVMService wants to take. - DictionaryService dd = Repository.getServiceRegistry(context).getDictionaryService(); - Map avmProps = new HashMap(); - for (Map.Entry entry : repoProps.entrySet()) - { - PropertyDefinition propDef = dd.getProperty(entry.getKey()); - if (propDef != null) - { - avmProps.put(entry.getKey(), new PropertyValue(propDef.getDataType().getName(), entry.getValue())); - } - } - // send the properties back to the repository - this.getAvmService().setNodeProperties(AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond(), avmProps); - - // perform the rename last as for an AVM it changes the NodeRef, but only if the name has changed! - String path = AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond(); - final String parentPath = AVMNodeConverter.SplitBase(path)[0]; - final String oldName = AVMNodeConverter.SplitBase(path)[1]; - - if (name != null && name.equals(oldName) == false) - { - if (this.getNodeService().hasAspect(nodeRef, WCMAppModel.ASPECT_RENDITION)) - { - throw new UnsupportedOperationException(this.getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME) + - " is a " + WCMAppModel.ASPECT_RENDITION + - " and cannot be renamed"); - } - - // need to find out if it's a form instance data before rename. for whatever reason, - // afterwards it claims it is not - if (this.getNodeService().hasAspect(nodeRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) - { - final FormInstanceData fid = this.getFormsService().getFormInstanceData(nodeRef); - // delete all existing renditions - for (final Rendition r : fid.getRenditions()) - { - this.getAvmService().removeNode(r.getPath()); - } - this.getNodeService().removeProperty(nodeRef, WCMAppModel.PROP_RENDITIONS); - } - - this.getAvmService().rename(parentPath, oldName, parentPath, name); - nodeRef = AVMNodeConverter.ToNodeRef(-1, AVMNodeConverter.ExtendAVMPath(parentPath, name)); - - if (this.getNodeService().hasAspect(nodeRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) - { - final FormInstanceData fid = this.getFormsService().getFormInstanceData(nodeRef); - for (final FormInstanceData.RegenerateResult rr : fid.regenerateRenditions()) - { - if (rr.getException() != null) - { - outcome = null; - Utils.addErrorMessage("error regenerating rendition using " + rr.getRenderingEngineTemplate().getName() + - ": " + rr.getException().getMessage(), - rr.getException()); - } - } - } - } - - // add the name property back to the properties map - if (name != null) - { - editedProps.put(ContentModel.PROP_NAME.toString(), name); - } - - return outcome; - } - - @Override - protected String doPostCommitProcessing(FacesContext context, String outcome) - { - // a rename may have occured - we need to reset the NodeRef of the modified AVM Node - // as an AVM NodeRef contains the name as part of ref - which can therefore change! - String name = this.editableNode.getName(); - String oldPath = AVMNodeConverter.ToAVMVersionPath(this.editableNode.getNodeRef()).getSecond(); - String newPath = oldPath.substring(0, oldPath.lastIndexOf('/') + 1) + name; - this.avmBrowseBean.setAvmActionNode(new AVMNode(this.getAvmService().lookup(-1, newPath))); - - return outcome; - } - - /** - * Formats the error message to display if an error occurs during finish processing - * - * @param exception The exception - * @return The formatted message - */ - @Override - protected String formatErrorMessage(Throwable exception) - { - if (exception instanceof FileExistsException) - { - return MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_EXISTS), - ((FileExistsException)exception).getName()); - } - else if (exception instanceof InvalidNodeRefException) - { - return MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), - new Object[] {this.avmBrowseBean.getAvmActionNode().getPath()}); - } - else - { - return super.formatErrorMessage(exception); - } - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/EditFolderPropertiesDialog.java b/source/java/org/alfresco/web/bean/wcm/EditFolderPropertiesDialog.java deleted file mode 100644 index 7cbd7996a7..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/EditFolderPropertiesDialog.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; - -import org.alfresco.model.ApplicationModel; -import org.alfresco.model.ContentModel; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.avm.LayeredFolderType; -import org.alfresco.repo.domain.PropertyValue; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.spaces.EditSpaceDialog; -import org.alfresco.web.ui.common.component.UIListItem; - -/** - * Backing bean for the Edit Folder Properties dialog. - * - * @author Kevin Roast - */ -public class EditFolderPropertiesDialog extends EditSpaceDialog -{ - private static final long serialVersionUID = -6423913727249054187L; - - protected AVMBrowseBean avmBrowseBean; - transient private AVMService avmService; - - - // ------------------------------------------------------------------------------ - // Bean property getters and setters - - /** - * @param avmBrowseBean The AVMBrowseBean to set. - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @param avmService The AVMService to set. - */ - public void setAvmService(AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (avmService == null) - { - avmService = (AVMService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "AVMLockingAwareService"); - } - return avmService; - } - - - // ------------------------------------------------------------------------------ - // Dialog implementation - - /** - * @see org.alfresco.web.bean.spaces.EditSpaceDialog#initEditableNode() - */ - @Override - protected Node initEditableNode() - { - return new Node(this.avmBrowseBean.getAvmActionNode().getNodeRef()); - } - - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - // update the existing node in the repository - NodeRef nodeRef = this.editableNode.getNodeRef(); - Map editedProps = this.editableNode.getProperties(); - - // handle the name property separately, it is a special case for AVM nodes - String name = (String)editedProps.get(ContentModel.PROP_NAME); - if (name != null) - { - editedProps.remove(ContentModel.PROP_NAME); - } - - // get the current set of properties from the repository - Map repoProps = this.getNodeService().getProperties(nodeRef); - - // add the "uifacets" aspect if required, properties will get set below - if (this.getNodeService().hasAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS) == false) - { - this.getNodeService().addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, null); - } - - // overwrite the current properties with the edited ones - Iterator iterProps = editedProps.keySet().iterator(); - while (iterProps.hasNext()) - { - String propName = iterProps.next(); - QName qname = QName.createQName(propName); - - // make sure the property is represented correctly - Serializable propValue = (Serializable)editedProps.get(propName); - - // check for empty strings when using number types, set to null in this case - if ((propValue != null) && (propValue instanceof String) && - (propValue.toString().length() == 0)) - { - PropertyDefinition propDef = this.getDictionaryService().getProperty(qname); - if (propDef != null) - { - if (propDef.getDataType().getName().equals(DataTypeDefinition.DOUBLE) || - propDef.getDataType().getName().equals(DataTypeDefinition.FLOAT) || - propDef.getDataType().getName().equals(DataTypeDefinition.INT) || - propDef.getDataType().getName().equals(DataTypeDefinition.LONG)) - { - propValue = null; - } - } - } - - repoProps.put(qname, propValue); - } - - // Translate to what AVMService wants to take. - DictionaryService dd = Repository.getServiceRegistry(context).getDictionaryService(); - Map avmProps = new HashMap(); - for (Map.Entry entry : repoProps.entrySet()) - { - PropertyDefinition propDef = dd.getProperty(entry.getKey()); - if (propDef != null) - { - avmProps.put(entry.getKey(), new PropertyValue(propDef.getDataType().getName(), entry.getValue())); - } - } - - // send the properties back to the repository - this.getAvmService().setNodeProperties(AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond(), avmProps); - - // perform the rename last as for an AVM it changes the NodeRef - if (name != null) - { - // OnMoveNodePolicy behavior differs for Web-Client and external calls (FTP, CIFS) - // Flag is set for the current thread - Boolean wasIssuedByWebClient = LayeredFolderType.isIssuedByWebClient(); - try - { - LayeredFolderType.setIssuedByWebClient(true); - this.getFileFolderService().rename(nodeRef, name); - editedProps.put(ContentModel.PROP_NAME.toString(), name); - } - finally - { - LayeredFolderType.setIssuedByWebClient(wasIssuedByWebClient); - } - - } - - return outcome; - } - - @Override - protected String doPostCommitProcessing(FacesContext context, String outcome) - { - // a rename may have occured - we need to reset the NodeRef of the modified AVM Node - // as an AVM NodeRef contains the name as part of ref - which can therefore change! - String name = this.editableNode.getName(); - String oldPath = AVMNodeConverter.ToAVMVersionPath(this.editableNode.getNodeRef()).getSecond(); - String newPath = oldPath.substring(0, oldPath.lastIndexOf('/') + 1) + name; - this.avmBrowseBean.setAvmActionNode(new AVMNode(this.getAvmService().lookup(-1, newPath))); - - return outcome; - } - - public List getIcons() - { - List icons = new ArrayList(1); - - UIListItem item = new UIListItem(); - item.setValue(DEFAULT_SPACE_ICON_NAME); - item.setImage("/images/icons/" + DEFAULT_SPACE_ICON_NAME + ".gif"); - icons.add(item); - - return icons; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/EditFormWizard.java b/source/java/org/alfresco/web/bean/wcm/EditFormWizard.java deleted file mode 100644 index 787185bdf9..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/EditFormWizard.java +++ /dev/null @@ -1,434 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; - -import org.alfresco.model.ContentModel; -import org.alfresco.model.WCMAppModel; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.workflow.WorkflowDefinition; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.forms.Form; -import org.alfresco.web.forms.RenderingEngineTemplate; -import org.alfresco.web.ui.common.Utils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Backing bean for the Edit Form wizard. - * - * @author Ariel Backenroth - * @author Arseny Kovalchuk (Bug Fixer) - * - * Methods removeRenderingEngineTemplateFromWebProjects, addRenderingEngineTemplateToWebProjects, searchRenderingEngineTemplateInWebProject - * are added to fix an issue reported in https://issues.alfresco.com/jira/browse/ETWOONE-317 - * - */ -public class EditFormWizard - extends CreateFormWizard -{ - private static final long serialVersionUID = -3260838389223325316L; - - private final static Log LOGGER = LogFactory.getLog(EditFormWizard.class); - - private List removedRenderingEngineTemplates; - private List associatedWebProjects; - - // ------------------------------------------------------------------------------ - // Wizard implementation - - /** - * Initialises the wizard - */ - @Override - public void init(final Map parameters) - { - super.init(parameters); - - final NodeRef formNodeRef = this.browseBean.getActionSpace().getNodeRef(); - if (formNodeRef == null) - { - throw new IllegalArgumentException("Edit Form wizard requires action node context."); - } - - final Form form = this.getFormsService().getForm(formNodeRef); - // simple properties - this.setFormName(form.getName()); - this.setFormTitle(form.getTitle()); - this.setFormDescription(form.getDescription()); - this.setSchemaRootElementName(form.getSchemaRootElementName()); - NodeRef schemaNodeRef = (NodeRef) - this.getNodeService().getProperty(formNodeRef, WCMAppModel.PROP_XML_SCHEMA); - if (schemaNodeRef == null) - { - if (LOGGER.isDebugEnabled()) - LOGGER.debug(WCMAppModel.PROP_XML_SCHEMA + " not set on " + formNodeRef + - ", checking " + WCMAppModel.PROP_XML_SCHEMA_OLD); - - schemaNodeRef = (NodeRef) - getNodeService().getProperty(formNodeRef, WCMAppModel.PROP_XML_SCHEMA_OLD); - if (schemaNodeRef != null) - { - getNodeService().setProperty(formNodeRef, WCMAppModel.PROP_XML_SCHEMA, schemaNodeRef); - } - } - if (schemaNodeRef == null) - { - throw new NullPointerException("expected property " + WCMAppModel.PROP_XML_SCHEMA + - " of " + formNodeRef + - " for form " + form.getName() + - " not to be null."); - } - this.setSchemaFileName((String)this.getNodeService().getProperty(schemaNodeRef, - ContentModel.PROP_NAME)); - try - { - this.schema = form.getSchema(); - } - catch (Throwable t) - { - final String msg = "unable to parse " + form.getName(); - Utils.addErrorMessage(msg, t); - } - final WorkflowDefinition wf = form.getDefaultWorkflow(); - if (wf != null) - { - this.defaultWorkflowName = wf.getName(); - } - else - { - this.applyDefaultWorkflow = false; - } - this.setOutputPathPatternForFormInstanceData(form.getOutputPathPattern()); - - for (RenderingEngineTemplate ret : form.getRenderingEngineTemplates()) - { - final RenderingEngineTemplateData data = - this.new RenderingEngineTemplateData(ret); - this.renderingEngineTemplates.add(data); - } - this.removedRenderingEngineTemplates = null; - - if (getIsWebForm() == true) - { - this.associatedWebProjects = this.getFormsService().getAssociatedWebProjects(form); - } - } - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(final FacesContext context, - final String outcome) - throws Exception - { - final NodeRef formNodeRef = this.browseBean.getActionSpace().getNodeRef(); - - // apply the name, title and description props - if (!this.getFormName().equals(this.getNodeService().getProperty(formNodeRef, ContentModel.PROP_NAME))) - { - this.getFileFolderService().rename(formNodeRef, this.getFormName()); - } - - this.getNodeService().setProperty(formNodeRef, ContentModel.PROP_TITLE, this.getFormTitle()); - this.getNodeService().setProperty(formNodeRef, ContentModel.PROP_DESCRIPTION, this.getFormDescription()); - this.getNodeService().setProperty(formNodeRef, - WCMAppModel.PROP_OUTPUT_PATH_PATTERN, - this.getOutputPathPatternForFormInstanceData()); - this.getNodeService().setProperty(formNodeRef, - WCMAppModel.PROP_XML_SCHEMA_ROOT_ELEMENT_NAME, - this.getSchemaRootElementName()); - final WorkflowDefinition wd = this.getDefaultWorkflowDefinition(); - final List workflowRefs = - this.getNodeService().getChildAssocs(formNodeRef, - WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS, - RegexQNamePattern.MATCH_ALL); - - if (wd != null && workflowRefs.size() == 0) - { - if (LOGGER.isDebugEnabled()) - LOGGER.debug("adding workflow definition " + wd.getName() + - " to form " + this.getFormName()); - - final Map props = new HashMap(1, 1.0f); - props.put(WCMAppModel.PROP_WORKFLOW_NAME, wd.getName()); - this.getNodeService().createNode(formNodeRef, - WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS, - WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS, - WCMAppModel.TYPE_WORKFLOW_DEFAULTS, - props); - } - else if (wd != null && workflowRefs.size() == 1) - { - if (LOGGER.isDebugEnabled()) - LOGGER.debug("setting workflow definition " + wd.getName() + - " to form " + this.getFormName()); - - this.getNodeService().setProperty(workflowRefs.get(0).getChildRef(), - WCMAppModel.PROP_WORKFLOW_NAME, - wd.getName()); - } - else if (wd == null && workflowRefs.size() == 1) - { - if (LOGGER.isDebugEnabled()) - LOGGER.debug("removing workflow definitions from form " + this.getFormName()); - - this.getNodeService().removeChild(formNodeRef, workflowRefs.get(0).getChildRef()); - } - - if (this.getSchemaFile() != null) - { - final FileInfo fileInfo = - this.getFileFolderService().create(formNodeRef, - this.getSchemaFileName(), - ContentModel.TYPE_CONTENT); - // get a writer for the content and put the file - final ContentWriter writer = this.contentService.getWriter(fileInfo.getNodeRef(), - ContentModel.PROP_CONTENT, - true); - // set the mimetype and encoding - writer.setMimetype(MimetypeMap.MIMETYPE_XML); - writer.setEncoding("UTF-8"); - writer.putContent(this.getSchemaFile()); - this.getNodeService().setProperty(formNodeRef, - WCMAppModel.PROP_XML_SCHEMA, - fileInfo.getNodeRef()); - } - - if (this.removedRenderingEngineTemplates != null) - { - for (final RenderingEngineTemplateData retd : this.removedRenderingEngineTemplates) - { - if (LOGGER.isDebugEnabled()) - LOGGER.debug("removing rendering engine template " + retd); - - assert retd != null; - assert retd.getNodeRef() != null; - this.getNodeService().removeAssociation(formNodeRef, retd.getNodeRef(), - WCMAppModel.ASSOC_RENDERING_ENGINE_TEMPLATES); - this.getNodeService().removeChild(formNodeRef, retd.getNodeRef()); - this.removeRenderingEngineTemplateFromWebProjects(formNodeRef, retd); - - } - } - for (final RenderingEngineTemplateData retd : this.renderingEngineTemplates) - { - if (retd.getFile() != null) - { - this.saveRenderingEngineTemplate(retd, formNodeRef); - this.addRenderingEngineTemplateToWebProjects(formNodeRef, retd); - } - } - return outcome; - } - - /** - * Removes an associated Rendering Engine Template from all web forms in all web projects. - * - * @param formNodeRef Form nodeRef - * @param retd Rendering engine template to remove from web projects - */ - private void removeRenderingEngineTemplateFromWebProjects(NodeRef formNodeRef, RenderingEngineTemplateData retd) - { - List webProjects = getFormsService().getAssociatedWebProjects(getFormsService().getForm(formNodeRef)); - for (WebProject wp: webProjects) - { - ResultSet results = searchRenderingEngineTemplateInWebProject(wp, retd.getName()); - try - { - for (int i=0; i webProjects = getFormsService().getAssociatedWebProjects(form); - Map props = new HashMap(4, 1.0f); - for (WebProject wp: webProjects) - { - ResultSet results = searchRenderingEngineTemplateInWebProject(wp, retd.getName()); - try - { - int resultsCount = results.length(); - if (resultsCount>0) - { - //update - for (int i=0; i>>Web Project: " + wp); - LOGGER.debug(">>>StoreRef: " + storeRef); - LOGGER.debug(">>>Search query: " + query.toString()); - LOGGER.debug(">>>Search results: " + result.length()); - } - return result; - } - - /** - * Action handler called when the Remove button is pressed to remove a - * rendering engine - */ - @Override - public void removeSelectedRenderingEngineTemplate(final ActionEvent event) - { - final RenderingEngineTemplateData wrapper = (RenderingEngineTemplateData) - this.getRenderingEngineTemplatesDataModel().getRowData(); - if (wrapper != null) - { - if (this.removedRenderingEngineTemplates == null) - { - this.removedRenderingEngineTemplates = new LinkedList(); - } - this.removedRenderingEngineTemplates.add(wrapper); - } - super.removeSelectedRenderingEngineTemplate(event); - } - - - /** Indicates whether or not the wizard is currently in edit mode */ - @Override - public boolean getEditMode() - { - return true; - } - - @Override - public List getAssociatedWebProjects() - { - return this.associatedWebProjects; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/EditPermissionsDialog.java b/source/java/org/alfresco/web/bean/wcm/EditPermissionsDialog.java deleted file mode 100644 index efb9ec9bbf..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/EditPermissionsDialog.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.faces.component.UISelectOne; -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; -import javax.faces.model.DataModel; -import javax.faces.model.ListDataModel; -import javax.faces.model.SelectItem; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessPermission; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.users.UserMembersBean.PermissionWrapper; -import org.alfresco.web.ui.common.component.UIActionLink; - -/** - * Class for EditPermissions dialog - * - * @author Sergei Gavrusev - */ -public class EditPermissionsDialog extends UpdatePermissionsDialog -{ - private static final long serialVersionUID = 670465612383178325L; - - private static final String MSG_EDIT_PERMS_FOR = "edit_permissions_title"; - - private boolean finishButtonDisabled = true; - - private List personPerms = null; - private transient DataModel personPermsDataModel = null; - private String personAuthority; - - /** - * @param event - */ - public void setupAction(ActionEvent event) - { - - UIActionLink link = (UIActionLink) event.getComponent(); - Map params = link.getParameterMap(); - personAuthority = params.get("userName"); - - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.wcm.UpdatePermissionsDialog#init(java.util.Map) - */ - @Override - public void init(Map parameters) - { - super.init(parameters); - setActiveNode(getAvmBrowseBean().getAvmActionNode()); - personPerms = new ArrayList(3); - personPermsDataModel = null; - - NodeRef actionNode = getAvmBrowseBean().getAvmActionNode().getNodeRef(); - NodeRef parentRef = getNodeService().getPrimaryParent(actionNode).getParentRef(); - Set parentPermission = getPermissionService().getAllSetPermissions(parentRef); - - Set permsForRemove = ManagePermissionsDialog.getPermissionsForType(); - Set allSetPerms = getPermissionService().getAllSetPermissions(getActiveNode().getNodeRef()); - for (AccessPermission perm : allSetPerms) - { - if (!parentPermission.contains(perm)) - { - if (perm.getAuthority().equals(personAuthority) && permsForRemove.contains(perm.getPermission())) - { - PermissionWrapper wraper = new PermissionWrapper(perm.getPermission(), perm.getPermission()); - personPerms.add(wraper); - } - } - } - - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.dialog.BaseDialogBean#getFinishButtonDisabled() - */ - @Override - public boolean getFinishButtonDisabled() - { - return finishButtonDisabled; - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.dialog.BaseDialogBean#getContainerTitle() - */ - @Override - public String getContainerTitle() - { - FacesContext fc = FacesContext.getCurrentInstance(); - String pattern = Application.getMessage(fc, MSG_EDIT_PERMS_FOR); - return MessageFormat.format(pattern, personAuthority); - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.wcm.BasePermissionsDialog#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - setPermissions(getActiveNode()); - createLock(getActiveNode()); - - finishButtonDisabled = true; - - return outcome; - } - - @Override - public String cancel() - { - finishButtonDisabled = true; - - return super.cancel(); - } - - /** - * Set permissions for current node - * - * @param node - */ - private void setPermissions(AVMNode node) - { - NodeRef nodeRef = node.getNodeRef(); - Set permsForRemove = ManagePermissionsDialog.getPermissionsForType(); - - // Set only those permissions that contains in personPerms - // Other permissions are removed - for (String perm : permsForRemove) - { - boolean needToSet = false; - for (PermissionWrapper wrapper : personPerms) - { - if (wrapper.getPermission().equals(perm)) - { - needToSet = true; - break; - } - } - - if (needToSet) - { - getPermissionService().setPermission(nodeRef, personAuthority, perm, true); - } - else - { - getPermissionService().deletePermission(nodeRef, personAuthority, perm); - } - } - } - - /** - * @return The list of available permissions for the users/groups - */ - public SelectItem[] getPerms() - { - - return WCMPermissionsUtils.getPermissions(); - } - - /** - * Action handler called when the Add Permission button is pressed to process the current selection - */ - public void addPermission(ActionEvent event) - { - UISelectOne permPicker = (UISelectOne) event.getComponent().findComponent("perms"); - - String permission = (String) permPicker.getValue(); - if (permission != null) - { - boolean foundExisting = false; - for (int n = 0; n < personPerms.size(); n++) - { - PermissionWrapper wrapper = personPerms.get(n); - if (wrapper.getPermission().equals(permission)) - { - foundExisting = true; - break; - } - } - - if (!foundExisting) - { - FacesContext context = FacesContext.getCurrentInstance(); - PermissionWrapper wrapper = new PermissionWrapper(permission, Application.getMessage(context, permission)); - this.personPerms.add(wrapper); - finishButtonDisabled = false; - } - } - - } - - /** - * Returns the properties for current Person permissions JSF DataModel - * - * @return JSF DataModel representing the current Person permissions - */ - public DataModel getPersonPermsDataModel() - { - if (this.personPermsDataModel == null) - { - this.personPermsDataModel = new ListDataModel(); - } - - if (this.personPermsDataModel.getWrappedData() == null) - { - this.personPermsDataModel.setWrappedData(this.personPerms); - } - - return this.personPermsDataModel; - } - - /** - * Action handler called when the Remove button is pressed to remove a permission from current user - */ - public void removePermission(ActionEvent event) - { - PermissionWrapper wrapper = (PermissionWrapper) getPersonPermsDataModel().getRowData(); - if (wrapper != null) - { - this.personPerms.remove(wrapper); - finishButtonDisabled = false; - } - } - -} diff --git a/source/java/org/alfresco/web/bean/wcm/EditWebContentWizard.java b/source/java/org/alfresco/web/bean/wcm/EditWebContentWizard.java deleted file mode 100644 index b105c9ed13..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/EditWebContentWizard.java +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.wcm.util.WCMUtil; -import org.alfresco.web.app.Application; -import org.alfresco.web.forms.Form; -import org.alfresco.web.forms.FormInstanceData; -import org.alfresco.web.forms.FormNotFoundException; -import org.alfresco.web.forms.Rendition; -import org.alfresco.util.XMLUtil; -import org.alfresco.web.ui.common.Utils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Bean implementation for the "Edit Web Content Wizard" dialog - */ -public class EditWebContentWizard extends CreateWebContentWizard -{ - private static final long serialVersionUID = 439996926303151006L; - - private static final Log logger = LogFactory.getLog(EditWebContentWizard.class); - - private AVMNode avmNode; - private Form form; - private String storeNameBeforeEditing; - - protected Set existingLocks = null; - - // ------------------------------------------------------------------------------ - // Wizard implementation - - @Override - public void init(final Map parameters) - { - super.init(parameters); - this.avmNode = this.avmBrowseBean.getAvmActionNode(); - if (this.avmNode == null) - { - throw new IllegalArgumentException("Edit Form wizard requires action node context."); - } - - if (logger.isDebugEnabled()) - logger.debug("path is " + this.avmNode.getPath()); - - this.createdPath = AVMUtil.getCorrespondingPathInPreviewStore(this.avmNode.getPath()); - final WebProject webProject = new WebProject(this.createdPath); - - try - { - this.formInstanceData = this.getFormsService().getFormInstanceData(-1, this.createdPath); - this.formName = this.formInstanceData.getForm().getName(); - this.fileName = this.formInstanceData.getName(); - - this.form = webProject.getForm(this.formName); - } - catch (FormNotFoundException fnfe) - { - Utils.addErrorMessage(fnfe.getMessage(), fnfe); - } - this.content = this.getAvmService().getContentReader(-1, this.createdPath).getContentString(); - this.mimeType = MimetypeMap.MIMETYPE_XML; - - // calculate which locks are present at init time - this.existingLocks = new HashSet(4); - this.storeNameBeforeEditing = null; - String lock = this.getAvmLockingService().getLockOwner(AVMUtil.getStoreId(this.createdPath), - AVMUtil.getStoreRelativePath(this.createdPath)); - if (lock != null) - { - this.existingLocks.add(this.createdPath); - - if (logger.isDebugEnabled()) - logger.debug("Lock exists for xml instance " + this.createdPath + " at initialisation"); - } - - for (final Rendition r : this.formInstanceData.getRenditions()) - { - String path = r.getPath(); - lock = this.getAvmLockingService().getLockOwner(AVMUtil.getStoreId(path), - AVMUtil.getStoreRelativePath(path)); - if (lock != null) - { - this.existingLocks.add(path); - - if (logger.isDebugEnabled()) - logger.debug("Lock exists for rendition " + path + " at initialisation"); - } - } - } - - @Override - public String cancel() - { - if (this.formInstanceData != null && this.renditions != null) - { - if (this.existingLocks.contains(this.createdPath) == false) - { - // there wasn't an existing lock on the form at the start of the - // wizard so remove the one present now - if (logger.isDebugEnabled()) - logger.debug("removing form instance data lock from " + - AVMUtil.getCorrespondingPathInMainStore(this.createdPath) + - " as user chose to cancel and it wasn't present at initialisation"); - - this.getAvmLockingService().removeLock(AVMUtil.getStoreId(this.createdPath), - AVMUtil.getStoreRelativePath(this.createdPath)); - } - - for (Rendition r : this.renditions) - { - String path = r.getPath(); - - if (this.existingLocks.contains(path) == false) - { - // there wasn't a lock on the rendition at the start of - // the wizard so remove the one present now - if (logger.isDebugEnabled()) - logger.debug("removing lock from rendition " + - AVMUtil.getCorrespondingPathInMainStore(path) + - " as user chose to cancel and it wasn't present at initialisation"); - - this.getAvmLockingService().removeLock(AVMUtil.getStoreId(path), - AVMUtil.getStoreRelativePath(path)); - } - } - } - - if (this.storeNameBeforeEditing != null) - { - String storeId = AVMUtil.getStoreId(this.createdPath); - String storePath = AVMUtil.getStoreRelativePath(this.createdPath); - String lockOwner = this.getAvmLockingService().getLockOwner(storeId, storePath); - Map lockData = this.getAvmLockingService().getLockData(storeId, storePath); - - if (lockOwner != null) - { - if (logger.isDebugEnabled()) - logger.debug("transferring lock from " + lockData.get(WCMUtil.LOCK_KEY_STORE_NAME) + " to " + - storeNameBeforeEditing + " on cancel editing"); - - lockData.put(WCMUtil.LOCK_KEY_STORE_NAME, this.storeNameBeforeEditing); - this.getAvmLockingService().modifyLock(storeId, storePath, lockOwner, storeId, storePath, lockData); - } - } - - return super.cancel(); - } - - @Override - public String back() - { - if ("content".equals(Application.getWizardManager().getCurrentStepName())) - { - //override in order not to delete these items - this.formInstanceData = null; - this.renditions = null; - } - return super.back(); - } - - @Override - protected void saveContent() - throws Exception - { - if (logger.isDebugEnabled()) - logger.debug("saving " + this.createdPath); - - String storeId = AVMUtil.getStoreId(this.createdPath); - String storePath = AVMUtil.getStoreRelativePath(this.createdPath); - String storeName = AVMUtil.getStoreName(this.createdPath); - String lockOwner = this.getAvmLockingService().getLockOwner(storeId, storePath); - Map lockData = this.getAvmLockingService().getLockData(storeId, storePath); - - if (lockOwner != null) - { - if (logger.isDebugEnabled()) - logger.debug("transferring lock from " + lockData.get(WCMUtil.LOCK_KEY_STORE_NAME) + " to " + storeName); - - this.storeNameBeforeEditing = lockData.get(WCMUtil.LOCK_KEY_STORE_NAME); - lockData.put(WCMUtil.LOCK_KEY_STORE_NAME, AVMUtil.getStoreName(this.createdPath)); - this.getAvmLockingService().modifyLock(storeId, storePath, lockOwner, storeId, storePath, lockData); - } - - final ContentWriter writer = this.getAvmService().getContentWriter(this.createdPath, true); - this.content = XMLUtil.toString(this.getInstanceDataDocument(), false); - writer.putContent(this.content); - - // XXXarielb might not need to do this reload - this.formInstanceData = this.getFormsService().getFormInstanceData(-1, this.createdPath); - final List result = this.formInstanceData.regenerateRenditions(); - this.renditions = new LinkedList(); - for (FormInstanceData.RegenerateResult rr : result) - { - if (rr.getException() != null) - { - Utils.addErrorMessage("error regenerating rendition using " + rr.getRenderingEngineTemplate().getName() + - ": " + rr.getException().getMessage(), - rr.getException()); - - // if the renditions were locked before the regenerate, move the lock back to main store - String path = rr.getPath(); - - if (rr.getLockOwner() != null) - { - this.existingLocks.add(path); - } - - if (this.existingLocks.contains(path)) - { - String renditionStoreId = AVMUtil.getStoreId(path); - String renditionStorePath = AVMUtil.getStoreRelativePath(path); - String renditionStoreName = AVMUtil.getCorrespondingMainStoreName(AVMUtil.getStoreName(path)); - Map renditionlockData = this.getAvmLockingService().getLockData(AVMUtil.getStoreId(path), AVMUtil.getStoreRelativePath(path)); - renditionlockData.put(WCMUtil.LOCK_KEY_STORE_NAME, renditionStoreName); - - if (logger.isDebugEnabled()) - logger.debug("transferring existing lock for " + path + " back to " + renditionStoreName); - - this.getAvmLockingService().modifyLock(renditionStoreId, renditionStorePath, lockOwner, renditionStoreId, renditionStorePath, renditionlockData); - } - } - else - { - final Rendition r = rr.getRendition(); - this.renditions.add(r); - - String path = r.getPath(); - - if (rr.getLockOwner() != null) - { - this.existingLocks.add(path); - - String renditionStoreId = AVMUtil.getStoreId(path); - String renditionStorePath = AVMUtil.getStoreRelativePath(path); - String renditionStoreName = AVMUtil.getCorrespondingMainStoreName(AVMUtil.getStoreName(path)); - Map renditionlockData = this.getAvmLockingService().getLockData(AVMUtil.getStoreId(path), AVMUtil.getStoreRelativePath(path)); - renditionlockData.put(WCMUtil.LOCK_KEY_STORE_NAME, renditionStoreName); - - if (logger.isDebugEnabled()) - logger.debug("transferring lock for " + path + " back to " + renditionStoreName); - - this.getAvmLockingService().modifyLock(renditionStoreId, renditionStorePath, rr.getLockOwner(), renditionStoreId, renditionStorePath, renditionlockData); - } - } - } - } - - /** Indicates whether or not the wizard is currently in edit mode */ - @Override - public boolean getEditMode() - { - return true; - } - - @Override - public boolean getSubmittable() - { - return !AVMUtil.isWorkflowStore(AVMUtil.getStoreName(this.createdPath)); - } - - /** - * Overridden to avoid calling getWebProject since potentially there is no web project - * context in workflow scenario. - */ - @Override - public Form getForm() - { - return this.form; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java deleted file mode 100644 index ae097460ba..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; -import javax.faces.model.SelectItem; - -import org.alfresco.model.WCMAppModel; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.wcm.webproject.WebProjectInfo; -import org.alfresco.web.app.AlfrescoNavigationHandler; - -/** - * Backing bean for the Edit Web Project wizard. - * - * @author Kevin Roast - */ -public class EditWebsiteWizard extends CreateWebsiteWizard -{ - private static final long serialVersionUID = -4856350244207566218L; - - protected AVMBrowseBean avmBrowseBean; - - // ------------------------------------------------------------------------------ - // Wizard implementation - - /** - * Initialises the wizard - */ - public void init(Map parameters) - { - super.init(parameters); - - // the editMode flag is used to disabled some wizard fields - this.editMode = true; - - NodeRef websiteRef = this.browseBean.getActionSpace().getNodeRef(); - if (websiteRef == null) - { - throw new IllegalArgumentException("Edit Web Project wizard requires action node context."); - } - - this.webappsList = null; - - loadWebProjectModel(websiteRef, true, false); - } - - @Override - public boolean getFinishButtonDisabled() - { - // always allow Finish as we are editing existing settings - return false; - } - - /** - * @return List of SelectItem objects representing the webapp folders present in the project - */ - @Override - public List getWebappsList() - { - if (this.webappsList == null) - { - // create list of webapps - List webApps = getWebProjectService().listWebApps(getWebProjectNodeRef()); - this.webappsList = new ArrayList(webApps.size()); - for (String webAppName : webApps) - { - this.webappsList.add(new SelectItem(webAppName, webAppName)); - } - } - - return this.webappsList; - } - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - NodeRef nodeRef = this.browseBean.getActionSpace().getNodeRef(); - - WebProjectInfo wpInfo = getWebProjectService().getWebProject(nodeRef); - - if(!wpInfo.getName().equals(this.name)) - { - getFileFolderService().rename(nodeRef, this.name); - } - - // apply the name, title and description props - - wpInfo.setName(this.name); - wpInfo.setTitle(this.title); - wpInfo.setDescription(this.description); - wpInfo.setIsTemplate(this.isSource); - wpInfo.setPreviewProviderName(this.previewProvider); - - getWebProjectService().updateWebProject(wpInfo); - - // clear the existing settings for forms, template, workflows and deployment - then - // the existing methods can be used to apply the modified and previous settings from scratch - clearWebProjectModel(nodeRef); - - // change the root webapp name for the website - if (this.webapp != null && this.webapp.length() != 0) - { - getNodeService().setProperty(nodeRef, WCMAppModel.PROP_DEFAULTWEBAPP, this.webapp); - - // inform the AVMBrowseBean of the potential change - this.avmBrowseBean.setWebapp(this.webapp); - } - - // TODO: allow change of dns name - via store rename functionality - - // persist the forms, templates, workflows, workflow defaults and deployment config - // to the model for this web project - saveWebProjectModel(nodeRef); - - // Make sure name and description are refreshed before display - this.navigator.resetCurrentNodeProperties(); - - return AlfrescoNavigationHandler.CLOSE_WIZARD_OUTCOME; - } - - /** - * @param avmBrowseBean The AVMBrowseBean to set. - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * Cascade delete the existing Form and Workflow defs attached to the specified Web Project node - * - * @param nodeRef Web project node - */ - private void clearWebProjectModel(NodeRef nodeRef) - { - List webFormRefs = getNodeService().getChildAssocs( - nodeRef, WCMAppModel.ASSOC_WEBFORM, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef ref : webFormRefs) - { - // cascade delete will take case of child-child relationships - getNodeService().removeChild(nodeRef, ref.getChildRef()); - } - - List wfRefs = getNodeService().getChildAssocs( - nodeRef, WCMAppModel.ASSOC_WEBWORKFLOWDEFAULTS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef ref : wfRefs) - { - getNodeService().removeChild(nodeRef, ref.getChildRef()); - } - - List serverRefs = getNodeService().getChildAssocs( - nodeRef, WCMAppModel.ASSOC_DEPLOYMENTSERVER, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef ref : serverRefs) - { - getNodeService().removeChild(nodeRef, ref.getChildRef()); - } - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/FileDetailsBean.java b/source/java/org/alfresco/web/bean/wcm/FileDetailsBean.java deleted file mode 100644 index 3da4b62c3b..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/FileDetailsBean.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.Serializable; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; -import javax.transaction.UserTransaction; - -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.avm.actions.AVMRevertToVersionAction; -import org.alfresco.repo.web.scripts.FileTypeImageUtils; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ActionService; -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.util.Pair; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.servlet.DownloadContentServlet; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.ui.common.Utils; -import org.alfresco.web.ui.common.component.UIActionLink; -import org.alfresco.web.ui.common.component.data.UIRichList; - -/** - * Backing bean for File Details page. - * - * @author Kevin Roast - */ -public class FileDetailsBean extends AVMDetailsBean -{ - private static final long serialVersionUID = -3263315503769148385L; - - /** Action service bean reference */ - transient private ActionService actionService; - - private final static String MSG_LEFT_QUOTE = "left_qoute"; - private final static String MSG_RIGHT_QUOTE = "right_quote"; - - - // ------------------------------------------------------------------------------ - // Construction - - /** - * Default constructor - */ - public FileDetailsBean() - { - super(); - - // initial state of some panels that don't use the default - panels.put("version-history-panel", false); - } - - - // ------------------------------------------------------------------------------ - // Bean getters and setters - - /** - * @param actionService The actionService to set. - */ - public void setActionService(ActionService actionService) - { - this.actionService = actionService; - } - - private ActionService getActionService() - { - if (actionService == null) - { - actionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getActionService(); - } - return actionService; - } - - /** - * @see org.alfresco.web.bean.wcm.AVMDetailsBean#getAvmNode() - */ - @Override - public AVMNode getAvmNode() - { - return this.avmBrowseBean.getAvmActionNode(); - } - - /** - * @return a Node wrapper of the AVM File Node - for property sheet support - */ - public Node getDocument() - { - return new Node(getAvmNode().getNodeRef()); - } - - /** - * Returns the URL to the content for the current document - * - * @return Content url to the current document - */ - public String getBrowserUrl() - { - return DownloadContentServlet.generateBrowserURL(getAvmNode().getNodeRef(), getAvmNode().getName()); - } - - /** - * Returns the download URL to the content for the current document - * - * @return Download url to the current document - */ - public String getDownloadUrl() - { - return DownloadContentServlet.generateDownloadURL(getAvmNode().getNodeRef(), getAvmNode().getName()); - } - - /** - * Returns the virtualisation server URL to the content for the current document - * - * @return Preview url for the current document - */ - public String getPreviewUrl() - { - return AVMUtil.getPreviewURI(getAvmNode().getPath()); - } - - /** - * @return The 32x32 filetype icon for the file - */ - public String getFileType32() - { - return FileTypeImageUtils.getFileTypeImage(getAvmNode().getName(), false); - } - - /** - * @see org.alfresco.web.bean.wcm.AVMDetailsBean#getNodes() - */ - @Override - protected List getNodes() - { - return (List)this.avmBrowseBean.getFiles(); - } - - /** - * @return version history list for a node - */ - public List> getVersionHistory() - { - AVMNode avmNode = getAvmNode(); - List history = this.getAvmService().getHistory(avmNode.getDescriptor(), -1); - List> wrappers = new ArrayList>(history.size()); - for (AVMNodeDescriptor record : history) - { - Map wrapper = new HashMap(8, 1.0f); - - wrapper.put("version", record.getVersionID()); - wrapper.put("strVersion", Integer.toString(record.getVersionID())); - wrapper.put("modifiedDate", new Date(record.getModDate())); - Pair path = this.getAvmService().getAPath(record); - if (path != null) - { - wrapper.put("url", DownloadContentServlet.generateBrowserURL( - AVMNodeConverter.ToNodeRef(path.getFirst(), path.getSecond()), avmNode.getName())); - } - wrapper.put("fileType16", FileTypeImageUtils.getFileTypeImage(avmNode.getName(), true)); - - wrappers.add(wrapper); - } - return wrappers; - } - - /** - * Revert a node back to a previous version - */ - public void revertNode(ActionEvent event) - { - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - int version = Integer.parseInt(params.get("version")); - - UserTransaction tx = null; - try - { - FacesContext context = FacesContext.getCurrentInstance(); - tx = Repository.getUserTransaction(context, false); - tx.begin(); - - Map args = new HashMap(1, 1.0f); - List history = this.getAvmService().getHistory(getAvmNode().getDescriptor(), -1); - // the history list should contain the version ID we are looking for - for (AVMNodeDescriptor record : history) - { - if (record.getVersionID() == version) - { - // the action expects the HEAD revision as the noderef and - // the to-revert param as the previous version to revert to - Action action = this.getActionService().createAction(AVMRevertToVersionAction.NAME, args); - args.put(AVMRevertToVersionAction.TOREVERT, record); - this.getActionService().executeAction(action, getAvmNode().getNodeRef()); - - // clear the version history list after a revert ready for refresh - UIRichList versionList = (UIRichList)link.findComponent("version-history-list"); - versionList.setValue(null); - - // reset the action node reference as the version ID has changed - avmBrowseBean.setAvmActionNode(new AVMNode(getAvmService().lookup(-1, getAvmNode().getPath()))); - break; - } - } - - tx.commit(); - } - catch (Throwable err) - { - err.printStackTrace(System.err); - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - } - } - - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - // TODO Auto-generated method stub - return null; - } - - public String getCancelButtonLabel() - { - return Application.getMessage(FacesContext.getCurrentInstance(), "close"); - } - - public String getContainerTitle() - { - FacesContext fc = FacesContext.getCurrentInstance(); - return Application.getMessage(fc, "details_of") + " " + Application.getMessage(fc, MSG_LEFT_QUOTE) + getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE); - } - - public String getCurrentItemId() - { - return getAvmNode().getId(); - } - - public String getOutcome() - { - if ( getAvmNode() != null && AVMUtil.isWorkflowStore(AVMUtil.getStoreName(getAvmNode().getPath())) ) - { - return "dialog:close:dialog:workflowShowFileDetails"; - } - else - { - return "dialog:close:dialog:showFileDetails"; - } - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/FilePickerBean.java b/source/java/org/alfresco/web/bean/wcm/FilePickerBean.java deleted file mode 100644 index a4bf37eb24..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/FilePickerBean.java +++ /dev/null @@ -1,1062 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.InputStream; -import java.io.Serializable; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Pattern; - -import javax.faces.context.ExternalContext; -import javax.faces.context.FacesContext; -import javax.faces.context.ResponseWriter; -import javax.servlet.http.HttpServletRequest; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.model.WCMModel; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.domain.PropertyValue; -import org.alfresco.repo.search.SearcherException; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.ContentService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.ResultSetRow; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.Pair; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.servlet.ajax.InvokeCommand; -import org.alfresco.web.bean.FileUploadBean; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.util.XMLUtil; -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; -import org.apache.commons.fileupload.servlet.ServletFileUpload; -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.dom4j.Document; -import org.dom4j.DocumentException; -import org.dom4j.DocumentHelper; -import org.dom4j.Element; -import org.dom4j.XPath; -import org.dom4j.io.SAXReader; -import org.springframework.util.FileCopyUtils; - -/** - * Bean for interacting with the file picker widget using ajax requests. - */ -public class FilePickerBean implements Serializable -{ - private static final Log LOGGER = LogFactory.getLog(FilePickerBean.class); - - private static final String CONFIGURED_SEARCH_QUERY_XPATH = "/search/query"; - private static final String CDATA_START_DELIM = "![CDATA["; - private static final String CDATA_END_DELIM = "]]"; - - // parameter names - private static final String PARAM_FOLDER_RESTRICTION = "folderRestriction"; - private static final String PARAM_CONFIGURED_SEARCH_NAME = "configSearchName"; - private static final String PARAM_SELECTABLE_TYPES = "selectableTypes"; - private static final String PARAM_FILTER_MIME_TYPES = "filterMimetypes"; - private static final String PARAM_CURRENT_PATH = "currentPath"; - private static final String EXTERNAL_PROTOCOL_REGEXP = "^.*:.*"; - - private final Set uploads = new HashSet(); - - // property instance variables - private AVMBrowseBean avmBrowseBean; - transient private AVMService avmService; - transient private NamespaceService namespaceService; - transient private SearchService searchService; - transient private NodeService nodeService; - transient private DictionaryService dictionaryService; - transient private ContentService contentService; - - // cached reference to the public saved searches folder - private NodeRef publicSearchesRef = null; - - public FilePickerBean() - { - } - - public void clearUploadedFiles() - { - this.uploads.clear(); - } - - public NodeRef[] getUploadedFiles() - { - return (NodeRef[]) this.uploads.toArray(new NodeRef[this.uploads.size()]); - } - - /** - * Set avmBrowseBean property for this bean - * - * @param avmBrowseBean - * the AVMBrowseBean object to pass into this property - */ - public void setAvmBrowseBean(final AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * Get avmBrowseBean property for this bean - * - * @return avmBrowseBean property value for this bean - */ - public AVMBrowseBean getAvmBrowseBean() - { - return this.avmBrowseBean; - } - - /** - * Set avmService property for this bean - * - * @param avmService - * the avmService object to pass into this property - */ - public void setAvmService(final AVMService avmService) - { - this.avmService = avmService; - } - - /** - * Get avmService property for this bean - * - * @return avmService property value for this bean - */ - public AVMService getAvmService() - { - if (this.avmService == null) - { - this.avmService = Repository.getServiceRegistry( - FacesContext.getCurrentInstance()).getAVMService(); - } - return this.avmService; - } - - /** - * Set nodeService property value for this bean - * - * @param nodeService - * the NodeService object to pass into this property - */ - public void setNodeService(final NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Get nodeService property for this bean - * - * @return nodeService property value for this bean - */ - public NodeService getNodeService() - { - if (this.nodeService == null) - { - this.nodeService = Repository.getServiceRegistry( - FacesContext.getCurrentInstance()).getNodeService(); - } - return this.nodeService; - } - - /** - * Set searchService property for this bean - * - * @param searchService - * the SearchService object to pass into this property - */ - public void setSearchService(final SearchService searchService) - { - this.searchService = searchService; - } - - /** - * Get SearchService property for this bean - * - * @return searchService property value for this bean - */ - public SearchService getSearchService() - { - if (this.searchService == null) - { - this.searchService = Repository.getServiceRegistry( - FacesContext.getCurrentInstance()).getSearchService(); - } - return this.searchService; - } - - /** - * Set dictionaryService property value for this bean - * - * @param dictionaryService - * the DictionaryService object to pass into this property - */ - public void setDictionaryService(final DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * Get dictionaryService property for this bean - * - * @return dictionaryService property value for this bean - */ - public DictionaryService getDictionaryService() - { - if (this.dictionaryService == null) - { - this.dictionaryService = Repository.getServiceRegistry( - FacesContext.getCurrentInstance()).getDictionaryService(); - } - return this.dictionaryService; - } - - /** - * Set namespaceService property for this bean - * - * @param namespaceService - * the NamespaceService object to pass into this property - */ - public void setNamespaceService(final NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * Get the namespaceService property value for this bean - * - * @return namespaceService property value for this bean - */ - public NamespaceService getNamespaceService() - { - if (this.namespaceService == null) - { - this.namespaceService = Repository.getServiceRegistry( - FacesContext.getCurrentInstance()).getNamespaceService(); - } - return this.namespaceService; - } - - /** - * Set contentService property - * - * @param contentService - * the ContentService object to pass into this property - */ - public void setContentService(final ContentService contentService) - { - this.contentService = contentService; - } - - /** - * Get contentService property value for this bean - * - * @return contentService property value for this bean - */ - public ContentService getContentService() - { - if (this.contentService == null) - { - this.contentService = Repository.getServiceRegistry( - FacesContext.getCurrentInstance()).getContentService(); - } - return this.contentService; - } - - /** - * Provides data for a file picker widget. - */ - @InvokeCommand.ResponseMimetype(value = MimetypeMap.MIMETYPE_XML) - public void getFilePickerData() throws Exception - { - final FacesContext facesContext = FacesContext.getCurrentInstance(); - final ExternalContext externalContext = facesContext.getExternalContext(); - - // get configured search name parameter value - String configSearchName = null; - String[] configSearchNameParam = (String[]) externalContext - .getRequestParameterValuesMap().get(PARAM_CONFIGURED_SEARCH_NAME); - if ((configSearchNameParam != null) - && (configSearchNameParam.length != 0)) - { - configSearchName = configSearchNameParam[0]; - } - - // get selectableTypes parameter value - final QName[] selectableTypes = this - .getSelectableTypes((String[]) externalContext - .getRequestParameterValuesMap().get(PARAM_SELECTABLE_TYPES)); - - // / get filterMimetypes parameter value - final Pattern[] filterMimetypes = this - .getFilterMimetypes((String[]) externalContext - .getRequestParameterValuesMap().get(PARAM_FILTER_MIME_TYPES)); - - // get 'folderRestriction' parameter value - // expecting a relative AVM folder path to be held in this parameter - // (relative to web project webapp root) - String folderPathRestriction = null; - String[] folderPathRestrictionParam = (String[]) externalContext - .getRequestParameterValuesMap().get(PARAM_FOLDER_RESTRICTION); - if ((folderPathRestrictionParam != null) - && (folderPathRestrictionParam.length != 0)) - { - folderPathRestriction = folderPathRestrictionParam[0]; - - // remove leading '/' or '\' (if present) from path restriction - if ((folderPathRestriction.charAt(0) == '/') - || (folderPathRestriction.charAt(0) == '\\')) - { - folderPathRestriction = folderPathRestriction.substring(1); - } - } - - // ### - // the following section sets file picker current path (the folder that - // file picker - // is opened at when selected/changed in the form) - - String currentPath = null; - - // get current path request parameter - String currentPathReqParam = (String) externalContext - .getRequestParameterMap().get(PARAM_CURRENT_PATH); - - // create file picker data XML document to return - // and append file picker data element to it - final org.w3c.dom.Document filePickerDataDoc = XMLUtil.newDocument(); - final org.w3c.dom.Element filePickerDataElement = filePickerDataDoc - .createElement("file-picker-data"); - filePickerDataDoc.appendChild(filePickerDataElement); - - // if current path request parameter null then set current path to the - // current AVM path - if (currentPathReqParam == null) - { - currentPath = this.getCurrentAVMPath(); - } - - // Fix for ALF-3764. We cannot select an external protocol link (i.e. http://example.net by filepicker. - // Such links should be typed manually in the text box. - if (currentPathReqParam.matches(EXTERNAL_PROTOCOL_REGEXP)) - { - currentPath = this.getCurrentAVMPath(); - filePickerDataElement.setAttribute("error", Application.getMessage(facesContext, "error_external_protocol_support")); - } - // else set current path to current path request parameter converted to - // AVM preview - // store path - else - { - final String previewStorePath = AVMUtil - .getCorrespondingPathInPreviewStore(this.getCurrentAVMPath()); - currentPath = AVMUtil.buildPath(previewStorePath, currentPathReqParam, - AVMUtil.PathRelation.WEBAPP_RELATIVE); - } - - // if folder path restriction (relative path) is set, - // then calculate the absolute restriction path from the root - // of the webapp and set the current path to that - if ((folderPathRestriction != null) - && (folderPathRestriction.length() != 0)) - { - currentPath = AVMUtil.getWebappPath(currentPath) + "/" + folderPathRestriction; - } - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(this + ".getFilePickerData(path = " + currentPath - + ", folderRestriction = " - + folderPathRestriction - + ", selectableTypes = [" - + StringUtils.join(selectableTypes, ",") - + "], filterMimetypes = [" - + StringUtils.join(filterMimetypes, ",") + "])"); - } - - // make sure that there is a node associated with current path - // if not, set an applicable error message as an attribute on - // the file picker data element - final AVMNodeDescriptor currentNode = this.getAvmService().lookup(-1, - currentPath); - - // if the current node is null (path held in current path variable is - // invalid), then add an error attribute to the file picker data - if (currentNode == null) - { - currentPath = AVMUtil.getWebappRelativePath(currentPath); - - filePickerDataElement.setAttribute("error", MessageFormat.format( - Application.getMessage(facesContext, "error_not_found"), - "'" + currentPath.substring(currentPath.lastIndexOf("/") + 1, currentPath.length()) + "'", - (currentPath.lastIndexOf("/") == 0 ? "/" : currentPath.substring( - 0, currentPath.lastIndexOf("/"))))); - - // If folder restriction has been set, since the derived - // current path is invalid just set it to null - if ((folderPathRestriction != null) - && (folderPathRestriction.length() != 0)) - { - currentPath = null; - } else - // otherwise folder restriction has not been set, so it should be safe - // to fall back to setting the current path to the current AVM path - // (as was the behaviour before the folder restriction feature - // was added) - { - currentPath = this.getCurrentAVMPath(); - } - } - // else current node is not null (path held in current path variable is - // valid) - else - { - // if node for current path points to a file instead of a directory, - // then make sure that the current path points to - // just the directory part of the path - if (!currentNode.isDirectory()) - { - currentPath = AVMNodeConverter.SplitBase(currentPath)[0]; - } - } - - // create current-node element representing node for current path - // and append it to the file picker data element - org.w3c.dom.Element currentNodeElement = filePickerDataDoc - .createElement("current-node"); - if (currentPath == null) - { - currentNodeElement.setAttribute("avmPath", ""); - currentNodeElement.setAttribute("webappRelativePath", ""); - } else - { - currentNodeElement.setAttribute("avmPath", currentPath); - currentNodeElement.setAttribute("webappRelativePath", AVMUtil - .getWebappRelativePath(currentPath)); - } - currentNodeElement.setAttribute("type", "directory"); - currentNodeElement.setAttribute("image", "/images/icons/space_small.gif"); - - filePickerDataElement.appendChild(currentNodeElement); - - // if configured search name supplied (i.e. neither null nor empty), - // then get configured search node matching given name - // and add the nodes from the search result to the - // file-picker-data element - if ((configSearchName != null) && (configSearchName.length() != 0)) - { - // get node reference for named configured search - NodeRef configuredSearchNodeRef = getConfiguredSearches(configSearchName); - - // if configured search node ref is null, then there is no - // configured search matching the name in the 'config search name' - // parameter, so add error message as attribute to file-picker-data - // element - if (configuredSearchNodeRef == null) - { - filePickerDataElement.setAttribute("error", MessageFormat.format( - Application.getMessage(facesContext, "error_search_not_exist"), - configSearchName)); - } - else - // else node ref for named configured search is not null, then - // add content nodes from search results as child elements of - // the file picker data element. - { - try - { - addSearchResultNodes(filePickerDataDoc, filePickerDataElement, - configuredSearchNodeRef, selectableTypes, facesContext); - } - // if searcher exception thrown whilst getting search results, - // then add error message as attribute to file-picker-data element - catch (SearcherException e) - { - filePickerDataElement.setAttribute("error", MessageFormat.format( - Application.getMessage(facesContext, "error_retrieving_search_results"), - configSearchName, e.getMessage())); - } - } - } - else - { - // add elements for child nodes of current path to file picker - // data element if current path is not null - if (currentPath != null) - { - addPathChildNodesToElement(filePickerDataDoc, - filePickerDataElement, currentPath, selectableTypes, - filterMimetypes, facesContext); - } - } - - final ResponseWriter out = facesContext.getResponseWriter(); - XMLUtil.print(filePickerDataDoc, out); - } - - @InvokeCommand.ResponseMimetype(value = MimetypeMap.MIMETYPE_HTML) - public void uploadFile() throws Exception - { - LOGGER.debug(this + ".uploadFile()"); - final FacesContext facesContext = FacesContext.getCurrentInstance(); - final ExternalContext externalContext = facesContext.getExternalContext(); - final HttpServletRequest request = (HttpServletRequest) externalContext - .getRequest(); - - final ServletFileUpload upload = new ServletFileUpload( - new DiskFileItemFactory()); - upload.setHeaderEncoding("UTF-8"); - final List fileItems = upload.parseRequest(request); - final FileUploadBean bean = new FileUploadBean(); - String uploadId = null; - String currentPath = null; - String filename = null; - String returnPage = null; - InputStream fileInputStream = null; - for (FileItem item : fileItems) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("item = " + item); - } - if (item.isFormField() && item.getFieldName().equals("upload-id")) - { - uploadId = item.getString(); - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("uploadId is " + uploadId); - } - } - if (item.isFormField() && item.getFieldName().equals("return-page")) - { - returnPage = item.getString(); - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("returnPage is " + returnPage); - } - } else if (item.isFormField() - && item.getFieldName().equals("currentPath")) - { - final String previewStorePath = AVMUtil - .getCorrespondingPathInPreviewStore(this.getCurrentAVMPath()); - currentPath = AVMUtil.buildPath(previewStorePath, item.getString(), - AVMUtil.PathRelation.WEBAPP_RELATIVE); - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("currentPath is " + currentPath); - } - } else - { - filename = FilenameUtils.getName(item.getName()); - fileInputStream = item.getInputStream(); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("uploading file " + filename); - } - } - } - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("saving file " + filename + " to " + currentPath); - } - - try - { - FileCopyUtils.copy(fileInputStream, this.getAvmService().createFile( - currentPath, filename)); - final Map props = new HashMap( - 1, 1.0f); - props.put(ContentModel.PROP_TITLE, new PropertyValue( - DataTypeDefinition.TEXT, filename)); - // props.put(ContentModel.PROP_DESCRIPTION, - // new PropertyValue(DataTypeDefinition.TEXT, - // "Uploaded for form " + this.xformsSession.getForm().getName())); - this.getAvmService().setNodeProperties(currentPath + "/" + filename, - props); - this.getAvmService().addAspect(currentPath + "/" + filename, - ContentModel.ASPECT_TITLED); - - this.uploads.add(AVMNodeConverter.ToNodeRef(-1, currentPath + "/" - + filename)); - returnPage = returnPage.replace("${_FILE_TYPE_IMAGE}", org.alfresco.repo.web.scripts.FileTypeImageUtils - .getFileTypeImage(facesContext, filename, true)); - } catch (Exception e) - { - LOGGER.debug(e.getMessage(), e); - returnPage = returnPage.replace("${_UPLOAD_ERROR}", e.getMessage()); - } - - LOGGER.debug("upload complete. sending response: " + returnPage); - final org.w3c.dom.Document result = XMLUtil.newDocument(); - final org.w3c.dom.Element htmlEl = result.createElement("html"); - result.appendChild(htmlEl); - final org.w3c.dom.Element bodyEl = result.createElement("body"); - htmlEl.appendChild(bodyEl); - - final org.w3c.dom.Element scriptEl = result.createElement("script"); - bodyEl.appendChild(scriptEl); - scriptEl.setAttribute("type", "text/javascript"); - final org.w3c.dom.Node scriptText = result.createTextNode(returnPage); - scriptEl.appendChild(scriptText); - - final ResponseWriter out = facesContext.getResponseWriter(); - XMLUtil.print(result, out); - } - - private String getCurrentAVMPath() - { - final AVMNode node = this.getAvmBrowseBean().getAvmActionNode(); - if (node == null) - { - return this.getAvmBrowseBean().getCurrentPath(); - } - - final String result = node.getPath(); - return node.isDirectory() ? result - : AVMNodeConverter.SplitBase(result)[0]; - } - - private QName[] getSelectableTypes(final String[] selectableTypes) - { - final QName[] result = (selectableTypes == null ? new QName[] - { WCMModel.TYPE_AVM_CONTENT, WCMModel.TYPE_AVM_FOLDER } - : new QName[selectableTypes.length]); - - if (selectableTypes != null) - { - for (int i = 0; i < selectableTypes.length; i++) - { - result[i] = QName.resolveToQName(this.getNamespaceService(), - selectableTypes[i]); - } - } - return result; - } - - private Pattern[] getFilterMimetypes(final String[] filterMimetypes) - { - final Pattern[] result = filterMimetypes == null ? new Pattern[0] - : new Pattern[filterMimetypes.length]; - if (filterMimetypes != null) - { - for (int i = 0; i < filterMimetypes.length; i++) - { - result[i] = Pattern.compile(filterMimetypes[i].replaceAll("\\*", - "\\.*").replaceAll("\\/", "\\\\/")); - } - } - return result; - } - - /** - * Add child nodes of supplied path to given parent element. Directory - * listing is done on given path. Elements representing the child nodes - * returned in the directory listing are added to the supplied parent - * element. - * - * @param doc - * XML document to which the parent node belongs - * @param parent - * parent element to add given nodes to as child elements - * @param path - * path from which to extract child nodes - * @param selectableTypes - * array of types which are the only ones that should be selectable - * in the file picker - * @param filterMimetypes - * array of MIME type patterns used to filter out child nodes - * extracted from the given path which don't match the given MIME - * type patterns - * @param facesContext - * faces context used to set image attribute on each child element - */ - private void addPathChildNodesToElement(org.w3c.dom.Document doc, - org.w3c.dom.Element parent, String path, QName[] selectableTypes, - Pattern[] filterMimetypes, FacesContext facesContext) - { - // append elements for the child AVM nodes of the current path - // to parent element - for (final Map.Entry entry : this - .getAvmService().getDirectoryListing(-1, path).entrySet()) - { - // if AVM node is a content node and the filter MIME types parameter - // has been set, then only add child element for AVM node if it matches - // one of the specified MIME types in the parameter - if (!entry.getValue().isDirectory() && filterMimetypes.length != 0) - { - final String contentMimetype = this.getAvmService() - .getContentDataForRead(entry.getValue()).getMimetype(); - - boolean matched = false; - for (final Pattern p : filterMimetypes) - { - matched = p.matcher(contentMimetype).matches(); - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(p + ".matches(" + contentMimetype + ") = " - + matched); - } - if (matched) - { - break; - } - } - - // if AVM node MIME type doesn't match any of the types in the - // filter MIME types parameter, then don't do any further processing - // on it and jump back to the start of the AVM node traversal loop - if (!matched) - { - continue; - } - } - - // create child element representing AVM node and add to file picker - // data element - addAVMChildNodeToParentElement(doc, parent, entry.getValue(), - selectableTypes, facesContext); - } - } - - /** - * Add result content nodes from configured search as - * child node elements to the provided parent element - * - * @param doc - * XML document to which the supplied parent node belongs - * @param parent - * parent element to which to add search result content nodes - * as child elements - * @param configuredSearchNodeRef - * configured search node reference for which result content nodes - * are added as child elements to the provided parent element - * @param selectableTypes - * node types which must be marked as selectable in the file - * picker - * @param facesContext - * faces context used to set image attribute on each child element - */ - private void addSearchResultNodes(org.w3c.dom.Document doc, - org.w3c.dom.Element parent, NodeRef configuredSearchNodeRef, - QName[] selectableTypes, FacesContext facesContext) - { - // run configured search to get content nodes returned in search result - List searchResultNodes = runConfiguredSearch(configuredSearchNodeRef); - - // if there are no search results (i.e. null) throw exception - if (searchResultNodes == null) - { - throw new SearcherException("No results returned by search query.\n" - + "Search node reference: " + configuredSearchNodeRef); - } - - for (AVMNodeDescriptor node : searchResultNodes) - { - // create child element representing AVM node and add to file picker - // data element - addAVMChildNodeToParentElement(doc, parent, node, selectableTypes, - facesContext); - } - } - - /** - * Run a configured search represented by the given node reference, against - * the web project the XForm is currently within - * - * @param configuredQueryNodRef - * NodeRef of the configured query with which to run the search - * - * @return content nodes returned by the search - */ - private List runConfiguredSearch( - NodeRef configSearchNodeRef) - { - // get the store id used to run the configured search query - WebProject webProject = this.getAvmBrowseBean().getWebProject(); - String storeID = webProject.getStoreId(); - - // extract the content of configured search node to XML document - ContentReader contentReader = getContentService().getReader( - configSearchNodeRef, ContentModel.PROP_CONTENT); - InputStream queryInpStream = contentReader.getContentInputStream(); - SAXReader reader = new SAXReader(); - Document queryDoc = null; - try - { - queryDoc = reader.read(queryInpStream); - } catch (DocumentException de) - { - // ignore exception and return null - return null; - } - - // extract search query from configured search XML document - String query = null; - XPath queryXPath = DocumentHelper - .createXPath(CONFIGURED_SEARCH_QUERY_XPATH); - List xpathResult = queryXPath.selectNodes(queryDoc); - if ((xpathResult != null) && (xpathResult.size() != 0)) - { - // get the text from the query element - Element queryElement = (Element) xpathResult.get(0); - String queryElemText = queryElement.getText(); - - // now extract the actual search query string from the CDATA section - // within that text - - int cdataStartDelimIndex = queryElemText.indexOf(CDATA_START_DELIM); - int cdataEndDelimIndex = queryElemText.indexOf(CDATA_END_DELIM); - - // if the CDATA start delimiter is found in the query element text - // && there is text between the CDATA start and end delimiters then - // extract - // the query string from the CDATA section - if ((cdataStartDelimIndex > -1) - && ((cdataStartDelimIndex + CDATA_START_DELIM.length()) < cdataEndDelimIndex)) - { - query = queryElemText.substring(cdataStartDelimIndex - + CDATA_START_DELIM.length(), cdataEndDelimIndex); - } - else - { - // otherwise just use the text as is - query = queryElemText; - } - } - - // perform the search against the repository - // if query was extracted from the configured search successfully - // (extracted query non-null) - List resultNodeDescriptors = null; - if ((query != null) && (query.length() != 0)) - { - ResultSet results = null; - try - { - results = this.getSearchService().query( - new StoreRef(StoreRef.PROTOCOL_AVM, storeID), - SearchService.LANGUAGE_LUCENE, query); - - if (results.length() != 0) - { - resultNodeDescriptors = new ArrayList(); - for (int i = 0; i < results.length(); i++) - { - ResultSetRow row = results.getRow(i); - NodeRef resultNodeRef = row.getNodeRef(); - Node resultNode = new Node(resultNodeRef); - - // only add content type nodes to the search result - // as we don't want the user to navigate down into folders - // in the search results - if (getDictionaryService().isSubClass(resultNode.getType(), - ContentModel.TYPE_CONTENT)) - { - Pair pair = AVMNodeConverter - .ToAVMVersionPath(resultNodeRef); - Integer version = pair.getFirst(); - String path = pair.getSecond(); - resultNodeDescriptors.add(getAvmService().lookup(version, - path)); - } - } - } - } catch (Throwable err) - { - throw new AlfrescoRuntimeException("Failed to execute search: " - + query, err); - } finally - { - if (results != null) - { - results.close(); - } - } - } - - return resultNodeDescriptors; - } - - /** - * Get the cached reference to the public saved searches folder. This method - * will first get a reference to the public saved searches folder and assign - * it to the cached reference if is it is null. - * - * @return the cached reference to the public Saved Searches folder - */ - private NodeRef getPublicSearchesRef() - { - // if the cached reference is null, then get a reference to the - // public saved searches folder to assign to it - if (publicSearchesRef == null) - { - // Use the search service get a reference to the - // public saved searches folder. - FacesContext fc = FacesContext.getCurrentInstance(); - String xpath = Application.getRootPath(fc) + "/" - + Application.getGlossaryFolderName(fc) + "/" - + Application.getSavedSearchesFolderName(fc); - - List results = null; - try - { - results = getSearchService().selectNodes( - getNodeService().getRootNode(Repository.getStoreRef()), - xpath, null, getNamespaceService(), false); - } catch (AccessDeniedException err) - { - // ignore and return null - } - - if (results != null && results.size() != 0) - { - publicSearchesRef = results.get(0); - } - } - - return publicSearchesRef; - } - - /** - * Get node for configured search by name. - * - * @param configSearchName - * name of configured search for which to get node - * @return node reference for configured search - */ - public NodeRef getConfiguredSearches(String configSearchName) - { - NodeRef configSearchNodeRef = null; - - // get the folder reference from the - // public searches location - NodeRef publicSearchesFolderRef = getPublicSearchesRef(); - - // read the content nodes under the folder - List childRefs = getNodeService().getChildAssocs( - publicSearchesFolderRef, ContentModel.ASSOC_CONTAINS, - RegexQNamePattern.MATCH_ALL); - - // return content node with name matching given configured search name - if (childRefs.size() != 0) - { - for (ChildAssociationRef ref : childRefs) - { - NodeRef childNodeRef = ref.getChildRef(); - Node childNode = new Node(childNodeRef); - if (getDictionaryService().isSubClass(childNode.getType(), - ContentModel.TYPE_CONTENT)) - { - String childNodeName = childNode.getName(); - if (childNodeName.equals(configSearchName)) - { - configSearchNodeRef = childNodeRef; - break; - } - } - } - } - - return configSearchNodeRef; - } - - /** - * Create child element representing given AVM node and add to given parent - * element - * - * @param doc - * Document to which given parent element belongs - * @param parent - * parent element to add AVM node to as child element - * @param node - * AVM node to add as child node to given parent - * @param selectableTypes - * AVM node types which must be marked as selectable - * @param facesContent - * Faces context used to get file-type icon for given AVM node - */ - private void addAVMChildNodeToParentElement(org.w3c.dom.Document doc, - org.w3c.dom.Element parent, AVMNodeDescriptor node, - QName[] selectableTypes, FacesContext facesContext) - { - // create child node element to add to file picker data - org.w3c.dom.Element childNodeElement = doc.createElement("child-node"); - childNodeElement.setAttribute("avmPath", node.getPath()); - childNodeElement.setAttribute("webappRelativePath", AVMUtil - .getWebappRelativePath(node.getPath())); - childNodeElement.setAttribute("type", node.isDirectory() ? "directory" - : "file"); - - // Set image attribute on each child - // TODO (Glen): IS this the right image to set? - // originally from Ariel's code - childNodeElement.setAttribute("image", - (node.isDirectory() ? "/images/icons/space_small.gif" : org.alfresco.repo.web.scripts.FileTypeImageUtils - .getFileTypeImage(facesContext, node.getName(), true))); - - boolean selectable = false; - - // set 'selectable' attribute on child node to mark whether node should - // be selectable in file picker or not - // - // TODO Ariel: faking this for now since i can't figure out how to - // efficiently get the type - // qname from the avmservice - for (final QName typeQName : selectableTypes) - { - selectable = selectable - || (WCMModel.TYPE_AVM_FOLDER.equals(typeQName) && node - .isDirectory()); - selectable = selectable - || (WCMModel.TYPE_AVM_CONTENT.equals(typeQName) && !node - .isDirectory()); - } - childNodeElement.setAttribute("selectable", Boolean.toString(selectable)); - - // append child node element to parent - parent.appendChild(childNodeElement); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/FolderDetailsBean.java b/source/java/org/alfresco/web/bean/wcm/FolderDetailsBean.java deleted file mode 100644 index aa31a58783..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/FolderDetailsBean.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.List; - -import javax.faces.context.FacesContext; - -import org.alfresco.repo.avm.AVMNodeType; -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.repository.Node; - -/** - * Backing bean for Folder Details page. - * - * @author Kevin Roast - */ -public class FolderDetailsBean extends AVMDetailsBean -{ - private static final long serialVersionUID = -2668158215990649862L; - - private final static String MSG_LEFT_QUOTE = "left_qoute"; - private final static String MSG_RIGHT_QUOTE = "right_quote"; - - /** - * @see org.alfresco.web.bean.wcm.AVMDetailsBean#getAvmNode() - */ - @Override - public AVMNode getAvmNode() - { - return this.avmBrowseBean.getAvmActionNode(); - } - - /** - * @return a Node wrapper of the AVM Folder Node - for property sheet support - */ - public Node getFolder() - { - return new Node(getAvmNode().getNodeRef()); - } - - /** - * Returns the virtualisation server URL to the content for the current document - * - * @return Preview url for the current document - */ - public String getPreviewUrl() - { - return AVMUtil.getPreviewURI(getAvmNode().getPath()); - } - - /** - * @return true if the folder is a layered folder with a primary indirection - */ - public boolean getIsPrimaryLayeredFolder() - { - boolean result = false; - - String path = getAvmNode().getPath(); - AVMNodeDescriptor nodeDesc = getAvmService().lookup(-1, path); - if (nodeDesc != null) - { - result = (nodeDesc.getType() == AVMNodeType.LAYERED_DIRECTORY && nodeDesc.isPrimary()); - } - - return result; - } - - /** - * @see org.alfresco.web.bean.wcm.AVMDetailsBean#getNodes() - */ - @Override - protected List getNodes() - { - return (List)this.avmBrowseBean.getFolders(); - } - - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - // TODO Auto-generated method stub - return null; - } - - public String getCancelButtonLabel() - { - return Application.getMessage(FacesContext.getCurrentInstance(), "close"); - } - - public String getContainerTitle() - { - FacesContext fc = FacesContext.getCurrentInstance(); - return Application.getMessage(fc, "details_of") + " " + Application.getMessage(fc, MSG_LEFT_QUOTE) + getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE); - } - - public String getCurrentItemId() - { - return getAvmNode().getId(); - } - - public String getOutcome() - { - return "dialog:close:dialog:showFolderDetails"; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/FormDetailsDialog.java b/source/java/org/alfresco/web/bean/wcm/FormDetailsDialog.java deleted file mode 100644 index 955792758d..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/FormDetailsDialog.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; - -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.workflow.WorkflowDefinition; -import org.alfresco.service.cmr.workflow.WorkflowService; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.wcm.CreateWebsiteWizard.FormWrapper; -import org.alfresco.web.bean.wcm.CreateWebsiteWizard.WorkflowWrapper; -import org.alfresco.web.ui.common.component.UIListItem; -import org.alfresco.web.ui.wcm.WebResources; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Backing bean for the Website Project Form Details dialog. - * Launched from the Form Details button on the Define Web Content Forms page. - * - * @author Kevin Roast - */ -public class FormDetailsDialog extends BaseDialogBean -{ - private static final long serialVersionUID = -7191411837509451750L; - - private static final Log logger = LogFactory.getLog(FormDetailsDialog.class); - - transient private AVMService avmService; - protected CreateWebsiteWizard websiteWizard; - transient private WorkflowService workflowService; - - private String title; - private String description; - private String outputPathPattern; - private String[] workflowSelectedValue; - - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map) - */ - @Override - public void init(Map parameters) - { - super.init(parameters); - this.title = null; - this.description = null; - this.outputPathPattern = null; - this.workflowSelectedValue = null; - } - - @Override - public String getContainerDescription() - { - return MessageFormat.format(Application.getBundle(FacesContext.getCurrentInstance()).getString("form_template_details_desc"), - this.getActionForm().getName(), - this.websiteWizard.getName()); - } - - /** - * @param avmService The avmService to set. - */ - public void setAvmService(AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (avmService == null) - { - avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - return avmService; - } - - - /** - * @param wizard The Create Website Wizard to set. - */ - public void setCreateWebsiteWizard(CreateWebsiteWizard wizard) - { - this.websiteWizard = wizard; - } - - /** - * @param workflowService The WorkflowService to set. - */ - public void setWorkflowService(WorkflowService workflowService) - { - this.workflowService = workflowService; - } - - protected WorkflowService getWorkflowService() - { - if (workflowService == null) - { - workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService(); - } - return workflowService; - } - - /** - * @return an object representing the form for the current action - */ - public FormWrapper getActionForm() - { - return this.websiteWizard.getActionForm(); - } - - /** - * @return Returns the description. - */ - public String getDescription() - { - if (this.description == null) - { - this.description = getActionForm().getDescription(); - } - return this.description; - } - - /** - * @param description The description to set. - */ - public void setDescription(String description) - { - this.description = description; - } - - /** - * @return Returns the title. - */ - public String getTitle() - { - if (this.title == null) - { - this.title = getActionForm().getTitle(); - } - return this.title; - } - - /** - * @param title The title to set. - */ - public void setTitle(String title) - { - this.title = title; - } - - /** - * @return Returns the filename pattern - */ - public String getOutputPathPattern() - { - if (this.outputPathPattern == null) - { - this.outputPathPattern = getActionForm().getOutputPathPattern(); - } - return this.outputPathPattern; - } - - /** - * @param pattern The filename pattern to set. - */ - public void setOutputPathPattern(String pattern) - { - this.outputPathPattern = pattern; - } - - /** - * @return Returns the workflow Selected Value. - */ - public String[] getWorkflowSelectedValue() - { - if (this.workflowSelectedValue == null) - { - WorkflowWrapper workflow = getActionForm().getWorkflow(); - if (workflow != null) - { - this.workflowSelectedValue = new String[] {workflow.getName()}; - } - } - return this.workflowSelectedValue; - } - - /** - * @param workflowSelectedValue The workflow Selected Value to set. - */ - public void setWorkflowSelectedValue(String[] workflowSelectedValue) - { - this.workflowSelectedValue = workflowSelectedValue; - } - - /** - * @return List of UIListItem object representing the available workflows for the template - */ - public List getWorkflowList() - { - // get list of workflows from config definitions - List workflowDefs = AVMWorkflowUtil.getConfiguredWorkflows(); - List items = new ArrayList(workflowDefs.size()); - for (WorkflowDefinition workflowDef : workflowDefs) - { - UIListItem item = new UIListItem(); - item.setValue(workflowDef.getName()); - item.setLabel(workflowDef.getTitle()); - item.setDescription(workflowDef.getDescription()); - item.setImage(WebResources.IMAGE_WORKFLOW_32); - items.add(item); - } - - return items; - } - - - // ------------------------------------------------------------------------------ - // Dialog implementation - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - // push values from title/description etc. back into action FormWrapper - FormWrapper form = getActionForm(); - if (this.title != null) - { - form.setTitle(this.title); - } - if (this.description != null) - { - form.setDescription(this.description); - } - if (this.outputPathPattern != null) - { - form.setOutputPathPattern(this.outputPathPattern); - } - if (this.workflowSelectedValue != null && this.workflowSelectedValue.length != 0) - { - // test to make sure we don't lose the existing workflow configuration - String wfSelected = this.workflowSelectedValue[0]; - if (form.getWorkflow() == null || form.getWorkflow().getName().equals(wfSelected) == false) - { - WorkflowDefinition def = this.getWorkflowService().getDefinitionByName(wfSelected); - form.setWorkflow(new CreateWebsiteWizard.WorkflowWrapper(def.getName(), def.getTitle(), def.getDescription())); - } - } - return outcome; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/FormTemplatesDialog.java b/source/java/org/alfresco/web/bean/wcm/FormTemplatesDialog.java deleted file mode 100644 index c800d19805..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/FormTemplatesDialog.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; -import javax.faces.model.DataModel; -import javax.faces.model.ListDataModel; - -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.wcm.CreateWebsiteWizard.FormWrapper; -import org.alfresco.web.bean.wcm.CreateWebsiteWizard.PresentationTemplate; -import org.alfresco.web.forms.Form; -import org.alfresco.web.forms.RenderingEngineTemplate; -import org.alfresco.web.ui.common.component.UIListItem; -import org.alfresco.web.ui.common.component.UISelectList; -import org.alfresco.web.ui.wcm.WebResources; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Backing bean for the Website Project Form Templates dialog. - * Launched from the Select Templates button on the Define Web Content Forms page. - * - * @author Kevin Roast - */ -public class FormTemplatesDialog extends BaseDialogBean -{ - private static final long serialVersionUID = 6383166841680919841L; - - private static final String COMPONENT_TEMPLATELIST = "template-list"; - - private static final Log logger = LogFactory.getLog(FormTemplatesDialog.class); - - transient private AVMService avmService; - protected CreateWebsiteWizard websiteWizard; - - /** datamodel for table of selected presentation templates */ - transient private DataModel templatesDataModel = null; - - /** list of objects describing the selected presentation templates*/ - private List templates = null; - - /** transient list of template UIListItem objects */ - private List templateList = null; - - /** - * @param avmService The avmService to set. - */ - public void setAvmService(AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (this.avmService == null) - { - this.avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - return this.avmService; - } - - /** - * @param wizard The Create Website Wizard to set. - */ - public void setCreateWebsiteWizard(CreateWebsiteWizard wizard) - { - this.websiteWizard = wizard; - } - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map) - */ - @Override - public void init(Map parameters) - { - super.init(parameters); - this.templatesDataModel = null; - this.templates = new ArrayList(getActionForm().getTemplates().size()); - this.templates.addAll(getActionForm().getTemplates()); - } - - @Override - public String getContainerDescription() - { - return MessageFormat.format(Application.getBundle(FacesContext.getCurrentInstance()).getString("form_template_templates_desc"), - this.getActionForm().getName(), - this.websiteWizard.getName()); - } - - /** - * @return an object representing the form for the current action - */ - public FormWrapper getActionForm() - { - return this.websiteWizard.getActionForm(); - } - - /** - * @return JSF data model wrapping the templates selected by the user - */ - public DataModel getTemplatesDataModel() - { - if (this.templatesDataModel == null) - { - this.templatesDataModel = new ListDataModel(); - } - - // only set the wrapped data once otherwise the rowindex is reset - if (this.templatesDataModel.getWrappedData() == null) - { - this.templatesDataModel.setWrappedData(this.templates); - } - - return this.templatesDataModel; - } - - /** - * @param templatesDataModel JSF data model wrapping the templates - */ - public void setTemplatesDataModel(DataModel templatesDataModel) - { - this.templatesDataModel = templatesDataModel; - } - - /** - * @return List of UIListItem objects representing the available presentation templates for selection - */ - public List getTemplatesList() - { - Form form = getActionForm().getForm(); - List engines = form.getRenderingEngineTemplates(); - List items = new ArrayList(engines.size()); - for (RenderingEngineTemplate engine : engines) - { - PresentationTemplate wrapper = new PresentationTemplate(engine); - UIListItem item = new UIListItem(); - item.setValue(wrapper); - item.setLabel(wrapper.getTitle() + " (" + engine.getMimetypeForRendition() + ")"); - item.setDescription(wrapper.getDescription()); - item.setImage(WebResources.IMAGE_TEMPLATE_32); - items.add(item); - } - this.templateList = items; - return items; - } - - /** - * Action handler to add a template to the list for this form - */ - public void addTemplate(ActionEvent event) - { - UISelectList selectList = (UISelectList)event.getComponent().findComponent(COMPONENT_TEMPLATELIST); - int index = selectList.getRowIndex(); - if (index != -1) - { - PresentationTemplate template = (PresentationTemplate)this.templateList.get(index).getValue(); - // clone the PresentationTemplate into one the user can modify - this.templates.add(new PresentationTemplate(template.getRenderingEngineTemplate(), template.getOutputPathPattern())); - } - } - - /** - * Remove a presentation template from the selected list - */ - public void removeTemplate(ActionEvent event) - { - PresentationTemplate wrapper = (PresentationTemplate)this.getTemplatesDataModel().getRowData(); - if (wrapper != null) - { - this.templates.remove(wrapper); - } - } - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - List list = getActionForm().getTemplates(); - list.clear(); - for (PresentationTemplate wrapper : this.templates) - { - list.add(wrapper); - } - return outcome; - } - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#getFinishButtonDisabled() - */ - @Override - public boolean getFinishButtonDisabled() - { - return false; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/FormWorkflowDialog.java b/source/java/org/alfresco/web/bean/wcm/FormWorkflowDialog.java deleted file mode 100644 index b1b009b0a8..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/FormWorkflowDialog.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.Serializable; -import java.text.MessageFormat; -import java.util.List; -import java.util.Map; -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; - -import javax.faces.context.FacesContext; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.repo.workflow.WorkflowModel; -import org.alfresco.service.cmr.repository.AssociationRef; -import org.alfresco.service.cmr.workflow.WorkflowDefinition; -import org.alfresco.service.cmr.workflow.WorkflowService; -import org.alfresco.service.cmr.workflow.WorkflowTaskDefinition; -import org.alfresco.service.namespace.QName; -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.alfresco.web.bean.repository.TransientNode; -import org.alfresco.web.bean.workflow.WorkflowUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Backing bean for the Website Project Configure Workflow dialog. - * Launched from the Configure Workflow button on the Define Web Content Forms page. - * - * @author Kevin Roast - */ -public class FormWorkflowDialog extends BaseDialogBean -{ - private static final long serialVersionUID = -7858470945912453738L; - - private static final String MSG_ERROR_FILENAME_PATTERN = "error_filename_pattern"; - - private static final Log logger = LogFactory.getLog(FormWorkflowDialog.class); - - private String filenamePattern; - - transient private WorkflowService workflowService; - - protected CreateWebsiteWizard websiteWizard; - protected TransientNode workflowNode; - - - /** - * @param workflowService The WorkflowService to set. - */ - public void setWorkflowService(WorkflowService workflowService) - { - this.workflowService = workflowService; - } - - protected WorkflowService getWorkflowService() - { - if (this.workflowService == null) - { - this.workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService(); - } - return this.workflowService; - } - - /** - * @param wizard The Create Website Wizard to set. - */ - public void setCreateWebsiteWizard(CreateWebsiteWizard wizard) - { - this.websiteWizard = wizard; - } - - /** - * @return Returns the filename pattern. - */ - public String getFilenamePattern() - { - if (this.filenamePattern == null) - { - this.filenamePattern = getActionWorkflow().getFilenamePattern(); - } - return this.filenamePattern; - } - - /** - * @param filenamePattern The filename pattern to set. - */ - public void setFilenamePattern(String filenamePattern) - { - if (this.filenamePattern != null && this.filenamePattern.length() != 0) - { - this.filenamePattern = filenamePattern; - } - } - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map) - */ - @Override - public void init(Map parameters) - { - super.init(parameters); - - this.filenamePattern = null; - this.workflowNode = null; - - WorkflowConfiguration workflow = getActionWorkflow(); - if (workflow == null) - { - throw new IllegalArgumentException("Workflow action context is mandatory."); - } - - // populate the workflow if exists and already has a task type assigned - if (workflow.getType() != null) - { - // bind against current params from action Workflow - this.workflowNode = new TransientNode(workflow.getType(), - "task_" + System.currentTimeMillis(), workflow.getParams()); - } - else - { - // no type found - init workflow node type based on workflow definition - WorkflowDefinition flowDef = this.getWorkflowService().getDefinitionByName(workflow.getName()); - if (flowDef != null) - { - WorkflowTaskDefinition taskDef = flowDef.getStartTaskDefinition(); - if (taskDef != null) - { - // create an instance of a task from the data dictionary - this.workflowNode = new TransientNode(taskDef.metadata.getName(), - "task_" + System.currentTimeMillis(), workflow.getParams()); - } - } - } - } - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - if (this.workflowNode != null) - { - // push serialized params back into workflow object - WorkflowConfiguration wf = getActionWorkflow(); - Map taskParams = WorkflowUtil.prepareTaskParams(this.workflowNode); - if (wf.getParams() == null) - { - wf.setParams(taskParams); - } - else - { - // merge existing with params - as only new items are returned from the editor - Map params = wf.getParams(); - for (QName qname : taskParams.keySet()) - { - Serializable value = taskParams.get(qname); - if (params.get(qname) == null || (value instanceof List == false)) - { - params.put(qname, value); - } - else - { - List current = (List)params.get(qname); - if (qname.equals(WorkflowModel.ASSOC_ASSIGNEES)) - { - current.clear(); - } - current.addAll((List)value); - } - } - // remove any deleted associations - Map> assocs = this.workflowNode.getRemovedAssociations(); - for (String assocName : assocs.keySet()) - { - QName assocQName = Repository.resolveToQName(assocName); - - // get the associations removed and create list of targets - if (params.containsKey(assocQName)) - { - List current = (List)params.get(assocQName); - if (current != null) - { - Map removedAssocs = assocs.get(assocName); - for (AssociationRef assoc : removedAssocs.values()) - { - current.remove(assoc.getTargetRef()); - } - } - } - } - wf.setParams(params); - } - wf.setType(this.workflowNode.getType()); - - if (this.filenamePattern != null && this.filenamePattern.length() != 0) - { - // check the filename pattern compiles and display an error if a problem occurs - try - { - Pattern.compile(this.filenamePattern); - } - catch (PatternSyntaxException pax) - { - throw new AlfrescoRuntimeException( - MessageFormat.format( - Application.getMessage(FacesContext.getCurrentInstance(), MSG_ERROR_FILENAME_PATTERN), - pax.getMessage()), pax); - } - wf.setFilenamePattern(this.filenamePattern); - } - } - return outcome; - } - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#getFinishButtonDisabled() - */ - @Override - public boolean getFinishButtonDisabled() - { - return false; - } - - /** - * @return an object representing the workflow for the current action - */ - public WorkflowConfiguration getActionWorkflow() - { - return this.websiteWizard.getActionWorkflow(); - } - - /** - * Returns the Node representing the start task metadata required - * - * @return The Node for the start task - */ - public Node getWorkflowMetadataNode() - { - return this.workflowNode; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/ImportWebsiteDialog.java b/source/java/org/alfresco/web/bean/wcm/ImportWebsiteDialog.java deleted file mode 100644 index f850282ddf..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/ImportWebsiteDialog.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.File; -import java.text.MessageFormat; - -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; - -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.wcm.asset.AssetService; -import org.alfresco.web.app.AlfrescoNavigationHandler; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.context.UIContextService; -import org.alfresco.web.bean.FileUploadBean; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.ui.common.Utils; - -/** - * Backing bean for the Import Website Content dialog. - * - * This dialog manages the upload of a ZIP archive file, which is then unpacked and loaded into - * the AVM store with the complete folder and file structure. - * - * @author Kevin Roast - */ -public class ImportWebsiteDialog extends BaseDialogBean -{ - private static final long serialVersionUID = -432986732265292504L; - - //private static Log logger = LogFactory.getLog(ImportWebsiteDialog.class); - - protected File file; - protected String fileName; - protected boolean isFinished = false; - protected boolean highByteZip = false; - - protected AVMBrowseBean avmBrowseBean; - transient private AssetService assetService; - - - /** - * @param avmBrowseBean The AVMBrowseBean to set. - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @param avmService The AssetService to set. - */ - public void setAssetService(AssetService assetService) - { - this.assetService = assetService; - } - - protected AssetService getAssetService() - { - if (this.assetService == null) - { - this.assetService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAssetService(); - } - return this.assetService; - } - - /** - * @return Returns the name of the file - */ - public String getFileName() - { - // try and retrieve the file and filename from the file upload bean - // representing the file we previously uploaded. - FacesContext ctx = FacesContext.getCurrentInstance(); - FileUploadBean fileBean = (FileUploadBean)ctx.getExternalContext().getSessionMap(). - get(FileUploadBean.FILE_UPLOAD_BEAN_NAME); - if (fileBean != null) - { - this.file = fileBean.getFile(); - this.fileName = fileBean.getFileName(); - } - - return this.fileName; - } - - /** - * @param fileName The name of the file - */ - public void setFileName(String fileName) - { - this.fileName = fileName; - - // we also need to keep the file upload bean in sync - FacesContext ctx = FacesContext.getCurrentInstance(); - FileUploadBean fileBean = (FileUploadBean)ctx.getExternalContext().getSessionMap(). - get(FileUploadBean.FILE_UPLOAD_BEAN_NAME); - if (fileBean != null) - { - fileBean.setFileName(this.fileName); - } - } - - /** - * @return the highByteZip encoding switch - */ - public boolean isHighByteZip() - { - return this.highByteZip; - } - - /** - * @param highByteZip the encoding switch for high-byte ZIP filenames to set - */ - public void setHighByteZip(boolean highByteZip) - { - this.highByteZip = highByteZip; - } - - public boolean getFinishButtonDisabled() - { - return (this.fileName == null || this.fileName.length() == 0); - } - - - // ------------------------------------------------------------------------------ - // Action event handlers - - /** - * Action listener called when the add content dialog is called - */ - public void start(ActionEvent event) - { - clearUpload(); - this.fileName = null; - } - - /** - * Action handler called when the Finish button is pressed - */ - public String finish() - { - String outcome = null; - - // check the isFinished flag to stop the finish button - // being pressed multiple times - if (this.isFinished == false) - { - this.isFinished = true; - - try - { - FacesContext context = FacesContext.getCurrentInstance(); - RetryingTransactionHelper.RetryingTransactionCallback cb = - new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Object execute() - { - // get the AVM path that will contain the imported content - String rootPath = avmBrowseBean.getCurrentPath(); - - String[] parts = rootPath.split(":"); - String sbStoreId = parts[0]; - String parentFolderPath = parts[1]; - - getAssetService().bulkImport(sbStoreId, parentFolderPath, file, isHighByteZip()); - - return null; - } - }; - - Repository.getRetryingTransactionHelper(context).doInTransaction(cb); - - UIContextService.getInstance(context).notifyBeans(); - - outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; - } - catch (Throwable e) - { - Utils.addErrorMessage(MessageFormat.format( - Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), - e.getMessage()), e); - } - finally - { - // reset the flag so we can re-attempt the operation - this.isFinished = false; - } - } - - return outcome; - } - - /** - * Action handler called when the user wishes to remove an uploaded file - */ - public String removeUploadedFile() - { - clearUpload(); - - // also clear the file name - this.fileName = null; - - // refresh the current page - return null; - } - - /** - * Action handler called when the dialog is cancelled - */ - public String cancel() - { - clearUpload(); - - return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; - } - - - // ------------------------------------------------------------------------------ - // Helper Methods - - /** - * Deletes the uploaded file and removes the FileUploadBean from the session - */ - protected void clearUpload() - { - // delete the temporary file we uploaded earlier - if (this.file != null) - { - this.file.delete(); - } - - this.file = null; - - // remove the file upload bean from the session - FacesContext ctx = FacesContext.getCurrentInstance(); - ctx.getExternalContext().getSessionMap().remove(FileUploadBean.FILE_UPLOAD_BEAN_NAME); - } - - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - return null; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/InviteWebsiteUsersWizard.java b/source/java/org/alfresco/web/bean/wcm/InviteWebsiteUsersWizard.java deleted file mode 100644 index 679dc216be..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/InviteWebsiteUsersWizard.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import javax.faces.context.FacesContext; - -import org.alfresco.model.WCMAppModel; -import org.alfresco.wcm.util.WCMUtil; -import org.alfresco.wcm.webproject.WebProjectService; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.wizard.BaseInviteUsersWizard; -import org.alfresco.web.ui.common.Utils; - -/** - * Bean providing the ability to invite users to a web project space. - * - * @author kevinr - */ -public class InviteWebsiteUsersWizard extends BaseInviteUsersWizard -{ - private static final long serialVersionUID = -8128781845465773847L; - - /** the node representing the website */ - private Node website; - - /** root AVM store the users are invited into */ - private String avmStore; - - /** assume we are launching the wizard standalone */ - private boolean standalone = true; - - transient private WebProjectService wpService; - - - public void setWebProjectService(WebProjectService wpService) - { - this.wpService = wpService; - } - - protected WebProjectService getWebProjectService() - { - if (wpService == null) - { - wpService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWebProjectService(); - } - return wpService; - } - - /** - * @see org.alfresco.web.bean.wizard.BaseInviteUsersWizard#init(java.util.Map) - */ - @Override - public void init(Map parameters) - { - super.init(parameters); - // only allow one selection per authority - this.allowDuplicateAuthorities = false; - this.website = null; - this.avmStore = null; - this.standalone = true; - } - - public void reset() - { - this.isFinished = false; - this.allowDuplicateAuthorities = false; - this.website = null; - this.avmStore = null; - this.standalone = true; - } - - /** - * @see org.alfresco.web.bean.wizard.BaseInviteUsersWizard#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - super.finishImpl(context, outcome); - - Map selectedInvitees = new HashMap(this.userGroupRoles.size()); - for (UserGroupRole userRole : this.userGroupRoles) - { - selectedInvitees.put(userRole.getAuthority(), userRole.getRole()); - } - - getWebProjectService().inviteWebUsersGroups(this.getNode().getNodeRef(), selectedInvitees, true); - - return outcome; - } - - /** - * @return summary text for the wizard - */ - public String getSummary() - { - FacesContext fc = FacesContext.getCurrentInstance(); - - // build a summary section to list the invited users and there roles - StringBuilder buf = new StringBuilder(128); - String currentUser = Application.getCurrentUser(fc).getUserName(); - boolean foundCurrentUser = false; - for (UserGroupRole userRole : this.userGroupRoles) - { - if (currentUser.equals(userRole.getAuthority())) - { - foundCurrentUser = true; - } - buf.append(Utils.encode(userRole.getLabel())); - buf.append("
"); - } - if (isStandalone() == false && foundCurrentUser == false) - { - buf.append(buildLabelForUserAuthorityRole( - currentUser, WCMUtil.ROLE_CONTENT_MANAGER)); - } - - return buildSummary( - new String[] {Application.getMessage(fc, MSG_USERROLES)}, - new String[] {buf.toString()}); - } - - @Override - protected Set getPermissionsForType() - { - // Let the permission service do the caching to allow for dynamic model updates, etc. - return this.permissionService.getSettablePermissions(WCMAppModel.TYPE_AVMWEBFOLDER); - } - - protected void setNode(Node node) - { - this.website = node; - } - - @Override - protected Node getNode() - { - if (this.website != null) - { - return this.website; - } - else - { - return this.browseBean.getActionSpace(); - } - } - - /** - * @return Returns the root AVM store. - */ - public String getAvmStore() - { - if (this.avmStore == null) - { - this.avmStore = (String)getNode().getProperties().get(WCMAppModel.PROP_AVMSTORE); - } - return this.avmStore; - } - - /** - * @param avmStore The root AVM store to set. - */ - public void setAvmStore(String avmStore) - { - this.avmStore = avmStore; - } - - /** - * @return Returns the edit mode. - */ - public boolean isStandalone() - { - return this.standalone; - } - - /** - * @param editMode The edit mode to set. - */ - public void setStandalone(boolean editMode) - { - this.standalone = editMode; - } - - @Override - protected String getEmailTemplateXPath() - { - FacesContext fc = FacesContext.getCurrentInstance(); - String xpath = Application.getRootPath(fc) + "/" + - Application.getGlossaryFolderName(fc) + "/" + - Application.getEmailTemplatesFolderName(fc) + "/" + - Application.getInviteEmailTemplatesFolderName(fc) + "//*"; - return xpath; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/ManageChangeRequestTaskDialog.java b/source/java/org/alfresco/web/bean/wcm/ManageChangeRequestTaskDialog.java deleted file mode 100644 index 069713e5b0..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/ManageChangeRequestTaskDialog.java +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.WCMModel; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.service.cmr.avm.locking.AVMLockingService; -import org.alfresco.service.cmr.avmsync.AVMDifference; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; -import org.alfresco.wcm.util.WCMUtil; -import org.alfresco.web.app.AlfrescoNavigationHandler; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.workflow.ManageTaskDialog; -import org.alfresco.web.bean.workflow.WorkflowUtil; -import org.alfresco.web.config.DialogsConfigElement.DialogButtonConfig; -import org.alfresco.web.ui.common.Utils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Bean implementation for the "Manage Task" dialog when dealing - * with the "Change Request" task specifically. - * - * @author gavinc - */ -public class ManageChangeRequestTaskDialog extends ManageTaskDialog -{ - private static final long serialVersionUID = -236829535702107101L; - - protected boolean doResubmitNow = false; - protected AVMBrowseBean avmBrowseBean; - transient private AVMLockingService avmLockingService; - - private final static Log logger = LogFactory.getLog(ManageChangeRequestTaskDialog.class); - - // ------------------------------------------------------------------------------ - // Dialog implementation - - @Override - public void init(Map parameters) - { - super.init(parameters); - - // reset the doResubmit flag - this.doResubmitNow = false; - } - - @Override - public List getAdditionalButtons() - { - List buttons = super.getAdditionalButtons(); - - buttons.add(new DialogButtonConfig(ID_PREFIX + "resubmit", null, "task_done_resubmit_all", - "#{DialogManager.bean.transitionAndResubmit}", "false", null)); - - return buttons; - } - - // ------------------------------------------------------------------------------ - // Event handlers - - @Override - public String transition() - { - String outcome = getDefaultFinishOutcome(); - - if (logger.isDebugEnabled()) - logger.debug("Transitioning change request task: " + this.getWorkflowTask().id); - - final FacesContext context = FacesContext.getCurrentInstance(); - - try - { - RetryingTransactionHelper txnHelper = Repository.getRetryingTransactionHelper(FacesContext.getCurrentInstance()); - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public Object execute() throws Throwable - { - // get the current username and place in list - String username = Application.getCurrentUser(context).getUserName(); - List newLockOwners = new ArrayList(1); - newLockOwners.add(username); - - // prepare the edited parameters for saving - Map params = WorkflowUtil.prepareTaskParams(taskNode); - - // update the task with the updated parameters and resources - getWorkflowService().updateTask(getWorkflowTask().id, params, null, null); - - // get the list of nodes that have expired (comparing workflow store to - // the users main store) - List submitPaths = new ArrayList(); - List submitNodes = new ArrayList(); - Pair pkgPath = AVMNodeConverter.ToAVMVersionPath(workflowPackage); - AVMNodeDescriptor pkgDesc = getAvmService().lookup(pkgPath.getFirst(), pkgPath.getSecond()); - String targetPath = pkgDesc.getIndirection(); - List diffs = getAvmSyncService().compare(pkgPath.getFirst(), - pkgPath.getSecond(), -1, targetPath, null); - - // update the users main store with the changes from the workflow store - getAvmSyncService().update(diffs, null, false, false, true, true, null, null); - - // move locks - for (AVMDifference diff : diffs) - { - // move the lock for this path from the user workflow sandbox to the users main store - // we need to do this because the workflow endTask will trigger deletion of the (user) - // workflow store which will in turn recursively remove all the locks. - String diffSourcePath = diff.getSourcePath(); - String diffSourceAvmStore = WCMUtil.getWebProjectStoreIdFromPath(diffSourcePath); - String sourceWebProject = WCMUtil.getWebProjectStoreId(diffSourceAvmStore); - String diffTargetPath = diff.getDestinationPath(); - String diffTargetAvmStore = WCMUtil.getWebProjectStoreIdFromPath(diffTargetPath); - String targetWebProject = WCMUtil.getWebProjectStoreId(diffSourceAvmStore); - if (!sourceWebProject.equals(targetWebProject)) - { - throw new AlfrescoRuntimeException( - "The source web project does not match the target web project: \n" + - " Source: " + diffSourcePath + "\n" + - " Target: " + diffTargetPath); - } - - Map lockAttributes = Collections.singletonMap( - WCMUtil.LOCK_KEY_STORE_NAME, diffTargetAvmStore); - boolean modified = getAvmLockingService().modifyLock( - sourceWebProject, AVMUtil.getStoreRelativePath(diffSourcePath), username, - sourceWebProject, AVMUtil.getStoreRelativePath(diffTargetPath), lockAttributes); - if (modified && logger.isDebugEnabled()) - { - logger.debug( - "Moved lock: " + AVMUtil.getStoreId(diffSourcePath) + "-" + - AVMUtil.getStoreRelativePath(diffSourcePath) + - " to user: " + username); - } - } - - // re-submit all the items now if requested - if (doResubmitNow) - { - for (AVMDifference diff : diffs) - { - String destPath = diff.getDestinationPath(); - - AVMNodeDescriptor node = getAvmService().lookup(diff.getDestinationVersion(), - destPath, true); - if (node != null) - { - submitNodes.add(node); - submitPaths.add(destPath); - } - } - - setupSubmitDialog(context, submitPaths, submitNodes); - } - - // signal the default transition to the workflow task - getWorkflowService().endTask(getWorkflowTask().id, null); - - return null; - } - }; - txnHelper.doInTransaction(callback); - - // if we get this far close the task dialog - if (this.doResubmitNow) - { - // open the submit dialog if re-submitting - outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + - AlfrescoNavigationHandler.OUTCOME_SEPARATOR + - AlfrescoNavigationHandler.DIALOG_PREFIX + "submitSandboxItems"; - } - } - catch (Throwable e) - { - Utils.addErrorMessage(formatErrorMessage(e), e); - outcome = this.getErrorOutcome(e); - } - - return outcome; - } - - /** - * Event handler for the 'Task Done & Re-Submit All' button - */ - public String transitionAndResubmit() - { - this.doResubmitNow = true; - return this.transition(); - } - - // ------------------------------------------------------------------------------ - // Setters - - /** - * @param avmBrowseBean AVMBrowseBean instance - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @param avmLockingService The AVMLockingService instance - */ - public void setAvmLockingService(AVMLockingService avmLockingService) - { - this.avmLockingService = avmLockingService; - } - - // ------------------------------------------------------------------------------ - // Helper methods - - protected AVMLockingService getAvmLockingService() - { - if (this.avmLockingService == null) - { - this.avmLockingService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMLockingService(); - } - return this.avmLockingService; - } - - /** - * Submits all the expired items immediately after the task is completed - * by launching the submit dialog with the expired items set as the modified - * items - * - * @param context Faces context - * @param submitPaths The list of paths being submitted - * @param submitNodes Node desriptor for each node being submitted - */ - protected void setupSubmitDialog(FacesContext context, List submitPaths, - List submitNodes) - { - // start the submission dialog with the list of paths to submit - if (logger.isDebugEnabled()) - logger.debug("starting submit dialog with expired paths: " + submitPaths); - - // get hold of the node ref that represents the web project the expired items - // belong to and get the name of the users main store - NodeRef userStoreNodeRef = (NodeRef)this.getNodeService().getProperty( - this.workflowPackage, WCMModel.PROP_AVM_DIR_INDIRECTION); - String userStoreAvmPath = AVMNodeConverter.ToAVMVersionPath(userStoreNodeRef).getSecond(); - String userStoreName = AVMUtil.getStoreName(userStoreAvmPath); - NodeRef webProjectRef = getWebProjectService().getWebProjectNodeFromStore(WCMUtil.getWebProjectStoreId(userStoreName)); - - // update the UI context to the web project - this.browseBean.clickSpace(webProjectRef); - this.avmBrowseBean.setupSandboxAction(userStoreName, - Application.getCurrentUser(context).getUserName()); - - // setup the context for the submit dialog and initialise it - this.avmBrowseBean.setNodesForSubmit(submitNodes); - Map dialogParams = new HashMap(1); - dialogParams.put(SubmitDialog.PARAM_LOAD_SELECTED_NODES_FROM_BROWSE_BEAN, - Boolean.TRUE.toString()); - Application.getDialogManager().setupParameters(dialogParams); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/ManagePermissionsDialog.java b/source/java/org/alfresco/web/bean/wcm/ManagePermissionsDialog.java deleted file mode 100644 index 35311ce00a..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/ManagePermissionsDialog.java +++ /dev/null @@ -1,605 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; -import javax.faces.event.ValueChangeEvent; -import javax.transaction.UserTransaction; - -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.service.cmr.repository.InvalidNodeRefException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessPermission; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.context.IContextListener; -import org.alfresco.web.bean.dialog.FilterViewSupport; -import org.alfresco.web.bean.repository.MapNode; -import org.alfresco.web.bean.repository.QNameNodeMap; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.users.UserMembersBean; -import org.alfresco.web.ui.common.Utils; -import org.alfresco.web.ui.common.component.UIListItem; -import org.alfresco.web.ui.common.component.UIModeList; -import org.alfresco.web.ui.common.component.data.UIRichList; -import org.alfresco.web.ui.repo.WebResources; - -/** - * Class for ManagePermissions dialog - * - * @author Sergei Gavrusev - */ -public class ManagePermissionsDialog extends BasePermissionsDialog implements IContextListener, FilterViewSupport -{ - private static final long serialVersionUID = -6980134441634707541L; - - private static final String MSG_MANAGE_PERMS_FOR = "manage_permissions_title"; - private static final String MSG_VIEW_PERMS_FOR = "view_permissions_title"; - - private static final String LOCAL = "local"; - private static final String INHERITED = "inherited"; - - private final static String MSG_CLOSE = "close"; - - private String filterMode = INHERITED; - - - /** PersonService bean reference */ - transient private PersonService personService; - - private UIRichList usersRichList = null; - - private boolean inheritParenSpacePermissions; - - - /** - * @param personService The personService to set. - */ - public void setPersonService(final PersonService personService) - { - this.personService = personService; - } - - /** - * Getter for personService - * - * @return personService - */ - protected PersonService getPersonService() - { - if (personService == null) - { - personService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPersonService(); - } - return personService; - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map) - */ - public void init(Map parameters) - { - super.init(parameters); - contextUpdated(); - inheritParenSpacePermissions = getPermissionService().getInheritParentPermissions(getAvmBrowseBean().getAvmActionNode().getNodeRef()); - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - return null; - } - - /** - * @return the list of user nodes for list data binding - */ - public List getUsers() - { - boolean includeInherited = true; - - if (this.filterMode.equals(LOCAL)) - { - includeInherited = false; - } - - FacesContext context = FacesContext.getCurrentInstance(); - - List personNodes = null; - - UserTransaction tx = null; - try - { - tx = Repository.getUserTransaction(context, true); - tx.begin(); - - // Return all the permissions set against the current node - // for any authentication instance (user/group). - // Then combine them into a single list for each authentication - // found. - - NodeRef actionNode = getAvmBrowseBean().getAvmActionNode().getNodeRef(); - - Map> permissionMap; - Map> parentPermissionMap; - Set permissions = getPermissionService().getAllSetPermissions(actionNode); - Set permsToDisplay = getPermissionsForType(); - - permissionMap = getPerson(permissions, permsToDisplay); - - NodeRef parentRef = getNodeService().getPrimaryParent(actionNode).getParentRef(); - parentPermissionMap = getPerson(getPermissionService().getAllSetPermissions(parentRef), permsToDisplay); - - // for each authentication (username/group key) found we get the Person - // node represented by it and use that for our list databinding object - personNodes = new ArrayList(permissionMap.size()); - List local = new ArrayList(); - List inh = new ArrayList(); - for (String authority : permissionMap.keySet()) - { - local.clear(); - inh.clear(); - - divisionPermissions(authority, permissionMap, parentPermissionMap, inh, local); - // check if we are dealing with a person (User Authority) - if (AuthorityType.getAuthorityType(authority) == AuthorityType.GUEST || getPersonService().personExists(authority)) - { - NodeRef nodeRef = getPersonService().getPerson(authority); - if (nodeRef != null) - { - // create our Node representation - MapNode node = new MapNode(nodeRef); - - // set data binding properties - // this will also force initialisation of the props now - // during the UserTransaction - // it is much better for performance to do this now - // rather than during page bind - - if (includeInherited) - { - addUserPermissions(node, context, inh, personNodes, nodeRef, true); - } - - addUserPermissions(node, context, local, personNodes, nodeRef, false); - } - } - else - { - // need a map (dummy node) to represent props for this Group - // Authority - - if (includeInherited) - { - addGroupPermissions(authority, context, personNodes, inh, true); - } - addGroupPermissions(authority, context, personNodes, local, false); - } - } - - // commit the transaction - tx.commit(); - } - catch (InvalidNodeRefException refErr) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage(context, Repository.ERROR_NODEREF), new Object[] { refErr.getNodeRef() })); - personNodes = Collections. emptyList(); - try - { - if (tx != null) - { - tx.rollback(); - } - } - catch (Exception tex) - { - } - } - catch (Throwable err) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage(context, Repository.ERROR_GENERIC), err.getMessage()), err); - personNodes = Collections. emptyList(); - try - { - if (tx != null) - { - tx.rollback(); - } - } - catch (Exception tex) - { - } - } - - return personNodes; - } - - /** - * Add group permissions - * - * @param authority - * @param context - * @param personNodes - * @param perms - * @param inherited - */ - private void addGroupPermissions(final String authority, FacesContext context, List personNodes, List perms, final boolean inherited) - { - if (perms == null || perms.size() == 0) - return; - Map node = new HashMap(5, 1.0f); - if (authority.startsWith(PermissionService.GROUP_PREFIX) == true) - { - node.put("fullName", authority.substring(PermissionService.GROUP_PREFIX.length())); - } - else - { - node.put("fullName", authority); - } - node.put("userName", authority); - node.put("id", authority); - node.put("perms", UserMembersBean.roleListToString(context, perms)); - node.put("icon", WebResources.IMAGE_GROUP); - node.put("inherited", inherited); - - personNodes.add(node); - } - - /** - * Add users permissions - * - * @param node - * @param context - * @param perms - * @param personNodes - * @param nodeRef - * @param inherited - */ - private void addUserPermissions(MapNode node, FacesContext context, List perms, List personNodes, NodeRef nodeRef, boolean inherited) - { - if (perms == null || perms.size() == 0) - return; - Map props = (Map) ((QNameNodeMap) node.getProperties()).clone(); - String firstName = (String)node.get("firstName"); - String lastName = (String)node.get("lastName"); - props.put("fullName", (firstName != null ? firstName : "") + ' ' + (lastName != null ? lastName : "")); - props.put("perms", UserMembersBean.roleListToString(context, perms)); - props.put("icon", WebResources.IMAGE_PERSON); - props.put("inherited", inherited); - - personNodes.add(props); - } - - /** - * Separate permissions on inherited and local - * - * @param authority - * @param person - * @param parentPerson - * @param inherited - * @param local - */ - private void divisionPermissions(String authority, Map> person, Map> parentPerson, List inherited, List local) - { - List parentPerms = parentPerson.get(authority); - List perms = person.get(authority); - if (parentPerms == null) - { - local.addAll(perms); - return; - } - if (perms.equals(parentPerms)) - { - inherited.addAll(perms); - return; - } - for (String perm : perms) - { - if (parentPerms.contains(perm)) - { - inherited.add(perm); - } - else - { - local.add(perm); - } - } - } - - /** - * @param permissions - * @param permsToDisplay - * @return - */ - private Map> getPerson(Set permissions, Set permsToDisplay) - { - Map> permissionMap = new HashMap>(8, 1.0f); - for (AccessPermission permission : permissions) - { - if (permsToDisplay.contains(permission.getPermission())) - { - // we are only interested in Allow and not groups/owner etc. - if (permission.getAccessStatus() == AccessStatus.ALLOWED - && (permission.getAuthorityType() == AuthorityType.USER || permission.getAuthorityType() == AuthorityType.GROUP - || permission.getAuthorityType() == AuthorityType.GUEST || permission.getAuthorityType() == AuthorityType.EVERYONE)) - { - String authority = permission.getAuthority(); - - List userPermissions = permissionMap.get(authority); - if (userPermissions == null) - { - // create for first time - userPermissions = new ArrayList(4); - permissionMap.put(authority, userPermissions); - } - // add the permission name for this authority - userPermissions.add(permission.getPermission()); - } - } - } - return permissionMap; - } - - /** - * Get available permissions - * - * @return Set of permissions - */ - public static Set getPermissionsForType() - { - Set permissions = new LinkedHashSet(3); - permissions.add(PermissionService.READ); - permissions.add(PermissionService.WRITE); - permissions.add(PermissionService.DELETE); - - return permissions; - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.app.context.IContextListener#areaChanged() - */ - public void areaChanged() - { - // nothing to do - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.app.context.IContextListener#contextUpdated() - */ - public void contextUpdated() - { - if (this.usersRichList != null) - { - this.usersRichList.setValue(null); - } - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.app.context.IContextListener#spaceChanged() - */ - public void spaceChanged() - { - // nothing to do - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.dialog.FilterViewSupport#filterModeChanged(javax.faces.event.ActionEvent) - */ - public void filterModeChanged(ActionEvent event) - { - UIModeList viewList = (UIModeList) event.getComponent(); - setFilterMode(viewList.getValue().toString()); - // force the list to be re-queried when the page is refreshed - if (this.usersRichList != null) - { - this.usersRichList.setValue(null); - } - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.dialog.FilterViewSupport#getFilterItems() - */ - public List getFilterItems() - { - FacesContext context = FacesContext.getCurrentInstance(); - List items = new ArrayList(2); - - UIListItem item1 = new UIListItem(); - item1.setValue(INHERITED); - item1.setLabel(Application.getMessage(context, INHERITED)); - items.add(item1); - - UIListItem item2 = new UIListItem(); - item2.setValue(LOCAL); - item2.setLabel(Application.getMessage(context, LOCAL)); - items.add(item2); - - return items; - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.dialog.FilterViewSupport#getFilterMode() - */ - public String getFilterMode() - { - return filterMode; - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.dialog.FilterViewSupport#setFilterMode(java.lang.String) - */ - public void setFilterMode(final String filterMode) - { - this.filterMode = filterMode; - - // clear datalist cache ready to change results based on filter setting - contextUpdated(); - - } - - /** - * Getter for usersRichList - * - * @return usersRichList - */ - public UIRichList getUsersRichList() - { - return usersRichList; - } - - /** - * Setter for usersRichList - * - * @param usersRichList - */ - public void setUsersRichList(final UIRichList usersRichList) - { - this.usersRichList = usersRichList; - } - - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.dialog.BaseDialogBean#restored() - */ - @Override - public void restored() - { - super.restored(); - contextUpdated(); - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.dialog.BaseDialogBean#getCancelButtonLabel() - */ - @Override - public String getCancelButtonLabel() - { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE); - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.dialog.BaseDialogBean#getFinishButtonDisabled() - */ - @Override - public boolean getFinishButtonDisabled() - { - return false; - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.dialog.BaseDialogBean#getActionsContext() - */ - @Override - public Object getActionsContext() - { - return this; - } - - @Override - public String getContainerTitle() - { - FacesContext fc = FacesContext.getCurrentInstance(); - String pattern = Application.getMessage(fc, isRendered() ? MSG_MANAGE_PERMS_FOR : MSG_VIEW_PERMS_FOR); - - return MessageFormat.format(pattern, getAvmBrowseBean().getAvmActionNode().getName()); - } - - /** - * @return true if node in Staging Sandbox - */ - public boolean isRendered() - { - boolean result = false; - final String path = AVMNodeConverter.ToAVMVersionPath(getAvmBrowseBean().getAvmActionNode().getNodeRef()).getSecond(); - if (!AVMUtil.isMainStore(AVMUtil.getStoreName(path))) - { - result = true; - } - return result; - - } - - /** - * Getter for inheritParenSpacePermissions - * - * @return inheritParenSpacePermissions - */ - public boolean isInheritParenSpacePermissions() - { - return inheritParenSpacePermissions; - } - - /** - * Setter for inheritParenSpacePermissions Set the global inheritance behaviour for permissions on a node. - * - * @param inheritParenSpacePermissions - */ - public void setInheritParenSpacePermissions(final boolean inheritParenSpacePermissions) - { - this.inheritParenSpacePermissions = inheritParenSpacePermissions; - getPermissionService().setInheritParentPermissions(getAvmBrowseBean().getAvmActionNode().getNodeRef(), inheritParenSpacePermissions); - contextUpdated(); - } - - public void inheritPermissionsValueChanged(ValueChangeEvent event) - { - boolean inheritPermissions = (Boolean)event.getNewValue(); - setInheritParenSpacePermissions(inheritPermissions); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/ManageReviewTaskDialog.java b/source/java/org/alfresco/web/bean/wcm/ManageReviewTaskDialog.java deleted file mode 100644 index 35999d1d1e..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/ManageReviewTaskDialog.java +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.text.MessageFormat; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; -import javax.transaction.UserTransaction; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.repo.domain.PropertyValue; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.ServiceRegistry; -import org.alfresco.service.cmr.avm.AVMNotFoundException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.wcm.sandbox.SandboxConstants; -import org.alfresco.wcm.util.WCMUtil; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.workflow.ManageTaskDialog; -import org.alfresco.web.ui.common.Utils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Bean implementation for the "Manage Task" dialog when dealing - * with review related WCM tasks. - * - * @author gavinc - */ -public class ManageReviewTaskDialog extends ManageTaskDialog -{ - private static final long serialVersionUID = 59524560340308134L; - - private static final String MSG_WEB_PRJ_DOES_NOT_EXIST = "error_webprj_does_not_exist"; - - protected String store; - protected String webapp; - protected NodeRef webProjectRef; - protected AVMBrowseBean avmBrowseBean; - transient private PermissionService permissionService; - - private static final Log logger = LogFactory.getLog(ManageReviewTaskDialog.class); - - - // ------------------------------------------------------------------------------ - // Implementation - - @Override - public void init(Map parameters) - { - super.init(parameters); - - FacesContext context = FacesContext.getCurrentInstance(); - UserTransaction tx = null; - - try - { - tx = Repository.getUserTransaction(context, true); - tx.begin(); - - // try and retrieve the link validation report from the workflow - // store, if present setup the validation state on AVMBrowseBean - this.store = this.workflowPackage.getStoreRef().getIdentifier(); - - // get the web project noderef for the workflow store - String wpStoreId = WCMUtil.getWebProjectStoreId(this.store); - this.webProjectRef = getWebProjectService().getWebProjectNodeFromStore(WCMUtil.getWebProjectStoreId(this.store)); - - if (this.webProjectRef == null) - { - String mesg = MessageFormat.format(Application.getMessage(context, MSG_WEB_PRJ_DOES_NOT_EXIST), wpStoreId); - throw new AlfrescoRuntimeException(mesg); - } - - // commit the changes - tx.commit(); - } - catch (Throwable e) - { - // rollback the transaction - try { if (tx != null) {tx.rollback();} } catch (Exception ex) {} - Utils.addErrorMessage(formatErrorMessage(e), e); - } - } - - // ------------------------------------------------------------------------------ - // Event handlers - - public String viewLinkReport() - { - if (logger.isDebugEnabled()) - logger.debug("Viewing link validation report for: " + - AVMUtil.buildStoreWebappPath(this.store, this.webapp)); - - Map params = new HashMap(3); - params.put("store", this.store); - params.put("webapp", this.webapp); - params.put("compareToStaging", "true"); - Application.getDialogManager().setupParameters(params); - - return "dialog:linkValidation"; - } - - public String viewDeployReport() - { - if (logger.isDebugEnabled()) - logger.debug("Viewing deployment report for store: " + store); - - Map params = new HashMap(3); - params.put("store", this.store); - Application.getDialogManager().setupParameters(params); - - return "dialog:viewDeploymentReport"; - } - - public String deploy() - { - if (logger.isDebugEnabled()) - logger.debug("Deploying workflow store: " + this.store); - - Map params = new HashMap(4); - params.put("store", this.store); - params.put("webproject", this.webProjectRef.toString()); - params.put("calledFromTaskDialog", Boolean.TRUE.toString()); - - // if a test server has already been allocated inform the dialog - // that an update is needed - List testServers = DeploymentUtil.findAllocatedTestServers(this.store); - if (!testServers.isEmpty()) - { - params.put("updateTestServer", "true"); - } - - Application.getDialogManager().setupParameters(params); - - return "dialog:deployWebsite"; - } - - public String releaseTestServer() - { - if (logger.isDebugEnabled()) - logger.debug("Release test server for store: " + store); - - Map params = new HashMap(3); - params.put("store", this.store); - Application.getDialogManager().setupParameters(params); - - return "dialog:releaseTestServer"; - } - - // ------------------------------------------------------------------------------ - // Getters and Setters - - /** - * @param avmBrowseBean AVMBrowseBean instance - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @param permissionService The PermissionService to set. - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - protected PermissionService getPermissionService() - { - if (permissionService == null) - { - permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService(); - } - return permissionService; - } - - /** - * @return Determines if there are any test servers configured for the - * web project this task belongs to - */ - @SuppressWarnings("unchecked") - public boolean getTestServersAvailable() - { - // NOTE: This method is called a lot as it is referenced as a value binding - // expression in a 'rendered' attribute, we therefore cache the result - // on a per request basis - - Boolean result = null; - - FacesContext context = FacesContext.getCurrentInstance(); - Map request = context.getExternalContext().getRequestMap(); - if (request.get(AVMBrowseBean.REQUEST_BEEN_DEPLOYED_RESULT) == null) - { - result = Boolean.FALSE; - - if (this.webProjectRef != null && getPermissionService().hasPermission(webProjectRef, PermissionService.READ_PROPERTIES).equals(AccessStatus.ALLOWED)) - { - final ServiceRegistry serviceRegistry = Repository.getServiceRegistry(context); - final NodeRef projectRef = this.webProjectRef; - - TransactionService transactionService = serviceRegistry.getTransactionService(); - RetryingTransactionCallback> findTestServers = new RetryingTransactionCallback>() - { - public List execute() throws Exception - { - return serviceRegistry.getDeploymentService().findTestDeploymentServers(projectRef, false); - } - }; - List testServers = transactionService.getRetryingTransactionHelper().doInTransaction(findTestServers); - - if (testServers != null) - { - result = new Boolean(testServers != null && testServers.size() > 0); - } - } - - request.put(AVMBrowseBean.REQUEST_BEEN_DEPLOYED_RESULT, result); - } - else - { - result = (Boolean)request.get(AVMBrowseBean.REQUEST_BEEN_DEPLOYED_RESULT); - } - - return result.booleanValue(); - } - - /** - * @return Determines whether a deployment has been attempted - */ - public boolean getDeployAttempted() - { - PropertyValue propVal = null; - try - { - propVal = getAvmService().getStoreProperty(this.store, - SandboxConstants.PROP_LAST_DEPLOYMENT_ID); - } - catch (AVMNotFoundException nfe) - { - // ignore - eg. web project deleted - } - - return (propVal != null); - } - - /** - * - */ - /** - * @return Determines whether a test server is allocated - */ - public boolean getTestServerAllocated() - { - // if a test server has already been allocated inform the dialog - // that an update is needed - List testServers = DeploymentUtil.findAllocatedTestServers(this.store); - if (!testServers.isEmpty()) - { - return true; - } - return false; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/MonitorDeploymentDialog.java b/source/java/org/alfresco/web/bean/wcm/MonitorDeploymentDialog.java deleted file mode 100644 index 8ce66d76c8..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/MonitorDeploymentDialog.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.Map; - -import javax.faces.context.FacesContext; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Monitors the deployment of a web project snapshot to one or more remote servers. - * - * @author gavinc - */ -public class MonitorDeploymentDialog extends BaseDialogBean -{ - private static final long serialVersionUID = -2800892205678915972L; - - protected String outcome; - protected NodeRef webProjectRef; - - protected AVMBrowseBean avmBrowseBean; - - private static final Log logger = LogFactory.getLog(MonitorDeploymentDialog.class); - - // ------------------------------------------------------------------------------ - // Dialog implementation - - @Override - public void init(Map parameters) - { - super.init(parameters); - - // setup context for dialog - String webProject = parameters.get("webproject"); - if (webProject == null) - { - this.webProjectRef = this.avmBrowseBean.getWebsite().getNodeRef(); - } - else - { - this.webProjectRef = new NodeRef(webProject); - } - - // determine outcome required - String calledFromTaskDialog = parameters.get("calledFromTaskDialog"); - if (calledFromTaskDialog != null && - calledFromTaskDialog.equals(Boolean.TRUE.toString())) - { - outcome = "dialog:close:myalfresco"; - } - else - { - outcome = "dialog:close:browseWebsite"; - } - - if (logger.isDebugEnabled()) - { - logger.debug("Initialising dialog to monitor deployment of " + - this.webProjectRef.toString()); - } - } - - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - return outcome; - } - - @Override - protected String getDefaultCancelOutcome() - { - return this.outcome; - } - - @Override - public String getCancelButtonLabel() - { - return Application.getMessage(FacesContext.getCurrentInstance(), "close"); - } - - // ------------------------------------------------------------------------------ - // Bean getters and setters - - /** - * @param avmBrowseBean The AVM BrowseBean to set - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @return The NodeRef of the web project the deployment reports are being shown for - */ - public NodeRef getWebProjectRef() - { - return this.webProjectRef; - } - - // MER experiment - protected int versionToDeploy; - protected String[] deployTo; - protected String store; - protected String deployMode; - protected String calledFromTaskDialog; - protected NodeRef websiteRef; - - /** - * Returns the remote servers to deploy to as an array - * - * @return String array of servers to deploy to - */ - public String[] getDeployTo() - { - return this.deployTo; - } - - /** - * Sets the list of remote servers to deploy to - * - * @param deployTo String array of servers to deploy to - */ - public void setDeployTo(String[] deployTo) - { - this.deployTo = deployTo; - } - - /** - * Returns the type of server to deploy to, either 'live' or 'test'. - * - * @return The type of server to deploy to - */ - public String getDeployMode() - { - return this.deployMode; - } - - /** - * @return The store being deployed - */ - public String getStore() - { - return this.store; - } - - /** - * @return The version of the snapshot to deploy - */ - public int getSnapshotVersion() - { - return this.versionToDeploy; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/PromptForWebFormDialog.java b/source/java/org/alfresco/web/bean/wcm/PromptForWebFormDialog.java deleted file mode 100644 index 67288b6167..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/PromptForWebFormDialog.java +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.Serializable; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; -import javax.faces.model.SelectItem; - -import org.alfresco.model.WCMAppModel; -import org.alfresco.repo.domain.PropertyValue; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.namespace.QName; -import org.alfresco.web.app.AlfrescoNavigationHandler; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.data.IDataContainer; -import org.alfresco.web.data.QuickSort; -import org.alfresco.web.forms.Form; -import org.alfresco.web.forms.FormInstanceData; -import org.alfresco.web.forms.FormNotFoundException; -import org.alfresco.web.forms.FormsService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * @author arielb - */ -public class PromptForWebFormDialog extends BaseDialogBean -{ - private static final long serialVersionUID = 8062203927131257236L; - - private static final Log logger = LogFactory.getLog(PromptForWebFormDialog.class); - - /** AVM service reference */ - transient private AVMService avmService; - - /** AVM Browse Bean reference */ - protected AVMBrowseBean avmBrowseBean; - - /** The FormsService reference */ - transient private FormsService formsService; - - private transient List formChoices; - - private String formName; - private String cancelOutcome; - private String finishOutcome; - - // ------------------------------------------------------------------------------ - // Bean property getters and setters - - /** - * @param avmService The avmService to set. - */ - public void setAvmService(AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (this.avmService == null) - { - this.avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - return this.avmService; - } - - /** - * @param avmBrowseBean The AVMBrowseBean to set. - */ - public void setAvmBrowseBean(final AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - /** - * @param formsService The FormsService to set. - */ - public void setFormsService(final FormsService formsService) - { - this.formsService = formsService; - } - - protected FormsService getFormsService() - { - if (this.formsService == null) - { - this.formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); - } - return this.formsService; - } - - /** - * @return Returns the current AVM node context. - */ - public AVMNode getAvmNode() - { - return this.avmBrowseBean.getAvmActionNode(); - } - - // ------------------------------------------------------------------------------ - // Dialog implementation - - @Override - public void init(final Map parameters) - { - super.init(parameters); - this.cancelOutcome = (this.parameters.containsKey("cancelOutcome") - ? this.parameters.get("cancelOutcome") - : "dialog:editAvmFile"); - this.finishOutcome = (this.parameters.containsKey("finishOutcome") - ? this.parameters.get("finishOutcome") - : "wizard:editWebContent"); - this.formName = null; - this.formChoices = null; - final String avmPath = this.getAvmNode().getPath(); - if (this.getAvmService().hasAspect(this.getAvmNode().getVersion(), - avmPath, - WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) - { - // build a status message if this is an error case - - FormInstanceData fid = null; - try - { - fid = this.getFormsService().getFormInstanceData(this.getAvmNode().getVersion(), avmPath); - final Form f = fid.getForm(); - this.formName = f.getName(); - - if (logger.isDebugEnabled()) - { - // strange case... this should throw an exception if we're here... - logger.debug(avmPath + ".getForm() did not throw a form not found. why are we here?"); - } - } - catch (final FormNotFoundException fnfe) - { - String msg = (fnfe.getWebProject() != null - ? "prompt_for_web_form_form_not_found_error_in_web_project" - : "prompt_for_web_form_form_not_found_error"); - msg = Application.getMessage(FacesContext.getCurrentInstance(), msg); - - if (fid != null) - { - msg = (fnfe.getWebProject() != null - ? MessageFormat.format(msg, - fnfe.getFormName(), - fid.getName(), - fnfe.getWebProject().getName()) - : MessageFormat.format(msg, - fnfe.getFormName(), - fid.getName())); - } - - this.avmBrowseBean.displayStatusMessage(FacesContext.getCurrentInstance(), msg); - } - } - } - - @Override - public String cancel() - { - getAvmService().removeAspect(this.getAvmNode().getPath(), WCMAppModel.ASPECT_RENDITION); - getAvmService().removeAspect(this.getAvmNode().getPath(), WCMAppModel.ASPECT_FORM_INSTANCE_DATA); - - return super.cancel(); - } - - @Override - protected String finishImpl(final FacesContext context, String outcome) - throws Exception - { - - if (logger.isDebugEnabled()) - { - logger.debug("configuring " + this.getAvmNode().getPath() + - " to use form " + this.getFormName()); - } - - if (!this.getAvmService().hasAspect(this.getAvmNode().getVersion(), - this.getAvmNode().getPath(), - WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) - { - String cwd = AVMUtil.getCorrespondingPathInPreviewStore(this.avmBrowseBean.getCurrentPath()); - - Map props = new HashMap(1, 1.0f); - props.put(WCMAppModel.PROP_PARENT_FORM_NAME, this.getFormName()); - props.put(WCMAppModel.PROP_ORIGINAL_PARENT_PATH, cwd); - this.getNodeService().addAspect(this.getAvmNode().getNodeRef(), WCMAppModel.ASPECT_FORM_INSTANCE_DATA, props); - } - else - { - this.getAvmService().setNodeProperty(this.getAvmNode().getPath(), - WCMAppModel.PROP_PARENT_FORM_NAME, - new PropertyValue(DataTypeDefinition.TEXT, this.getFormName())); - } - - return outcome; - } - - @Override - public boolean getFinishButtonDisabled() - { - return this.getFormChoices().size() == 0; - } - - @Override - protected String getDefaultCancelOutcome() - { - return (super.getDefaultCancelOutcome() + - AlfrescoNavigationHandler.OUTCOME_SEPARATOR + - this.cancelOutcome); - } - - @Override - protected String getDefaultFinishOutcome() - { - return (super.getDefaultFinishOutcome() + - AlfrescoNavigationHandler.OUTCOME_SEPARATOR + - this.finishOutcome); - } - - // ------------------------------------------------------------------------------ - // Bean Getters and Setters - - /** - * @return the available forms from this web project that can be created. - */ - public List getFormChoices() - { - if (this.formChoices == null) - { - final WebProject wp = new WebProject(this.getAvmNode().getPath()); - final List forms = wp.getForms(); - this.formChoices = new ArrayList(forms.size()); - for (final Form f : forms) - { - this.formChoices.add(new SelectItem(f.getName(), f.getTitle())); - } - - final QuickSort sorter = new QuickSort(this.formChoices, "label", true, IDataContainer.SORT_CASEINSENSITIVE); - sorter.sort(); - - } - return this.formChoices; - } - - /** - * @return the currently selected form - */ - public String getFormName() - { - return this.formName; - } - - /** - * @param form Sets the currently selected form - */ - public void setFormName(final String formName) - { - this.formName = formName; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/RegenerateRenditionsWizard.java b/source/java/org/alfresco/web/bean/wcm/RegenerateRenditionsWizard.java deleted file mode 100644 index 1550d51d9e..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/RegenerateRenditionsWizard.java +++ /dev/null @@ -1,737 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.ResourceBundle; - -import javax.faces.component.UIViewRoot; -import javax.faces.context.FacesContext; -import javax.faces.model.SelectItem; - -import org.alfresco.model.WCMAppModel; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.web.scripts.FileTypeImageUtils; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.avm.locking.AVMLockingService; -import org.alfresco.service.cmr.avmsync.AVMDifference; -import org.alfresco.service.cmr.avmsync.AVMSyncService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.ResultSetRow; -import org.alfresco.service.cmr.search.SearchParameters; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.wcm.webproject.WebProjectInfo; -import org.alfresco.wcm.webproject.WebProjectService; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.wizard.BaseWizardBean; -import org.alfresco.web.data.IDataContainer; -import org.alfresco.web.data.QuickSort; -import org.alfresco.web.forms.Form; -import org.alfresco.web.forms.FormInstanceData; -import org.alfresco.web.forms.FormNotFoundException; -import org.alfresco.web.forms.FormsService; -import org.alfresco.web.forms.RenderingEngineTemplate; -import org.alfresco.web.forms.RenderingEngineTemplateImpl; -import org.alfresco.web.forms.Rendition; -import org.alfresco.web.forms.RenderingEngine.TemplateNotFoundException; -import org.alfresco.web.ui.common.Utils; -import org.alfresco.web.ui.common.component.UIListItem; -import org.alfresco.web.ui.common.component.UIListItems; -import org.alfresco.web.ui.common.component.data.UIRichList; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * @author arielb - */ -public class RegenerateRenditionsWizard - extends BaseWizardBean -{ - private static final long serialVersionUID = -8573877482412328963L; - - public final String REGENERATE_SCOPE_ALL = "all"; - public final String REGENERATE_SCOPE_FORM = "form"; - public final String REGENERATE_SCOPE_RENDERING_ENGINE_TEMPLATE = "rendering_engine_template"; - - private final static Log logger = LogFactory.getLog(RegenerateRenditionsWizard.class); - - transient protected WebProjectService wpService; - transient private AVMLockingService avmLockingService; - transient private AVMService avmService; - transient private AVMSyncService avmSyncService; - transient private SearchService searchService; - transient private FormsService formsService; - transient private PermissionService permissionService; - - private WebProject selectedWebProject; - private String[] selectedForms; - private String[] selectedRenderingEngineTemplates; - private UIRichList renditionChoicesRichList; - private List regeneratedRenditions; - private String regenerateScope; - - // ------------------------------------------------------------------------------ - // Wizard implementation - - @Override - protected String finishImpl(final FacesContext context, final String outcome) - throws Exception - { - if (this.regeneratedRenditions != null) - { - final List diffList = new ArrayList(this.regeneratedRenditions.size()); - for (final Rendition r : this.regeneratedRenditions) - { - diffList.add(new AVMDifference(-1, r.getPath(), - -1, AVMUtil.getCorrespondingPathInMainStore(r.getPath()), - AVMDifference.NEWER)); - } - - if (logger.isDebugEnabled()) - { - logger.debug("updating " + diffList.size() + " renditions in staging"); - } - - getAvmSyncService().update(diffList, null, true, true, true, true, null, null); - String description = null; - final ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); - if (this.regenerateScope.equals(REGENERATE_SCOPE_FORM)) - { - description = MessageFormat.format(bundle.getString("regenerate_renditions_snapshot_description_scope_form"), - StringUtils.join(this.selectedForms, ", ")); - } - else if (this.regenerateScope.equals(REGENERATE_SCOPE_RENDERING_ENGINE_TEMPLATE)) - { - description = MessageFormat.format(bundle.getString("regenerate_renditions_snapshot_description_scope_rendering_engine_template"), - StringUtils.join(this.selectedRenderingEngineTemplates, ", ")); - } - else - { - description = MessageFormat.format(bundle.getString("regenerate_renditions_snapshot_description_scope_web_project"), - this.selectedWebProject.getName()); - } - getAvmService().createSnapshot(this.selectedWebProject.getStoreId(), - MessageFormat.format(bundle.getString("regenerate_renditions_snapshot_short_description"), - diffList.size()), - description); - } - return outcome; - } - - @Override - public void init(final Map parameters) - { - super.init(parameters); - this.selectedWebProject = null; - this.selectedForms = null; - this.selectedRenderingEngineTemplates = null; - this.renditionChoicesRichList = null; - this.regeneratedRenditions = null; - this.regenerateScope = REGENERATE_SCOPE_ALL; - if (this.browseBean.getDocument() != null) - { - if (this.browseBean.getDocument().hasAspect(WCMAppModel.ASPECT_FORM)) - { - this.selectedForms = new String[] { this.browseBean.getDocument().getName() }; - } - } - else if (this.browseBean.getActionSpace() != null) - { - this.selectedForms = new String[] { this.browseBean.getActionSpace().getName() }; - } - } - - @Override - public String next() - { - final int step = Application.getWizardManager().getCurrentStep(); - if (step == 2) - { - try - { - this.regeneratedRenditions = this.regenerateRenditions(); - } - catch (Exception e) - { - Application.getWizardManager().getState().setCurrentStep(step - 1); - Utils.addErrorMessage(e.getMessage(), e); - } - } - return super.next(); - } - - @Override - public String cancel() - { - if (this.selectedWebProject != null) - { - final String stagingStoreName = this.selectedWebProject.getStoreId(); - final String previewStoreName = AVMUtil.getCorrespondingPreviewStoreName(stagingStoreName); - getAvmSyncService().resetLayer(AVMUtil.buildStoreRootPath(previewStoreName)); - } - return super.cancel(); - } - - @Override - public boolean getNextButtonDisabled() - { - boolean disabled = false; - if ("select_renditions".equals(Application.getWizardManager().getCurrentStepName())) - { - disabled = this.selectedWebProject == null; - } - return disabled; - } - - @Override - public String getStepDescription() - { - final ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); - final String stepName = Application.getWizardManager().getCurrentStepName(); - if ("summary".equals(stepName)) - { - final String s = this.selectedWebProject.getTitle(); - return MessageFormat.format(bundle.getString("regenerate_renditions_summary_desc"), - this.regeneratedRenditions.size(), - s != null && s.length() != 0 ? s : this.selectedWebProject.getName()); - } - else - { - return super.getContainerDescription(); - } - } - - // ------------------------------------------------------------------------------ - // Bean Getters and Setters - - public String getRegenerateScope() - { - return this.regenerateScope; - } - - public void setRegenerateScope(final String regenerateScope) - { - this.regenerateScope = regenerateScope; - } - - public List getWebProjectChoices() - { - List wpInfos = getWebProjectService().listWebProjects(); - List result = new ArrayList(wpInfos.size()); - - QuickSort sorter = new QuickSort((List)wpInfos, "name", true, IDataContainer.SORT_CASEINSENSITIVE); - sorter.sort(); - - for (WebProjectInfo wpInfo : wpInfos) - { - if(getPermissionService().hasPermission(wpInfo.getNodeRef(), PermissionService.WCM_CONTENT_MANAGER) == AccessStatus.ALLOWED) { - // display only web projects to which the authenticated user has CONTENT MANAGER rights - String s = wpInfo.getTitle(); - if (this.selectedWebProject == null) - { - this.selectedWebProject = new WebProject(wpInfo.getNodeRef()); - } - result.add(new SelectItem(wpInfo.getNodeRef().toString(), s != null && s.length() != 0 ? s : wpInfo.getName())); - } - } - return result; - } - - public String getSelectedWebProject() - { - return this.selectedWebProject == null ? null : this.selectedWebProject.getNodeRef().toString(); - } - - public void setSelectedWebProject(final String webProject) - { - this.selectedWebProject = (webProject == null || webProject.length() == 0 - ? null - : new WebProject(new NodeRef(webProject))); - - final UIViewRoot c = FacesContext.getCurrentInstance().getViewRoot(); - ((UIListItems)c.findComponent("wizard:wizard-body:select_list_form_choices:list_items_form_choices")).setValue(null); - ((UIListItems)c.findComponent("wizard:wizard-body:select_list_rendering_engine_template_choices:list_items_rendering_engine_template_choices")).setValue(null); - this.renditionChoicesRichList = null; - } - - public List getFormChoices() - { - final List result = new LinkedList(); - final ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); - if (this.selectedWebProject != null) - { - for (final Form f : this.selectedWebProject.getForms()) - { - final UIListItem item = new UIListItem(); - item.setValue(f.getName()); - item.setLabel(f.getTitle()); - final List fids = this.getRelatedFormInstanceData(this.selectedWebProject, f); - - item.setDescription(MessageFormat.format(bundle.getString("regenerate_renditions_select_renditions_select_item_desc"), - fids.size() * f.getRenderingEngineTemplates().size(), - this.selectedWebProject.getName())); - item.setImage("/images/icons/webform_large.gif"); - result.add(item); - } - } - return result; - } - - public String[] getSelectedForms() - { - return this.selectedForms; - } - - public void setSelectedForms(final String[] forms) - { - this.selectedForms = forms == null || forms.length == 0 ? null : forms; - } - - public String getSelectedForm() - { - return this.selectedForms != null && this.selectedForms.length != 0 ? this.selectedForms[0] : null; - } - - public void setSelectedForm(final String form) - { - this.selectedForms = form == null || form.length() == 0 ? null : new String[] { form }; - this.renditionChoicesRichList = null; - } - - public List getRenderingEngineTemplateChoices() - { - final List result = new LinkedList(); - final ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); - for (final Form f : this.selectedWebProject.getForms()) - { - for (final RenderingEngineTemplate ret : f.getRenderingEngineTemplates()) - { - final UIListItem item = new UIListItem(); - item.setValue(f.getName() + ":" + ret.getName()); - item.setLabel(ret.getTitle() + "(" + ret.getMimetypeForRendition() + ")"); - final List rs = this.getRelatedRenditions(this.selectedWebProject, ret); - item.setDescription(MessageFormat.format(bundle.getString("regenerate_renditions_select_renditions_select_item_desc"), - rs.size(), - this.selectedWebProject.getName())); - item.setImage(FileTypeImageUtils.getFileTypeImage(ret.getName(), false)); - result.add(item); - } - } - return result; - } - - public String[] getSelectedRenderingEngineTemplates() - { - return this.selectedRenderingEngineTemplates; - } - - public void setSelectedRenderingEngineTemplates(final String[] renderingEngineTemplates) - { - this.selectedRenderingEngineTemplates = renderingEngineTemplates; - this.renditionChoicesRichList = null; - } - - - public List getRegeneratedRenditions() - { - return this.regeneratedRenditions; - } - - public void setRegeneratedRenditionsRichList(UIRichList richList) - { - this.renditionChoicesRichList = richList; - } - - public UIRichList getRegeneratedRenditionsRichList() - { - return this.renditionChoicesRichList; - } - - // ------------------------------------------------------------------------------ - // Service Injection - - /** - * @param wpService The WebProjectService to set. - */ - public void setWebProjectService(WebProjectService wpService) - { - this.wpService = wpService; - } - - protected WebProjectService getWebProjectService() - { - if (wpService == null) - { - wpService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWebProjectService(); - } - return wpService; - } - - /** - * @param avmService The AVMService to set. - */ - public void setAvmService(final AVMService avmService) - { - this.avmService = avmService; - } - - private AVMService getAvmService() - { - if (this.avmService == null) - { - this.avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - return this.avmService; - } - - /** - * @param avmLockingService The AVMLockingService to set. - */ - public void setAvmLockingService(final AVMLockingService avmLockingService) - { - this.avmLockingService = avmLockingService; - } - - private AVMLockingService getAvmLockingService() - { - if (this.avmLockingService == null) - { - this.avmLockingService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMLockingService(); - } - return this.avmLockingService; - } - - /** - * @param avmSyncService The AVMSyncService to set. - */ - public void setAvmSyncService(final AVMSyncService avmSyncService) - { - this.avmSyncService = avmSyncService; - } - - private AVMSyncService getAvmSyncService() - { - if (this.avmSyncService == null) - { - this.avmSyncService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMSyncService(); - } - return this.avmSyncService; - } - - /** - * @param searchService The SearchService to set. - */ - public void setSearchService(final SearchService searchService) - { - this.searchService = searchService; - } - - protected SearchService getSearchService() - { - if (this.searchService == null) - { - this.searchService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSearchService(); - } - return this.searchService; - } - - /** - * @param formsService The FormsService to set. - */ - public void setFormsService(final FormsService formsService) - { - this.formsService = formsService; - } - - private FormsService getFormsService() - { - if (this.formsService == null) - { - this.formsService = (FormsService)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); - } - return this.formsService; - } - - /** - * @param formsService The FormsService to set. - */ - public void setPermissionService(final PermissionService permissionService) - { - this.permissionService = permissionService; - } - - private PermissionService getPermissionService() - { - if (this.permissionService == null) - { - this.permissionService = (PermissionService)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "PermissionService"); - } - return this.permissionService; - } - - // ------------------------------------------------------------------------------ - // Helper Methods - - private List getRelatedFormInstanceData(final WebProject webProject, final Form f) - { - final SearchParameters sp = new SearchParameters(); - final StoreRef storeRef = AVMNodeConverter.ToStoreRef(webProject.getStagingStore()); - sp.addStore(storeRef); - sp.setLanguage(SearchService.LANGUAGE_LUCENE); - final StringBuilder query = new StringBuilder(256); - query.append("+ASPECT:\"" + WCMAppModel.ASPECT_FORM_INSTANCE_DATA + "\""); - query.append(" -ASPECT:\"" + WCMAppModel.ASPECT_RENDITION + "\""); - query.append(" +@" + Repository.escapeQName(WCMAppModel.PROP_PARENT_FORM_NAME) + - ":\"" + f.getName() + "\""); - - if (logger.isDebugEnabled()) - { - logger.debug("running query " + query); - } - - sp.setQuery(query.toString()); - final ResultSet rs = getSearchService().query(sp); - try - { - final List result = new ArrayList(rs.length()); - for (final ResultSetRow row : rs) - { - final String avmPath = AVMNodeConverter.ToAVMVersionPath(row.getNodeRef()).getSecond(); - final String previewAvmPath = AVMUtil.getCorrespondingPathInPreviewStore(avmPath); - - try - { - FormInstanceData fid = getFormsService().getFormInstanceData(-1, previewAvmPath); - result.add(fid); - } - catch (final FormNotFoundException fnfe) - { - // ignore - } - } - - return result; - } - finally - { - rs.close(); - } - } - - private List getRelatedRenditions(final WebProject webProject, final RenderingEngineTemplate ret) - { - final SearchParameters sp = new SearchParameters(); - final StoreRef storeRef = AVMNodeConverter.ToStoreRef(webProject.getStagingStore()); - sp.addStore(storeRef); - sp.setLanguage(SearchService.LANGUAGE_LUCENE); - final StringBuilder query = new StringBuilder(); - query.append("+ASPECT:\"" + WCMAppModel.ASPECT_RENDITION + "\""); - query.append(" +@" + Repository.escapeQName(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE) + - ":\"" + ((RenderingEngineTemplateImpl)ret).getNodeRef() + "\""); - - if (logger.isDebugEnabled()) - { - logger.debug("running query " + query); - } - - sp.setQuery(query.toString()); - final ResultSet rs = getSearchService().query(sp); - try - { - final List result = new ArrayList(rs.length()); - for (final ResultSetRow row : rs) - { - final String avmPath = AVMNodeConverter.ToAVMVersionPath(row.getNodeRef()).getSecond(); - final String previewAvmPath = AVMUtil.getCorrespondingPathInPreviewStore(avmPath); - result.add(getFormsService().getRendition(-1, previewAvmPath)); - } - return result; - } - finally - { - rs.close(); - } - } - - private List regenerateRenditions() - { - final String stagingStoreName = this.selectedWebProject.getStoreId(); - final String previewStoreName = AVMUtil.getCorrespondingPreviewStoreName(stagingStoreName); - getAvmSyncService().resetLayer(AVMUtil.buildStoreRootPath(previewStoreName)); - - final SearchParameters sp = new SearchParameters(); - final StoreRef storeRef = AVMNodeConverter.ToStoreRef(this.selectedWebProject.getStagingStore()); - sp.addStore(storeRef); - sp.setLanguage(SearchService.LANGUAGE_LUCENE); - StringBuilder query = new StringBuilder(128); - if (this.regenerateScope.equals(REGENERATE_SCOPE_ALL) || - this.regenerateScope.equals(REGENERATE_SCOPE_FORM)) - { - query.append("+ASPECT:\"" + WCMAppModel.ASPECT_FORM_INSTANCE_DATA + "\""); - query.append(" -ASPECT:\"" + WCMAppModel.ASPECT_RENDITION + "\""); - } - else - { - query.append("+ASPECT:\"" + WCMAppModel.ASPECT_RENDITION + "\""); - } - - if (this.regenerateScope.equals(REGENERATE_SCOPE_FORM) && - this.selectedForms != null) - { - query.append(" +("); - for (int i = 0; i < this.selectedForms.length; i++) - { - query.append("@" + Repository.escapeQName(WCMAppModel.PROP_PARENT_FORM_NAME) + - ":\"" + this.selectedForms[i] + "\""); - if (i != this.selectedForms.length - 1) - { - query.append(" OR "); - } - } - query.append(") "); - } - - if (this.regenerateScope.equals(REGENERATE_SCOPE_RENDERING_ENGINE_TEMPLATE) && - this.selectedRenderingEngineTemplates != null) - { - query.append(" +("); - for (int i = 0; i < this.selectedRenderingEngineTemplates.length; i++) - { - String[] parts = this.selectedRenderingEngineTemplates[i].split(":"); - String formName = parts[0]; - String templateName = parts[1]; - try - { - Form f = this.selectedWebProject.getForm(formName); - RenderingEngineTemplate ret = - f.getRenderingEngineTemplate(templateName); - query.append("@" + Repository.escapeQName(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE) + - ":\"" + ((RenderingEngineTemplateImpl)ret).getNodeRef() + "\""); - - if (i != this.selectedRenderingEngineTemplates.length - 1) - { - query.append(" OR "); - } - } - catch (FormNotFoundException fnfe) - { - logger.warn("regenerating renditions of template " + templateName + ": " + fnfe.getMessage(), fnfe); - } - } - query.append(") "); - } - - if (logger.isDebugEnabled()) - { - logger.debug("running query " + query); - } - - sp.setQuery(query.toString()); - final ResultSet rs = getSearchService().query(sp); - try - { - if (logger.isDebugEnabled()) - { - logger.debug("received " + rs.length() + " results"); - } - - final List result = new ArrayList(rs.length()); - for (final ResultSetRow row : rs) - { - final String avmPath = AVMNodeConverter.ToAVMVersionPath(row.getNodeRef()).getSecond(); - final String previewAvmPath = AVMUtil.getCorrespondingPathInPreviewStore(avmPath); - if (this.regenerateScope.equals(REGENERATE_SCOPE_ALL) || - this.regenerateScope.equals(REGENERATE_SCOPE_FORM)) - { - FormInstanceData fid = null; - try - { - fid = this.formsService.getFormInstanceData(-1, previewAvmPath); - final List regenResults = fid.regenerateRenditions(); - for (final FormInstanceData.RegenerateResult rr : regenResults) - { - if (rr.getException() != null) - { - Utils.addErrorMessage("error regenerating rendition using " + - rr.getRenderingEngineTemplate().getName() + - ": " + rr.getException().getMessage(), - rr.getException()); - } - else - { - result.add(rr.getRendition()); - } - if (rr.getRendition() != null) - { - getAvmLockingService().removeLock(AVMUtil.getStoreId(rr.getRendition().getPath()), - AVMUtil.getStoreRelativePath(rr.getRendition().getPath())); - } - } - } - catch (FormNotFoundException fnfe) - { - logger.warn("regenerating renditions of " + previewAvmPath + ": " + fnfe.getMessage(), fnfe); - } - } - else - { - final Rendition r = this.formsService.getRendition(-1, previewAvmPath); - try - { - r.regenerate(); - result.add(r); - - getAvmLockingService().removeLock(AVMUtil.getStoreId(r.getPath()), AVMUtil.getStoreRelativePath(r.getPath())); - } - catch (TemplateNotFoundException tnfe) - { - logger.warn("regenerating renditions of " + previewAvmPath + ": " + tnfe.getMessage(), tnfe); - } - catch (IllegalArgumentException iae) - { - logger.warn("regenerating renditions of " + previewAvmPath + ": " + iae.getMessage(), iae); - } - catch (Exception e) - { - Utils.addErrorMessage("error regenerating rendition using " + - r.getRenderingEngineTemplate().getName() + - ": " + e.getMessage(), - e); - } - } - } - return result; - } - finally - { - rs.close(); - } - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/ReleaseTestServerDialog.java b/source/java/org/alfresco/web/bean/wcm/ReleaseTestServerDialog.java deleted file mode 100644 index 1d9ad8e1e8..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/ReleaseTestServerDialog.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; - -import org.alfresco.model.WCMAppModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.web.app.AlfrescoNavigationHandler; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.jsf.FacesContextUtils; - -/** - * Bean implementation for the "Release Test Server" dialog - * - * @author gavinc - */ -public class ReleaseTestServerDialog extends BaseDialogBean -{ - protected String store; - - private static final long serialVersionUID = -3702005115210010993L; - - private static final Log logger = LogFactory.getLog(ReleaseTestServerDialog.class); - - // ------------------------------------------------------------------------------ - // Dialog implementation - - @Override - public void init(Map parameters) - { - super.init(parameters); - - this.store = parameters.get("store"); - - if (this.store == null || this.store.length() == 0) - { - throw new IllegalArgumentException("store parameter is mandatory"); - } - } - - @SuppressWarnings("unchecked") - @Override - protected String finishImpl(FacesContext context, String outcome) - throws Exception - { - - WebApplicationContext wac = FacesContextUtils.getRequiredWebApplicationContext(context); - NodeService unprotectedNodeService = (NodeService)wac.getBean("nodeService"); - - List testServers = DeploymentUtil.findAllocatedTestServers(this.store); - for(NodeRef testServer : testServers) - { - unprotectedNodeService.setProperty(testServer, - WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO, null); - - if (logger.isDebugEnabled()) - logger.debug("Released test server '" + testServer + "' from store: " + this.store); - } - - // close dialog and refresh website view -// return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + -// AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browseWebsite"; - return(outcome); - } - - @Override - public boolean getFinishButtonDisabled() - { - return false; - } - - @Override - public String getFinishButtonLabel() - { - return Application.getMessage(FacesContext.getCurrentInstance(), "yes"); - } - - @Override - public String getCancelButtonLabel() - { - return Application.getMessage(FacesContext.getCurrentInstance(), "no"); - } - - // ------------------------------------------------------------------------------ - // Bean Getters and Setters - - /** - * Returns the confirmation to display to the user before deleting the reports. - * - * @return The message to display - */ - public String getConfirmMessage() - { - return Application.getMessage(FacesContext.getCurrentInstance(), "release_server_confirm"); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/RemovePermissionsDialog.java b/source/java/org/alfresco/web/bean/wcm/RemovePermissionsDialog.java deleted file mode 100644 index 175c0d0d6e..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/RemovePermissionsDialog.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.text.MessageFormat; -import java.util.Map; -import java.util.Set; - -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; - -import org.alfresco.service.cmr.security.AccessPermission; -import org.alfresco.web.app.Application; -import org.alfresco.web.ui.common.component.UIActionLink; - -/** - * Class for RemovePermissions dialog - * - * @author Sergei Gavrusev - */ -public class RemovePermissionsDialog extends UpdatePermissionsDialog -{ - private static final long serialVersionUID = 7804466683515156182L; - - private static final String MSG_YES = "yes"; - private static final String MSG_NO = "no"; - private static final String MSG_REMOVE_PERMS_FOR = "remove_permissions_title"; - private String personAuthority = null; - - @Override - public boolean getFinishButtonDisabled() - { - return false; - } - - @Override - public String getFinishButtonLabel() - { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_YES); - } - - @Override - public String getCancelButtonLabel() - { - - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_NO); - } - - @Override - public String getContainerTitle() - { - - FacesContext fc = FacesContext.getCurrentInstance(); - String pattern = Application.getMessage(fc, MSG_REMOVE_PERMS_FOR); - return MessageFormat.format(pattern, personAuthority); - - } - - - @Override - public void init(Map parameters) - { - super.init(parameters); - setActiveNode(getAvmBrowseBean().getAvmActionNode()); - } - - - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - - removePermissions(getActiveNode()); - createLock(getActiveNode()); - - return outcome; - } - - /** - * Remove permission from node - * - * @param node - */ - private void removePermissions(AVMNode node) - { - Set permsForRemove = ManagePermissionsDialog.getPermissionsForType(); - Set allSetPerms = getPermissionService().getAllSetPermissions(node.getNodeRef()); - for (AccessPermission perm : allSetPerms) - { - if (perm.getAuthority().equals(personAuthority) && permsForRemove.contains(perm.getPermission())) - { - getPermissionService().deletePermission(node.getNodeRef(), personAuthority, perm.getPermission()); - - } - } - } - - /** - * @param event - */ - public void setupAction(ActionEvent event) - { - - UIActionLink link = (UIActionLink) event.getComponent(); - Map params = link.getParameterMap(); - personAuthority = params.get("userName"); - } - -} diff --git a/source/java/org/alfresco/web/bean/wcm/RevertAllDialog.java b/source/java/org/alfresco/web/bean/wcm/RevertAllDialog.java deleted file mode 100644 index 3164049992..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/RevertAllDialog.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.text.MessageFormat; - -import javax.faces.application.FacesMessage; -import javax.faces.context.FacesContext; - -import org.alfresco.wcm.sandbox.SandboxService; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.repository.Repository; - -/** - * Revert (undo) all files in the current user sandbox. - * - * @author Kevin Roast - */ -public class RevertAllDialog extends BaseDialogBean -{ - private static final long serialVersionUID = 2693006540783155474L; - - private static final String MSG_REVERTALL_SUCCESS = "revertall_success"; - - protected AVMBrowseBean avmBrowseBean; - transient private SandboxService sbService; - - public void setSandboxService(SandboxService sbService) - { - this.sbService = sbService; - } - - protected SandboxService getSandboxService() - { - if (this.sbService == null) - { - this.sbService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSandboxService(); - } - return this.sbService; - } - - /** - * @param avmBrowseBean The AVM BrowseBean to set - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - String webApp = this.avmBrowseBean.getWebapp(); - String userSandboxId = this.avmBrowseBean.getSandbox(); - - getSandboxService().revertWebApp(userSandboxId, webApp); - - String msg = MessageFormat.format(Application.getMessage( - context, MSG_REVERTALL_SUCCESS), this.avmBrowseBean.getUsername()); - FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg); - context.addMessage(AVMBrowseBean.FORM_ID + ':' + AVMBrowseBean.COMPONENT_SANDBOXESPANEL, facesMsg); - - return outcome; - } - - /** - * @return the confirmation to display to the user - */ - public String getConfirmMessage() - { - return Application.getMessage(FacesContext.getCurrentInstance(), "revert_all_confirm"); - } - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#getFinishButtonDisabled() - */ - @Override - public boolean getFinishButtonDisabled() - { - return false; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/RevertSelectedDialog.java b/source/java/org/alfresco/web/bean/wcm/RevertSelectedDialog.java deleted file mode 100644 index 8152f53847..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/RevertSelectedDialog.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; - -import javax.faces.application.FacesMessage; -import javax.faces.context.FacesContext; - -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.wcm.sandbox.SandboxService; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.repository.Repository; - -/** - * Revert (undo) the selected files in the current user sandbox. - * - * @author Kevin Roast - */ -public class RevertSelectedDialog extends BaseDialogBean -{ - private static final long serialVersionUID = -8432152646736206685L; - - private static final String MSG_REVERTSELECTED_SUCCESS = "revertselected_success"; - - protected AVMBrowseBean avmBrowseBean; - transient private SandboxService sbService; - - /** - * @param avmBrowseBean The AVM BrowseBean to set - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - public void setSandboxService(SandboxService sbService) - { - this.sbService = sbService; - } - - protected SandboxService getSandboxService() - { - if (this.sbService == null) - { - this.sbService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSandboxService(); - } - return this.sbService; - } - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - String userSandboxId = this.avmBrowseBean.getSandbox(); - - List selected = this.avmBrowseBean.getSelectedSandboxItems(); - if (selected != null && selected.size() > 0) - { - List relativePaths = new ArrayList(selected.size()); - for (AVMNodeDescriptor node : selected) - { - relativePaths.add(AVMUtil.getStoreRelativePath(node.getPath())); - } - - getSandboxService().revertList(userSandboxId, relativePaths); - - String msg = MessageFormat.format(Application.getMessage( - context, MSG_REVERTSELECTED_SUCCESS), this.avmBrowseBean.getUsername()); - FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg); - context.addMessage(AVMBrowseBean.FORM_ID + ':' + AVMBrowseBean.COMPONENT_SANDBOXESPANEL, facesMsg); - } - - return outcome; - } - - /** - * @return the confirmation to display to the user - */ - public String getConfirmMessage() - { - return Application.getMessage(FacesContext.getCurrentInstance(), "revert_selected_confirm"); - } - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#getFinishButtonDisabled() - */ - @Override - public boolean getFinishButtonDisabled() - { - return false; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/RevertSnapshotDialog.java b/source/java/org/alfresco/web/bean/wcm/RevertSnapshotDialog.java deleted file mode 100644 index 9d932b1216..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/RevertSnapshotDialog.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.text.MessageFormat; -import java.util.Map; - -import javax.faces.context.FacesContext; - -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.dialog.BaseDialogBean; - -/** - * Revert snapshot - * @author valerysh - * - */ -public class RevertSnapshotDialog extends BaseDialogBean -{ - private static final String MSG_REVERT_SNAPSHOT_CONFIRM = "revert_snapshot_confirm"; - - protected AVMBrowseBean avmBrowseBean; - - Map parameters; - - /** - * @param avmBrowseBean The AVM BrowseBean to set - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - @Override - public void init(Map parameters) - { - super.init(parameters); - - this.parameters = parameters; - } - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - this.avmBrowseBean.revertSnapshot(parameters); - return outcome; - } - - /** - * @return the confirmation to display to the user - */ - public String getConfirmMessage() - { - return MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), MSG_REVERT_SNAPSHOT_CONFIRM), - parameters.get("version")); - } - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#getFinishButtonDisabled() - */ - @Override - public boolean getFinishButtonDisabled() - { - return false; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/SetPermissionsDialog.java b/source/java/org/alfresco/web/bean/wcm/SetPermissionsDialog.java deleted file mode 100644 index 2f4510cc56..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/SetPermissionsDialog.java +++ /dev/null @@ -1,519 +0,0 @@ -/* - * Copyright (C) 2005-2011 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.ResourceBundle; -import java.util.Set; - -import javax.faces.component.UISelectOne; -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; -import javax.faces.model.DataModel; -import javax.faces.model.ListDataModel; -import javax.faces.model.SelectItem; -import javax.transaction.UserTransaction; - -import org.alfresco.model.ContentModel; -import org.alfresco.query.PagingRequest; -import org.alfresco.query.PagingResults; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.service.cmr.security.PersonService.PersonInfo; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.ui.common.SortableSelectItem; -import org.alfresco.web.ui.common.Utils; -import org.alfresco.web.ui.common.component.UIGenericPicker; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Class for SetPermissions dialog - * - * @author Sergei Gavrusev - */ -public class SetPermissionsDialog extends UpdatePermissionsDialog -{ - private static final long serialVersionUID = -8139619811033232880L; - - /** logger */ - private static Log logger = LogFactory.getLog(SetPermissionsDialog.class); - - private static final String MSG_USERS = "users"; - private static final String MSG_GROUPS = "groups"; - - private static final String MSG_SET_PERMS_FOR = "set_permissions_title"; - - transient private AuthorityService authorityService; - transient private PersonService personService; - - transient private DataModel userPermsDataModel = null; - - private List childList = null; - private List userGroupPerms = null; - - /** - * @param authorityService The authorityService to set. - */ - public void setAuthorityService(final AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * Getter for authorityService - * - * @return authorityService - */ - protected AuthorityService getAuthorityService() - { - if (authorityService == null) - { - authorityService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAuthorityService(); - } - return authorityService; - } - - /** - * @param personService The PersonService to set. - */ - public void setPersonService(final PersonService personService) - { - this.personService = personService; - } - - /** - * Getter for personService - * - * @return personService - */ - - protected PersonService getPersonService() - { - if (personService == null) - { - personService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPersonService(); - } - return personService; - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.wcm.UpdatePermissionsDialog#init(java.util.Map) - */ - @Override - public void init(Map parameters) - { - super.init(parameters); - - setActiveNode(getAvmBrowseBean().getAvmActionNode()); - userGroupPerms = new ArrayList(8); - userPermsDataModel = null; - childList = new ArrayList(); - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.dialog.BaseDialogBean#getFinishButtonDisabled() - */ - @Override - public boolean getFinishButtonDisabled() - { - if (userGroupPerms.size() == 0) - return true; - else - return false; - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.dialog.BaseDialogBean#getContainerTitle() - */ - @Override - public String getContainerTitle() - { - - FacesContext fc = FacesContext.getCurrentInstance(); - String pattern = Application.getMessage(fc, MSG_SET_PERMS_FOR); - return MessageFormat.format(pattern, getActiveNode().getName()); - - } - - /* - * (non-Javadoc) - * - * @see org.alfresco.web.bean.wcm.BasePermissionsDialog#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - // check if any permissions was selected - if (userGroupPerms.size() > 0) - { - childList.add(getActiveNode().getDescriptor()); - setPermissions(getActiveNode().getDescriptor()); - createLock(getActiveNode()); - } - - return outcome; - } - - /** - * Set permissions for current node - * - * @param node - */ - private void setPermissions(final AVMNodeDescriptor node) - { - - for (int i = 0; i < userGroupPerms.size(); i++) - { - UserGroupPerm userGroupPerm = userGroupPerms.get(i); - final String authority = userGroupPerm.getAuthority(); - // find the selected permission ref from it's name and apply for the specified user - Set perms = ManagePermissionsDialog.getPermissionsForType(); - for (final String permission : perms) - { - if (userGroupPerm.getPermission().equals(permission)) - { - getPermissionService().setPermission(AVMNodeConverter.ToNodeRef(-1, node.getPath()), authority, permission, true); - - if (logger.isDebugEnabled()) - logger.debug("permission setted:" + permission); - break; - } - } - } - - } - - /** - * Property accessed by the Generic Picker component. - * - * @return The array of filter options to show in the users/groups picker - */ - public SelectItem[] getFilters() - { - ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); - - return new SelectItem[] { new SelectItem("0", bundle.getString(MSG_USERS)), new SelectItem("1", bundle.getString(MSG_GROUPS)) }; - } - - /** - * Query callback method executed by the Generic Picker component. This method is part of the contract to the Generic Picker, it is up to the backing bean to execute whatever - * query is appropriate and return the results. - * - * @param filterIndex Index of the filter drop-down selection - * @param contains Text from the contains textbox - * @return An array of SelectItem objects containing the results to display in the picker. - */ - public SelectItem[] pickerCallback(int filterIndex, String contains) - { - FacesContext context = FacesContext.getCurrentInstance(); - - SelectItem[] items; - - UserTransaction tx = null; - try - { - tx = Repository.getUserTransaction(context, true); - tx.begin(); - - List results = new ArrayList(); - - if (filterIndex == 0) - { - List persons = getPersonService().getPeople( - Utils.generatePersonFilter(contains.trim()), - true, - Utils.generatePersonSort(), - new PagingRequest(Utils.getPersonMaxResults(), null) - ).getPage(); - - for (int index = 0; index < persons.size(); index++) - { - PersonInfo person = persons.get(index); - String firstName = person.getFirstName(); - String lastName = person.getLastName(); - String username = person.getUserName(); - if (username != null) - { - SelectItem item = new SortableSelectItem(username, firstName + " " + lastName + " [" + username + "]", lastName); - results.add(item); - } - } - } - else - { - Set groups; - - if (contains != null && contains.startsWith("*")) - { - // if the search term starts with a wildcard use Lucene based search to find groups (results will be inconsistent) - String term = contains.trim() + "*"; - groups = getAuthorityService().findAuthorities(AuthorityType.GROUP, null, false, term, - AuthorityService.ZONE_APP_DEFAULT); - } - else - { - // all other searches use the canned query so search results are consistent - PagingResults pagedResults = getAuthorityService().getAuthorities(AuthorityType.GROUP, - AuthorityService.ZONE_APP_DEFAULT, contains, true, true, new PagingRequest(10000)); - groups = new LinkedHashSet(pagedResults.getPage()); - } - - // add the EVERYONE group to the results - groups.addAll(getAuthorityService().getAllAuthorities(AuthorityType.EVERYONE)); - - String groupDisplayName; - for (String group : groups) - { - // get display name, if not present strip prefix from group id - groupDisplayName = getAuthorityService().getAuthorityDisplayName(group); - if (groupDisplayName == null || groupDisplayName.length() == 0) - { - groupDisplayName = group.substring(PermissionService.GROUP_PREFIX.length()); - } - - results.add(new SortableSelectItem(group, groupDisplayName, groupDisplayName)); - } - } - - items = new SelectItem[results.size()]; - results.toArray(items); - Arrays.sort(items); - - // commit the transaction - tx.commit(); - } - catch (Throwable err) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); - try - { - if (tx != null) - { - tx.rollback(); - } - } - catch (Exception tex) - { - } - - items = new SelectItem[0]; - } - - return items; - } - - /** - * Action handler called when the Add button is pressed to process the current selection - */ - public void addSelection(ActionEvent event) - { - UIGenericPicker picker = (UIGenericPicker) event.getComponent().findComponent("picker"); - UISelectOne permissionPicker = (UISelectOne) event.getComponent().findComponent("permissions"); - - String[] results = picker.getSelectedResults(); - if (results != null) - { - String permission = (String) permissionPicker.getValue(); - if (permission != null) - { - for (int i = 0; i < results.length; i++) - { - addAuthorityWithPerm(results[i], permission); - } - } - } - } - - /** - * Add an authority with the specified permission to the list . - * - * @param authority Authority to add (cannot be null) - * @param permsission Permission for the authorities (cannot be null) - */ - public void addAuthorityWithPerm(String authority, String permsission) - { - // only add if authority not already present in the list with same role - boolean foundExisting = false; - for (int n = 0; n < userGroupPerms.size(); n++) - { - UserGroupPerm wrapper = userGroupPerms.get(n); - if (authority.equals(wrapper.getAuthority()) && (permsission.equals(wrapper.getPermission()))) - { - foundExisting = true; - break; - } - } - - if (foundExisting == false) - { - StringBuilder label = new StringBuilder(64); - - // build a display label showing the user and their role for the space - AuthorityType authType = AuthorityType.getAuthorityType(authority); - if (authType == AuthorityType.GUEST || authType == AuthorityType.USER) - { - if (authType == AuthorityType.GUEST || getPersonService().personExists(authority) == true) - { - // found a User authority - label.append(buildLabelForUserAuthorityPerm(authority, permsission)); - } - } - else - { - // found a group authority - label.append(buildLabelForGroupAuthorityPerm(authority, permsission)); - } - - userGroupPerms.add(new UserGroupPerm(authority, permsission, label.toString())); - } - } - - /** - * Action handler called when the Remove button is pressed to remove a user+permission - */ - public void removeSelection(ActionEvent event) - { - UserGroupPerm wrapper = (UserGroupPerm) getUserPermsDataModel().getRowData(); - if (wrapper != null) - { - userGroupPerms.remove(wrapper); - } - } - - /** - * Returns the properties for current user-roles JSF DataModel - * - * @return JSF DataModel representing the current user-permission - */ - public DataModel getUserPermsDataModel() - { - if (userPermsDataModel == null) - { - userPermsDataModel = new ListDataModel(); - } - - // only set the wrapped data once otherwise the rowindex is reset - if (userPermsDataModel.getWrappedData() == null) - { - userPermsDataModel.setWrappedData(userGroupPerms); - } - - return userPermsDataModel; - } - - /** - * Helper to build a label of the form: Firstname Lastname (permission) - */ - public String buildLabelForUserAuthorityPerm(String authority, String role) - { - // found a User authority - NodeRef ref = getPersonService().getPerson(authority); - String firstName = (String) getNodeService().getProperty(ref, ContentModel.PROP_FIRSTNAME); - String lastName = (String) getNodeService().getProperty(ref, ContentModel.PROP_LASTNAME); - - StringBuilder buf = new StringBuilder(100); - buf.append(firstName).append(" ").append(lastName != null ? lastName : "").append(" (").append(Application.getMessage(FacesContext.getCurrentInstance(), role)).append(")"); - - return buf.toString(); - } - - /** - * Helper to build a label for a Group authority of the form: Groupname (permission) - */ - public String buildLabelForGroupAuthorityPerm(String authority, String role) - { - StringBuilder buf = new StringBuilder(100); - buf.append(authority.substring(PermissionService.GROUP_PREFIX.length())).append(" (").append(Application.getMessage(FacesContext.getCurrentInstance(), role)).append(")"); - - return buf.toString(); - } - - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException - { - in.defaultReadObject(); - - userPermsDataModel = new ListDataModel(); - userPermsDataModel.setWrappedData(userGroupPerms); - - } - - /** - * @return The list of available permissions for the users/groups - */ - public SelectItem[] getPermissions() - { - - return WCMPermissionsUtils.getPermissions(); - } - - /** - * Simple wrapper class to represent a user/group and a permission combination - */ - public static class UserGroupPerm implements Serializable - { - private static final long serialVersionUID = -1546705703700113861L; - - public UserGroupPerm(String authority, String permission, String label) - { - this.authority = authority; - this.permission = permission; - this.label = label; - } - - public String getAuthority() - { - return authority; - } - - public String getPermission() - { - return permission; - } - - public String getLabel() - { - return label; - } - - private String authority; - private String permission; - private String label; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/SnapshotSandboxDialog.java b/source/java/org/alfresco/web/bean/wcm/SnapshotSandboxDialog.java deleted file mode 100644 index cd557278ea..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/SnapshotSandboxDialog.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.text.MessageFormat; -import java.util.Map; - -import javax.faces.context.FacesContext; - -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.repository.Repository; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Backing bean for the Snaphost Sandbox dialog. - * - * @author Kevin Roast - */ -public class SnapshotSandboxDialog extends BaseDialogBean -{ - private static final long serialVersionUID = -7325435181889945320L; - - private static final Log logger = LogFactory.getLog(SnapshotSandboxDialog.class); - - private static final String MSG_SNAPSHOT_FAILURE = "snapshot_failure"; - private static final String MSG_SNAPSHOT_SUCCESS = "snapshot_success"; - - transient private AVMService avmService; - protected AVMBrowseBean avmBrowseBean; - - private String label; - private String description; - - - /** - * @param avmBrowseBean The avmBrowseBean to set. - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @param avmService The avmService to set. - */ - public void setAvmService(AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (this.avmService == null) - { - this.avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - return this.avmService; - } - - /** - * @return Returns the snapshot description. - */ - public String getDescription() - { - return this.description; - } - - /** - * @param description The snapshot description to set. - */ - public void setDescription(String description) - { - this.description = description; - } - - /** - * @return Returns the snaphost label. - */ - public String getLabel() - { - return this.label; - } - - /** - * @param label The snapshot label to set. - */ - public void setLabel(String label) - { - this.label = label; - } - - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map) - */ - @Override - public void init(Map parameters) - { - super.init(parameters); - this.label = null; - this.description = null; - } - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - // find the previous version - to see if a snapshot was acutally performed - int oldVersion = this.getAvmService().getLatestSnapshotID(this.avmBrowseBean.getSandbox()); - int version = this.getAvmService().createSnapshot( - this.avmBrowseBean.getSandbox(), this.label, this.description) - .get(this.avmBrowseBean.getSandbox()); - if (version > oldVersion) - { - // a new snapshot was created - String msg = MessageFormat.format(Application.getMessage( - context, MSG_SNAPSHOT_SUCCESS), this.label, this.avmBrowseBean.getSandbox()); - this.avmBrowseBean.displayStatusMessage(context, msg); - } - else - { - // no changes had occured - no snapshot was required - String msg = Application.getMessage(context, MSG_SNAPSHOT_FAILURE); - this.avmBrowseBean.displayStatusMessage(context, msg); - } - - return outcome; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/SubmitConfigureWorkflowDialog.java b/source/java/org/alfresco/web/bean/wcm/SubmitConfigureWorkflowDialog.java deleted file mode 100644 index d3e286c13c..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/SubmitConfigureWorkflowDialog.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - - -/** - * Configure Workflow sub-dialog for the Submit Dialog. - * - * @author Kevin Roast - */ -public class SubmitConfigureWorkflowDialog extends FormWorkflowDialog -{ - private static final long serialVersionUID = 3828466420354771233L; - - protected SubmitDialog submitDialog; - - - /** - * @param submitDialog The SubmitDialog to set. - */ - public void setSubmitDialog(SubmitDialog submitDialog) - { - this.submitDialog = submitDialog; - } - - - /** - * @return an object representing the workflow for the current action - */ - @Override - public WorkflowConfiguration getActionWorkflow() - { - return this.submitDialog.getActionWorkflow(); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java b/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java deleted file mode 100644 index 00bb637e82..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java +++ /dev/null @@ -1,1137 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.Serializable; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Pattern; - -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; -import javax.transaction.UserTransaction; - -import org.alfresco.config.JNDIConstants; -import org.alfresco.model.ContentModel; -import org.alfresco.model.WCMAppModel; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.web.scripts.FileTypeImageUtils; -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.avmsync.AVMDifference; -import org.alfresco.service.cmr.avmsync.AVMSyncService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.workflow.WorkflowDefinition; -import org.alfresco.service.cmr.workflow.WorkflowService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.springframework.extensions.surf.util.ISO8601DateFormat; -import org.alfresco.util.NameMatcher; -import org.alfresco.wcm.sandbox.SandboxFactory; -import org.alfresco.wcm.sandbox.SandboxService; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.servlet.DownloadContentServlet; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.BrowseBean; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.forms.Form; -import org.alfresco.web.forms.FormInstanceData; -import org.alfresco.web.forms.FormNotFoundException; -import org.alfresco.web.forms.FormsService; -import org.alfresco.web.forms.Rendition; -import org.alfresco.web.ui.common.Utils; -import org.alfresco.web.ui.common.component.UIListItem; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Submit items for WCM workflow dialog. - * - * @author Kevin Roast - */ -public class SubmitDialog extends BaseDialogBean -{ - private static final long serialVersionUID = -2445905376358150000L; - - public static final String PARAM_LOAD_SELECTED_NODES_FROM_BROWSE_BEAN = "loadSelectedNodesFromBrowseBean"; - private static final String SPACE_ICON = "/images/icons/" + BrowseBean.SPACE_SMALL_DEFAULT + ".gif"; - private static final String MSG_DELETED_ITEM = "avm_node_deleted"; - private static final String MSG_ERR_WORKFLOW_CONFIG = "submit_workflow_config_error"; - - public static final String MSG_ERR_INVALID_LAUNCH_DATE = "msg_err_invalid_launch_date_on_submit"; - public static final String MSG_ERR_INVALID_EXPIRATION_DATE = "msg_err_invalid_expiration_date_on_submit"; - public static final String MSG_ERR_PATTERN_INVALID_EXPIRATION_DATE = "msg_err_pattern_invalid_expiration_date_on_submit"; - - private String comment; - private String label; - private String[] workflowSelectedValue; - private boolean enteringExpireDate = false; - private boolean loadSelectedNodesFromBrowseBean = false; - private boolean autoDeploy = false; - private Date defaultExpireDate; - private Date launchDate; - - private List submitItems; - private List warningItems; - private HashSet workflows; - private Map expirationDates; - private List workflowItems; - private Map workflowParams; - - protected AVMBrowseBean avmBrowseBean; - - transient private AVMService avmService; - transient private WorkflowService workflowService; - transient private AVMSyncService avmSyncService; - transient private FormsService formsService; - transient private SandboxFactory sandboxFactory; - transient private SandboxService sandboxService; - - transient private NameMatcher nameMatcher; - - - /** Current workflow for dialog context */ - protected WorkflowConfiguration actionWorkflow = null; - - private static final Log logger = LogFactory.getLog(SubmitDialog.class); - - /** - * @param avmService The AVM Service to set. - */ - public void setAvmService(AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (avmService == null) - { - avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - return avmService; - } - - /** - * @param avmSyncService The AVMSyncService to set. - */ - public void setAvmSyncService(AVMSyncService avmSyncService) - { - this.avmSyncService = avmSyncService; - } - - protected AVMSyncService getAvmSyncService() - { - if (this.avmSyncService == null) - { - this.avmSyncService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMSyncService(); - } - return this.avmSyncService; - } - - /** - * @param avmBrowseBean The AVM BrowseBean to set - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @param workflowService The WorkflowService to set. - */ - public void setWorkflowService(WorkflowService workflowService) - { - this.workflowService = workflowService; - } - - protected WorkflowService getWorkflowService() - { - if (workflowService == null) - { - workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService(); - } - return workflowService; - } - - /** - * @param nameMatcher The nameMatcher to set. - */ - public void setNameMatcher(NameMatcher nameMatcher) - { - this.nameMatcher = nameMatcher; - } - - /** - * @return nameMatcher - */ - protected NameMatcher getNameMatcher() - { - //check for null for cluster environment - if (nameMatcher == null) - { - nameMatcher = (NameMatcher) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "globalPathExcluder"); - } - return nameMatcher; - } - - /** - * @param formsService The FormsService to set. - */ - public void setFormsService(final FormsService formsService) - { - this.formsService = formsService; - } - - protected FormsService getFormsService() - { - if (formsService == null) - { - formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); - } - return formsService; - } - - public void setSandboxService(final SandboxService sandboxService) - { - this.sandboxService = sandboxService; - } - - protected SandboxService getSandboxService() - { - if (sandboxService == null) - { - sandboxService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSandboxService(); - } - return sandboxService; - } - - // TODO - refactor ... push down into sandbox service (submit to workflow) - public void setSandboxFactory(final SandboxFactory sandboxFactory) - { - this.sandboxFactory = sandboxFactory; - } - - protected SandboxFactory getSandboxFactory() - { - if (sandboxFactory == null) - { - sandboxFactory = (SandboxFactory) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "SandboxFactory"); - } - return sandboxFactory; - } - - - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map) - */ - @Override - public void init(Map parameters) - { - super.init(parameters); - - this.comment = null; - this.label = null; - this.submitItems = null; - this.warningItems = null; - this.workflowItems = null; - this.workflows = new HashSet(4); - this.expirationDates = new HashMap(8); - this.defaultExpireDate = new Date(); - this.workflowSelectedValue = null; - this.launchDate = null; - this.autoDeploy = false; - this.workflowParams = null; - - // determine if the dialog has been started from a workflow - this.loadSelectedNodesFromBrowseBean = Boolean.valueOf(this.parameters.get(PARAM_LOAD_SELECTED_NODES_FROM_BROWSE_BEAN)); - } - - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - // NOTE: This does not get called in this dialog as we have overridden finish() - - return null; - } - - @Override - public String finish() - { - // NOTE: We need to handle the transaction ourselves in this dialog as the store needs - // to be committed and the virtualisation server informed of the workflow - // sandbox BEFORE the workflow gets started. This is so that the link validation - // service can use the virtualisation server to produce the link report. - // The best solution would be for the link check node of the workflow to be - // asynchronous and to wait until the initiating transaction had committed - // before running but there's no support for this. - // We therefore need to use 2 transactions, one to create the workflow store - // (if necessary) and one to start the workflow - - if (getSubmitItemsSize() == 0) - { - return null; - } - - FacesContext context = FacesContext.getCurrentInstance(); - String outcome = null; - - // check the isFinished flag to stop the finish button - // being pressed multiple times - if (this.isFinished == false) - { - this.isFinished = true; - - try - { - // note: always submit via workflow (always defaults to direct submit workflow) - //outcome = submitViaWorkflow(context); - - String workflowName = null; - if ((this.workflowSelectedValue != null) && (this.workflowSelectedValue.length > 0)) - { - // get the defaults from the workflow configuration attached to the selected workflow - workflowName = this.workflowSelectedValue[0]; - for (FormWorkflowWrapper wrapper : this.workflows) - { - if (wrapper.name.equals(workflowName)) - { - this.workflowParams = wrapper.params; - } - } - - if (this.workflowParams == null) - { - // create error msg for display in dialog - the user must configure the workflow params - Utils.addErrorMessage(Application.getMessage(context, MSG_ERR_WORKFLOW_CONFIG)); - return outcome; - } - } - - final String finalWorkflowName = workflowName; - - List items = getSubmitItems(); - - final List relativePaths = new ArrayList(items.size()); - - for (ItemWrapper wrapper : items) - { - relativePaths.add(AVMUtil.getStoreRelativePath(wrapper.getDescriptor().getPath())); - } - - Date currentDate = new Date(); - if (launchDate !=null) - { - if (launchDate.before(currentDate)) - { - Utils.addErrorMessage(Application.getMessage(context, MSG_ERR_INVALID_LAUNCH_DATE)); - return null; - } - } - - if ((submitItems != null) && (!submitItems.isEmpty()) && (expirationDates != null) && (!expirationDates.isEmpty())) - { - StringBuilder errorMessage = new StringBuilder(); - byte errFlag = 0; - for (ItemWrapper wrapper : submitItems) - { - String key = wrapper.descriptor.getPath(); - Date expiritionDate = expirationDates.get(key); - if (expiritionDate != null) - { - if (launchDate != null) - { - if (expiritionDate.before(launchDate)) - { - errFlag = 1; - errorMessage.append(wrapper.descriptor.getName()).append(", "); - } - } - else - { - if (expiritionDate.before(currentDate)) - { - errorMessage.append(wrapper.descriptor.getName()).append(", "); - errFlag = 2; - } - } - } - } - if (errorMessage.length()>0) - { - errorMessage.delete(errorMessage.length()-2, errorMessage.length()); - } - switch (errFlag) - { - case 1: - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage(context, MSG_ERR_PATTERN_INVALID_EXPIRATION_DATE), errorMessage.toString())); - return null; - } - case 2: - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage(context, MSG_ERR_INVALID_EXPIRATION_DATE), errorMessage.toString())); - return null; - } - } - } - - final String sbStoreId = this.avmBrowseBean.getSandbox(); - - String submitLabel = this.label; - String submitComment = this.comment; - // crop to maximum length - if (submitLabel != null && submitLabel.length() > 255) - { - submitLabel = submitLabel.substring(0, 255); - } - if (submitComment != null && submitComment.length() > 255) - { - submitComment = submitComment.substring(0, 255); - } - - final String finalSubmitLabel = submitLabel; - final String finalSubmitComment = submitComment; - - // note: always submit via workflow (if no workflow selected, then defaults to direct submit workflow) - - // This nees to run with higher rights to push into the work flow store .... - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() { - - public Object doWork() throws Exception - { - getSandboxService().submitListAssets(sbStoreId, relativePaths, - finalWorkflowName, workflowParams, - finalSubmitLabel, finalSubmitComment, - expirationDates, launchDate, autoDeploy); - return null; - } - - }, AuthenticationUtil.getSystemUserName()); - - - // if we get this far return the default outcome - outcome = this.getDefaultFinishOutcome(); - } - finally - { - // reset the flag so we can re-attempt the operation - isFinished = false; - } - } - - return outcome; - } - /** - * @see org.alfresco.web.bean.dialog.BaseDialogBean#getFinishButtonDisabled() - */ - @Override - public boolean getFinishButtonDisabled() - { - return (getSubmitItemsSize() == 0); - } - - /** - * @return Returns the workflow comment. - */ - public String getComment() - { - return this.comment; - } - - /** - * @param comment The workflow comment to set. - */ - public void setComment(String comment) - { - this.comment = comment; - } - - /** - * @return Returns the snapshot label. - */ - public String getLabel() - { - return this.label; - } - - /** - * @param label The snapshot label to set. - */ - public void setLabel(String label) - { - this.label = label; - } - - /** - * @return The default expiration date - */ - public Date getDefaultExpireDate() - { - return this.defaultExpireDate; - } - - /** - * @param defaultExpireDate The default expiration date - */ - public void setDefaultExpireDate(Date defaultExpireDate) - { - this.defaultExpireDate = defaultExpireDate; - } - - /** - * @return true if a default expiration date is being entered - */ - public boolean isEnteringExpireDate() - { - return this.enteringExpireDate; - } - - /** - * @return Map of expiration dates for the modified items - */ - public Map getExpiredDates() - { - return this.expirationDates; - } - - /** - * @return Returns the workflow Selected Value. - */ - public String[] getWorkflowSelectedValue() - { - return this.workflowSelectedValue; - } - - /** - * @param workflowSelectedValue The workflow Selected Value to set. - */ - public void setWorkflowSelectedValue(String[] workflowSelectedValue) - { - this.workflowSelectedValue = workflowSelectedValue; - } - - /** - * @return Returns the content launch date - */ - public Date getLaunchDate() - { - return this.launchDate; - } - - /** - * @param launchDate The content launch date - */ - public void setLaunchDate(Date launchDate) - { - this.launchDate = launchDate; - } - - /** - * @return Flag to indicate whether the changes should be deployed upon approval - */ - public boolean isAutoDeploy() - { - return this.autoDeploy; - } - - /** - * @param autoDeploy Flag to indicate whether the changes should be deployed upon approval - */ - public void setAutoDeploy(boolean autoDeploy) - { - this.autoDeploy = autoDeploy; - } - - /** - * @return List of UIListItem object representing the available workflows for the website - */ - @SuppressWarnings("unchecked") - public List getWorkflowList() - { - if (this.workflowItems == null) - { - // ensure all workflows have been collected from any form generated assets - calcluateListItemsAndWorkflows(); - - // add the list of workflows for the website itself to the set - NodeRef websiteRef = this.avmBrowseBean.getWebsite().getNodeRef(); - List webWorkflowRefs = getNodeService().getChildAssocs( - websiteRef, WCMAppModel.ASSOC_WEBWORKFLOWDEFAULTS, RegexQNamePattern.MATCH_ALL); - List workflowMatchers = new ArrayList(webWorkflowRefs.size()); - for (ChildAssociationRef ref : webWorkflowRefs) - { - NodeRef wfDefaultsRef = ref.getChildRef(); - String wfName = (String)getNodeService().getProperty(wfDefaultsRef, WCMAppModel.PROP_WORKFLOW_NAME); - Map params = (Map)AVMWorkflowUtil.deserializeWorkflowParams( - wfDefaultsRef); - String matchPattern = (String)getNodeService().getProperty( - wfDefaultsRef, WCMAppModel.PROP_FILENAMEPATTERN); - if (matchPattern != null) - { - // add to temp list with the file name pattern - workflowMatchers.add(new FormWorkflowWrapper(wfName, params, matchPattern)); - } - } - - // perform match on each submitted file against available workflows - for (ItemWrapper wrapper : this.submitItems) - { - String path = wrapper.getPath(); - // shallow copy the list of matchers so we can remove items while looping - List matchers = new ArrayList(workflowMatchers); - for (int i=0; i items = new ArrayList(this.workflows.size()); - for (FormWorkflowWrapper wrapper : this.workflows) - { - WorkflowDefinition workflowDef = getWorkflowService().getDefinitionByName(wrapper.name); - UIListItem item = new UIListItem(); - item.setValue(workflowDef.getName()); - String label = workflowDef.getTitle(); - String desc = workflowDef.getDescription(); - if (desc != null && desc.length() > 0) - { - label = label + "(" + desc + ")"; - } - item.setLabel(label); - items.add(item); - - // add first workflow as default selection - if (workflowSelectedValue == null) - { - workflowSelectedValue = new String[]{ workflowDef.getName() }; - } - } - this.workflowItems = items; - } - - return this.workflowItems; - } - - /** - * @return size of the workflow selection list - */ - public int getWorkflowListSize() - { - return getWorkflowList().size(); - } - - /** - * @return the List of bean items to show in the Submit list - */ - public List getSubmitItems() - { - if (this.submitItems == null) - { - // this method builds all submit and warning item data structures - calcluateListItemsAndWorkflows(); - } - return this.submitItems; - } - - /** - * @return size of the submit list - */ - public int getSubmitItemsSize() - { - return getSubmitItems().size(); - } - - /** - * @return the List of bean items to show in the Warning list - */ - public List getWarningItems() - { - if (this.warningItems == null) - { - // this method builds all submit and warning item data structures - calcluateListItemsAndWorkflows(); - } - return this.warningItems; - } - - /** - * @return size of the warning list - */ - public int getWarningItemsSize() - { - return this.getWarningItems().size(); - } - - /** - * Calculate the lists of Submittable Items, Warning items and the list of available workflows. - */ - private void calcluateListItemsAndWorkflows() - { - UserTransaction tx = null; - - try - { - FacesContext context = FacesContext.getCurrentInstance(); - tx = Repository.getUserTransaction(context, true); - tx.begin(); - - List selected; - if (this.loadSelectedNodesFromBrowseBean) - { - // if the dialog was started from a workflow the AVM browse bean should - // have the list of nodes that need submitting - selected = this.avmBrowseBean.getNodesForSubmit(); - this.avmBrowseBean.setNodesForSubmit(null); - } - // if the dialog was started from the UI determine what nodes the user selected to submit - else if (this.avmBrowseBean.getAllItemsAction()) - { - String webapp = this.avmBrowseBean.getWebapp(); - String userStore = AVMUtil.buildStoreWebappPath(this.avmBrowseBean.getSandbox(), webapp); - String stagingStore = AVMUtil.buildStoreWebappPath(this.avmBrowseBean.getStagingStore(), webapp); - List diffs = this.getAvmSyncService().compare(-1, userStore, -1, stagingStore, getNameMatcher()); - selected = new ArrayList(diffs.size()); - for (AVMDifference diff : diffs) - { - selected.add(getAvmService().lookup(-1, diff.getSourcePath(), true)); - } - } - else if (this.avmBrowseBean.getAvmActionNode() == null) - { - // multiple items selected - selected = this.avmBrowseBean.getSelectedSandboxItems(); - } - else - { - // single item selected - selected = new ArrayList(1); - selected.add(getAvmService().lookup(-1, this.avmBrowseBean.getAvmActionNode().getPath(), true)); - } - - if (selected == null) - { - this.submitItems = Collections.emptyList(); - this.warningItems = Collections.emptyList(); - } - else - { - Set submittedPaths = new HashSet(selected.size()); - this.submitItems = new ArrayList(selected.size()); - this.warningItems = new ArrayList(selected.size() >> 1); - - for (AVMNodeDescriptor node : selected) - { - if (AVMWorkflowUtil.isInActiveWorkflow(AVMUtil.getStoreName(node.getPath()), node)) - { - this.warningItems.add(new ItemWrapper(node)); - continue; - } - NodeRef ref = AVMNodeConverter.ToNodeRef(-1, node.getPath()); - if (submittedPaths.contains(node.getPath())) - { - continue; - } - - boolean isForm = getNodeService().hasAspect(ref, WCMAppModel.ASPECT_FORM_INSTANCE_DATA); - boolean isRendition = getNodeService().hasAspect(ref, WCMAppModel.ASPECT_RENDITION); - - if (((!isForm) && (!isRendition)) || (node.isDeleted() && (!isForm))) - { - // found single item for submit - // note: could be a single deleted rendition - to enable deletion of old renditions (eg. if template no longer applicable) - this.submitItems.add(new ItemWrapper(node)); - submittedPaths.add(node.getPath()); - } - else - { - // item is a form (note: could be deleted) or a rendition - - FormInstanceData fid = null; - try - { - if (isRendition) - { - // found a generated rendition asset - locate the parent form instance data file - // and use this to find all generated assets that are appropriate - // NOTE: this path value is store relative - fid = getFormsService().getRendition(ref).getPrimaryFormInstanceData(true); - } - else - { - fid = getFormsService().getFormInstanceData(ref); - } - } - catch (FormNotFoundException fnfe) - { - logger.warn(fnfe); - } - - if (fid != null) - { - // add the form instance data file to the list for submission - if (!submittedPaths.contains(fid.getPath())) - { - this.submitItems.add(new ItemWrapper(getAvmService().lookup(-1, fid.getPath(), true))); - submittedPaths.add(fid.getPath()); - } - - // locate renditions for this form instance data file and add to list for submission - for (final Rendition rendition : fid.getRenditions(true)) - { - final String renditionPath = rendition.getPath(); - if (!submittedPaths.contains(renditionPath)) - { - this.submitItems.add(new ItemWrapper(getAvmService().lookup(-1, renditionPath, true))); - submittedPaths.add(renditionPath); - } - } - - // lookup the workflow defaults for that form and store into the list of available workflows - Form f = null; - try - { - f = fid.getForm(); - WorkflowDefinition defaultWfDef = f.getDefaultWorkflow(); - if (defaultWfDef != null) - { - this.workflows.add(new FormWorkflowWrapper(defaultWfDef.getName(), - fid.getForm().getDefaultWorkflowParameters())); - } - } - catch (FormNotFoundException fnfe) - { - logger.warn(fnfe); - } - } - - // See WCM-1090 ACT-1551 - // cannot depend on renditions of the form instance to contain the present - // node. Add it here if it hasn't been added by the above process. - if (!submittedPaths.contains(node.getPath())) - { - this.submitItems.add(new ItemWrapper(node)); - submittedPaths.add(node.getPath()); - } - } - } - } - - tx.commit(); - } - catch (Throwable e) - { - // rollback the transaction on error - try { if (tx != null) {tx.rollback();} } catch (Exception ex) {} - - // rethrow the exception to highlight the problem - throw (RuntimeException)e; - } - } - - /** - * Action method to setup a workflow for dialog context for the current row - */ - public void setupConfigureWorkflow(ActionEvent event) - { - if (this.workflowSelectedValue != null) - { - String workflowName = this.workflowSelectedValue[0]; - for (WorkflowConfiguration wrapper : this.workflows) - { - if (wrapper.getName().equals(workflowName)) - { - setActionWorkflow(wrapper); - } - } - } - } - - /** - * @return Returns the action Workflow for dialog context - */ - public WorkflowConfiguration getActionWorkflow() - { - return this.actionWorkflow; - } - - /** - * @param actionWorkflow The action Workflow to set for dialog context - */ - public void setActionWorkflow(WorkflowConfiguration actionWorkflow) - { - this.actionWorkflow = actionWorkflow; - } - - /** - * Applies the entered default date to all modified items - * - * @param event The event - */ - public void applyDefaultExpireDateToAll(ActionEvent event) - { - if (logger.isDebugEnabled()) - logger.debug("applying default expiration date of " + this.defaultExpireDate + " to all modified items"); - - List items = this.getSubmitItems(); - for (ItemWrapper item : items) - { - if (item.descriptor.getType() == 0) - { - this.expirationDates.put(item.descriptor.getPath(), this.defaultExpireDate); - } - } - - this.enteringExpireDate = false; - } - - /** - * Toggles the enteringExpireDate flag - * - * @param event The event - */ - public void enterExpireDate(ActionEvent event) - { - this.enteringExpireDate = true; - } - - /** - * Simple structure class to wrap form workflow name and default parameter values - */ - private static class FormWorkflowWrapper implements WorkflowConfiguration - { - private static final long serialVersionUID = -6264439015998987731L; - - private String name; - private Map params; - private QName type; - private String strFilenamePattern; - private Pattern filenamePattern; - - FormWorkflowWrapper(String name, Map params) - { - this.name = name; - this.params = params; - } - - FormWorkflowWrapper(String name, Map params, String filenamePattern) - { - this.name = name; - this.params = params; - setFilenamePattern(filenamePattern); - } - - public String getName() - { - return this.name; - } - - public String getFilenamePattern() - { - return this.strFilenamePattern; - } - - public void setFilenamePattern(String pattern) - { - if (pattern != null) - { - this.strFilenamePattern = pattern; - this.filenamePattern = Pattern.compile(pattern); - } - } - - public Map getParams() - { - return this.params; - } - - public void setParams(Map params) - { - this.params = params; - } - - public QName getType() - { - return this.type; - } - - public void setType(QName type) - { - this.type = type; - } - - boolean matchesPath(String path) - { - return (filenamePattern != null && - filenamePattern.matcher(path).matches()); - } - - @Override - public int hashCode() - { - return this.name.hashCode(); - } - - @Override - public boolean equals(Object obj) - { - return (obj instanceof FormWorkflowWrapper && - this.name.equals(((FormWorkflowWrapper)obj).name)); - } - } - - /** - * Wrapper class to provide UI RichList component getters for an AVM node descriptor - */ - public class ItemWrapper implements Serializable - { - private static final long serialVersionUID = 6079164681664703986L; - - private static final String rootPath = '/' + JNDIConstants.DIR_DEFAULT_APPBASE; - private AVMNodeDescriptor descriptor; - - public ItemWrapper(AVMNodeDescriptor descriptor) - { - this.descriptor = descriptor; - } - - public boolean getFile() - { - return this.descriptor.isFile(); - } - - public boolean getExpirable() - { - return this.descriptor.isFile() && (this.descriptor.isDeleted() == false); - } - - public boolean getDeleted() - { - return descriptor.isDeleted(); - } - - public String getName() - { - String result = descriptor.getName(); - if (descriptor.isDeleted()) - { - result += " [" + Application.getMessage(FacesContext.getCurrentInstance(), MSG_DELETED_ITEM) + "]"; - } - return result; - } - - public String getModifiedDate() - { - return ISO8601DateFormat.format(new Date(descriptor.getModDate())); - } - - public String getExpirationDate() - { - String expireDate = null; - - Date date = expirationDates.get(this.descriptor.getPath()); - if (date != null) - { - expireDate = ISO8601DateFormat.format(date); - } - - return expireDate; - } - - public String getDescription() - { - if (descriptor.isDeleted() == false) - { - return (String)getNodeService().getProperty( - AVMNodeConverter.ToNodeRef(-1, descriptor.getPath()), ContentModel.PROP_DESCRIPTION); - } - else - { - return ""; - } - } - - public String getPath() - { - return descriptor.getPath().substring(descriptor.getPath().indexOf(rootPath) + rootPath.length()); - } - - public String getFullPath() - { - return descriptor.getPath(); - } - - public String getUrl() - { - return DownloadContentServlet.generateBrowserURL( - AVMNodeConverter.ToNodeRef(-1, descriptor.getPath()), descriptor.getName()); - } - - public String getPreviewUrl() - { - return AVMUtil.getPreviewURI(descriptor.getPath()); - } - - public AVMNodeDescriptor getDescriptor() - { - return this.descriptor; - } - - public String getIcon() - { - return (descriptor.isFile() || descriptor.isDeletedFile() - ? FileTypeImageUtils.getFileTypeImage(descriptor.getName(), true) - : SPACE_ICON); - } - - @Override - public boolean equals(Object obj) - { - return (obj instanceof ItemWrapper && - ((ItemWrapper)obj).descriptor.getPath().equals(descriptor.getPath())); - } - - @Override - public int hashCode() - { - return descriptor.getPath().hashCode(); - } - } -} \ No newline at end of file diff --git a/source/java/org/alfresco/web/bean/wcm/UnlockFileDialog.java b/source/java/org/alfresco/web/bean/wcm/UnlockFileDialog.java deleted file mode 100644 index f83393fe2d..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/UnlockFileDialog.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.text.MessageFormat; - -import javax.faces.context.FacesContext; - -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.avm.locking.AVMLockingService; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.repository.Repository; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Bean implementation for the AVM "Unlock File" dialog - * - * @author Gavin Cornwell - */ -public class UnlockFileDialog extends BaseDialogBean -{ - private static final long serialVersionUID = -2985826502913718770L; - - private static final Log logger = LogFactory.getLog(UnlockFileDialog.class); - - protected AVMService avmService; - protected AVMLockingService lockingService; - protected AVMBrowseBean avmBrowseBean; - - /** - * @param avmBrowseBean The avmBrowseBean to set. - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @param avmService The avmService to set. - */ - public void setAvmService(AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (this.avmService == null) - { - this.avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - - return this.avmService; - } - - /** - * @param lockingService The avmLockingService to set. - */ - public void setAvmLockingService(AVMLockingService lockingService) - { - this.lockingService = lockingService; - } - - protected AVMLockingService getAvmLockingService() - { - if (this.lockingService == null) - { - this.lockingService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMLockingService(); - } - - return this.lockingService; - } - - // ------------------------------------------------------------------------------ - // Dialog implementation - - @Override - protected String finishImpl(final FacesContext context, final String outcome) - throws Exception - { - // get the content to delete - final AVMNode node = this.avmBrowseBean.getAvmActionNode(); - if (node == null) - { - logger.warn("WARNING: unlock called without a current AVM Node!"); - } - else - { - if (logger.isDebugEnabled()) - logger.debug("Trying to unlock AVM node: " + node.getPath()); - - this.getAvmLockingService().removeLock(this.avmBrowseBean.getWebProject().getStoreId(), - AVMUtil.getStoreRelativePath(node.getPath())); - } - - return outcome; - } - - @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 unlockConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(), - "unlock_file_confirm"); - - return MessageFormat.format(unlockConfirmMsg, - new Object[] {this.avmBrowseBean.getAvmActionNode().getName()}); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/UpdatePermissionsDialog.java b/source/java/org/alfresco/web/bean/wcm/UpdatePermissionsDialog.java deleted file mode 100644 index 342a598def..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/UpdatePermissionsDialog.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.Collections; -import java.util.Map; - -import javax.faces.context.FacesContext; - -import org.alfresco.service.cmr.avm.locking.AVMLockingService; -import org.alfresco.service.cmr.security.AuthenticationService; -import org.alfresco.wcm.util.WCMUtil; -import org.alfresco.web.bean.repository.Repository; - -/** - * Base class for Remove,Set,Edit Permissions dialogs - * - * @author Sergei Gavrusev - */ -public class UpdatePermissionsDialog extends BasePermissionsDialog -{ - private static final long serialVersionUID = 7189321059584956816L; - transient private AVMLockingService avmLockingService; - transient private AuthenticationService authenticationService; - - private AVMNode activeNode; - - @Override - public void init(Map parameters) - { - - super.init(parameters); - } - - /** - * @param avmLockingService The AVMLockingService to set. - */ - public void setAvmLockingService(final AVMLockingService avmLockingService) - { - this.avmLockingService = avmLockingService; - } - - protected AVMLockingService getAvmLockingService() - { - if (avmLockingService == null) - { - avmLockingService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMLockingService(); - } - return avmLockingService; - } - - /** - * @param authenticationService The AuthenticationService to set. - */ - protected void setAuthenticationService(final AuthenticationService authenticationService) - { - this.authenticationService = authenticationService; - } - - protected AuthenticationService getAuthenticationService() - { - if (authenticationService == null) - { - authenticationService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAuthenticationService(); - } - - return authenticationService; - } - - /** - * Create lock for node if it is necessary. Also create lock for children, if they inherit parent permissions. - */ - protected void createLock(AVMNode node) - { - String avmPath = node.getPath(); - String webProject = WCMUtil.getWebapp(avmPath); - String avmStore = WCMUtil.getStoreName(avmPath); - String relativePath = WCMUtil.getStoreRelativePath(avmPath); - - /* - * The logic doesn't look correct here. If the lock is held by another user, then the - * action is to DO NOTHING! - * TODO: Examine and fix - or remove this class completely - */ - if (getAvmLockingService().getLockOwner(webProject, relativePath) == null && !node.isDirectory()) - { - String userName = getAuthenticationService().getCurrentUserName(); - Map lockAttributes = Collections.singletonMap(WCMUtil.LOCK_KEY_STORE_NAME, avmStore); - getAvmLockingService().lock(webProject, relativePath, userName, lockAttributes); - } - } - - /** - * Getter for active node property - */ - public AVMNode getActiveNode() - { - return activeNode; - } - - /** - * Setter for active node property - */ - public void setActiveNode(final AVMNode activeNode) - { - this.activeNode = activeNode; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/ViewDeploymentReportDialog.java b/source/java/org/alfresco/web/bean/wcm/ViewDeploymentReportDialog.java deleted file mode 100644 index 74bc886e8c..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/ViewDeploymentReportDialog.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.text.MessageFormat; -import java.util.Map; - -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.ui.common.component.UIActionLink; -import org.alfresco.web.ui.common.component.UIModeList; -import org.alfresco.web.ui.wcm.component.UIDeploymentReports; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Views the deployment reports created as a result of the last deployment attempt - * - * @author gavinc - */ -public class ViewDeploymentReportDialog extends BaseDialogBean -{ - private static final long serialVersionUID = -8054466371051782132L; - - protected String store; - protected NodeRef attempt; - protected String attemptDate; - protected boolean panelExpanded = false; - protected String dateFilter = UIDeploymentReports.FILTER_DATE_WEEK; - - private static final Log logger = LogFactory.getLog(ViewDeploymentReportDialog.class); - - // ------------------------------------------------------------------------------ - // Dialog implementation - - @Override - public void init(Map parameters) - { - super.init(parameters); - - this.store = parameters.get("store"); - this.dateFilter = UIDeploymentReports.FILTER_DATE_WEEK; - this.panelExpanded = false; - this.attempt = null; - this.attemptDate = null; - - if (this.store == null || this.store.length() == 0) - { - throw new IllegalArgumentException("store parameter is mandatory"); - } - - if (logger.isDebugEnabled()) - logger.debug("Initialising dialog to view deployment report for: " + - this.store); - } - - @Override - public String getCancelButtonLabel() - { - return Application.getMessage(FacesContext.getCurrentInstance(), "close"); - } - - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - return outcome; - } - - @Override - public String getContainerDescription() - { - String desc = null; - - if (attempt == null) - { - desc = Application.getMessage(FacesContext.getCurrentInstance(), - "deployment_report_desc"); - } - else - { - desc = Application.getMessage(FacesContext.getCurrentInstance(), - "deployment_previous_report_desc"); - } - - return desc; - } - - @Override - public String getContainerTitle() - { - String title = null; - - if (attempt == null) - { - title = Application.getMessage(FacesContext.getCurrentInstance(), - "deployment_report_title"); - } - else - { - String pattern = Application.getMessage(FacesContext.getCurrentInstance(), - "deployment_previous_report_title"); - title = MessageFormat.format(pattern, this.attemptDate); - } - - return title; - } - - // ------------------------------------------------------------------------------ - // Event handlers - - /** - * Action handler called when the Date filter is changed by the user - */ - public void dateFilterChanged(ActionEvent event) - { - UIModeList filterComponent = (UIModeList)event.getComponent(); - setDateFilter(filterComponent.getValue().toString()); - } - - /** - * Action handler called when a deployment attempt is selected - */ - public void attemptSelected(ActionEvent event) - { - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - String attempt = params.get("attemptRef"); - if (attempt != null && attempt.length() != 0) - { - this.attemptDate = params.get("attemptDate"); - this.attempt = new NodeRef(attempt); - } - } - - /** - * Action handler called when the panel is expanded or collapsed - */ - public void panelToggled(ActionEvent event) - { - this.panelExpanded = !this.panelExpanded; - } - - /** - * Action handler called when user wants to go back to the last report - */ - public void showLastReport(ActionEvent event) - { - this.attempt = null; - this.attemptDate = null; - this.panelExpanded = false; - } - - // ------------------------------------------------------------------------------ - // Bean getters and setters - - public String getStore() - { - return this.store; - } - - public String getDateFilter() - { - return this.dateFilter; - } - - public void setDateFilter(String dateFilter) - { - this.dateFilter = dateFilter; - } - - public NodeRef getAttempt() - { - return this.attempt; - } - - public boolean getPanelExpanded() - { - return this.panelExpanded; - } -} \ No newline at end of file diff --git a/source/java/org/alfresco/web/bean/wcm/WCMCompareUtils.java b/source/java/org/alfresco/web/bean/wcm/WCMCompareUtils.java deleted file mode 100644 index e86855b8b7..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/WCMCompareUtils.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; - -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.avm.AVMStoreDescriptor; -import org.alfresco.service.cmr.avmsync.AVMDifference; -import org.alfresco.service.cmr.avmsync.AVMSyncService; -import org.alfresco.util.NameMatcher; -import org.alfresco.wcm.sandbox.SandboxService; -import org.alfresco.wcm.sandbox.SandboxVersion; -import org.alfresco.web.app.Application; - -/** - * AVMCompare Utils - * - * @author ValerySh - */ -public class WCMCompareUtils -{ - - /** - * Get a difference map between two corresponding node trees. - * - * @param avmSyncService AVMSyncService - * @param srcVersion The version id for the source tree. - * @param srcPath The avm path to the source tree. - * @param dstVersion The version id for the destination tree. - * @param dstPath The avm path to the destination tree. - * @param excluder A NameMatcher used to exclude files from consideration. - * @return list of compared objects - */ - public static List> getComparedNodes(AVMSyncService avmSyncService, int srcVersion, String srcPath, int dstVersion, String dstPath, NameMatcher excluder) - { - FacesContext context = FacesContext.getCurrentInstance(); - List compare = avmSyncService.compare(srcVersion, srcPath, dstVersion, dstPath, excluder); - List> result = new ArrayList>(); - for (AVMDifference diff : compare) - { - String path = diff.getSourcePath(); - Map node = new HashMap(); - String sandboxPath = AVMUtil.getSandboxPath(path); - node.put("path", path.replaceFirst(sandboxPath, "")); - node.put("name", path.substring(path.lastIndexOf("/") + 1)); - - String status; - switch (diff.getDifferenceCode()) - { - case AVMDifference.OLDER: - status = Application.getMessage(context, "avm_compare_older"); - break; - case AVMDifference.NEWER: - status = Application.getMessage(context, "avm_compare_newer"); - break; - case AVMDifference.SAME: - status = Application.getMessage(context, "avm_compare_same"); - break; - case AVMDifference.DIRECTORY: - status = Application.getMessage(context, "avm_compare_directory"); - break; - case AVMDifference.CONFLICT: - status = Application.getMessage(context, "avm_compare_conflict"); - break; - default: - status = ""; - } - node.put("status", status); - - result.add(node); - } - return result; - } - - /** - * checks the version of the first is accessible for Store - * - * @param versions versions of specified store. - * @param item Version - * @return true if version is first - */ - public static boolean isFirstVersion(List versions, SandboxVersion item) - { - boolean result = false; - if (versions.size() > 0) - { - if (item.getVersion() == Collections.min(versions, new SandboxVersionComparator()).getVersion()) - { - result = true; - } - } - return result; - } - - /** - * checks the version of the last is accessible for Store - * - * @param versions versions of specified store. - * @param item Version - * @return true if version is latest - */ - public static boolean isLatestVersion(List versions, SandboxVersion item) - { - boolean result = false; - if (versions.size() > 0) - { - if (item.getVersion() == Collections.max(versions, new SandboxVersionComparator()).getVersion()) - { - result = true; - } - } - return result; - } - - /** - * Get Previous Version Id - * - * @param sandboxService SandboxService - * @param name The name of the AVMStore - * @param version Current version Id - * @return Previous Version Id - */ - public static int getPrevVersionID(SandboxService sandboxService, String name, int version) - { - List allVersions = getAllVersionID(sandboxService, name); - Collections.sort(allVersions); - int index = allVersions.indexOf(version); - if (index == 0) - { - return 0; - } - else - { - if (index == -1) - { - return -1; - } - } - return allVersions.get(index - 1); - } - - /** - * Receive Stores List - * - * @param avmService AVMService - * @return List Stores name - */ - public static List receiveStoresList(AVMService avmService) - { - List result = new ArrayList(); - List storeDescs = avmService.getStores(); - for (AVMStoreDescriptor storeDesc : storeDescs) - { - if (!storeDesc.getCreator().equalsIgnoreCase(AuthenticationUtil.SYSTEM_USER_NAME) && !AVMUtil.isPreviewStore(storeDesc.getName())) - { - result.add(storeDesc.getName()); - } - } - return result; - } - - /** - * Get the versions id in an AVMStore - * - * @param sandboxService SandboxService - * @param store The name of the AVMStore - * @return List versions id - */ - public static List getAllVersionID(SandboxService sandboxService, String store) - { - List allVersions = sandboxService.listSnapshots(store, false); - List result = new ArrayList(); - for (SandboxVersion sandboxVersion : allVersions) - { - result.add(sandboxVersion.getVersion()); - } - return result; - } - - /** - * Comparator for SandboxVersion class - */ - private static class SandboxVersionComparator implements Comparator - { - - public int compare(SandboxVersion o1, SandboxVersion o2) - { - return ((Integer) o1.getVersion()).compareTo((Integer) o2.getVersion()); - } - - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/WCMPermissionsUtils.java b/source/java/org/alfresco/web/bean/wcm/WCMPermissionsUtils.java deleted file mode 100644 index 9819f6ef90..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/WCMPermissionsUtils.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.ResourceBundle; -import java.util.Set; - -import javax.faces.context.FacesContext; -import javax.faces.model.SelectItem; - -import org.alfresco.web.app.Application; - -public class WCMPermissionsUtils -{ - /** - * @return The list of available permissions for the users/groups - */ - public static SelectItem[] getPermissions() - { - ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); - - Set perms = ManagePermissionsDialog.getPermissionsForType(); - SelectItem[] permissions = new SelectItem[perms.size()]; - int index = 0; - for (String permission : perms) - { - String displayLabel = bundle.getString(permission); - permissions[index++] = new SelectItem(permission, displayLabel); - } - - return permissions; - } - -} diff --git a/source/java/org/alfresco/web/bean/wcm/WebProject.java b/source/java/org/alfresco/web/bean/wcm/WebProject.java deleted file mode 100644 index 6a97a91455..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/WebProject.java +++ /dev/null @@ -1,391 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; - -import org.alfresco.model.ContentModel; -import org.alfresco.model.WCMAppModel; -import org.alfresco.service.ServiceRegistry; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.wcm.sandbox.SandboxConstants; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.data.IDataContainer; -import org.alfresco.web.data.QuickSort; -import org.alfresco.web.forms.Form; -import org.alfresco.web.forms.FormImpl; -import org.alfresco.web.forms.FormNotFoundException; -import org.alfresco.web.forms.FormsService; -import org.alfresco.web.forms.RenderingEngineTemplate; -import org.alfresco.web.forms.RenderingEngineTemplateImpl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Provides configured data for a web project. - * - * @author Ariel Backenroth - */ -public class WebProject implements Serializable -{ - ///////////////////////////////////////////////////////////////////////////// - - private static final long serialVersionUID = 2480625511643744703L; - - /** - * Wraps a form object to provide overridden values at the web project level - */ - private class FormWrapper extends FormImpl - { - private static final long serialVersionUID = 1L; - - private final NodeRef formNodeRef; - private Form baseForm; - private NodeRef defaultWorkflowNodeRef; - - private FormWrapper(final Form form, - final NodeRef formNodeRef, - final FormsService formsService) - { - super(((FormImpl)form).getNodeRef(), formsService); - this.formNodeRef = formNodeRef; - } - - @Override - public String getTitle() - { - final NodeService nodeService = this.getServiceRegistry().getNodeService(); - return (String)nodeService.getProperty(this.formNodeRef, - ContentModel.PROP_TITLE); - } - - @Override - public String getDescription() - { - final NodeService nodeService = this.getServiceRegistry().getNodeService(); - return (String)nodeService.getProperty(this.formNodeRef, - ContentModel.PROP_DESCRIPTION); - } - - @Override - public String getOutputPathPattern() - { - final NodeService nodeService = this.getServiceRegistry().getNodeService(); - final String result = (String) - nodeService.getProperty(this.formNodeRef, - WCMAppModel.PROP_OUTPUT_PATH_PATTERN); - return (result != null ? result : this.baseForm.getOutputPathPattern()); - } - - @Override - protected NodeRef getDefaultWorkflowNodeRef() - { - if (this.defaultWorkflowNodeRef == null) - { - final NodeService nodeService = this.getServiceRegistry().getNodeService(); - final List workflowRefs = - nodeService.getChildAssocs(this.formNodeRef, - WCMAppModel.ASSOC_WORKFLOWDEFAULTS, - RegexQNamePattern.MATCH_ALL); - if (workflowRefs.size() == 0) - { - return null; - } - - this.defaultWorkflowNodeRef = workflowRefs.get(0).getChildRef(); - } - return this.defaultWorkflowNodeRef; - } - - @Override - protected Map loadRenderingEngineTemplates() - { - final Map allRets = super.loadRenderingEngineTemplates(); - - final NodeService nodeService = this.getServiceRegistry().getNodeService(); - final List retNodeRefs = - nodeService.getChildAssocs(this.formNodeRef, - WCMAppModel.ASSOC_WEBFORMTEMPLATE, - RegexQNamePattern.MATCH_ALL); - final Map result = - new HashMap(retNodeRefs.size(), 1.0f); - for (ChildAssociationRef car : retNodeRefs) - { - final String renderingEngineTemplateName = (String) - nodeService.getProperty(car.getChildRef(), - WCMAppModel.PROP_BASE_RENDERING_ENGINE_TEMPLATE_NAME); - final String outputPathPattern = (String) - nodeService.getProperty(car.getChildRef(), WCMAppModel.PROP_OUTPUT_PATH_PATTERN); - final RenderingEngineTemplateImpl ret = (RenderingEngineTemplateImpl) - allRets.get(renderingEngineTemplateName); - if (ret != null) - { - - result.put(ret.getName(), - new RenderingEngineTemplateImpl(ret.getNodeRef(), - ret.getRenditionPropertiesNodeRef(), - this.getFormsService()) - { - private static final long serialVersionUID = -5498865830153013192L; - - @Override - public String getOutputPathPattern() - { - return outputPathPattern; - } - }); - } - - } - return result; - } - } - - ///////////////////////////////////////////////////////////////////////////// - - private final static Log LOGGER = LogFactory.getLog(WebProject.class); - - private final NodeRef nodeRef; - private String storeId = null; - - public WebProject(final NodeRef nodeRef) - { - if (nodeRef == null) - { - throw new NullPointerException(); - } - - final NodeService nodeService = getServiceRegistry().getNodeService(); - if (!WCMAppModel.TYPE_AVMWEBFOLDER.equals(nodeService.getType(nodeRef))) - { - throw new IllegalArgumentException(nodeRef + " is not a " + WCMAppModel.TYPE_AVMWEBFOLDER); - } - - this.nodeRef = nodeRef; - } - - public WebProject(final String avmPath) - { - if (avmPath == null) - { - throw new NullPointerException(); - } - - final String stagingStore = AVMUtil.buildStagingStoreName(AVMUtil.getStoreId(AVMUtil.getStoreName(avmPath))); - final AVMService avmService = this.getServiceRegistry().getAVMService(); - this.nodeRef = (NodeRef) - avmService.getStoreProperty(stagingStore, - SandboxConstants.PROP_WEB_PROJECT_NODE_REF).getValue(DataTypeDefinition.NODE_REF); - } - - /** - * Returns the noderef for the webproject - * - * @return the noderef for the webproject. - */ - public NodeRef getNodeRef() - { - return this.nodeRef; - } - - /** - * Returns the name of the web project. - * - * @return the name of the web project. - * @deprecated - */ - public String getName() - { - // TODO refactor out ... - final NodeService nodeService = getServiceRegistry().getNodeService(); - return (String)nodeService.getProperty(this.nodeRef, ContentModel.PROP_NAME); - } - - /** - * Returns the title of the web project. - * - * @return the title of the web project. - * @deprecated - */ - public String getTitle() - { - // TODO refactor out ... - final NodeService nodeService = getServiceRegistry().getNodeService(); - return (String)nodeService.getProperty(this.nodeRef, ContentModel.PROP_TITLE); - } - - /** - * Returns the description of the web project. - * - * @return the description of the web project. - * @deprecated - */ - public String getDescription() - { - // TODO refactor out ... - final NodeService nodeService = getServiceRegistry().getNodeService(); - return (String)nodeService.getProperty(this.nodeRef, ContentModel.PROP_DESCRIPTION); - } - - /** - * Returns the store id for this web project. - * - * @return the store id for this web project. - * @deprecated - */ - public String getStoreId() - { - // TODO refactor out ... - if (this.storeId == null) - { - final NodeService nodeService = getServiceRegistry().getNodeService(); - this.storeId = (String)nodeService.getProperty(this.nodeRef, WCMAppModel.PROP_AVMSTORE); - } - return this.storeId; - } - - /** - * Returns the staging store name. - * - * @return the staging store name. - * @deprecated - */ - public String getStagingStore() - { - // TODO refactor out ... - return AVMUtil.buildStagingStoreName(this.getStoreId()); - } - - /** - * Returns the forms configured for this web project. - * - * @return the forms configured for this web project. - */ - public List getForms() - { - final List forms = new ArrayList(this.getFormsImpl().values()); - final QuickSort sorter = new QuickSort(forms, "name", true, IDataContainer.SORT_CASEINSENSITIVE); - sorter.sort(); - return Collections.unmodifiableList(forms); - } - - /** - * Returns the form with the given name or null if not found. - * - * @param name the name of the form - * @return the form or null if not found. - * @exception NullPointerException if the name is null. - */ - public Form getForm(final String name) - throws FormNotFoundException - { - if (name == null) - { - throw new NullPointerException(); - } - final Form result = this.getFormsImpl().get(name); - if (result == null || !name.equals(result.getName())) - { - if (result != null) - { - LOGGER.debug("removing " + name + - " from cache as it doesn't match mapped form " + result.getName()); - this.getFormsImpl().remove(name); - } - throw new FormNotFoundException(name, this); - } - return result; - } - - /** - * @return true if this WebProject has any workflows assigned directly to the website or - * assigned to any of the forms attached to it - */ - public boolean hasWorkflow() - { - // note: there's always a submit workflow, as direct to staging is now - // also routed via workflow - return true; - } - - private Map getFormsImpl() - { - final ServiceRegistry serviceRegistry = this.getServiceRegistry(); - final NodeService nodeService = serviceRegistry.getNodeService(); - final FormsService formsService = WebProject.getFormsService(); - final List formRefs = - nodeService.getChildAssocs(this.nodeRef, - WCMAppModel.ASSOC_WEBFORM, - RegexQNamePattern.MATCH_ALL); - Map result = new HashMap(formRefs.size(), 1.0f); - for (final ChildAssociationRef ref : formRefs) - { - final String formName = (String) - nodeService.getProperty(ref.getChildRef(), WCMAppModel.PROP_FORMNAME); - try - { - final Form baseForm = formsService.getWebForm(formName); - result.put(formName, new FormWrapper(baseForm, ref.getChildRef(), formsService)); - } - catch (FormNotFoundException fnfe) - { - LOGGER.debug("got exception " + fnfe.getMessage() + - " while loading web forms for project " + this.getName()); - } - } - return result; - } - - private static FormsService getFormsService() - { - return (FormsService)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), - "FormsService"); - } - - private static ServiceRegistry getServiceRegistry() - { - final FacesContext fc = FacesContext.getCurrentInstance(); - return Repository.getServiceRegistry(fc); - } - - public boolean equals(final Object other) - { - return (other != null && - other instanceof WebProject && - this.getNodeRef().equals(((WebProject)other).getNodeRef())); - } - - public int hashCode() - { - return this.nodeRef.hashCode(); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/WebSiteDetailsDialog.java b/source/java/org/alfresco/web/bean/wcm/WebSiteDetailsDialog.java deleted file mode 100644 index 2326f00b8c..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/WebSiteDetailsDialog.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (C) 2005-2012 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; - -import org.alfresco.model.ApplicationModel; -import org.alfresco.model.ContentModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.TemplateService; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.BaseDetailsBean; -import org.alfresco.web.bean.dialog.NavigationSupport; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.ui.common.NodeListUtils; -import org.alfresco.web.ui.common.NodePropertyComparator; -import org.alfresco.web.ui.common.component.UIActionLink; - -public class WebSiteDetailsDialog extends BaseDetailsBean implements NavigationSupport -{ - - private static final long serialVersionUID = -7951329243417867229L; - - private static final String MSG_DETAILS_OF = "details_of"; - private static final String MSG_LOCATION = "location"; - private final static String MSG_CLOSE = "close"; - private final static String MSG_LEFT_QUOTE = "left_qoute"; - private final static String MSG_RIGHT_QUOTE = "right_quote"; - - - /** - * Returns the Space this bean is currently representing - * - * @return The Space Node - */ - public Node getSpace() - { - return getNode(); - } - - @Override - protected Node getLinkResolvedNode() - { - Node space = getSpace(); - if (ApplicationModel.TYPE_FOLDERLINK.equals(space.getType())) - { - NodeRef destRef = (NodeRef) space.getProperties().get(ContentModel.PROP_LINK_DESTINATION); - if (getNodeService().exists(destRef)) - { - space = new Node(destRef); - } - } - return space; - } - - @Override - public Node getNode() - { - return this.browseBean.getActionSpace(); - } - - @Override - protected String getPropertiesPanelId() - { - return "space-props"; - } - - @Override - public Map getTemplateModel() - { - HashMap model = new HashMap(1, 1.0f); - - model.put("space", getSpace().getNodeRef()); - model.put(TemplateService.KEY_IMAGE_RESOLVER, imageResolver); - - return model; - - } - - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - return null; - } - - public String getCurrentItemId() - { - return getId(); - } - - public String getOutcome() - { - return "dialog:close:dialog:showSpaceDetails"; - } - - public void nextItem(ActionEvent event) - { - UIActionLink link = (UIActionLink) event.getComponent(); - Map params = link.getParameterMap(); - String id = params.get("id"); - if (id != null && id.length() != 0) - { - NodeRef currNodeRef = new NodeRef(Repository.getStoreRef(), id); - List nodes = this.browseBean.getParentNodes(currNodeRef); - Node next = null; - if (nodes.size() > 1) - { - String currentSortColumn = this.browseBean.getSpacesRichList().getCurrentSortColumn(); - boolean currentSortDescending = this.browseBean.getSpacesRichList().isCurrentSortDescending(); - Collections.sort(nodes, new NodePropertyComparator(currentSortColumn, !currentSortDescending)); - next = NodeListUtils.nextItem(nodes, id); - this.browseBean.setupSpaceAction(next.getId(), false); - } - if (next == null) - { - Node currNode = new Node(currNodeRef); - this.navigator.setupDispatchContext(currNode); - } - } - - } - - public void previousItem(ActionEvent event) - { - UIActionLink link = (UIActionLink) event.getComponent(); - Map params = link.getParameterMap(); - String id = params.get("id"); - if (id != null && id.length() != 0) - { - NodeRef currNodeRef = new NodeRef(Repository.getStoreRef(), id); - List nodes = this.browseBean.getParentNodes(currNodeRef); - Node previous = null; - if (nodes.size() > 1) - { - String currentSortColumn = this.browseBean.getSpacesRichList().getCurrentSortColumn(); - boolean currentSortDescending = this.browseBean.getSpacesRichList().isCurrentSortDescending(); - Collections.sort(nodes, new NodePropertyComparator(currentSortColumn, !currentSortDescending)); - previous = NodeListUtils.previousItem(nodes, id); - this.browseBean.setupSpaceAction(previous.getId(), false); - } - if (previous == null) - { - Node currNode = new Node(currNodeRef); - this.navigator.setupDispatchContext(currNode); - } - } - - } - - public String cancel() - { - this.navigator.resetCurrentNodeProperties(); - return super.cancel(); - } - - public String getCancelButtonLabel() - { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE); - } - - @Override - public String getContainerSubTitle() - { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + - getSpace().getNodePath().toDisplayPath(getNodeService(), getPermissionService()); - } - - public String getContainerTitle() - { - FacesContext fc = FacesContext.getCurrentInstance(); - return Application.getMessage(fc, MSG_DETAILS_OF) + " " + Application.getMessage(fc, MSG_LEFT_QUOTE) + getName() + Application.getMessage(fc, MSG_RIGHT_QUOTE); - } - -} diff --git a/source/java/org/alfresco/web/bean/wcm/WorkflowConfiguration.java b/source/java/org/alfresco/web/bean/wcm/WorkflowConfiguration.java deleted file mode 100644 index 696cf1959a..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/WorkflowConfiguration.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.bean.wcm; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.service.namespace.QName; - -/** - * Interface contract for wrapper classes that encapsulate workflow configuration data. - * - * @author Kevin Roast - */ -public interface WorkflowConfiguration extends Serializable -{ - /** - * @return definition name of the workflow - */ - public String getName(); - - /** - * @return the param map for the workflow - */ - public Map getParams(); - - /** - * @param params The param map for the workflow - */ - public void setParams(Map params); - - /** - * @return the filename pattern match regex for the workflow - */ - public String getFilenamePattern(); - - /** - * @param pattern The filename pattern match regex for the workflow - */ - public void setFilenamePattern(String pattern); - - /** - * @return the QName type of the underlying node representing the workflow - */ - public QName getType(); - - /** - * @param type QName type of the underlying node representing the workflow - */ - public void setType(QName type); -} diff --git a/source/java/org/alfresco/web/bean/wcm/preview/NullPreviewURIService.java b/source/java/org/alfresco/web/bean/wcm/preview/NullPreviewURIService.java deleted file mode 100644 index 527d03cca2..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/preview/NullPreviewURIService.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ - -package org.alfresco.web.bean.wcm.preview; - -/** - * A PreviewURIService that always returns null (no preview URI). - * - * @author Peter Monks (peter.monks@alfresco.com) - * - * @since 2.2.1 - * - * @deprecated see org.alfresco.web.bean.wcm.preview.NullPreviewURIService - */ -public class NullPreviewURIService extends org.alfresco.wcm.preview.NullPreviewURIService implements PreviewURIService -{ - public String getPreviewURI(final String storeId, final String webapp) - { - return super.getPreviewURI(storeId, webapp, null); - } -} \ No newline at end of file diff --git a/source/java/org/alfresco/web/bean/wcm/preview/PreviewURIService.java b/source/java/org/alfresco/web/bean/wcm/preview/PreviewURIService.java deleted file mode 100644 index 4bcfa22d11..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/preview/PreviewURIService.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ - -package org.alfresco.web.bean.wcm.preview; - - -/** - * Abstraction for generating preview URLs. - * - * @author Peter Monks (peter.monks@alfresco.com) - * - * @since 2.2.1 - * - * @deprecated see org.alfresco.wcm.preview.PreviewURIServiceProvider - */ -public interface PreviewURIService -{ - /** - * @param storeId The id of the store to generate the preview URI for. - * @param pathToAsset The path to the asset to generate the preview URI for (can be null or empty, to return preview URL to store) - * @return The Preview URI for the given store id and/or asset (may be null). - */ - String getPreviewURI(String storeId, String pathToAsset); -} diff --git a/source/java/org/alfresco/web/bean/wcm/preview/StoreSpecificPreviewURIService.java b/source/java/org/alfresco/web/bean/wcm/preview/StoreSpecificPreviewURIService.java deleted file mode 100644 index b555211deb..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/preview/StoreSpecificPreviewURIService.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ - -package org.alfresco.web.bean.wcm.preview; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.alfresco.util.Pair; - - -/** - * A PreviewURIService that proxies requests to underlying PreviewURIGenerator implementations based on the store that the Preview URI - * is being generated for. - * - * @author Peter Monks (peter.monks@alfresco.com) - * - * @since 2.2.1 - * - * @deprecated see org.alfresco.wcm.preview.* - */ -public class StoreSpecificPreviewURIService implements PreviewURIService -{ - private final List> storeURIGenerators; - private final PreviewURIService fallback; - - - public StoreSpecificPreviewURIService(final List> storeURIGenerators) - { - this(storeURIGenerators, null); - } - - - public StoreSpecificPreviewURIService(final List> storeURIGenerators, - final PreviewURIService fallback) - { - List> compiledStoreURIGenerators = null; - - // Iterate through the list, compiling all of the regex strings into Pattern objects - if (storeURIGenerators != null) - { - Iterator> iter = storeURIGenerators.iterator(); - - compiledStoreURIGenerators = new ArrayList>(storeURIGenerators.size()); - - while (iter.hasNext()) - { - Pair pair = iter.next(); - - if (pair != null) - { - String regex = pair.getFirst(); - - if (regex != null && regex.trim().length() > 0) - { - Pattern pattern = Pattern.compile(regex); - compiledStoreURIGenerators.add(new Pair(pattern, pair.getSecond())); - } - } - } - } - - // We make the list unmodifiable to ensure correct behaviour in the presence of concurrent (multi-threaded) invocations. - this.storeURIGenerators = Collections.unmodifiableList(compiledStoreURIGenerators); - this.fallback = fallback == null ? new VirtualisationServerPreviewURIService() : fallback; - } - - - /** - * @see org.alfresco.web.bean.wcm.preview.PreviewURIService#getPreviewURI(java.lang.String, java.lang.String) - */ - public String getPreviewURI(final String storeId, final String pathToAsset) - { - String result = null; - boolean resultFound = false; - - if (storeURIGenerators != null) - { - Iterator> iter = storeURIGenerators.iterator(); - - while (iter.hasNext()) - { - Pair pair = iter.next(); - Matcher matcher = pair.getFirst().matcher(storeId); - - if (matcher.matches()) - { - result = pair.getSecond().getPreviewURI(storeId, pathToAsset); - resultFound = true; - break; - } - } - } - - // We didn't find an impl for the given store, so use the fallback impl - if (!resultFound) - { - result = fallback.getPreviewURI(storeId, pathToAsset); - } - - return(result); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/preview/URITemplatePreviewURIService.java b/source/java/org/alfresco/web/bean/wcm/preview/URITemplatePreviewURIService.java deleted file mode 100644 index ae820b6c8c..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/preview/URITemplatePreviewURIService.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ - -package org.alfresco.web.bean.wcm.preview; - - -/** - * A PreviewURIService that takes a URI template and replaces the following parameters per request: - *
    - *
  • {storeId} - the store Id of the preview request
  • - *
  • {pathToAsset} - the full path and filename of the asset being previewed (including a leading '/')
  • - *
- * - * @author Peter Monks (peter.monks@alfresco.com) - * - * @since 2.2.1 - * - * @deprecated see org.alfresco.wcm.preview.URITemplatePreviewURIService - */ -public class URITemplatePreviewURIService extends org.alfresco.wcm.preview.URITemplatePreviewURIService implements PreviewURIService -{ - public URITemplatePreviewURIService(final String uriTemplate) - { - // PRECONDITIONS - assert uriTemplate != null : "uriTemplate must not be null."; - - // Body - this.uriTemplate = uriTemplate; - } - - public String getPreviewURI(final String storeId, final String webapp) - { - return super.getPreviewURI(storeId, webapp, null); - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/preview/VirtualisationServerPreviewURIService.java b/source/java/org/alfresco/web/bean/wcm/preview/VirtualisationServerPreviewURIService.java deleted file mode 100644 index 1c69a0f47a..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/preview/VirtualisationServerPreviewURIService.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ - -package org.alfresco.web.bean.wcm.preview; - -import javax.faces.context.FacesContext; - -import org.alfresco.service.ServiceRegistry; -import org.alfresco.web.bean.repository.Repository; - - -/** - * A PreviewURIService that constructs a virtualisation server URI. - * - * @author Peter Monks (peter.monks@alfresco.com) - * - * @since 2.2.1 - * - * @deprecated see org.alfresco.wcm.preview.VirtualisationServerPreviewURIService - */ -public class VirtualisationServerPreviewURIService extends org.alfresco.wcm.preview.VirtualisationServerPreviewURIService implements PreviewURIService -{ - /** - * @see org.alfresco.web.bean.wcm.preview.PreviewURIService#getPreviewURI(java.lang.String, java.lang.String) - */ - public String getPreviewURI(final String sbStoreId, final String pathToAsset) - { - ServiceRegistry serviceRegistry = Repository.getServiceRegistry(FacesContext.getCurrentInstance()); - - this.setAvmService(serviceRegistry.getAVMService()); - this.setVirtServerRegistry(serviceRegistry.getVirtServerRegistry()); - - return super.getPreviewURI(sbStoreId, pathToAsset, null); - } - -} \ No newline at end of file diff --git a/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java b/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java index b0c369bf3b..5cb6600b07 100644 --- a/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java +++ b/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java @@ -33,13 +33,8 @@ import javax.transaction.UserTransaction; import org.alfresco.model.ApplicationModel; import org.alfresco.model.ContentModel; -import org.alfresco.repo.avm.AVMNodeConverter; import org.alfresco.repo.workflow.WorkflowModel; -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.avmsync.AVMSyncService; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.workflow.WorkflowInstance; import org.alfresco.service.cmr.workflow.WorkflowService; import org.alfresco.service.cmr.workflow.WorkflowTask; @@ -48,8 +43,6 @@ import org.alfresco.service.cmr.workflow.WorkflowTaskState; import org.alfresco.service.cmr.workflow.WorkflowTransition; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; -import org.alfresco.wcm.webproject.WebProjectService; import org.alfresco.web.app.AlfrescoNavigationHandler; import org.alfresco.web.app.Application; import org.alfresco.web.app.servlet.FacesHelper; @@ -60,7 +53,6 @@ import org.alfresco.web.bean.repository.NodePropertyResolver; import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.TransientNode; import org.alfresco.web.bean.repository.User; -import org.alfresco.web.bean.wcm.AVMNode; import org.alfresco.web.config.DialogsConfigElement.DialogButtonConfig; import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.component.UIActionLink; @@ -78,9 +70,6 @@ public class ManageTaskDialog extends BaseDialogBean private static final long serialVersionUID = -3209544870892993135L; transient private WorkflowService workflowService; - transient private AVMService avmService; - transient private AVMSyncService avmSyncService; - transient private WebProjectService wpService; protected Node taskNode; transient private WorkflowTask task; transient private WorkflowInstance workflowInstance; @@ -148,8 +137,6 @@ public class ManageTaskDialog extends BaseDialogBean Boolean isSystemPackage = (Boolean) this.getNodeService().getProperty(this.workflowPackage, WorkflowModel.PROP_IS_SYSTEM_PACKAGE); LOGGER.debug("Workflow package: " + this.workflowPackage + " system package: " + isSystemPackage); - boolean isWCMWorkflow = (this.workflowPackage.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM)); - LOGGER.debug("is wcm workflow: " + isWCMWorkflow); } } } @@ -732,38 +719,30 @@ public class ManageTaskDialog extends BaseDialogBean for (NodeRef nodeRef : contents) { - if (nodeRef.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM)) + if (this.getNodeService().exists(nodeRef)) { - Pair vp = AVMNodeConverter.ToAVMVersionPath(nodeRef); - this.addAVMNode(new AVMNode(this.getAvmService().lookup(vp.getFirst(), vp.getSecond(), true))); - } - else - { - if (this.getNodeService().exists(nodeRef)) - { - // find it's type so we can see if it's a node we - // are interested in - QName type = this.getNodeService().getType(nodeRef); + // find it's type so we can see if it's a node we + // are interested in + QName type = this.getNodeService().getType(nodeRef); - // make sure the type is defined in the data - // dictionary - if (this.getDictionaryService().getType(type) != null) + // make sure the type is defined in the data + // dictionary + if (this.getDictionaryService().getType(type) != null) + { + // look for content nodes or links to content + // NOTE: folders within workflow packages are + // ignored for now + if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_CONTENT) + || ApplicationModel.TYPE_FILELINK.equals(type)) { - // look for content nodes or links to content - // NOTE: folders within workflow packages are - // ignored for now - if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_CONTENT) - || ApplicationModel.TYPE_FILELINK.equals(type)) + // if the node is not in the removed list + // then add create the + // client side representation and add to the + // list + if (this.packageItemsToRemove == null + || this.packageItemsToRemove.contains(nodeRef.toString()) == false) { - // if the node is not in the removed list - // then add create the - // client side representation and add to the - // list - if (this.packageItemsToRemove == null - || this.packageItemsToRemove.contains(nodeRef.toString()) == false) - { - createAndAddNode(nodeRef); - } + createAndAddNode(nodeRef); } } } @@ -840,62 +819,6 @@ public class ManageTaskDialog extends BaseDialogBean return workflowService; } - /** - * Sets the avm service to use - * - * @param avmService AvmService instance - */ - public void setAvmService(final AVMService avmService) - { - this.avmService = avmService; - } - - protected AVMService getAvmService() - { - if (avmService == null) - { - avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); - } - return avmService; - } - - /** - * Sets the avm sync service to use - * - * @param avmSyncService AvmSycService instance - */ - public void setAvmSyncService(final AVMSyncService avmSyncService) - { - this.avmSyncService = avmSyncService; - } - - protected AVMSyncService getAvmSyncService() - { - if (avmSyncService == null) - { - avmSyncService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMSyncService(); - } - return avmSyncService; - } - - /** - * @param wpService The WebProjectService to set. - */ - public void setWebProjectService(final WebProjectService wpService) - { - this.wpService = wpService; - } - - protected WebProjectService getWebProjectService() - { - if (wpService == null) - { - wpService = (WebProjectService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), - "WebProjectService"); - } - return wpService; - } - protected WorkflowTask getWorkflowTask() { if (task == null) @@ -918,27 +841,6 @@ public class ManageTaskDialog extends BaseDialogBean // ------------------------------------------------------------------------------ // Helper methods - protected void addAVMNode(final AVMNode node) - { - node.getProperties().put("taskId", this.getWorkflowTask().id); - node.addPropertyResolver("path", AVMNode.RESOLVER_SANDBOX_RELATIVE_PATH); - node.addPropertyResolver("previewUrl", AVMNode.RESOLVER_PREVIEW_URL); - node.addPropertyResolver("fileType16", AVMNode.RESOLVER_FILE_TYPE_16); - node.addPropertyResolver("size", this.browseBean.resolverSize); - if (!node.isDirectory()) - { - node.addPropertyResolver("url", this.browseBean.resolverUrl); - } - this.resources.add(node); - if (node.isDirectory() && !node.getDescriptor().isDeleted()) - { - for (final AVMNodeDescriptor d : this.getAvmService().getDirectoryListingArray(node.getDescriptor(), true)) - { - this.addAVMNode(new AVMNode(d)); - } - } - } - protected void createAndAddNode(NodeRef nodeRef) { // create our Node representation diff --git a/source/java/org/alfresco/web/config/WCMConfigElement.java b/source/java/org/alfresco/web/config/WCMConfigElement.java deleted file mode 100644 index 5b358bfdd0..0000000000 --- a/source/java/org/alfresco/web/config/WCMConfigElement.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.config; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.springframework.extensions.config.ConfigElement; -import org.springframework.extensions.config.element.GenericConfigElement; - -/** - * Custom config element that represents the config data for WCM - * - * @author gavinc - */ -public class WCMConfigElement extends GenericConfigElement -{ - private static final long serialVersionUID = -4906603037550877971L; - - protected Map childrenMap; - - public static final String CONFIG_ELEMENT_ID = "wcm"; - - /** - * Default constructor - */ - public WCMConfigElement() - { - super(CONFIG_ELEMENT_ID); - } - - /** - * Constructor - * - * @param name Name of the element this config element represents - */ - public WCMConfigElement(String name) - { - super(name); - - this.childrenMap = new HashMap(8); - } - - @Override - public ConfigElement combine(ConfigElement configElement) - { - WCMConfigElement combined = new WCMConfigElement(this.name); - WCMConfigElement toCombineElement = (WCMConfigElement)configElement; - - // work out which child element to add - Map toCombineKids = toCombineElement.getChildrenAsMap(); - List kids = this.getChildren(); - if (kids != null) - { - for (ConfigElement child : kids) - { - String childName = child.getName(); - if (toCombineKids.containsKey(childName)) - { - // check for the 'xforms' child element - if (childName.equals("xforms")) - { - // add the widgets from the 'to combine' element to - // this one and then add to the new combined element - for (ConfigElement widget : toCombineKids.get("xforms").getChildren()) - { - ((GenericConfigElement)child).addChild(widget); - } - - // add the current child to the combined one - combined.addChild(child); - } - else - { - // use the overridden child element - combined.addChild(toCombineKids.get(childName)); - } - } - else - { - // the current child has not be overridden so - // just add the current child - combined.addChild(child); - } - } - } - - // make sure any children only present in the 'to combine' element - // are added - kids = toCombineElement.getChildren(); - if (kids != null) - { - Map combinedKids = combined.getChildrenAsMap(); - for (ConfigElement child : kids) - { - if (!combinedKids.containsKey(child.getName())) - { - combined.addChild(child); - } - } - } - - - return combined; - } - - @Override - public void addChild(ConfigElement configElement) - { - super.addChild(configElement); - - // also add the child element to our map - this.childrenMap.put(configElement.getName(), (GenericConfigElement)configElement); - } - - /** - * Returns the children in a Map - * - * @return Child elements as a Map - */ - public Map getChildrenAsMap() - { - return this.childrenMap; - } -} diff --git a/source/java/org/alfresco/web/config/WCMElementReader.java b/source/java/org/alfresco/web/config/WCMElementReader.java deleted file mode 100644 index 0e3eb6f643..0000000000 --- a/source/java/org/alfresco/web/config/WCMElementReader.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.config; - -import org.springframework.extensions.config.ConfigElement; -import org.springframework.extensions.config.xml.elementreader.GenericElementReader; -import org.dom4j.Element; - -/** - * Custom element reader to parse config for WCM - * - * @author gavinc - */ -public class WCMElementReader extends GenericElementReader -{ - public static final String ELEMENT_WCM = "wcm"; - - /** - * Default constructor - */ - public WCMElementReader() - { - super(null); - } - - /** - * @see org.springframework.extensions.config.xml.elementreader.ConfigElementReader#parse(org.dom4j.Element) - */ - public ConfigElement parse(Element element) - { - WCMConfigElement wcmConfigElement = null; - - if (element != null) - { - // create the config element object - wcmConfigElement = new WCMConfigElement(ELEMENT_WCM); - - // we know there are no attributes or values for the root element - // so just process the children - processChildren(element, wcmConfigElement); - } - - return wcmConfigElement; - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/WebResources.java b/source/java/org/alfresco/web/ui/wcm/WebResources.java deleted file mode 100644 index dff9cee7ff..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/WebResources.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm; - -/** - * @author Kevin Roast - */ -public class WebResources extends org.alfresco.web.ui.repo.WebResources -{ - // Image paths - public static final String IMAGE_SANDBOX_32 = "/images/icons/sandbox_large.gif"; - public static final String IMAGE_USERSANDBOX_32 = "/images/icons/user_sandbox_large.gif"; - public static final String IMAGE_WEBFORM_32 = "/images/icons/webform_large.gif"; - public static final String IMAGE_TEMPLATE_32 = "/images/icons/template_large.gif"; - public static final String IMAGE_WEBPROJECT_32 = "/images/icons/website_large.gif"; -} diff --git a/source/java/org/alfresco/web/ui/wcm/component/DeploymentServerConfigComparator.java b/source/java/org/alfresco/web/ui/wcm/component/DeploymentServerConfigComparator.java deleted file mode 100644 index bbafadca2f..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/component/DeploymentServerConfigComparator.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.component; - -import org.alfresco.web.bean.wcm.DeploymentServerConfig; - -/** - * Comparator to compare the values of a property on a DeploymentServrtConfig. - */ - -public class DeploymentServerConfigComparator implements java.util.Comparator{ - - public DeploymentServerConfigComparator(String propertyName) { - this.propertyName = propertyName; - } - private String propertyName; - - public int compare(DeploymentServerConfig o1, DeploymentServerConfig o2) { - String prop1 = (String)o1.getProperties().get(propertyName); - String prop2 = (String)o2.getProperties().get(propertyName); - - if(prop1 != null) { - int result = prop1.compareTo(prop2 != null ? prop2 : ""); - return result; - } - if(prop2 != null){ - // prop1 is null, prop2 is something - return -1; - } - // both prop1 and prop2 are null - return 0; - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/component/UIAVMList.java b/source/java/org/alfresco/web/ui/wcm/component/UIAVMList.java deleted file mode 100644 index 32d98fa671..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/component/UIAVMList.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.component; - -import org.alfresco.web.ui.common.component.data.UIRichList; -import org.alfresco.web.ui.common.renderer.data.IRichListRenderer; -import org.alfresco.web.ui.wcm.renderer.AVMListRenderer; - -/** - * @author Kevin Roast - */ -public class UIAVMList extends UIRichList -{ - /** - * Default constructor - */ - public UIAVMList() - { - setRendererType("org.alfresco.faces.AVMListRenderer"); - - // instantiate each renderer and add to the list - IRichListRenderer renderer = new AVMListRenderer.DetailsViewRenderer(); - viewRenderers.put(renderer.getViewModeID(), renderer); - } -} \ No newline at end of file diff --git a/source/java/org/alfresco/web/ui/wcm/component/UIAVMLockIcon.java b/source/java/org/alfresco/web/ui/wcm/component/UIAVMLockIcon.java deleted file mode 100644 index 1cccaea85d..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/component/UIAVMLockIcon.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.component; - -import java.io.IOException; - -import javax.faces.context.FacesContext; - -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.service.cmr.avm.AVMNotFoundException; -import org.alfresco.service.cmr.avm.locking.AVMLockingService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.wcm.asset.AssetInfo; -import org.alfresco.wcm.util.WCMUtil; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.ui.repo.component.UILockIcon; - -/** - * @author Ariel Backenroth - */ -public class UIAVMLockIcon extends UILockIcon -{ - public static final String ALFRESCO_FACES_AVMLOCKICON = "org.alfresco.faces.AVMLockIcon"; - - // ------------------------------------------------------------------------------ - // Component implementation - - /** - * @see javax.faces.component.UIComponent#getFamily() - */ - public String getFamily() - { - return ALFRESCO_FACES_AVMLOCKICON; - } - - /** - * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext) - */ - public void encodeBegin(FacesContext context) throws IOException - { - if (isRendered() == false) - { - return; - } - - boolean locked = false; - boolean lockedOwner = false; - Object val = getValue(); - String lockUser = null; - - if (val != null) - { - if (val instanceof AssetInfo) - { - // via UIUserSandboxes.renderUserFiles() - - AssetInfo asset = (AssetInfo)val; - - locked = asset.isLocked(); - - String assetLockOwner = asset.getLockOwner(); - if (assetLockOwner != null) - { - lockUser = assetLockOwner; - lockedOwner = lockUser.equals(Application.getCurrentUser(context).getUserName()); - } - } - else - { - // TODO eventually refactor out - - // via browse-sandbox.jsp -> AVMBrowseBean (getFolders/getFiles - directory listing or search) - - // get the value and see if the image is locked - final AVMLockingService avmLockingService = Repository.getServiceRegistry(context).getAVMLockingService(); - - // NodeRef or String - final String avmPath = (val instanceof NodeRef - ? AVMNodeConverter.ToAVMVersionPath((NodeRef)val).getSecond() - : (val instanceof String - ? (String)val - : null)); - if (avmPath != null) - { - String[] pathParts = WCMUtil.splitPath(avmPath); - String lockOwner = null; - try - { - lockOwner = avmLockingService.getLockOwner(WCMUtil.getWebProjectStoreId(pathParts[0]), pathParts[1]); - } - catch (AVMNotFoundException nfe) - { - // ignore - } - if (lockOwner != null) - { - locked = true; - lockUser = lockOwner; - lockedOwner = lockUser.equals(Application.getCurrentUser(context).getUserName()); - } - } - } - - this.encodeBegin(context, - locked, - lockedOwner, - lockUser == null ? new String[0] : new String[]{lockUser}); - } - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/component/UIDeployWebsite.java b/source/java/org/alfresco/web/ui/wcm/component/UIDeployWebsite.java deleted file mode 100644 index 98dfd4bde8..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/component/UIDeployWebsite.java +++ /dev/null @@ -1,806 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.component; - -import java.io.IOException; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.faces.component.UIInput; -import javax.faces.context.FacesContext; -import javax.faces.context.ResponseWriter; -import javax.faces.el.ValueBinding; -import javax.transaction.UserTransaction; - -import org.alfresco.model.WCMAppModel; -import org.alfresco.repo.avm.actions.AVMDeployWebsiteAction; -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.Application; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.wcm.AVMUtil; -import org.alfresco.web.bean.wcm.DeploymentMonitor; -import org.alfresco.web.bean.wcm.DeploymentServerConfig; -import org.alfresco.web.bean.wcm.DeploymentUtil; -import org.alfresco.web.ui.common.Utils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.util.comparator.CompoundComparator; - -/** - * JSF component that allows a user to select which servers to deploy a - * website to and provides monitoring of the deployments selected - * - * @author gavinc - */ -public class UIDeployWebsite extends UIInput -{ - protected NodeRef webProjectRef; - protected Integer snapshotVersion = -1; - protected Boolean monitorDeployment; - protected List monitorIds; - protected String deployMode; - protected String store; - - private static Log logger = LogFactory.getLog(UIDeployWebsite.class); - - // ------------------------------------------------------------------------------ - // Component implementation - - /** - * Default constructor - */ - public UIDeployWebsite() - { - setRendererType(null); - } - - @Override - public String getFamily() - { - return "org.alfresco.faces.DeployWebsite"; - } - - @SuppressWarnings("unchecked") - @Override - public void decode(FacesContext context) - { - super.decode(context); - - List selectedNodes = new LinkedList(); - Map valuesMap = context.getExternalContext().getRequestParameterValuesMap(); - - // Non grouped checkboxes have the name of the clientId - addValues(selectedNodes, valuesMap, this.getClientId(context)); - - // If we have been grouping the checkboxes then the name will have been generated as follows - // name = this.getClientId(context) + ":group1:child"; - Set keys = valuesMap.keySet(); - for (String key : keys) - { - // Check whether the key matches the pattern for a child checkbox - if (key.matches(this.getClientId(context) + ParentChildCheckboxHelper.helperChildPattern)) - { - // Key does matches the pattern for a child - addValues(selectedNodes, valuesMap, key); - } - } - - // Need to convert between between Object[] and String[] otherwise we get a class cast exception in the - // bowels of JSF. - String[] retVal = new String[selectedNodes.size()]; - java.lang.System.arraycopy(selectedNodes.toArray(), 0 , retVal, 0, selectedNodes.size()); - - // These are the selected nodeIds of the servers which have been selected - setSubmittedValue(retVal); - } - - /** - * Add the values from a map into a list - * @param selectedNodes list to add to - * @param valuesMap map of values - * @param key key into map - */ - private void addValues(List selectedNodes, Map valuesMap, String key) - { - String[] values = (String[])valuesMap.get(key); - if (values != null) - { - for(String value : values) - { - selectedNodes.add(value); - } - } - } - - @SuppressWarnings("unchecked") - @Override - public void restoreState(FacesContext context, Object state) - { - Object values[] = (Object[])state; - // standard component attributes are restored by the super class - super.restoreState(context, values[0]); - this.webProjectRef = (NodeRef)values[1]; - this.monitorDeployment = (Boolean)values[2]; - this.monitorIds = (List)values[3]; - this.snapshotVersion = (Integer)values[4]; - this.deployMode = (String)values[5]; - this.store = (String)values[6]; - } - - @Override - public Object saveState(FacesContext context) - { - Object values[] = new Object[7]; - // standard component attributes are saved by the super class - values[0] = super.saveState(context); - values[1] = this.webProjectRef; - values[2] = this.monitorDeployment; - values[3] = this.monitorIds; - values[4] = this.snapshotVersion; - values[5] = this.deployMode; - values[6] = this.store; - return values; - } - - @Override - public void encodeBegin(FacesContext context) throws IOException - { - if (isRendered() == false) - { - return; - } - - ResponseWriter out = context.getResponseWriter(); - UserTransaction tx = null; - try - { - tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); - tx.begin(); - - NodeRef webProject = this.getWebsite(); - if (webProject == null) - { - throw new IllegalArgumentException("The web project must be specified."); - } - - NodeService nodeService = Repository.getServiceRegistry(context).getNodeService(); - - out.write("\n"); - - // add some before the panels - out.write("\n
\n"); - - if (this.getMonitor()) - { - // get the ids of the deployment monitor objects - List deployMonitorIds = this.getMonitorIds(); - - if (logger.isDebugEnabled()) - { - logger.debug("Monitoring deployment of: " + deployMonitorIds); - } - - // TODO: Add support for 'sniffing' the session for deployment monitors - // this could be useful when the monitor ids are not known - - // render the supporting script required for monitoring - renderScript(context, out, deployMonitorIds); - - // render each server being deployed with an animated icon, the subsequent - // AJAX callback will update the progress. - for (String id : deployMonitorIds) - { - // try and find the monitor object in the session, if it's not there - // it has probably completed and been removed - DeploymentMonitor monitor = (DeploymentMonitor)context.getExternalContext(). - getSessionMap().get(id); - if (monitor != null) - { - if (logger.isDebugEnabled()) - logger.debug("Found deployment monitor: " + monitor); - - renderMonitoredServer(context, out, nodeService, monitor.getTargetServer(), id); - } - } - } - else - { - if (WCMAppModel.CONSTRAINT_TESTSERVER.equals(getDeployMode())) - { - // determine the state, the sandbox may already have a test server - // allocated, in which case we need to allow the user to preview or - // re-deploy. If this is the first deployment or the test server has - // been removed then show a list of available test servers to choose - // from. - - List allocatedServers = DeploymentUtil.findAllocatedTestServers(getStore()); - if (!allocatedServers.isEmpty()) - { - // there is at least one allocated server - for(NodeRef allocatedServer : allocatedServers) - { - renderAllocatedTestServer(context, out, nodeService, allocatedServer); - } - } - else - { - // a test server(s) needs to be selected - display the list of test servers - List refs = Repository.getServiceRegistry(context).getDeploymentService().findTestDeploymentServers(webProject, true); - - // Resolve the unsorted list of NodeRef to a sorted list of DeploymentServerConfig. - List servers = toSortedDeploymentServerConfig(nodeService, refs); - - if (servers.size() > 0) - { - ParentChildCheckboxHelper helper = new ParentChildCheckboxHelper(this.getClientId(context)); - boolean selected = false; - - for (DeploymentServerConfig server: servers) - { - // Get the display group - String displayGroup = (String)server.getProperties().get(DeploymentServerConfig.PROP_GROUP); - - helper.setCurrentDisplayGroup(displayGroup); - if(helper.newGroup) - { - out.write("

"); - out.write(" "); - out.write(Utils.encode(displayGroup)); - out.write("

"); - } - - if (helper.groupParentId.length() > 0) - { - // render the test server with a child checkbox - renderCheckableServer(context, out, nodeService, server.getServerRef(), selected, helper.groupChildName, helper.groupParentId); - } - else - { - // render the test server without a parent checkbox - renderCheckableServer(context, out, nodeService, server.getServerRef(), selected, this.getClientId(context)); - } - } - } - else - { - // show the none available message - out.write("
 "); - out.write(Application.getMessage(context, "deploy_test_server_not_available")); - out.write("
\n"); - out.write("\n"); - } - } - } - else - { - // Display live servers not test servers - - // TODO: get a list of the servers that have been successfully deployed to - - List refs = Repository.getServiceRegistry(context).getDeploymentService().findLiveDeploymentServers(webProject); - - // Resolve the unsorted list of NodeRef to a sorted list of DeploymentServerConfig. - List servers = toSortedDeploymentServerConfig(nodeService, refs); - - ParentChildCheckboxHelper helper = new ParentChildCheckboxHelper(this.getClientId(context)); - - // Now display the servers - for (DeploymentServerConfig server : servers) - { - // TODO: determine if the server has already been successfully deployed to - boolean selected = true; - - // Get the display group - String displayGroup = (String)server.getProperties().get(DeploymentServerConfig.PROP_GROUP); - - helper.setCurrentDisplayGroup(displayGroup); - if (helper.newGroup) - { - out.write("

"); - out.write(" "); - - out.write(Utils.encode(displayGroup)); - out.write("

"); - } - - if (helper.groupParentId.length() > 0) - { - // render the live server with a child checkbox - renderCheckableServer(context, out, nodeService, server.getServerRef(), selected, helper.groupChildName, helper.groupParentId); - } - else - { - // render the live server without a parent checkbox - renderCheckableServer(context, out, nodeService, server.getServerRef(), selected, this.getClientId(context)); - } - } - } - } - - tx.commit(); - } - catch (Throwable err) - { - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - throw new RuntimeException(err); - } - } - - // ------------------------------------------------------------------------------ - // Strongly typed component property accessors - - /** - * @return The NodeRef representation of the web project to show the deployment reports for - */ - public NodeRef getWebsite() - { - ValueBinding vb = getValueBinding("website"); - if (vb != null) - { - this.webProjectRef = (NodeRef)vb.getValue(getFacesContext()); - } - - return this.webProjectRef; - } - - /** - * @param value The NodeRef representation of the web project to show the deployment reports for - */ - public void setWebsite(NodeRef value) - { - this.webProjectRef = value; - } - - /** - * @return true if the component should monitor a deployment - */ - public boolean getMonitor() - { - ValueBinding vb = getValueBinding("monitor"); - if (vb != null) - { - this.monitorDeployment = (Boolean)vb.getValue(getFacesContext()); - } - - if (this.monitorDeployment == null) - { - this.monitorDeployment = Boolean.FALSE; - } - - return this.monitorDeployment.booleanValue(); - } - - /** - * @param monitor Determines whether a deployment should be monitored - */ - public void setMonitor(boolean monitor) - { - this.monitorDeployment = new Boolean(monitor); - } - - /** - * @return The list of deployment monitor IDs - */ - @SuppressWarnings("unchecked") - public List getMonitorIds() - { - ValueBinding vb = getValueBinding("monitorIds"); - if (vb != null) - { - this.monitorIds = (List)vb.getValue(getFacesContext()); - } - - return this.monitorIds; - } - - /** - * @param monitorIds List of monitor IDs to look for - */ - public void setMonitorIds(List monitorIds) - { - this.monitorIds = monitorIds; - } - - /** - * @return The version of the snapshot being deployed - */ - public int getSnapshotVersion() - { - ValueBinding vb = getValueBinding("snapshotVersion"); - if (vb != null) - { - this.snapshotVersion = (Integer)vb.getValue(getFacesContext()); - } - - return this.snapshotVersion; - } - - /** - * @param snapshotVersion The version of the snapshot being deployed - */ - public void setSnapshotVersion(int snapshotVersion) - { - this.snapshotVersion = snapshotVersion; - } - - /** - * @return The type of server being deployed to, 'live' or 'test' - */ - public String getDeployMode() - { - ValueBinding vb = getValueBinding("deployMode"); - if (vb != null) - { - this.deployMode = (String)vb.getValue(getFacesContext()); - } - - if (this.deployMode == null || this.deployMode.length() == 0) - { - this.deployMode = WCMAppModel.CONSTRAINT_TESTSERVER; - } - - return this.deployMode; - } - - /** - * @param deployMode The type of server to deploy to, 'live' or 'test' - */ - public void setDeployMode(String deployMode) - { - this.deployMode = deployMode; - } - - /** - * @return The store being deployed to - */ - public String getStore() - { - ValueBinding vb = getValueBinding("store"); - if (vb != null) - { - this.store = (String)vb.getValue(getFacesContext()); - } - - return this.store; - } - - /** - * @param store The store to deploy to - */ - public void setStore(String store) - { - this.store = store; - } - - // ------------------------------------------------------------------------------ - // Helpers - - private void renderScript(FacesContext context, ResponseWriter out, - List monitorIds) throws IOException - { - // create comma separated list of deplyment ids - StringBuilder ids = new StringBuilder(); - for (int x = 0; x < monitorIds.size(); x++) - { - if (x > 0) - { - ids.append(","); - } - - String id = monitorIds.get(x); - ids.append(id); - } - - // determine the polling frequency value - int pollFreq = AVMUtil.getRemoteDeploymentPollingFrequency() * 1000; - - // render the script to handle the progress monitoring - out.write("\n"); - - out.write("\n"); - } - - private void renderCheckableServer(FacesContext context, ResponseWriter out, NodeService nodeService, - NodeRef server, boolean selected, String checkBoxName) throws IOException - { - renderCheckableServer(context, out, nodeService, server, selected, checkBoxName, ""); - } - - private void renderCheckableServer(FacesContext context, ResponseWriter out, NodeService nodeService, - NodeRef server, boolean selected, String checkBoxName, String parentId) throws IOException - { - String contextPath = context.getExternalContext().getRequestContextPath(); - - renderPanelStart(out, contextPath); - - out.write("
"); - out.write(" 0) - { - out.write("name='"); - out.write(checkBoxName); - out.write("' "); - - // If there is a parent checkbox - // generate java script of the form - // onClick="select_one('xxx', 'area');" - if (parentId != null && parentId.length() > 0 ) - { - out.write("onClick=\"select_one(\'"); - out.write(parentId); - out.write("\', \'"); - out.write(checkBoxName); - out.write("');\" "); - } - } - out.write("value='"); - out.write(server.toString()); - out.write("'"); - if (selected) - { - out.write(" checked='checked'"); - } - out.write(" />
"); - - renderPanelMiddle(out, contextPath, nodeService, server, true); - - renderPanelEnd(out, contextPath); - } - - private void renderAllocatedTestServer(FacesContext context, ResponseWriter out, NodeService nodeService, - NodeRef server) throws IOException - { - String contextPath = context.getExternalContext().getRequestContextPath(); - - renderPanelStart(out, contextPath); - - renderPanelMiddle(out, contextPath, nodeService, server, false); - - String url = (String)nodeService.getProperty(server, WCMAppModel.PROP_DEPLOYSERVERURL); - if (url != null && url.length() > 0) - { - out.write(""); - } - - renderPanelEnd(out, contextPath); - - // render a hidden field with the value of the allocated test server - out.write(""); - } - - private void renderMonitoredServer(FacesContext context, ResponseWriter out, NodeService nodeService, - NodeRef server, String monitorId) throws IOException - { - String contextPath = context.getExternalContext().getRequestContextPath(); - - renderPanelStart(out, contextPath); - - out.write("
"); - out.write(""); - out.write("
"); - - renderPanelMiddle(out, contextPath, nodeService, server, true); - - out.write("
"); - out.write(Application.getMessage(context, "deploying")); - out.write("
"); - - out.write("
"); - out.write("
"); - - renderPanelEnd(out, contextPath); - } - - private void renderPanelStart(ResponseWriter out, String contextPath) throws IOException - { - // render start of panel - out.write(""); - out.write(""); - out.write(""); - if (showSeparator) - { - out.write(""); - } - out.write(""); - out.write("
"); - } - - private void renderPanelMiddle(ResponseWriter out, String contextPath, - NodeService nodeService, NodeRef server, boolean showSeparator) throws IOException - { - Map props = nodeService.getProperties(server); - String deployType = (String)props.get(WCMAppModel.PROP_DEPLOYTYPE); - String serverName = (String)props.get(WCMAppModel.PROP_DEPLOYSERVERNAME); - if (serverName == null || serverName.length() == 0) - { - serverName = AVMDeployWebsiteAction.calculateServerUri(props); - } - - out.write(""); - out.write("
"); - out.write("
"); - out.write("
"); - out.write(Utils.encode(serverName)); - out.write("
"); - } - - - private void renderPanelEnd(ResponseWriter out, String contextPath) throws IOException - { - // render end of panel - out.write("
"); - - // add some padding under each panel - out.write("\n
\n"); - } - - /** - * Utility method to read the details of the deployment nodes - * @param nodeService the node service - * @param refs a list of NodeRefs - * - * @return a sorted list of DeploymentServerConfig objects. - */ - @SuppressWarnings("unchecked") - private List toSortedDeploymentServerConfig(NodeService nodeService, List refs) { - // Resolve the list of NodeRef to a list of DeploymentServerConfig. - List servers = new ArrayList(); - for (NodeRef ref : refs) - { - DeploymentServerConfig server = new DeploymentServerConfig(ref, nodeService.getProperties(ref)); - servers.add(server); - } - - // Sort the deployment servers by display group then display name - CompoundComparator comp = new CompoundComparator(); - comp.addComparator(new DeploymentServerConfigComparator(DeploymentServerConfig.PROP_GROUP)); - comp.addComparator(new DeploymentServerConfigComparator(DeploymentServerConfig.PROP_NAME)); - Collections.sort(servers, comp); - - return servers; - } - - private class ParentChildCheckboxHelper - { - private String clientId; - String currentDisplayGroup = ""; - String groupChildName = ""; - String groupParentId = ""; - String groupName = ""; - int groupNumber = 1; - boolean newGroup = false; - - public ParentChildCheckboxHelper(String clientId) - { - this.clientId = clientId; - } - - public void setCurrentDisplayGroup(String currentDisplayGroup) - { - this.newGroup = !this.currentDisplayGroup.equalsIgnoreCase(currentDisplayGroup); - this.currentDisplayGroup = currentDisplayGroup; - if (this.newGroup) - { - changeGroup(currentDisplayGroup); - } - } - public String getCurrentDisplayGroup() - { - return currentDisplayGroup; - } - - private void changeGroup(String newGroupName) - { - // Examples of HTML naming scheme - // jsp17:group1:parent, jsp17:group1:child - // jsp17:group2:parent, jsp17:group2:child - groupName = clientId + ":group" + Integer.toString(groupNumber++); - groupChildName = groupName + ":child"; - groupParentId = groupName + ":parent"; - } - - /** - * Regex pattern for child checkbox names - matches implementation within changeGroup method of this class - */ - static final String helperChildPattern = ":group[\\d]+:child"; - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/component/UIDeploymentReports.java b/source/java/org/alfresco/web/ui/wcm/component/UIDeploymentReports.java deleted file mode 100644 index e70f3a0c71..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/component/UIDeploymentReports.java +++ /dev/null @@ -1,786 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.component; - -import java.io.IOException; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.ResourceBundle; - -import javax.faces.component.UIComponent; -import javax.faces.component.UIParameter; -import javax.faces.context.FacesContext; -import javax.faces.context.ResponseWriter; -import javax.faces.el.ValueBinding; -import javax.transaction.UserTransaction; - -import org.alfresco.model.ContentModel; -import org.alfresco.model.WCMAppModel; -import org.alfresco.repo.avm.actions.AVMDeployWebsiteAction; -import org.alfresco.repo.domain.PropertyValue; -import org.alfresco.wcm.sandbox.SandboxConstants; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.ContentService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.wcm.DeploymentUtil; -import org.alfresco.web.data.IDataContainer; -import org.alfresco.web.data.QuickSort; -import org.alfresco.web.ui.common.ComponentConstants; -import org.alfresco.web.ui.common.PanelGenerator; -import org.alfresco.web.ui.common.Utils; -import org.springframework.extensions.webscripts.ui.common.component.SelfRenderingComponent; -import org.alfresco.web.ui.common.component.UIActionLink; -import org.alfresco.web.ui.repo.component.UIActions; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.util.StringUtils; - -/** - * JSF component that displays the latest deployment reports for a web project. - * - * @author gavinc - */ -public class UIDeploymentReports extends SelfRenderingComponent -{ - // date filters - public static final String FILTER_DATE_TODAY = "today"; - public static final String FILTER_DATE_YESTERDAY = "yesterday"; - public static final String FILTER_DATE_WEEK = "week"; - public static final String FILTER_DATE_MONTH = "month"; - public static final String FILTER_DATE_ALL = "all"; - - protected String store; - protected String dateFilter; - protected Boolean showPrevious; - protected NodeRef attempt; - - private static final String MSG_ATTEMPT_DATE = "deploy_attempt_date"; - private static final String MSG_SERVERS = "deployed_to_servers"; - private static final String MSG_SNAPSHOT = "snapshot"; - private static final String MSG_SELECT_ATTEMPT = "select_deploy_attempt"; - - private static Log logger = LogFactory.getLog(UIDeploymentReports.class); - - // ------------------------------------------------------------------------------ - // Component implementation - - /** - * @see javax.faces.component.UIComponent#getFamily() - */ - public String getFamily() - { - return "org.alfresco.faces.DeploymentReports"; - } - - public void restoreState(FacesContext context, Object state) - { - Object values[] = (Object[])state; - // standard component attributes are restored by the super class - super.restoreState(context, values[0]); - this.store = (String)values[1]; - this.dateFilter = (String)values[2]; - this.showPrevious = (Boolean)values[3]; - this.attempt = (NodeRef)values[4]; - } - - public Object saveState(FacesContext context) - { - Object values[] = new Object[5]; - // standard component attributes are saved by the super class - values[0] = super.saveState(context); - values[1] = this.store; - values[2] = this.dateFilter; - values[3] = this.showPrevious; - values[4] = this.attempt; - return values; - } - - /** - * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext) - */ - @SuppressWarnings("unchecked") - public void encodeBegin(FacesContext context) throws IOException - { - if (isRendered() == false) - { - return; - } - - ResponseWriter out = context.getResponseWriter(); - UserTransaction tx = null; - try - { - tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); - tx.begin(); - - String storeName = getValue(); - if (storeName == null) - { - throw new IllegalArgumentException("The store must be specified."); - } - - boolean showPrevious = getShowPrevious(); - if (showPrevious) - { - renderPreviousReports(context, out, storeName); - } - else - { - renderAttempt(context, out, storeName); - } - - tx.commit(); - } - catch (Throwable err) - { - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - throw new RuntimeException(err); - } - } - - // ------------------------------------------------------------------------------ - // Strongly typed component property accessors - - /** - * @return The store to show the deployment reports for - */ - public String getValue() - { - ValueBinding vb = getValueBinding("value"); - if (vb != null) - { - this.store = (String)vb.getValue(getFacesContext()); - } - - return this.store; - } - - /** - * @param value The store to show the deployment reports for - */ - public void setValue(String value) - { - this.store = value; - } - - /** - * @return The current dateFilter if previous reports are being shown - */ - public String getDateFilter() - { - ValueBinding vb = getValueBinding("dateFilter"); - if (vb != null) - { - this.dateFilter = (String)vb.getValue(getFacesContext()); - } - - return this.dateFilter; - } - - /** - * @param value The dateFilter to use when previous reports are being shown - */ - public void setDateFilter(String value) - { - this.dateFilter = value; - } - - /** - * @return true if the component should show previous reports - */ - public boolean getShowPrevious() - { - ValueBinding vb = getValueBinding("showPrevious"); - if (vb != null) - { - this.showPrevious = (Boolean)vb.getValue(getFacesContext()); - } - - if (this.showPrevious == null) - { - this.showPrevious = Boolean.FALSE; - } - - return this.showPrevious.booleanValue(); - } - - /** - * @param showPrevious Determines whether previous reports are shown - */ - public void setShowPrevious(boolean showPrevious) - { - this.showPrevious = new Boolean(showPrevious); - } - - /** - * @return NodeRef of the deploymentattempt to show the details for - */ - public NodeRef getAttempt() - { - ValueBinding vb = getValueBinding("attempt"); - if (vb != null) - { - this.attempt = (NodeRef)vb.getValue(getFacesContext()); - } - - return this.attempt; - } - - /** - * @param value The NodeRef of the deploymentattempt to show the details for - */ - public void setAttempt(NodeRef value) - { - this.attempt = value; - } - - // ------------------------------------------------------------------------------ - // Helpers - - @SuppressWarnings("unchecked") - protected void renderPreviousReports(FacesContext context, ResponseWriter out, String store) - throws IOException - { - NodeService nodeService = Repository.getServiceRegistry(context).getNodeService(); - ResourceBundle bundle = Application.getBundle(context); - - List deployAttempts = null; - String dateFilter = getDateFilter(); - - if (logger.isDebugEnabled()) - logger.debug("Rendering previous deployment reports for store '" + store + - "' using dateFilter: " + dateFilter); - - if (dateFilter == null || dateFilter.equals(FILTER_DATE_ALL)) - { - deployAttempts = DeploymentUtil.findDeploymentAttempts(store); - } - else - { - // get today's date - Date toDate = new Date(); - - // calculate the from date - Date fromDate; - if (FILTER_DATE_TODAY.equals(dateFilter)) - { - fromDate = toDate; - } - else if (FILTER_DATE_YESTERDAY.equals(dateFilter)) - { - fromDate = new Date(toDate.getTime() - (1000L*60L*60L*24L)); - toDate = fromDate; - } - else if (FILTER_DATE_WEEK.equals(dateFilter)) - { - fromDate = new Date(toDate.getTime() - (1000L*60L*60L*24L*7L)); - } - else if (FILTER_DATE_MONTH.equals(dateFilter)) - { - fromDate = new Date(toDate.getTime() - (1000L*60L*60L*24L*30L)); - } - else - { - throw new IllegalArgumentException("Unknown date filter mode: " + dateFilter); - } - - // get the filtered list of attempts - deployAttempts = DeploymentUtil.findDeploymentAttempts(store, fromDate, toDate); - } - - if (deployAttempts.size() > 0) - { - out.write(""); - out.write(""); - - // create a list of DeploymentAttempt objects to be ordered - List orderedAttempts = new ArrayList(deployAttempts.size()); - for (NodeRef attempt : deployAttempts) - { - Map props = nodeService.getProperties(attempt); - String attemptId = (String)props.get(WCMAppModel.PROP_DEPLOYATTEMPTID); - Date attemptTime = (Date)props.get(WCMAppModel.PROP_DEPLOYATTEMPTTIME); - Integer version = (Integer)props.get(WCMAppModel.PROP_DEPLOYATTEMPTVERSION); - List servers = (List)props.get(WCMAppModel.PROP_DEPLOYATTEMPTSERVERS); - StringBuilder buffer = new StringBuilder(); - if (servers != null) - { - for (String server : servers) - { - if (buffer.length() != 0) - { - buffer.append(", "); - } - - buffer.append(Utils.encode(server)); - } - } - - orderedAttempts.add(new DeploymentAttempt(attempt, attemptId, - attemptTime, buffer.toString(), version)); - } - - // sort the list of deployment attempts - QuickSort sorter = new QuickSort(orderedAttempts, "date", false, - IDataContainer.SORT_CASEINSENSITIVE); - sorter.sort(); - - for (DeploymentAttempt attempt : orderedAttempts) - { - out.write(""); - } - - out.write("
"); - out.write(bundle.getString(MSG_ATTEMPT_DATE)); - out.write(""); - out.write(bundle.getString(MSG_SERVERS)); - out.write(""); - out.write(bundle.getString(MSG_SNAPSHOT)); - out.write("
"); - Utils.encodeRecursive(context, - aquireViewAttemptAction(context, attempt)); - out.write(""); - out.write(attempt.getServers()); - out.write(""); - Integer version = attempt.getVersion(); - if (version != null) - { - out.write(version.toString()); - if (version.intValue() == -1) - { - out.write(" ("); - out.write(bundle.getString("current_working_version")); - out.write(")"); - } - } - out.write("
"); - } - else - { - out.write("
"); - out.write(Application.getMessage(context, "no_deploy_attempts")); - out.write("
\n"); - } - } - - protected void renderAttempt(FacesContext context, ResponseWriter out, String store) - throws IOException - { - // get services required - NodeService nodeService = Repository.getServiceRegistry(context).getNodeService(); - ContentService contentService = Repository.getServiceRegistry(context).getContentService(); - AVMService avmService = Repository.getServiceRegistry(context).getAVMService(); - - // get the attempt node to show (if any) - NodeRef attempt = getAttempt(); - if (attempt == null) - { - if (logger.isDebugEnabled()) - logger.debug("Rendering last deployment report for store: " + store); - - // get the last deployment attempt id, then locate the deploymentattempt node - PropertyValue val = avmService.getStoreProperty(store, SandboxConstants.PROP_LAST_DEPLOYMENT_ID); - String attemptId = null; - - if (val != null) - { - attemptId = val.getStringValue(); - } - - if (attemptId == null || attemptId.length() == 0) - { - throw new IllegalStateException("Failed to retrieve deployment attempt id"); - } - - if (logger.isDebugEnabled()) - logger.debug("Retrieving deploymentattempt node with attempt id: " + attemptId); - - // get the deploymentattempt object - attempt = DeploymentUtil.findDeploymentAttempt(attemptId); - } - - // if we have an attempt node, render it - if (attempt != null) - { - if (logger.isDebugEnabled()) - logger.debug("Rendering deployment reports for attempt: " + attempt); - - // render the supporting JavaScript - out.write("\n"); - - // iterate through each deployment report - List deployReportRefs = nodeService.getChildAssocs( - attempt, WCMAppModel.ASSOC_DEPLOYMENTREPORTS, RegexQNamePattern.MATCH_ALL); - if (deployReportRefs.size() > 0) - { - for (ChildAssociationRef ref : deployReportRefs) - { - // render each report - renderReport(context, out, ref.getChildRef(), nodeService, contentService); - } - } - else - { - out.write("
 "); - out.write(Application.getMessage(context, "no_deploy_reports")); - out.write("
\n"); - } - - // add some padding after the panels - out.write("\n
\n"); - } - } - - protected void renderReport(FacesContext context, ResponseWriter out, NodeRef deploymentReport, - NodeService nodeService, ContentService contentService) - throws IOException - { - if (logger.isDebugEnabled()) - logger.debug("Rendering report: " + deploymentReport); - - // add some padding before the panel - out.write("\n
\n"); - - // start the surrounding panel - PanelGenerator.generatePanelStart(out, - context.getExternalContext().getRequestContextPath(), "lightstorm", "#eaeff2"); - - // extract the information we need to display - Map serverProps = nodeService.getProperties(deploymentReport); - Long serverId = (Long)serverProps.get(ContentModel.PROP_NODE_DBID); - String server = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVER); - boolean showServerAddress = true; - String serverName = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERNAMEUSED); - if (serverName == null || serverName.length() == 0) - { - serverName = server; - showServerAddress = false; - } - - String deployType = WCMAppModel.CONSTRAINT_ALFDEPLOY; - if (server.startsWith(AVMDeployWebsiteAction.FILE_SERVER_PREFIX)) - { - deployType = WCMAppModel.CONSTRAINT_FILEDEPLOY; - } - - String creator = (String)serverProps.get(ContentModel.PROP_CREATOR); - Date startTime = (Date)serverProps.get(WCMAppModel.PROP_DEPLOYSTARTTIME); - String started = ""; - if (startTime != null) - { - started = Utils.getDateTimeFormat(context).format(startTime); - } - - Date endTime = (Date)serverProps.get(WCMAppModel.PROP_DEPLOYENDTIME); - String finished = ""; - if (endTime != null) - { - finished = Utils.getDateTimeFormat(context).format(endTime); - } - - Boolean success = (Boolean)serverProps.get(WCMAppModel.PROP_DEPLOYSUCCESSFUL); - if (success == null) - { - success = Boolean.FALSE; - } - - String url = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERURLUSED); - String username = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERUSERNAMEUSED); - String source = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSOURCEPATHUSED); - String target = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERTARGETUSED); - String excludes = (String)serverProps.get(WCMAppModel.PROP_DEPLOYEXCLUDESUSED); - String failReason = (String)serverProps.get(WCMAppModel.PROP_DEPLOYFAILEDREASON); - - String content = ""; - ContentReader reader = contentService.getReader(deploymentReport, ContentModel.PROP_CONTENT); - if (reader != null) - { - content = reader.getContentString(); - if (content != null) - { - content = Utils.encode(content); - content = StringUtils.replace(content, "\r\n", "
"); - } - else - { - content = ""; - } - } - - int snapshot = -1; - Serializable snapshotObj = serverProps.get(WCMAppModel.PROP_DEPLOYVERSION); - if (snapshotObj != null && snapshotObj instanceof Integer) - { - snapshot = (Integer)snapshotObj; - } - - out.write(""); - out.write("
"); - out.write("
"); - out.write(Utils.encode(serverName)); - out.write("
  "); - if (success.booleanValue()) - { - out.write(Application.getMessage(context, "deploy_successful")); - } - else - { - out.write(Application.getMessage(context, "deploy_failed")); - } - out.write("
"); - - if (success.booleanValue() == false && failReason != null && failReason.length() > 0) - { - out.write("
"); - out.write(Application.getMessage(context, "reason")); - out.write(": "); - out.write(Utils.encode(failReason)); - out.write("
"); - } - - if (showServerAddress) - { - out.write("
"); - out.write(Application.getMessage(context, "deploy_server")); - out.write(": "); - out.write(Utils.encode(server)); - out.write("
"); - } - - out.write("
"); - out.write(Application.getMessage(context, "snapshot")); - out.write(": "); - out.write(Integer.toString(snapshot)); - out.write("
"); - - out.write("
"); - out.write(Application.getMessage(context, "deploy_started")); - out.write(": "); - out.write(started); - out.write("
"); - - out.write("
"); - out.write(Application.getMessage(context, "deploy_finished")); - out.write(": "); - out.write(finished); - out.write("
"); - - out.write("
"); - out.write(Application.getMessage(context, "deployed_by")); - out.write(": "); - out.write(Utils.encode(creator)); - out.write("
"); - - if (username != null) - { - out.write("
"); - out.write(Application.getMessage(context, "deploy_server_username")); - out.write(": "); - out.write(Utils.encode(username)); - out.write("
"); - } - - if (source != null) - { - out.write("
"); - out.write(Application.getMessage(context, "deploy_server_source_path")); - out.write(": "); - out.write(Utils.encode(source)); - out.write("
"); - } - - if (excludes != null) - { - out.write("
"); - out.write(Application.getMessage(context, "deploy_server_excludes")); - out.write(": "); - out.write(Utils.encode(excludes)); - out.write("
"); - } - - if (target != null) - { - out.write("
"); - out.write(Application.getMessage(context, "deploy_server_target_name")); - out.write(": "); - out.write(Utils.encode(target)); - out.write("
"); - } - - if (success.booleanValue() == true && url != null && url.length() > 0) - { - out.write("
"); - out.write(Application.getMessage(context, "deploy_server_url")); - out.write(": "); - out.write(Utils.encode(url)); - out.write("
"); - } - - if (content.length() > 0) - { - out.write("
 "); - out.write(Application.getMessage(context, "details")); - out.write("
\n"); - out.write(""); - } - out.write("\n
\n"); - out.write("
"); - - // finish the surrounding panel - PanelGenerator.generatePanelEnd(out, - context.getExternalContext().getRequestContextPath(), "lightstorm"); - } - - @SuppressWarnings("unchecked") - protected UIActionLink aquireViewAttemptAction(FacesContext context, DeploymentAttempt attempt) - { - UIActionLink action = null; - String actionId = "va_" + attempt.getId(); - - // try find the action as a child of this component - for (UIComponent component : (List)getChildren()) - { - if (actionId.equals(component.getId())) - { - action = (UIActionLink)component; - break; - } - } - - if (action == null) - { - // create the action and add as a child component - javax.faces.application.Application facesApp = context.getApplication(); - action = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK); - action.setId(actionId); - action.setValue(attempt.getDateAsString()); - action.setTooltip(Application.getMessage(context, MSG_SELECT_ATTEMPT)); - action.setShowLink(true); - action.setActionListener(facesApp.createMethodBinding( - "#{DialogManager.bean.attemptSelected}", UIActions.ACTION_CLASS_ARGS)); - - // add attemptRef param - UIParameter param1 = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER); - param1.setId(actionId + "_1"); - param1.setName("attemptRef"); - param1.setValue(attempt.getNodeRef().toString()); - action.getChildren().add(param1); - - // add attemptDate param - UIParameter param2 = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER); - param2.setId(actionId + "_2"); - param2.setName("attemptDate"); - param2.setValue(attempt.getDateAsString()); - action.getChildren().add(param2); - - this.getChildren().add(action); - } - - return action; - } - - private class DeploymentAttempt - { - private NodeRef nodeRef; - private String id; - private Date date; - private String servers; - private Integer version; - - public DeploymentAttempt(NodeRef nodeRef, String id, Date date, - String servers, Integer version) - { - this.nodeRef = nodeRef; - this.id = id; - this.date = date; - this.servers = servers; - this.version = version; - } - - public NodeRef getNodeRef() - { - return this.nodeRef; - } - - public String getId() - { - return this.id; - } - - public String getServers() - { - return this.servers; - } - - public Integer getVersion() - { - return this.version; - } - - public Date getDate() - { - return this.date; - } - - public String getDateAsString() - { - // format the date using the default pattern - return Utils.getDateTimeFormat(FacesContext.getCurrentInstance()).format(this.date); - } - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/component/UIDeploymentServers.java b/source/java/org/alfresco/web/ui/wcm/component/UIDeploymentServers.java deleted file mode 100644 index 9a20fe72dd..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/component/UIDeploymentServers.java +++ /dev/null @@ -1,1054 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.component; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.ResourceBundle; -import java.util.Set; - -import javax.faces.component.UICommand; -import javax.faces.component.UIComponent; -import javax.faces.component.UIInput; -import javax.faces.component.UIParameter; -import javax.faces.component.UISelectBoolean; -import javax.faces.component.UISelectItems; -import javax.faces.component.UISelectOne; -import javax.faces.context.FacesContext; -import javax.faces.context.ResponseWriter; -import javax.faces.el.MethodBinding; -import javax.faces.el.ValueBinding; -import javax.faces.model.SelectItem; -import javax.transaction.UserTransaction; - -import org.alfresco.model.WCMAppModel; -import org.alfresco.repo.avm.actions.AVMDeployWebsiteAction; -import org.alfresco.service.cmr.avm.deploy.DeploymentService; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.wcm.AVMUtil; -import org.alfresco.web.bean.wcm.DeploymentServerConfig; -import org.alfresco.web.ui.common.ComponentConstants; -import org.alfresco.web.ui.common.PanelGenerator; -import org.alfresco.web.ui.common.Utils; -import org.alfresco.web.ui.common.component.UIActionLink; -import org.alfresco.web.ui.common.component.UIListItem; -import org.alfresco.web.ui.repo.component.UIActions; -import org.springframework.util.comparator.CompoundComparator; - -/** - * JSF component that allows deployment servers to be added, edited and removed. - * - * @author gavinc - */ -public class UIDeploymentServers extends UIInput -{ - private static final String MSG_LIVE_SERVER = "deploy_server_type_live"; - private static final String MSG_TEST_SERVER = "deploy_server_type_test"; - private static final String MSG_TYPE = "deploy_server_type"; - private static final String MSG_NAME = "deploy_server_name"; - private static final String MSG_GROUP = "deploy_server_group"; - private static final String MSG_ADAPTER_NAME = "deploy_server_adapter_name"; - private static final String MSG_HOST = "deploy_server_host"; - private static final String MSG_PORT = "deploy_server_port"; - private static final String MSG_USER = "deploy_server_username"; - private static final String MSG_PWD = "deploy_server_password"; - private static final String MSG_URL = "deploy_server_url"; - private static final String MSG_ALLOCATED = "deploy_server_allocated"; - private static final String MSG_SOURCE = "deploy_server_source_path"; - private static final String MSG_TARGET = "deploy_server_target_name"; - private static final String MSG_EXCLUDES = "deploy_server_excludes"; - private static final String MSG_INCLUDE_AUTO_DEPLOY = "deploy_server_include_auto_deploy"; - private static final String MSG_EDIT = "edit_deploy_server"; - private static final String MSG_DELETE = "delete_deploy_server"; - private static final String MSG_NO_DEPLOY_SERVERS = "no_deploy_servers"; - private static final String MSG_NO_DATA = "no_data"; - - private List servers; - private DeploymentServerConfig currentServer; - private Boolean inAddMode; - private String addType; - - private DeploymentService deploymentService; - - // ------------------------------------------------------------------------------ - // Component implementation - - /** - * Default constructor - */ - public UIDeploymentServers() - { - setRendererType(null); - } - - @Override - public String getFamily() - { - return "org.alfresco.faces.DeploymentServers"; - } - - @SuppressWarnings("unchecked") - @Override - public void restoreState(FacesContext context, Object state) - { - Object values[] = (Object[])state; - // standard component attributes are restored by the super class - super.restoreState(context, values[0]); - this.servers = (List)values[1]; - this.inAddMode = (Boolean)values[2]; - this.addType = (String)values[3]; - this.currentServer = (DeploymentServerConfig)values[4]; - } - - @Override - public Object saveState(FacesContext context) - { - Object values[] = new Object[5]; - // standard component attributes are saved by the super class - values[0] = super.saveState(context); - values[1] = this.servers; - values[2] = this.inAddMode; - values[3] = this.addType; - values[4] = this.currentServer; - return values; - } - - @SuppressWarnings("unchecked") - @Override - public void encodeBegin(FacesContext context) throws IOException - { - if (isRendered() == false) - { - return; - } - - // clear previously generated children - this.getChildren().clear(); - - ResponseWriter out = context.getResponseWriter(); - UserTransaction tx = null; - try - { - tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); - tx.begin(); - - String contextPath = context.getExternalContext().getRequestContextPath(); - out.write("\n\n"); - - out.write("\n"); - out.write("
"); - - List servers = getValue(); - - // Sort the deployment servers by display group then display name - CompoundComparator comp = new CompoundComparator(); - comp.addComparator(new DeploymentServerConfigComparator(DeploymentServerConfig.PROP_GROUP)); - comp.addComparator(new DeploymentServerConfigComparator(DeploymentServerConfig.PROP_NAME)); - Collections.sort(servers, comp); - - if (getInAddMode()) - { - renderServerForm(context, out, null, false); - } - else - { - if (servers.size() == 0) - { - out.write("
 "); - out.write(Application.getMessage(context, MSG_NO_DEPLOY_SERVERS)); - out.write("
"); - } - } - - DeploymentServerConfig currentServer = getCurrentServer(); - String currentDisplayGroup = ""; - - for (DeploymentServerConfig server: servers) - { - // Write the display group title if it is a new title - String displayGroup = (String)server.getProperties().get(DeploymentServerConfig.PROP_GROUP); - if(!currentDisplayGroup.equalsIgnoreCase(displayGroup)) - { - // yes title has changed - write out the new displayGroup - out.write("

"); - out.write(Utils.encode(displayGroup)); - out.write("

"); - currentDisplayGroup = displayGroup; - } - - if (currentServer != null && currentServer.getId().equals(server.getId())) - { - // This is the server in edit mode - renderServerForm(context, out, server, true); - } - else - { - renderServer(context, out, server); - } - } - - out.write("
"); - - out.write("\n\n"); - - tx.commit(); - } - catch (Throwable err) - { - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - throw new RuntimeException(err); - } - } - - // ------------------------------------------------------------------------------ - // Strongly typed component property accessors - - /** - * @return List of deployment servers to show - */ - @SuppressWarnings("unchecked") - public List getValue() - { - ValueBinding vb = getValueBinding("value"); - if (vb != null) - { - this.servers = (List)vb.getValue(getFacesContext()); - } - - return this.servers; - } - - /** - * @param value The list of deployment servers to show - */ - public void setValue(List value) - { - this.servers = value; - } - - /** - * @param server The current deployment server being added or edited - */ - public void setCurrentServer(DeploymentServerConfig server) - { - this.currentServer = server; - } - - /** - * @return Deployment server currently being edited or added - */ - @SuppressWarnings("unchecked") - public DeploymentServerConfig getCurrentServer() - { - ValueBinding vb = getValueBinding("currentServer"); - if (vb != null) - { - this.currentServer = (DeploymentServerConfig)vb.getValue(getFacesContext()); - } - - return this.currentServer; - } - - /** - * @return true if the component should show a form to add a new server - */ - public boolean getInAddMode() - { - ValueBinding vb = getValueBinding("inAddMode"); - if (vb != null) - { - this.inAddMode = (Boolean)vb.getValue(getFacesContext()); - } - - if (this.inAddMode == null) - { - this.inAddMode = Boolean.FALSE; - } - - return this.inAddMode.booleanValue(); - } - - /** - * @param inAddMode Determines whether a new server should be added - */ - public void setInAddMode(boolean inAddMode) - { - this.inAddMode = new Boolean(inAddMode); - } - - /** - * @return The type of reciever server to add - */ - public String getAddType() - { - ValueBinding vb = getValueBinding("addType"); - if (vb != null) - { - this.addType = (String)vb.getValue(getFacesContext()); - } - - if (this.addType == null) - { - this.addType = WCMAppModel.CONSTRAINT_FILEDEPLOY; - } - - return this.addType; - } - - /** - * @param value The type of server receiver to add - */ - public void setAddType(String value) - { - this.addType = value; - } - - // ------------------------------------------------------------------------------ - // Helpers - - protected void renderServer(FacesContext context, ResponseWriter out, - DeploymentServerConfig server) throws IOException - { - String contextPath = context.getExternalContext().getRequestContextPath(); - ResourceBundle bundle = Application.getBundle(context); - String noData = bundle.getString(MSG_NO_DATA); - - String serverName = (String)server.getProperties().get(DeploymentServerConfig.PROP_NAME); - if (serverName == null || serverName.length() == 0) - { - serverName = AVMDeployWebsiteAction.calculateServerUri(server.getRepoProps()); - } - - out.write("
"); - PanelGenerator.generatePanelStart(out, contextPath, "lightstorm", "#eaeff2"); - out.write(""); - out.write("
"); - out.write(Utils.encode(serverName)); - out.write("
"); - Utils.encodeRecursive(context, aquireEditServerAction(context, server.getId())); - Utils.encodeRecursive(context, aquireDeleteServerAction(context, server.getId())); - out.write("
"); - out.write(""); - out.write(""); - out.write("
"); - - if (WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(server.getDeployType())) - { - - out.write(""); - } - - - out.write(""); - - - out.write(""); - - out.write(""); - - out.write(""); - - out.write("
"); - out.write(bundle.getString(MSG_ADAPTER_NAME)); - out.write(":"); - if (server.getProperties().get(DeploymentServerConfig.PROP_ADAPTER_NAME) != null) - { - out.write((String)server.getProperties().get(DeploymentServerConfig.PROP_ADAPTER_NAME)); - } - else - { - out.write(noData); - } - out.write("
"); - out.write(bundle.getString(MSG_HOST)); - out.write(":"); - if (server.getProperties().get(DeploymentServerConfig.PROP_HOST) != null) - { - out.write(Utils.encode((String)server.getProperties().get(DeploymentServerConfig.PROP_HOST))); - } - out.write("
"); - out.write(bundle.getString(MSG_PORT)); - out.write(":"); - if (server.getProperties().get(DeploymentServerConfig.PROP_PORT) != null) - { - out.write(Utils.encode((String)server.getProperties().get(DeploymentServerConfig.PROP_PORT))); - } - else - { - out.write(noData); - } - out.write("
"); - out.write(bundle.getString(MSG_URL)); - out.write(":"); - if (server.getProperties().get(DeploymentServerConfig.PROP_URL) != null) - { - out.write(Utils.encode((String)server.getProperties().get(DeploymentServerConfig.PROP_URL))); - } - else - { - out.write(noData); - } - out.write("
"); - out.write(bundle.getString(MSG_TYPE)); - out.write(":"); - if (server.getProperties().get(DeploymentServerConfig.PROP_TYPE) != null) - { - String type = (String)server.getProperties().get(DeploymentServerConfig.PROP_TYPE); - if (WCMAppModel.CONSTRAINT_LIVESERVER.equals(type)) - { - out.write(Utils.encode(Application.getMessage(context, MSG_LIVE_SERVER))); - } - else if (WCMAppModel.CONSTRAINT_TESTSERVER.equals(type)) - { - out.write(Utils.encode(Application.getMessage(context, MSG_TEST_SERVER))); - } - } - out.write("
"); - out.write(bundle.getString(MSG_USER)); - out.write(":"); - if (server.getProperties().get(DeploymentServerConfig.PROP_USER) != null) - { - out.write(Utils.encode((String)server.getProperties().get(DeploymentServerConfig.PROP_USER))); - } - else - { - out.write(noData); - } - out.write("
"); - - out.write(""); - - out.write(""); - - if (WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(server.getDeployType())) - { - out.write(""); - } - - if (WCMAppModel.CONSTRAINT_LIVESERVER.equals( - server.getProperties().get(DeploymentServerConfig.PROP_TYPE))) - { - out.write(""); - } - - if (WCMAppModel.CONSTRAINT_TESTSERVER.equals( - server.getProperties().get(DeploymentServerConfig.PROP_TYPE))) - { - out.write(""); - } - - out.write("
"); - out.write(bundle.getString(MSG_SOURCE)); - out.write(":"); - if (server.getProperties().get(DeploymentServerConfig.PROP_SOURCE_PATH) != null) - { - out.write(Utils.encode((String)server.getProperties().get(DeploymentServerConfig.PROP_SOURCE_PATH))); - } - else - { - out.write(noData); - } - out.write("
"); - out.write(bundle.getString(MSG_EXCLUDES)); - out.write(":"); - if (server.getProperties().get(DeploymentServerConfig.PROP_EXCLUDES) != null) - { - out.write(Utils.encode((String)server.getProperties().get(DeploymentServerConfig.PROP_EXCLUDES))); - } - else - { - out.write(noData); - } - out.write("
"); - out.write(bundle.getString(MSG_TARGET)); - out.write(":"); - if (server.getProperties().get(DeploymentServerConfig.PROP_TARGET_NAME) != null) - { - out.write(Utils.encode((String)server.getProperties().get(DeploymentServerConfig.PROP_TARGET_NAME))); - } - else - { - out.write(noData); - } - out.write("
"); - out.write(bundle.getString(MSG_INCLUDE_AUTO_DEPLOY)); - out.write(":"); - if (server.getProperties().get(DeploymentServerConfig.PROP_ON_APPROVAL) != null) - { - Object obj = server.getProperties().get(DeploymentServerConfig.PROP_ON_APPROVAL); - if (obj instanceof Boolean && ((Boolean)obj).booleanValue()) - { - out.write(bundle.getString("yes")); - } - else - { - out.write(bundle.getString("no")); - } - } - out.write("
"); - out.write(Utils.encode(bundle.getString(MSG_ALLOCATED))); - out.write(":"); - if (server.getProperties().get(DeploymentServerConfig.PROP_ALLOCATED_TO) != null) - { - String allocatedToTip = (String)server.getProperties().get( - DeploymentServerConfig.PROP_ALLOCATED_TO); - out.write(""); - out.write(bundle.getString("yes")); - out.write(" ("); - if (AVMUtil.isWorkflowStore(allocatedToTip)) - { - out.write(bundle.getString("review_sandbox")); - } - else - { - String username = AVMUtil.getUserName(allocatedToTip); - out.write(Utils.encode(username)); - } - out.write(")"); - } - else - { - out.write(bundle.getString("no")); - } - out.write("
"); - PanelGenerator.generatePanelEnd(out, contextPath, "lightstorm"); - out.write("
"); - } - - @SuppressWarnings("unchecked") - protected void renderServerForm(FacesContext context, ResponseWriter out, - DeploymentServerConfig server, boolean edit) throws IOException - { - String contextPath = context.getExternalContext().getRequestContextPath(); - ResourceBundle bundle = Application.getBundle(context); - - out.write("
"); - PanelGenerator.generatePanelStart(out, contextPath, "lightstorm", "#eaeff2"); - out.write(""); - out.write(""); - out.write("
"); - if (edit) - { - if (WCMAppModel.CONSTRAINT_ALFDEPLOY.equals(server.getDeployType())) - { - out.write(bundle.getString("edit_alf_deploy_server_info")); - } - else - { - out.write(bundle.getString("edit_file_deploy_server_info")); - } - } - else - { - if (WCMAppModel.CONSTRAINT_ALFDEPLOY.equals(getAddType())) - { - out.write(bundle.getString("add_alf_deploy_server_info")); - } - else - { - out.write(bundle.getString("add_file_deploy_server_info")); - } - } - out.write("
"); - - // create the server type drop down - out.write(""); - - // create the server display name field - out.write(""); - - // create the display group name field - out.write(""); - - if (!edit && WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(getAddType() ) || - (edit && WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(server.getDeployType()))) - { - // for an FSR create the protocol adapter field - out.write(""); - } - - // create the server host field - out.write(""); - - // create the server port field - out.write(""); - - // create the server url field - out.write(""); - - // create the server username field - out.write(""); - - // create the server password field - out.write(""); - - - - // create the source path field - out.write(""); - - // create the excludes field - out.write(""); - - if ((edit == false && WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(getAddType())) || - (edit && WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(server.getDeployType()))) - { - // create the target field - out.write(""); - } - - // create the auto deploy checkbox - out.write(""); - - // create and add the cancel button - out.write(""); - } - - // finish off tables and div - out.write("
"); - out.write(bundle.getString(MSG_TYPE)); - out.write(":"); - UIComponent type = context.getApplication().createComponent( - UISelectOne.COMPONENT_TYPE); - FacesHelper.setupComponentId(context, type, "deployServerType"); - type.getAttributes().put("styleClass", "inputField"); - type.getAttributes().put("onchange", - "javascript:Alfresco.deployServerTypeChanged();"); - ValueBinding vbType = context.getApplication().createValueBinding( - "#{WizardManager.bean.editedDeployServerProperties." + - DeploymentServerConfig.PROP_TYPE + "}"); - type.setValueBinding("value", vbType); - UISelectItems itemsComponent = (UISelectItems)context.getApplication(). - createComponent(UISelectItems.COMPONENT_TYPE); - List items = new ArrayList(2); - - items.add(new SelectItem(WCMAppModel.CONSTRAINT_LIVESERVER, - Application.getMessage(context, MSG_LIVE_SERVER))); - items.add(new SelectItem(WCMAppModel.CONSTRAINT_TESTSERVER, - Application.getMessage(context, MSG_TEST_SERVER))); - - itemsComponent.setValue(items); - type.getChildren().add(itemsComponent); - this.getChildren().add(type); - Utils.encodeRecursive(context, type); - out.write("
"); - out.write(bundle.getString(MSG_NAME)); - out.write(":"); - UIComponent name = context.getApplication().createComponent( - UIInput.COMPONENT_TYPE); - FacesHelper.setupComponentId(context, name, null); - name.getAttributes().put("styleClass", "inputField"); - ValueBinding vbName = context.getApplication().createValueBinding( - "#{WizardManager.bean.editedDeployServerProperties." + - DeploymentServerConfig.PROP_NAME + "}"); - name.setValueBinding("value", vbName); - this.getChildren().add(name); - Utils.encodeRecursive(context, name); - out.write("
"); - out.write(bundle.getString(MSG_GROUP)); - out.write(":"); - UIComponent group = context.getApplication().createComponent( - UIInput.COMPONENT_TYPE); - FacesHelper.setupComponentId(context, group, null); - group.getAttributes().put("styleClass", "inputField"); - ValueBinding vbGroup = context.getApplication().createValueBinding( - "#{WizardManager.bean.editedDeployServerProperties." + - DeploymentServerConfig.PROP_GROUP + "}"); - group.setValueBinding("value", vbGroup); - this.getChildren().add(group); - Utils.encodeRecursive(context, group); - out.write("
"); - out.write(bundle.getString(MSG_ADAPTER_NAME)); - out.write(":"); - - UIComponent adapterName = context.getApplication().createComponent( - UISelectOne.COMPONENT_TYPE); - FacesHelper.setupComponentId(context, adapterName, "deploy_server_adapter_name"); - adapterName.getAttributes().put("styleClass", "inputField"); - - ValueBinding vbAdapterName = context.getApplication().createValueBinding( - "#{WizardManager.bean.editedDeployServerProperties." + - DeploymentServerConfig.PROP_ADAPTER_NAME + "}"); - adapterName.setValueBinding("value", vbAdapterName); - - UISelectItems adaptersComponent = (UISelectItems)context.getApplication(). - createComponent(UISelectItems.COMPONENT_TYPE); - - DeploymentService dep = getDeploymentService(); - if(dep == null) - { - List adapters = new ArrayList(1); - adapters.add(new SelectItem("default", "Default")); - adaptersComponent.setValue(adapters); - } - else - { - Set adapterNames = dep.getAdapterNames(); - List adapters = new ArrayList(adapterNames.size()); - for(String aname : adapterNames) - { - adapters.add(new SelectItem(aname, aname)); - } - adaptersComponent.setValue(adapters); - } - - adapterName.getChildren().add(adaptersComponent); - this.getChildren().add(adapterName); - Utils.encodeRecursive(context, adapterName); - - out.write("
"); - out.write(bundle.getString(MSG_HOST)); - out.write(":"); - UIComponent host = context.getApplication().createComponent( - UIInput.COMPONENT_TYPE); - FacesHelper.setupComponentId(context, host, "deployServerHost"); - - host.getAttributes().put("styleClass", "inputField"); - host.getAttributes().put("onkeyup", - "javascript:Alfresco.checkDeployConfigButtonState();"); - host.getAttributes().put("onchange", - "javascript:Alfresco.checkDeployConfigButtonState();"); - - ValueBinding vbHost = context.getApplication().createValueBinding( - "#{WizardManager.bean.editedDeployServerProperties." + - DeploymentServerConfig.PROP_HOST + "}"); - host.setValueBinding("value", vbHost); - this.getChildren().add(host); - Utils.encodeRecursive(context, host); - out.write("
"); - out.write(bundle.getString(MSG_PORT)); - out.write(":"); - UIComponent port = context.getApplication().createComponent( - UIInput.COMPONENT_TYPE); - FacesHelper.setupComponentId(context, port, "deployServerPort"); - port.getAttributes().put("styleClass", "inputField"); - port.getAttributes().put("onkeyup", - "javascript:Alfresco.checkDeployConfigButtonState();"); - port.getAttributes().put("onchange", - "javascript:Alfresco.checkDeployConfigButtonState();"); - - ValueBinding vbPort = context.getApplication().createValueBinding( - "#{WizardManager.bean.editedDeployServerProperties." + - DeploymentServerConfig.PROP_PORT + "}"); - port.setValueBinding("value", vbPort); - this.getChildren().add(port); - Utils.encodeRecursive(context, port); - out.write("
"); - out.write(bundle.getString(MSG_URL)); - out.write(":"); - UIComponent url = context.getApplication().createComponent( - UIInput.COMPONENT_TYPE); - FacesHelper.setupComponentId(context, url, null); - url.getAttributes().put("styleClass", "inputField"); - ValueBinding vbUrl = context.getApplication().createValueBinding( - "#{WizardManager.bean.editedDeployServerProperties." + - DeploymentServerConfig.PROP_URL + "}"); - url.setValueBinding("value", vbUrl); - this.getChildren().add(url); - Utils.encodeRecursive(context, url); - out.write("
"); - out.write(bundle.getString(MSG_USER)); - out.write(":"); - UIComponent username = context.getApplication().createComponent( - UIInput.COMPONENT_TYPE); - FacesHelper.setupComponentId(context, username, null); - username.getAttributes().put("styleClass", "inputField"); - ValueBinding vbUser = context.getApplication().createValueBinding( - "#{WizardManager.bean.editedDeployServerProperties." + - DeploymentServerConfig.PROP_USER + "}"); - username.setValueBinding("value", vbUser); - this.getChildren().add(username); - Utils.encodeRecursive(context, username); - out.write("
"); - out.write(bundle.getString(MSG_PWD)); - out.write(":"); - UIComponent pwd = context.getApplication().createComponent( - UIInput.COMPONENT_TYPE); - FacesHelper.setupComponentId(context, pwd, null); - pwd.setRendererType("javax.faces.Secret"); - pwd.getAttributes().put("styleClass", "inputField"); - pwd.getAttributes().put("redisplay", true); - ValueBinding vbPwd = context.getApplication().createValueBinding( - "#{WizardManager.bean.editedDeployServerProperties." + - DeploymentServerConfig.PROP_PASSWORD + "}"); - pwd.setValueBinding("value", vbPwd); - this.getChildren().add(pwd); - Utils.encodeRecursive(context, pwd); - out.write("
"); - out.write(bundle.getString(MSG_SOURCE)); - out.write(":"); - UIComponent source = context.getApplication().createComponent( - UIInput.COMPONENT_TYPE); - FacesHelper.setupComponentId(context, source, null); - source.getAttributes().put("styleClass", "inputField"); - ValueBinding vbSource = context.getApplication().createValueBinding( - "#{WizardManager.bean.editedDeployServerProperties." + - DeploymentServerConfig.PROP_SOURCE_PATH + "}"); - source.setValueBinding("value", vbSource); - this.getChildren().add(source); - Utils.encodeRecursive(context, source); - out.write("
"); - out.write(bundle.getString(MSG_EXCLUDES)); - out.write(":"); - UIComponent excludes = context.getApplication().createComponent( - UIInput.COMPONENT_TYPE); - FacesHelper.setupComponentId(context, excludes, null); - excludes.getAttributes().put("styleClass", "inputField"); - ValueBinding vbExcludes = context.getApplication().createValueBinding( - "#{WizardManager.bean.editedDeployServerProperties." + - DeploymentServerConfig.PROP_EXCLUDES + "}"); - excludes.setValueBinding("value", vbExcludes); - this.getChildren().add(excludes); - Utils.encodeRecursive(context, excludes); - out.write("
"); - out.write(bundle.getString(MSG_TARGET)); - out.write(":"); - UIComponent target = context.getApplication().createComponent( - UIInput.COMPONENT_TYPE); - FacesHelper.setupComponentId(context, target, null); - target.getAttributes().put("styleClass", "inputField"); - ValueBinding vbTarget = context.getApplication().createValueBinding( - "#{WizardManager.bean.editedDeployServerProperties." + - DeploymentServerConfig.PROP_TARGET_NAME + "}"); - target.setValueBinding("value", vbTarget); - this.getChildren().add(target); - Utils.encodeRecursive(context, target); - out.write("
"); - UIComponent auto = context.getApplication().createComponent( - UISelectBoolean.COMPONENT_TYPE); - FacesHelper.setupComponentId(context, auto, "autoDeployCheckbox"); - ValueBinding vbAuto = context.getApplication().createValueBinding( - "#{WizardManager.bean.editedDeployServerProperties." + - DeploymentServerConfig.PROP_ON_APPROVAL + "}"); - auto.setValueBinding("value", vbAuto); - this.getChildren().add(auto); - Utils.encodeRecursive(context, auto); - out.write(" "); - out.write(bundle.getString(MSG_INCLUDE_AUTO_DEPLOY)); - out.write("
"); - UICommand cancelButton = (UICommand)context.getApplication().createComponent( - UICommand.COMPONENT_TYPE); - FacesHelper.setupComponentId(context, cancelButton, null); - cancelButton.setValue(bundle.getString("cancel")); - MethodBinding cancelBinding = context.getApplication().createMethodBinding( - "#{WizardManager.bean.cancelDeploymentServerConfig}", new Class[] {}); - cancelButton.setAction(cancelBinding); - this.getChildren().add(cancelButton); - Utils.encodeRecursive(context, cancelButton); - out.write("  "); - - if (edit) - { - // create the done button - UICommand saveButton = (UICommand)context.getApplication().createComponent( - UICommand.COMPONENT_TYPE); - FacesHelper.setupComponentId(context, saveButton, "deployActionButton"); - saveButton.setValue(bundle.getString("save")); - MethodBinding saveBinding = context.getApplication().createMethodBinding( - "#{WizardManager.bean.saveDeploymentServerConfig}", new Class[] {}); - saveButton.setAction(saveBinding); - this.getChildren().add(saveButton); - Utils.encodeRecursive(context, saveButton); - - } - else - { - // create the add button - UICommand addButton = (UICommand)context.getApplication().createComponent( - UICommand.COMPONENT_TYPE); - FacesHelper.setupComponentId(context, addButton, "deployActionButton"); - addButton.setValue(bundle.getString("add")); - MethodBinding addBinding = context.getApplication().createMethodBinding( - "#{WizardManager.bean.addDeploymentServerConfig}", new Class[] {}); - addButton.setAction(addBinding); - this.getChildren().add(addButton); - Utils.encodeRecursive(context, addButton); - out.write("
"); - PanelGenerator.generatePanelEnd(out, contextPath, "lightstorm"); - out.write("
"); - } - - @SuppressWarnings("unchecked") - protected UIActionLink aquireEditServerAction(FacesContext context, String serverId) - { - UIActionLink action = null; - String actionId = "edit_" + serverId; - - // try find the action as a child of this component - for (UIComponent component : (List)getChildren()) - { - if (actionId.equals(component.getId())) - { - action = (UIActionLink)component; - break; - } - } - - if (action == null) - { - // create the action and add as a child component - javax.faces.application.Application facesApp = context.getApplication(); - action = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK); - action.setId(actionId); - action.setValue(Application.getMessage(context, MSG_EDIT)); - action.setImage("/images/icons/edit_icon.gif"); - action.setShowLink(false); - action.setActionListener(facesApp.createMethodBinding( - "#{WizardManager.bean.editDeploymentServerConfig}", - UIActions.ACTION_CLASS_ARGS)); - - // add server id param - UIParameter param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER); - param.setId(actionId + "_1"); - param.setName("id"); - param.setValue(serverId); - action.getChildren().add(param); - - this.getChildren().add(action); - } - - return action; - } - - @SuppressWarnings("unchecked") - protected UIActionLink aquireDeleteServerAction(FacesContext context, String serverId) - { - UIActionLink action = null; - String actionId = "delete_" + serverId; - - // try find the action as a child of this component - for (UIComponent component : (List)getChildren()) - { - if (actionId.equals(component.getId())) - { - action = (UIActionLink)component; - break; - } - } - - if (action == null) - { - // create the action and add as a child component - javax.faces.application.Application facesApp = context.getApplication(); - action = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK); - action.setId(actionId); - action.setValue(Application.getMessage(context, MSG_DELETE)); - action.setImage("/images/icons/delete.gif"); - action.setShowLink(false); - action.setActionListener(facesApp.createMethodBinding( - "#{WizardManager.bean.deleteDeploymentServerConfig}", - UIActions.ACTION_CLASS_ARGS)); - - // add server id param - UIParameter param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER); - param.setId(actionId + "_1"); - param.setName("id"); - param.setValue(serverId); - action.getChildren().add(param); - - this.getChildren().add(action); - } - - return action; - } - - /** - * @return Options for the type of deployment server i.e. test or live - */ - public List getDeployServerTypes() - { - List items = new ArrayList(2); - - UIListItem live = new UIListItem(); - live.setValue(WCMAppModel.CONSTRAINT_LIVESERVER); - live.setLabel(Application.getMessage(FacesContext.getCurrentInstance(), MSG_LIVE_SERVER)); - - UIListItem test = new UIListItem(); - test.setValue(WCMAppModel.CONSTRAINT_TESTSERVER); - test.setLabel(Application.getMessage(FacesContext.getCurrentInstance(), MSG_TEST_SERVER)); - - items.add(live); - items.add(test); - - return items; - } - - protected DeploymentService getDeploymentService() - { - if (deploymentService == null) - { - deploymentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDeploymentService(); - } - return deploymentService; - } - -} diff --git a/source/java/org/alfresco/web/ui/wcm/component/UIFormProcessor.java b/source/java/org/alfresco/web/ui/wcm/component/UIFormProcessor.java deleted file mode 100644 index ed675839ee..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/component/UIFormProcessor.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.component; - -import java.io.IOException; - -import javax.faces.context.FacesContext; -import javax.faces.context.ResponseWriter; -import javax.faces.el.ValueBinding; - -import org.alfresco.web.forms.*; -import org.alfresco.web.ui.common.Utils; -import org.springframework.extensions.webscripts.ui.common.component.SelfRenderingComponent; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; - -/** - * @author Ariel Backenroth - */ -public class UIFormProcessor - extends SelfRenderingComponent -{ - private static final Log LOGGER = LogFactory.getLog(UIFormProcessor.class); - - private Document formInstanceData = null; - private String formInstanceDataName = null; - private Form form = null; - private FormProcessor.Session formProcessorSession = null; - - // ------------------------------------------------------------------------------ - // Component implementation - - /** - * @see javax.faces.component.UIComponent#getFamily() - */ - public String getFamily() - { - return "org.alfresco.faces.FormProcessor"; - } - - public void restoreState(final FacesContext context, final Object state) - { - final Object values[] = (Object[])state; - // standard component attributes are restored by the super class - super.restoreState(context, values[0]); - this.formInstanceData = (Document)values[1]; - this.formInstanceDataName = (String)values[2]; - this.form = (Form)values[3]; - this.formProcessorSession = (FormProcessor.Session)values[4]; - } - - public Object saveState(FacesContext context) - { - return new Object[] - { - // standard component attributes are saved by the super class - super.saveState(context), - this.formInstanceData, - this.formInstanceDataName, - this.form, - this.formProcessorSession - }; - } - - /** - * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext) - */ - @SuppressWarnings("unchecked") - public void encodeBegin(final FacesContext context) - throws IOException - { - if (!isRendered()) - { - return; - } - - final ResponseWriter out = context.getResponseWriter(); - final Form form = this.getForm(); - final FormProcessor fp = form.getFormProcessors().get(0); - final FormProcessor.Session fps = this.getFormProcessorSession(); - final Document fid = this.getFormInstanceData(); - final String formInstanceDataName = this.getFormInstanceDataName(); - try - { - if (fps != null && - fps.getForm().equals(form) && - fps.getFormInstanceData().equals(fid) && - fps.getFormInstanceDataName().equals(formInstanceDataName)) - { - LOGGER.debug("reusing form processor session " + fps); - fp.process(this.formProcessorSession, out); - } - else - { - if (fps != null) - { - this.setFormProcessorSession(null); - LOGGER.debug("clearing form instance data " + fid); - fid.removeChild(fid.getDocumentElement()); - } - LOGGER.debug("creating a new session for " + fid); - this.setFormProcessorSession(fp.process(fid, - formInstanceDataName, - form, - out)); - } - } - catch (Throwable t) - { - Utils.addErrorMessage(t.getMessage(), t); - out.write(t.toString()); - } - } - - // ------------------------------------------------------------------------------ - // Strongly typed component property accessors - - /** - * Returns the instance data to render - * - * @return The instance data to render - */ - public Document getFormInstanceData() - { - final ValueBinding vb = getValueBinding("formInstanceData"); - if (vb != null) - { - this.formInstanceData = (Document)vb.getValue(getFacesContext()); - } - return this.formInstanceData; - } - - /** - * Sets the instance data to render - * - * @param formInstanceData The instance data to render - */ - public void setFormInstanceData(final Document formInstanceData) - { - this.formInstanceData = formInstanceData; - } - - /** - * Returns the form instance data name - * - * @return The form instance data name - */ - public String getFormInstanceDataName() - { - final ValueBinding vb = this.getValueBinding("formInstanceDataName"); - if (vb != null) - { - this.formInstanceDataName = (String)vb.getValue(getFacesContext()); - } - return this.formInstanceDataName; - } - - /** - * Sets the form instance data name - * - * @param formInstanceDataName The form instance data name. - */ - public void setForm(final String formInstanceDataName) - { - this.formInstanceDataName = formInstanceDataName; - } - - /** - * Returns the form - * - * @return The form - */ - public Form getForm() - { - final ValueBinding vb = this.getValueBinding("form"); - if (vb != null) - { - this.form = (Form)vb.getValue(getFacesContext()); - } - return this.form; - } - - /** - * Sets the form - * - * @param form The form - */ - public void setForm(final Form form) - { - this.form = form; - } - - /** - * Returns the form processor session - * - * @return the form processor session - */ - public FormProcessor.Session getFormProcessorSession() - { - final ValueBinding vb = this.getValueBinding("formProcessorSession"); - if (vb != null) - { - this.formProcessorSession = (FormProcessor.Session) - vb.getValue(getFacesContext()); - } - LOGGER.debug("getFormProcessorSession() = " + this.formProcessorSession); - return this.formProcessorSession; - } - - /** - * Sets the form processor session - * - * @param formProcessorSession the form processor session. - */ - public void setFormProcessorSession(final FormProcessor.Session formProcessorSession) - { - if (formProcessorSession == null && this.formProcessorSession != null) - { - LOGGER.debug("destroying old session " + this.formProcessorSession); - this.formProcessorSession.destroy(); - } - this.formProcessorSession = formProcessorSession; - final ValueBinding vb = this.getValueBinding("formProcessorSession"); - if (vb != null) - { - vb.setValue(getFacesContext(), formProcessorSession); - } - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/component/UIPendingSubmissions.java b/source/java/org/alfresco/web/ui/wcm/component/UIPendingSubmissions.java deleted file mode 100644 index d16a81e554..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/component/UIPendingSubmissions.java +++ /dev/null @@ -1,524 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.component; - -import java.io.IOException; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.ResourceBundle; - -import javax.faces.component.UIComponent; -import javax.faces.component.UIParameter; -import javax.faces.context.FacesContext; -import javax.faces.context.ResponseWriter; -import javax.faces.el.ValueBinding; -import javax.transaction.UserTransaction; - -import org.alfresco.model.ContentModel; -import org.alfresco.model.WCMWorkflowModel; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.domain.PropertyValue; -import org.alfresco.repo.workflow.WorkflowModel; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.workflow.WorkflowTask; -import org.alfresco.service.cmr.workflow.WorkflowTaskQuery; -import org.alfresco.service.cmr.workflow.WorkflowTaskState; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.wcm.sandbox.SandboxConstants; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.wcm.AVMUtil; -import org.alfresco.web.ui.common.ComponentConstants; -import org.alfresco.web.ui.common.Utils; -import org.alfresco.web.ui.common.component.UIActionLink; -import org.alfresco.web.ui.repo.component.UIActions; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.alfresco.util.Pair; -import org.springframework.extensions.webscripts.ui.common.ConstantMethodBinding; -import org.springframework.extensions.webscripts.ui.common.component.SelfRenderingComponent; - -/** - * Component to display the list of pending submissions for a web project. - * - * @author Gavin Cornwell - */ -public class UIPendingSubmissions extends SelfRenderingComponent -{ - private static final String ACT_SHOW_TASK = "showTask"; - private static final String ACT_DETAILS = "pending_details"; - private static final String ACT_PREVIEW = "pending_preview"; - private static final String ACT_DIFF = "pending_diff"; - private static final String ACT_PROMOTE = "pending_promote"; - private static final String ACT_ABORT = "pending_abort"; - - private static final String REQUEST_TASKID = "_taskid"; - private static final String REQUEST_TASKTYPE = "_tasktype"; - private static final String REQUEST_LABEL = "_label"; - private static final String REQUEST_PREVIEW_REF = "_prevhref"; - private static final String REQUEST_WORKFLOWID = "_workflowid"; - - private static Log logger = LogFactory.getLog(UIPendingSubmissions.class); - - private static final String MSG_LABEL = "label"; - private static final String MSG_DESCRIPTION = "description"; - private static final String MSG_SUBMITTED = "submitted"; - private static final String MSG_USERNAME = "username"; - private static final String MSG_LAUNCH_DATE = "launch_date"; - private static final String MSG_ACTIONS = "actions"; - private static final String MSG_NO_PENDING = "no_pending_submissions"; - - /** sandbox to show pending submissions for */ - private String value; - - // ------------------------------------------------------------------------------ - // Component implementation - - /** - * @see javax.faces.component.UIComponent#getFamily() - */ - public String getFamily() - { - return "org.alfresco.faces.PendingSubmissions"; - } - - public void restoreState(FacesContext context, Object state) - { - Object values[] = (Object[])state; - // standard component attributes are restored by the super class - super.restoreState(context, values[0]); - this.value = (String)values[1]; - } - - public Object saveState(FacesContext context) - { - Object values[] = new Object[2]; - // standard component attributes are saved by the super class - values[0] = super.saveState(context); - values[1] = this.value; - return values; - } - - /** - * @see javax.faces.component.UIComponentBase#getRendersChildren() - */ - public boolean getRendersChildren() - { - return true; - } - - /** - * @see javax.faces.component.UIComponentBase#encodeChildren(javax.faces.context.FacesContext) - */ - public void encodeChildren(FacesContext context) throws IOException - { - // the child components are rendered explicitly during the encodeBegin() - } - - /** - * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext) - */ - @SuppressWarnings("unchecked") - public void encodeBegin(FacesContext context) throws IOException - { - if (isRendered() == false) - { - return; - } - - ResponseWriter out = context.getResponseWriter(); - - ResourceBundle bundle = Application.getBundle(context); - UserTransaction tx = null; - try - { - tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); - tx.begin(); - - String sandbox = getValue(); - if (sandbox == null) - { - throw new IllegalArgumentException("Sandbox must be specified."); - } - - // get the preview url for the sandbox - String sandboxPreviewUrl = AVMUtil.getPreviewURI(sandbox); - - // get the noderef representing the web project - PropertyValue val = Repository.getServiceRegistry(context).getAVMService(). - getStoreProperty(sandbox, SandboxConstants.PROP_WEB_PROJECT_NODE_REF); - NodeRef webProject = (NodeRef)val.getValue(DataTypeDefinition.NODE_REF); - - // get the list of pending tasks for this project - WorkflowTaskQuery query = new WorkflowTaskQuery(); - query.setTaskName(QName.createQName(NamespaceService.WCMWF_MODEL_1_0_URI, - "submitpendingTask")); - query.setTaskState(WorkflowTaskState.IN_PROGRESS); - Map processProps = new HashMap(); - processProps.put(WCMWorkflowModel.ASSOC_WEBPROJECT, webProject); - query.setProcessCustomProps(processProps); - query.setOrderBy(new WorkflowTaskQuery.OrderBy[] { - WorkflowTaskQuery.OrderBy.TaskDue_Desc, - WorkflowTaskQuery.OrderBy.TaskActor_Asc }); - List pendingTasks = Repository.getServiceRegistry(context). - getWorkflowService().queryTasks(query); - - if (pendingTasks.size() == 0) - { - out.write(bundle.getString(MSG_NO_PENDING)); - } - else - { - // output the javascript to handle the visual diff - out.write(""); - - // output header row - out.write(""); - out.write(""); - - // output the pending submissions and their actions - Map requestMap = context.getExternalContext().getRequestMap(); - - for (WorkflowTask task : pendingTasks) - { - String desc = (String)task.properties.get(WorkflowModel.PROP_DESCRIPTION); - String label = (String)task.properties.get(WCMWorkflowModel.PROP_LABEL); - String submitted = Utils.getDateTimeFormat(context).format(task.path.instance.startDate); - String username = (String)Repository.getServiceRegistry(context).getNodeService(). - getProperty(task.path.instance.initiator, ContentModel.PROP_USERNAME); - Date launchDate = (Date)task.properties.get(WCMWorkflowModel.PROP_LAUNCH_DATE); - String launch = Utils.getDateTimeFormat(context).format(launchDate); - - out.write(""); - } - - out.write("
"); - out.write(bundle.getString(MSG_DESCRIPTION)); - out.write(""); - out.write(bundle.getString(MSG_LABEL)); - out.write(""); - out.write(bundle.getString(MSG_SUBMITTED)); - out.write(""); - out.write(bundle.getString(MSG_USERNAME)); - out.write(""); - out.write(bundle.getString(MSG_LAUNCH_DATE)); - out.write(""); - out.write(bundle.getString(MSG_ACTIONS)); - out.write("
"); - - // show task link - UIActionLink showTask = findAction(ACT_SHOW_TASK, sandbox); - if (showTask == null) - { - Map params = new HashMap(1); - params.put("id", "#{" + REQUEST_TASKID + "}"); - params.put("type", "#{" + REQUEST_TASKTYPE + "}"); - showTask = createAction(context, sandbox, ACT_SHOW_TASK, - "#{" + REQUEST_LABEL + "}", null, "#{WorkflowBean.setupTaskDialog}", - "dialog:manageTask", null, params); - } - - requestMap.put(REQUEST_LABEL, desc); - requestMap.put(REQUEST_TASKID, task.id); - requestMap.put(REQUEST_TASKTYPE, - task.definition.metadata.getName().toString()); - Utils.encodeRecursive(context, showTask); - requestMap.remove(REQUEST_LABEL); - requestMap.remove(REQUEST_TASKID); - requestMap.remove(REQUEST_TASKTYPE); - - out.write(""); - out.write(Utils.encode(label)); - out.write(""); - out.write(submitted); - out.write(""); - out.write(Utils.encode(username)); - out.write(""); - out.write(launch); - out.write(""); - - // details action - UIActionLink details = findAction(ACT_DETAILS, sandbox); - if (details == null) - { - Map params = new HashMap(1); - params.put("id", "#{" + REQUEST_TASKID + "}"); - params.put("type", "#{" + REQUEST_TASKTYPE + "}"); - details = createAction(context, sandbox, ACT_DETAILS, null, - "/images/icons/Details.gif", "#{WorkflowBean.setupTaskDialog}", - "dialog:manageTask", null, params); - } - - requestMap.put(REQUEST_TASKID, task.id); - requestMap.put(REQUEST_TASKTYPE, - task.definition.metadata.getName().toString()); - Utils.encodeRecursive(context, details); - out.write("  "); - requestMap.remove(REQUEST_TASKID); - requestMap.remove(REQUEST_TASKTYPE); - - // preview action - NodeRef pkg = task.path.instance.workflowPackage; - Pair pkgPath = AVMNodeConverter.ToAVMVersionPath(pkg); - String workflowStore = AVMUtil.getStoreName(pkgPath.getSecond()); - String workflowPreviewUrl = AVMUtil.getPreviewURI(workflowStore); - - UIActionLink preview = findAction(ACT_PREVIEW, sandbox); - if (preview == null) - { - preview = createAction(context, sandbox, ACT_PREVIEW, null, - "/images/icons/preview_website.gif", null, null, - "#{" + REQUEST_PREVIEW_REF + "}", null); - } - - requestMap.put(REQUEST_PREVIEW_REF, workflowPreviewUrl); - Utils.encodeRecursive(context, preview); - requestMap.remove(REQUEST_PREVIEW_REF); - out.write("  "); - - // visual diff action - out.write(""); - out.write("");
-               out.write(Application.getMessage(context, ACT_DIFF));
-               out.write("  "); - - // promote action - UIActionLink promote = findAction(ACT_PROMOTE, sandbox); - if (promote == null) - { - Map params = new HashMap(1); - params.put("taskId", "#{" + REQUEST_TASKID + "}"); - promote = createAction(context, sandbox, ACT_PROMOTE, - null, "/images/icons/promote_submission.gif", - "#{AVMBrowseBean.promotePendingSubmission}", - null, null, params); - } - - requestMap.put(REQUEST_TASKID, task.id); - Utils.encodeRecursive(context, promote); - requestMap.remove(REQUEST_TASKID); - out.write("  "); - - // abort action - UIActionLink abort = findAction(ACT_ABORT, sandbox); - if (abort == null) - { - Map params = new HashMap(1); - params.put("workflowInstanceId", "#{" + REQUEST_WORKFLOWID + "}"); - abort = createAction(context, sandbox, ACT_ABORT, - null, "/images/icons/abort_submission.gif", - "#{AVMBrowseBean.cancelPendingSubmission}", - null, null, params); - } - - requestMap.put(REQUEST_WORKFLOWID, task.path.instance.id); - Utils.encodeRecursive(context, abort); - requestMap.remove(REQUEST_WORKFLOWID); - out.write("  "); - - out.write("
"); - } - - tx.commit(); - } - catch (Throwable err) - { - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - throw new RuntimeException(err); - } - } - - /** - * Locate a child UIActionLink component by name. - * - * @param name Of the action component to find - * @param sandbox Sandbox the action component is tied to - * - * @return UIActionLink component if found, else null if not created yet - */ - @SuppressWarnings("unchecked") - private UIActionLink findAction(String name, String sandbox) - { - UIActionLink action = null; - String actionId = name + '_' + sandbox; - if (logger.isDebugEnabled()) - logger.debug("Finding action Id: " + actionId); - for (UIComponent component : (List)getChildren()) - { - if (actionId.equals(component.getId())) - { - action = (UIActionLink)component; - if (logger.isDebugEnabled()) - logger.debug("...found action Id: " + actionId); - break; - } - } - return action; - } - - /** - * Create a UIActionLink child component. - * - * @param fc FacesContext - * @param sandbox Root sandbox name - * @param name Action name - will be used for I18N message lookup - * @param label The label to use for the action, if null the name - * will be used to do the I18N lookup - * @param icon Icon to display for the actio n - * @param actionListener Actionlistener for the action - * @param outcome Navigation outcome for the action - * @param url HREF URL for the action - * @param params Parameters name/values for the action listener args - * - * @return UIActionLink child component - */ - @SuppressWarnings("unchecked") - private UIActionLink createAction(FacesContext fc, String sandbox, String name, String label, - String icon, String actionListener, String outcome, String url, Map params) - { - javax.faces.application.Application facesApp = fc.getApplication(); - UIActionLink control = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK); - - String id = name + '_' + sandbox; - - if (logger.isDebugEnabled()) - logger.debug("...creating action Id: " + id); - - control.setRendererType(UIActions.RENDERER_ACTIONLINK); - control.setId(id); - if (label == null) - { - control.setValue(Application.getMessage(fc, name)); - } - else - { - ValueBinding vb = facesApp.createValueBinding(label); - control.setValueBinding("value", vb); - } - control.setShowLink(icon != null ? false : true); - control.setImage(icon); - - if (actionListener != null) - { - control.setActionListener(facesApp.createMethodBinding( - actionListener, UIActions.ACTION_CLASS_ARGS)); - - // add sandbox as the default action listener parameter - if (params == null) - { - UIParameter param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER); - param.setId(id + "_1"); - param.setName("sandbox"); - param.setValue(sandbox); - control.getChildren().add(param); - } - else - { - // if a specific set of parameters are supplied, then add them instead - int idIndex = 1; - for (String key : params.keySet()) - { - UIParameter param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER); - param.setId(id + '_' + Integer.toString(idIndex++)); - param.setName(key); - String value = params.get(key); - if (value.startsWith("#{") == true) - { - ValueBinding vb = facesApp.createValueBinding(value); - param.setValueBinding("value", vb); - } - else - { - param.setValue(params.get(key)); - } - control.getChildren().add(param); - } - } - } - if (outcome != null) - { - control.setAction(new ConstantMethodBinding(outcome)); - } - if (url != null) - { - if (url.startsWith("#{")) - { - ValueBinding vb = facesApp.createValueBinding(url); - control.setValueBinding("href", vb); - } - else - { - control.setHref(url); - } - - control.setTarget("new"); - } - - this.getChildren().add(control); - - return control; - } - - // ------------------------------------------------------------------------------ - // Strongly typed component property accessors - - /** - * Returns the Sandbox to show the pending submissions for - * - * @return The Sandbox name - */ - public String getValue() - { - ValueBinding vb = getValueBinding("value"); - if (vb != null) - { - this.value = (String)vb.getValue(getFacesContext()); - } - - return this.value; - } - - /** - * Sets the Sandbox to show the pending submissions for - * - * @param value The Sandbox name - */ - public void setValue(String value) - { - this.value = value; - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/component/UISandboxSnapshots.java b/source/java/org/alfresco/web/ui/wcm/component/UISandboxSnapshots.java deleted file mode 100644 index 2363982486..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/component/UISandboxSnapshots.java +++ /dev/null @@ -1,677 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.component; - -import java.io.IOException; -import java.text.DateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.ResourceBundle; - -import javax.faces.component.UIComponent; -import javax.faces.component.UIParameter; -import javax.faces.context.FacesContext; -import javax.faces.context.ResponseWriter; -import javax.faces.el.ValueBinding; -import javax.transaction.UserTransaction; - -import org.alfresco.model.WCMAppModel; -import org.alfresco.repo.domain.PropertyValue; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.wcm.sandbox.SandboxConstants; -import org.alfresco.wcm.sandbox.SandboxService; -import org.alfresco.wcm.sandbox.SandboxVersion; -import org.alfresco.wcm.util.WCMUtil; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.wcm.WCMCompareUtils; -import org.alfresco.web.bean.wcm.DeploymentUtil; -import org.alfresco.web.ui.common.ComponentConstants; -import org.alfresco.web.ui.common.Utils; -import org.alfresco.web.ui.common.component.UIActionLink; -import org.alfresco.web.ui.repo.component.UIActions; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.webscripts.ui.common.ConstantMethodBinding; -import org.springframework.extensions.webscripts.ui.common.component.SelfRenderingComponent; -import org.springframework.web.jsf.FacesContextUtils; - -/** - * @author Kevin Roast - */ -public class UISandboxSnapshots extends SelfRenderingComponent -{ - private static final String ACT_SNAPSHOT_PREVIEW = "snapshot_preview"; - private static final String ACT_SNAPSHOT_REVERT = "snapshot_revert"; - private static final String ACT_SNAPSHOT_COMPARE_TO_CURRENT = "snapshot_compare_to_current"; - private static final String ACT_SNAPSHOT_COMPARE_TO_PREVIOUS = "snapshot_compare_to_previous"; - private static final String ACT_SNAPSHOT_COMPARE_TO_ANY = "snapshot_compare_to_any"; - private static final String ACT_SNAPSHOT_DEPLOY = "snapshot_deploy"; - - private static final String REQUEST_SNAPVERSION = "_snapVer"; - - private static Log logger = LogFactory.getLog(UISandboxSnapshots.class); - - // snapshot date filters - public static final String FILTER_DATE_ALL = "all"; - public static final String FILTER_DATE_TODAY = "today"; - public static final String FILTER_DATE_WEEK = "week"; - public static final String FILTER_DATE_MONTH = "month"; - - private static final String MSG_LABEL = "name"; - private static final String MSG_DESCRIPTION = "description"; - private static final String MSG_DATE = "date"; - private static final String MSG_USERNAME = "snapshot_submitted_by"; - private static final String MSG_VERSION = "version"; - private static final String MSG_STATUS = "status"; - private static final String MSG_ACTIONS = "actions"; - private static final String MSG_LIVE = "live"; - - /** sandbox to show snapshots for */ - private String value; - - /** date filter to use when listing snapshots */ - private String dateFilter; - - /** The snapshot version deployed and the state of that deployment */ - private int deployAttemptVersion = -1; - private String deployStatus; - - // ------------------------------------------------------------------------------ - // Component implementation - - /** - * @see javax.faces.component.UIComponent#getFamily() - */ - public String getFamily() - { - return "org.alfresco.faces.SandboxSnapshots"; - } - - public void restoreState(FacesContext context, Object state) - { - Object values[] = (Object[]) state; - // standard component attributes are restored by the super class - super.restoreState(context, values[0]); - this.value = (String) values[1]; - } - - public Object saveState(FacesContext context) - { - Object values[] = new Object[2]; - // standard component attributes are saved by the super class - values[0] = super.saveState(context); - values[1] = this.value; - return values; - } - - /** - * @see javax.faces.component.UIComponentBase#getRendersChildren() - */ - public boolean getRendersChildren() - { - return true; - } - - /** - * @see javax.faces.component.UIComponentBase#encodeChildren(javax.faces.context.FacesContext) - */ - public void encodeChildren(FacesContext context) throws IOException - { - // the child components are rendered explicitly during the encodeBegin() - } - - /** - * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext) - */ - @SuppressWarnings("unchecked") - public void encodeBegin(FacesContext context) throws IOException - { - if (isRendered() == false) - { - return; - } - - ResponseWriter out = context.getResponseWriter(); - - ResourceBundle bundle = Application.getBundle(context); - DateFormat df = Utils.getDateTimeFormat(context); - AVMService avmService = getAVMService(context); - SandboxService sbService = getSandboxService(context); - UserTransaction tx = null; - try - { - tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); - tx.begin(); - - String sandbox = getValue(); - if (sandbox == null) - { - throw new IllegalArgumentException("Sandbox must be specified."); - } - - // TODO: apply tag style - removed hardcoded - out.write(""); - // header row - out.write(""); - - // get the list of snapshots we can potentially display - List versions; - String dateFilter = getDateFilter(); - if (dateFilter == null || dateFilter.equals(FILTER_DATE_ALL)) - { - versions = sbService.listSnapshots(sandbox, false); - } - else - { - Date toDate = new Date(); - Date fromDate; - if (FILTER_DATE_TODAY.equals(dateFilter)) - { - final Calendar c = Calendar.getInstance(); - c.setTime(toDate); - c.set(Calendar.HOUR_OF_DAY, 0); - c.set(Calendar.MINUTE, 0); - c.set(Calendar.SECOND, 0); - fromDate = c.getTime(); - } - else if (FILTER_DATE_WEEK.equals(dateFilter)) - { - fromDate = new Date(toDate.getTime() - (1000L * 60L * 60L * 24L * 7L)); - } - else if (FILTER_DATE_MONTH.equals(dateFilter)) - { - fromDate = new Date(toDate.getTime() - (1000L * 60L * 60L * 24L * 30L)); - } - else - { - throw new IllegalArgumentException("Unknown date filter mode: " + dateFilter); - } - versions = sbService.listSnapshots(sandbox, fromDate, toDate, false); - } - - // determine whether the deploy action should be shown - boolean showDeployAction = false; - NodeRef webProjectRef = Repository.getServiceRegistry(context).getWebProjectService().getWebProjectNodeFromStore(WCMUtil.getWebProjectStoreId(sandbox)); - List deployToServers = Repository.getServiceRegistry(context).getDeploymentService().findLiveDeploymentServers(webProjectRef); - if (deployToServers != null && deployToServers.size() > 0) - { - showDeployAction = true; - } - - // determine the deployment status for the website - NodeService nodeService = Repository.getServiceRegistry(context).getNodeService(); - determineDeploymentStatus(context, webProjectRef, sandbox, nodeService, avmService); - - Map requestMap = context.getExternalContext().getRequestMap(); - for (SandboxVersion item : versions) - { - // only display snapshots with a valid label/tag - others are system generated snapshots - if (! item.isSystemGenerated()) - { - int version = item.getVersion(); - - out.write(""); - } - } - - // end table - out.write("
"); - out.write(bundle.getString(MSG_LABEL)); - out.write(""); - out.write(bundle.getString(MSG_DESCRIPTION)); - out.write(""); - out.write(bundle.getString(MSG_DATE)); - out.write(""); - out.write(bundle.getString(MSG_USERNAME)); - out.write(""); - out.write(bundle.getString(MSG_VERSION)); - out.write(""); - out.write(bundle.getString(MSG_STATUS)); - out.write(""); - out.write(bundle.getString(MSG_ACTIONS)); - out.write("
"); - out.write(Utils.encode(item.getLabel())); - out.write(""); - out.write(item.getDescription() != null ? Utils.encode(item.getDescription()) : ""); - out.write(""); - out.write(df.format(item.getCreatedDate())); - out.write(""); - out.write(Utils.encode(item.getCreator())); - out.write(""); - out.write(Integer.toString(version)); - out.write(""); - if (version == this.deployAttemptVersion && this.deployStatus != null) - { - out.write(this.deployStatus); - } - else - { - out.write(" "); - } - out.write(""); - - // create actions for the item - - // revert action - UIActionLink action = findAction(ACT_SNAPSHOT_REVERT, sandbox); - if (action == null) - { - Map params = new HashMap(2, 1.0f); - params.put("sandbox", sandbox); - params.put("version", "#{" + REQUEST_SNAPVERSION + "}"); - action = createAction(context, sandbox, ACT_SNAPSHOT_REVERT, "/images/icons/revert.gif", "#{DialogManager.setupParameters}", "dialog:revertSnapshot", - null, params); - } - - requestMap.put(REQUEST_SNAPVERSION, Integer.toString(item.getVersion())); - Utils.encodeRecursive(context, action); - - // deploy action (if there are deployto servers specified) - if (showDeployAction) - { - out.write("  "); - action = findAction(ACT_SNAPSHOT_DEPLOY, sandbox); - if (action == null) - { - Map params = new HashMap(2, 1.0f); - params.put("version", "#{" + REQUEST_SNAPVERSION + "}"); - params.put("store", sandbox); - action = createAction(context, sandbox, ACT_SNAPSHOT_DEPLOY, "/images/icons/deploy.gif", "#{DialogManager.setupParameters}", "dialog:deployWebsite", - null, params); - } - - Utils.encodeRecursive(context, action); - } - - // TODO: restore once preview of a store by version is implemented in vserver - // out.write("  "); - /* - * Utils.encodeRecursive(context, aquireAction( context, sandbox, ACT_SNAPSHOT_PREVIEW, null, null, null)); out.write(" "); - */ - - boolean isLatestVersion = WCMCompareUtils.isLatestVersion(versions, item); - // ///////////////////////////////////////////////////////////////////////// - if (!isLatestVersion) - { - - out.write("  "); - - // Compare To Current Snapshot - action = findAction(ACT_SNAPSHOT_COMPARE_TO_CURRENT, sandbox); - if (action == null) - { - Map params = new HashMap(4, 1.0f); - params.put("sandbox", sandbox); - params.put("store", sandbox); - params.put("version", "#{" + REQUEST_SNAPVERSION + "}"); - action = createAction(context, sandbox, ACT_SNAPSHOT_COMPARE_TO_CURRENT, "/images/icons/comparetocurrent.png", "#{DialogManager.setupParameters}", - "dialog:compareToCurrentSnapshot", null, params); - - } - Utils.encodeRecursive(context, action); - } - - boolean isFirstVersion = WCMCompareUtils.isFirstVersion(versions, item); - if (!isFirstVersion) - { - out.write("  "); - - // Compare To previous Snapshot - action = findAction(ACT_SNAPSHOT_COMPARE_TO_PREVIOUS, sandbox); - if (action == null) - { - Map params = new HashMap(2, 1.0f); - params.put("sandbox", sandbox); - params.put("version", "#{" + REQUEST_SNAPVERSION + "}"); - action = createAction(context, sandbox, ACT_SNAPSHOT_COMPARE_TO_PREVIOUS, "/images/icons/comparetoprevious.png", "#{DialogManager.setupParameters}", - "dialog:compareToPreviousSnapshot", null, params); - - } - Utils.encodeRecursive(context, action); - } - out.write("  "); - // Compare To Any Snapshot - action = findAction(ACT_SNAPSHOT_COMPARE_TO_ANY, sandbox); - if (action == null) - { - Map params = new HashMap(2, 1.0f); - params.put("sandbox", sandbox); - params.put("version", "#{" + REQUEST_SNAPVERSION + "}"); - action = createAction(context, sandbox, ACT_SNAPSHOT_COMPARE_TO_ANY, "/images/icons/comparetoany.png", "#{DialogManager.setupParameters}", - "dialog:compareToAnySnapshot", null, params); - - } - Utils.encodeRecursive(context, action); - requestMap.remove(REQUEST_SNAPVERSION); - - out.write("
"); - - tx.commit(); - } - catch (Throwable err) - { - try - { - if (tx != null) - { - tx.rollback(); - } - } - catch (Exception tex) - { - } - throw new RuntimeException(err); - } - } - - /** - * Aquire a UIActionLink component for the specified action - * - * @param fc FacesContext - * @param sandbox Root sandbox name - * @param name Action name - will be used for I18N message lookup - * @param icon Icon to display for the action - * @param actionListener Actionlistener for the action - * @param outcome Navigation outcome for the action - * @return UIActionLink component - */ - private UIActionLink aquireAction(FacesContext fc, String sandbox, String name, String icon, String actionListener, String outcome) - { - return aquireAction(fc, sandbox, name, icon, actionListener, outcome, null, null); - } - - /** - * Aquire a UIActionLink component for the specified action - * - * @param fc FacesContext - * @param sandbox Root sandbox name - * @param name Action name - will be used for I18N message lookup - * @param icon Icon to display for the action - * @param actionListener Actionlistener for the action - * @param outcome Navigation outcome for the action - * @param url HREF URL for the action - * @param params Parameters name/values for the action listener args - * @return UIActionLink component - */ - private UIActionLink aquireAction(FacesContext fc, String sandbox, String name, String icon, String actionListener, String outcome, String url, Map params) - { - UIActionLink action = findAction(name, sandbox); - if (action == null) - { - action = createAction(fc, sandbox, name, icon, actionListener, outcome, url, params); - } - return action; - } - - /** - * Locate a child UIActionLink component by name. - * - * @param name Of the action component to find - * @param sandbox Sandbox the action component is tied to - * @return UIActionLink component if found, else null if not created yet - */ - @SuppressWarnings("unchecked") - private UIActionLink findAction(String name, String sandbox) - { - UIActionLink action = null; - String actionId = name + '_' + sandbox; - if (logger.isDebugEnabled()) - logger.debug("Finding action Id: " + actionId); - for (UIComponent component : (List) getChildren()) - { - if (actionId.equals(component.getId())) - { - action = (UIActionLink) component; - if (logger.isDebugEnabled()) - logger.debug("...found action Id: " + actionId); - break; - } - } - return action; - } - - /** - * Create a UIActionLink child component. - * - * @param fc FacesContext - * @param sandbox Root sandbox name - * @param name Action name - will be used for I18N message lookup - * @param icon Icon to display for the actio n - * @param actionListener Actionlistener for the action - * @param outcome Navigation outcome for the action - * @param url HREF URL for the action - * @param params Parameters name/values for the action listener args - * @return UIActionLink child component - */ - @SuppressWarnings("unchecked") - private UIActionLink createAction(FacesContext fc, String sandbox, String name, String icon, String actionListener, String outcome, String url, Map params) - { - javax.faces.application.Application facesApp = fc.getApplication(); - UIActionLink control = (UIActionLink) facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK); - - String id = name + '_' + sandbox; - if (logger.isDebugEnabled()) - logger.debug("...creating action Id: " + id); - control.setRendererType(UIActions.RENDERER_ACTIONLINK); - control.setId(id); - control.setValue(Application.getMessage(fc, name)); - control.setShowLink(icon != null ? false : true); - control.setImage(icon); - - if (actionListener != null) - { - control.setActionListener(facesApp.createMethodBinding(actionListener, UIActions.ACTION_CLASS_ARGS)); - - // add sandbox as the default action listener parameter - if (params == null) - { - UIParameter param = (UIParameter) facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER); - param.setId(id + "_1"); - param.setName("sandbox"); - param.setValue(sandbox); - control.getChildren().add(param); - } - else - { - // if a specific set of parameters are supplied, then add them instead - int idIndex = 1; - for (String key : params.keySet()) - { - UIParameter param = (UIParameter) facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER); - param.setId(id + '_' + Integer.toString(idIndex++)); - param.setName(key); - String value = params.get(key); - if (value.startsWith("#{") == true) - { - ValueBinding vb = facesApp.createValueBinding(value); - param.setValueBinding("value", vb); - } - else - { - param.setValue(params.get(key)); - } - control.getChildren().add(param); - } - } - } - if (outcome != null) - { - control.setAction(new ConstantMethodBinding(outcome)); - } - if (url != null) - { - control.setHref(url); - control.setTarget("new"); - } - - this.getChildren().add(control); - - return control; - } - - @SuppressWarnings("unchecked") - private void determineDeploymentStatus(FacesContext context, NodeRef webProjectRef, String sandbox, NodeService nodeService, AVMService avmService) - { - // if the store property holding the last deployment id is non null a - // deployment has been attempted - PropertyValue val = avmService.getStoreProperty(sandbox, SandboxConstants.PROP_LAST_DEPLOYMENT_ID); - String attemptId = null; - - if (val != null) - { - attemptId = val.getStringValue(); - - // get the latest deployment attempt - NodeRef attempt = DeploymentUtil.findDeploymentAttempt(attemptId); - if (attempt != null) - { - // retrieve the snapshot deployed - Integer ver = (Integer) nodeService.getProperty(attempt, WCMAppModel.PROP_DEPLOYATTEMPTVERSION); - if (ver != null) - { - this.deployAttemptVersion = ver.intValue(); - } - - // determine if all required reports are present - List selectedServers = (List) nodeService.getProperty(attempt, WCMAppModel.PROP_DEPLOYATTEMPTSERVERS); - int numServersSelected = 0; - if (selectedServers != null) - { - numServersSelected = selectedServers.size(); - - List deployReportRefs = nodeService.getChildAssocs(attempt, WCMAppModel.ASSOC_DEPLOYMENTREPORTS, RegexQNamePattern.MATCH_ALL); - - if (deployReportRefs.size() >= numServersSelected) - { - // the number of expected reports are present, determine the status - boolean oneOrMoreFailed = false; - boolean allFailed = true; - for (ChildAssociationRef ref : deployReportRefs) - { - NodeRef report = ref.getChildRef(); - - // get the deploy outcome - Boolean successful = (Boolean) nodeService.getProperty(report, WCMAppModel.PROP_DEPLOYSUCCESSFUL); - - if (successful != null) - { - if (successful.booleanValue()) - { - allFailed = false; - } - else - { - oneOrMoreFailed = true; - } - } - } - - // get the right status string - if (allFailed) - { - this.deployStatus = Application.getMessage(context, "deploy_status_failed"); - } - else if (oneOrMoreFailed) - { - this.deployStatus = Application.getMessage(context, "deploy_status_partial"); - } - else - { - this.deployStatus = Application.getMessage(context, "deploy_status_live"); - } - } - else - { - // not all expected reports are present yet, still in progress - this.deployStatus = Application.getMessage(context, "deploy_status_in_progress"); - } - } - } - } - } - - private AVMService getAVMService(FacesContext fc) - { - return (AVMService)FacesContextUtils.getRequiredWebApplicationContext(fc).getBean("AVMLockingAwareService"); - } - - private SandboxService getSandboxService(FacesContext fc) - { - return (SandboxService)FacesContextUtils.getRequiredWebApplicationContext(fc).getBean("SandboxService"); - } - - // ------------------------------------------------------------------------------ - // Strongly typed component property accessors - - /** - * Returns the Sandbox to show the snapshots for - * - * @return The Sandbox name - */ - public String getValue() - { - ValueBinding vb = getValueBinding("value"); - if (vb != null) - { - this.value = (String) vb.getValue(getFacesContext()); - } - - return this.value; - } - - /** - * Sets the Sandbox to show the snapshots for - * - * @param value The Sandbox name - */ - public void setValue(String value) - { - this.value = value; - } - - /** - * @return Returns the date filter. - */ - public String getDateFilter() - { - ValueBinding vb = getValueBinding("dateFilter"); - if (vb != null) - { - this.dateFilter = (String) vb.getValue(getFacesContext()); - } - - return this.dateFilter; - } - - /** - * @param dateFilter The date filter to set. - */ - public void setDateFilter(String dateFilter) - { - this.dateFilter = dateFilter; - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java b/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java deleted file mode 100644 index 2355d9913b..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java +++ /dev/null @@ -1,1596 +0,0 @@ -/* - * Copyright (C) 2005-2012 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.component; - -import java.io.IOException; -import java.io.Serializable; -import java.text.DateFormat; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.ResourceBundle; -import java.util.Set; - -import javax.faces.component.UIComponent; -import javax.faces.component.UIParameter; -import javax.faces.component.html.HtmlCommandButton; -import javax.faces.context.FacesContext; -import javax.faces.context.ResponseWriter; -import javax.faces.el.ValueBinding; -import javax.transaction.UserTransaction; - -import org.alfresco.config.JNDIConstants; -import org.alfresco.model.WCMAppModel; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.web.scripts.FileTypeImageUtils; -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.service.cmr.avmsync.AVMDifference; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.wcm.asset.AssetInfo; -import org.alfresco.wcm.asset.AssetInfoImpl; -import org.alfresco.wcm.sandbox.SandboxConstants; -import org.alfresco.wcm.sandbox.SandboxInfo; -import org.alfresco.wcm.sandbox.SandboxService; -import org.alfresco.wcm.util.WCMUtil; -import org.alfresco.wcm.webproject.WebProjectInfo; -import org.alfresco.wcm.webproject.WebProjectService; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.servlet.DownloadContentServlet; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.BrowseBean; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.repository.User; -import org.alfresco.web.bean.wcm.AVMBrowseBean; -import org.alfresco.web.bean.wcm.AVMNode; -import org.alfresco.web.bean.wcm.AVMUtil; -import org.alfresco.web.bean.wcm.DeploymentUtil; -import org.alfresco.web.bean.wcm.WebProject; -import org.alfresco.web.data.IDataContainer; -import org.alfresco.web.data.QuickSort; -import org.alfresco.web.forms.Form; -import org.alfresco.web.ui.common.ComponentConstants; -import org.alfresco.web.ui.common.PanelGenerator; -import org.alfresco.web.ui.common.Utils; -import org.alfresco.web.ui.common.component.UIActionLink; -import org.alfresco.web.ui.common.component.UIMenu; -import org.alfresco.web.ui.common.converter.ByteSizeConverter; -import org.alfresco.web.ui.repo.component.UIActions; -import org.alfresco.web.ui.wcm.WebResources; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.webscripts.ui.common.ConstantMethodBinding; -import org.springframework.extensions.webscripts.ui.common.component.SelfRenderingComponent; - -/** - * Component responsible for rendering the list of user sandboxes for a web project. - *

- * The list of users attached to the supplied Web Project noderef (must be of type - * wcm:avmfolder) are iterated and the various AVM services used to provide the list - * of modified files for each user in turn. Actions are rendering with appropriate - * permission evaluators next to each item. The status of workflows in progress are - * also checked against items when building the list of actions. - *

- * Multi-select functionality is provided for specific actions. - * - * @author Kevin Roast - */ -public class UIUserSandboxes extends SelfRenderingComponent implements Serializable -{ - private static final long serialVersionUID = 362170364310941059L; - - private static Log logger = LogFactory.getLog(UIUserSandboxes.class); - - private static final String ACT_FIND_FORM_CONTENT = "find_form_content"; - private static final String ACT_CREATE_FORM_CONTENT = "create_form_content"; - private static final String ACT_SANDBOX_REVERTSELECTED = "sandbox_revertselected"; - private static final String ACT_SANDBOX_SUBMITSELECTED = "sandbox_submitselected"; - private static final String ACT_SANDBOX_BROWSE = "sandbox_browse"; - private static final String ACT_SANDBOX_REVERTALL = "sandbox_revertall"; - private static final String ACT_SANDBOX_SUBMITALL = "sandbox_submitall"; - private static final String ACT_SANDBOX_PREVIEW = "sandbox_preview"; - private static final String ACT_SANDBOX_ICON = "sandbox_icon"; - private static final String ACT_REMOVE_SANDBOX = "sandbox_remove"; - private static final String ACT_SANDBOX_REFRESH = "sandbox_refresh"; - private static final String ACT_SANDBOX_DEPLOY = "sandbox_deploy"; - private static final String ACT_SANDBOX_DEPLOY_REPORT = "deployment_report_action"; - private static final String ACT_SANDBOX_RELEASE_SERVER = "sandbox_release_test_server"; - - private static final String ACTIONS_FILE = "avm_file_modified"; - private static final String ACTIONS_FOLDER = "avm_folder_modified"; - private static final String ACTIONS_DELETED = "avm_deleted_modified"; - - private static final String COMPONENT_ACTIONS = "org.alfresco.faces.Actions"; - - private static final String PANEL_MODIFIED = "_items"; - private static final String PANEL_FORMS = "_forms"; - - private static final String MSG_MODIFIED_ITEMS = "modified_items"; - private static final String MSG_CONTENT_FORMS = "content_forms"; - private static final String MSG_SIZE = "size"; - private static final String MSG_CREATED = "created_date"; - private static final String MSG_USERNAME = "sandbox_user"; - private static final String MSG_NAME = "name"; - private static final String MSG_TITLE = "title"; - private static final String MSG_DESCRIPTION = "description"; - private static final String MSG_MODIFIED = "modified_date"; - private static final String MSG_ACTIONS = "actions"; - private static final String MSG_DELETED_ITEM = "avm_node_deleted"; - private static final String MSG_SELECTED = "selected"; - private static final String MSG_NO_MODIFIED_ITEMS = "sandbox_no_modified_items"; - private static final String MSG_NO_WEB_FORMS = "sandbox_no_web_forms"; - private static final String MSG_MY_SANDBOX = "sandbox_my_sandbox"; - private static final String MSG_COUNT_CONFLICTED_ITEMS="count_conflicted_items"; - private static final String MSG_REVERT_ALL_CONFLICTS="revert_all_conflicts"; - - private static final String REQUEST_FORM_REF = "formref"; - private static final String REQUEST_PREVIEW_REF = "prevhref"; - private static final String REQUEST_UPDATE_TEST_SERVER = "updatetestserver"; - - private static final String SPACE_ICON = "/images/icons/" + BrowseBean.SPACE_SMALL_DEFAULT + ".gif"; - private static final String CONFLICTED_ICON = "/images/icons/conflict-16.gif"; - - public static final String PARAM_FORM_NAME = "form-name"; - - private static final String SCRIPT_MULTISELECT = - ""; - - /** website to show sandboxes for */ - private NodeRef value; - - /** webapp to filter list by */ - private String webapp; - - /** cached converter instance */ - transient private ByteSizeConverter sizeConverter = null; - - /** set of exanded user panels */ - private Set expandedPanels = new HashSet(); - - /** map of users to modified item nodes - used for multi-select action lookup */ - private Map userToRowLookup = new HashMap(8, 1.0f); - private Map rowToUserLookup = new HashMap(8, 1.0f); - private Map> userNodes = new HashMap>(8, 1.0f); - - private String[] checkedItems = null; - - /** transient list of available web forms */ - private List forms = null; - - - // ------------------------------------------------------------------------------ - // Component implementation - - /** - * @see javax.faces.component.UIComponent#getFamily() - */ - public String getFamily() - { - return "org.alfresco.faces.UserSandboxes"; - } - - @SuppressWarnings("unchecked") - public void restoreState(FacesContext context, Object state) - { - Object values[] = (Object[])state; - // standard component attributes are restored by the super class - super.restoreState(context, values[0]); - this.value = (NodeRef)values[1]; - this.expandedPanels = (Set)values[2]; - this.userToRowLookup = (Map)values[3]; - this.rowToUserLookup = (Map)values[4]; - this.userNodes = (Map)values[5]; - this.checkedItems = (String[])values[6]; - } - - public Object saveState(FacesContext context) - { - return new Object[] - { - // standard component attributes are saved by the super class - super.saveState(context), - this.value, - this.expandedPanels, - this.userToRowLookup, - this.rowToUserLookup, - this.userNodes, - this.checkedItems - }; - } - - /** - * @see javax.faces.component.UIComponentBase#getRendersChildren() - */ - public boolean getRendersChildren() - { - return true; - } - - /** - * @see javax.faces.component.UIComponentBase#encodeChildren(javax.faces.context.FacesContext) - */ - public void encodeChildren(FacesContext context) throws IOException - { - // the child components are rendered explicitly during the encodeBegin() - } - - /** - * @see javax.faces.component.UIComponentBase#decode(javax.faces.context.FacesContext) - */ - @SuppressWarnings("unchecked") - public void decode(FacesContext context) - { - Map requestMap = context.getExternalContext().getRequestParameterMap(); - Map valuesMap = context.getExternalContext().getRequestParameterValuesMap(); - - // detect if Modified Items or Available Content Forms panel has been expanded/collapsed - String fieldId = getClientId(context) + PANEL_FORMS; - String value = (String)requestMap.get(fieldId); - if (value == null || value.length() == 0) - { - fieldId = getClientId(context) + PANEL_MODIFIED; - value = (String)requestMap.get(fieldId); - } - if (value != null && value.length() != 0) - { - // expand/collapse the specified users panel - if (this.expandedPanels.contains(value) == true) - { - // collapse by removing from expanded list - this.expandedPanels.remove(value); - } - else - { - // add to expanded panel set - this.expandedPanels.add(value); - } - } - - // store the list of checked items for multi-select action context - this.checkedItems = (String[])valuesMap.get(getClientId(context)); - } - - /** - * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext) - */ - @SuppressWarnings("unchecked") - public void encodeBegin(FacesContext context) throws IOException - { - if (isRendered() == false) - { - return; - } - - ResponseWriter out = context.getResponseWriter(); - - this.rowToUserLookup.clear(); - this.userToRowLookup.clear(); - this.userNodes.clear(); - this.forms = null; - - ResourceBundle bundle = Application.getBundle(context); - SandboxService sbService = getSandboxService(context); - WebProjectService wpService = getWebProjectService(context); - NodeService nodeService = getNodeService(context); - PermissionService permissionService = getPermissionService(context); - AVMBrowseBean avmBrowseBean = (AVMBrowseBean)FacesHelper.getManagedBean(context, AVMBrowseBean.BEAN_NAME); - boolean showAllSandboxes = avmBrowseBean.getShowAllSandboxes(); - UserTransaction tx = null; - try - { - tx = Repository.getUserTransaction(context, true); - tx.begin(); - - NodeRef websiteRef = getValue(); - if (websiteRef == null) - { - throw new IllegalArgumentException("Website NodeRef must be specified."); - } - String storeRoot = (String)nodeService.getProperty(websiteRef, WCMAppModel.PROP_AVMSTORE); - - // find out the current user role in the web project - User currentUser = Application.getCurrentUser(context); - String currentUserName = currentUser.getUserName(); - String currentUserRole = wpService.getWebUserRole(websiteRef, currentUserName); - - // sort the user list alphabetically and insert the current user at the top of the list - List userRoleWrappers; - if (showAllSandboxes) - { - Map userRoles = null; - if (currentUserRole.equals(WCMUtil.ROLE_CONTENT_MANAGER) || currentUserRole.equals(WCMUtil.ROLE_CONTENT_PUBLISHER)) - { - Map allUserRoles = wpService.listWebUsers(websiteRef); - - WebProjectInfo wpInfo = wpService.getWebProject(websiteRef); - List sbInfos = sbService.listSandboxes(wpInfo.getStoreId()); - - userRoles = new HashMap(sbInfos.size()); - - // Note: currently displays author sandboxes only - for (SandboxInfo sbInfo : sbInfos) - { - if (sbInfo.getSandboxType().equals(SandboxConstants.PROP_SANDBOX_AUTHOR_MAIN)) - { - userRoles.put(sbInfo.getName(), allUserRoles.get(sbInfo.getName())); - } - } - } - else - { - userRoles = new HashMap(1); - userRoles.put(currentUserName, currentUserRole); - } - - userRoleWrappers = buildSortedUserRoles(nodeService, currentUserName, userRoles); - } - else - { - userRoleWrappers = buildCurrentUserRole(wpService, websiteRef, currentUserName); - } - - // determine whether the deploy action should be shown - boolean deployServersConfigured = false; - List deployToServers = Repository.getServiceRegistry(context).getDeploymentService().findTestDeploymentServers(websiteRef, false); - if (deployToServers != null && deployToServers.size() > 0) - { - deployServersConfigured = true; - } - - // output a javascript function we need for multi-select functionality - out.write(SCRIPT_MULTISELECT); - - // walk the list of users who have a sandbox in the website - int index = 0; - for (UserRoleWrapper wrapper : userRoleWrappers) - { - String username = wrapper.UserName; - String userrole = wrapper.UserRole; - - // create the lookup value of sandbox index to username - this.userToRowLookup.put(index, username); - this.rowToUserLookup.put(username, index); - - // build the name of the main store for this user (user sandbox id) - String mainStore = AVMUtil.buildUserMainStoreName(storeRoot, username); - - // check it exists before we render the view - if (sbService.getSandbox(mainStore) != null) - { - // check the permissions on this store for the current user - if (logger.isDebugEnabled()) - logger.debug("Checking user role to view store: " + mainStore); - - if ((showAllSandboxes && - (currentUserName.equals(username) || - WCMUtil.ROLE_CONTENT_MANAGER.equals(currentUserRole) || - WCMUtil.ROLE_CONTENT_PUBLISHER.equals(currentUserRole))) || - showAllSandboxes == false) - { - if (logger.isDebugEnabled()) - logger.debug("Building sandbox view for user store: " + mainStore); - - // determine if the sandbox has an allocated test server for deployment - List testServers = DeploymentUtil.findAllocatedTestServers(mainStore); - boolean hasAllocatedTestServer = (!testServers.isEmpty()); - - // determine if there are any previous deployment attempts - List deployAttempts = DeploymentUtil.findDeploymentAttempts(mainStore); - boolean hasPreviousDeployments = (deployAttempts.size() > 0); - - // for each user sandbox, generate an outer panel table - PanelGenerator.generatePanelStart(out, - context.getExternalContext().getRequestContextPath(), - "innerwhite", - "white"); - - // components for the current username, preview, browse and modified items inner list - out.write(""); - - // modified items panel - out.write(""); - - // content forms panel - if (permissionService.hasPermission( - AVMNodeConverter.ToNodeRef(-1, AVMUtil.buildSandboxRootPath(mainStore)), - PermissionService.ADD_CHILDREN) == AccessStatus.ALLOWED) - { - out.write(""); - } - out.write("
"); - // show the icon for the sandbox as a clickable browse link image - // this is currently identical to the sandbox_browse action as below - UIActionLink browseAction = aquireAction( - context, mainStore, username, ACT_SANDBOX_ICON, WebResources.IMAGE_USERSANDBOX_32, - "#{AVMBrowseBean.setupSandboxAction}", "browseSandbox"); - browseAction.setTooltip(Application.getMessage(context, ACT_SANDBOX_BROWSE) + " (" + username + " " + Application.getMessage(context, "sandbox_title_extension") + ")"); - - browseAction.setShowLink(false); - Utils.encodeRecursive(context, browseAction); - out.write(""); - if (wrapper.IsCurrentUser == false) - { - out.write(""); - out.write(bundle.getString(MSG_USERNAME)); - out.write(": "); - out.write(Utils.encode(username)); - } - else - { - out.write(""); - out.write(bundle.getString(MSG_MY_SANDBOX)); - out.write(""); - } - out.write(" ("); - out.write(bundle.getString(userrole)); - out.write(")
"); - - // Direct actions for a sandbox... - - // Browse Sandbox - UIActionLink action = aquireAction(context, mainStore, username, ACT_SANDBOX_BROWSE, "/images/icons/space_small.gif", "#{AVMBrowseBean.setupSandboxAction}", "browseSandbox"); - action.setTooltip(Application.getMessage(context, ACT_SANDBOX_BROWSE) + " (" + username + " " + Application.getMessage(context, "sandbox_title_extension") + ")"); - - Utils.encodeRecursive(context, action); - out.write(""); - - // Preview Website - String websiteUrl = AVMUtil.getPreviewURI(mainStore, JNDIConstants.DIR_DEFAULT_WWW_APPBASE + '/' + getWebapp()); - Map requestMap = context.getExternalContext().getRequestMap(); - requestMap.put(REQUEST_PREVIEW_REF, websiteUrl); - - action = aquireAction(context, mainStore, username, ACT_SANDBOX_PREVIEW, "/images/icons/preview_website.gif", null, null, "#{" + REQUEST_PREVIEW_REF + "}", null); - action.setTooltip(Application.getMessage(context, ACT_SANDBOX_PREVIEW) + " (" + username + " " + Application.getMessage(context, "sandbox_title_extension") + ")"); - - Utils.encodeRecursive(context, action); - requestMap.remove(REQUEST_PREVIEW_REF); - out.write(""); - - // Submit All Items - action = aquireAction(context, mainStore, username, ACT_SANDBOX_SUBMITALL, "/images/icons/submit_all.gif", "#{AVMBrowseBean.setupAllItemsAction}", "dialog:submitSandboxItems"); - action.setTooltip(Application.getMessage(context, ACT_SANDBOX_SUBMITALL) + " (" + username + " " + Application.getMessage(context, "sandbox_title_extension") + ")"); - - Utils.encodeRecursive(context, action); - out.write(""); - - // Revert All Items - action = aquireAction(context, mainStore, username, ACT_SANDBOX_REVERTALL, "/images/icons/revert_all.gif", "#{AVMBrowseBean.setupAllItemsAction}", "dialog:revertAllItems"); - action.setTooltip(Application.getMessage(context, ACT_SANDBOX_REVERTALL) + " (" + username + " " + Application.getMessage(context, "sandbox_title_extension") + ")"); - - Utils.encodeRecursive(context, action); - out.write(""); - - // More Actions menu - UIMenu menu = findMenu(mainStore); - if (menu == null) - { - // create the menu, then the actions - menu = createMenu(context, mainStore); - menu.setTooltip(Application.getMessage(context, "more_actions") + " (" + username + " " + Application.getMessage(context, "sandbox_title_extension") + ")"); - - // add the menu to this component - this.getChildren().add(menu); - } - - // clear current menu actions then add relevant ones - menu.getChildren().clear(); - - // Deploy action - if (deployServersConfigured) - { - Map dialogParams = new HashMap(6); - dialogParams.put("store", mainStore); - dialogParams.put("username", username); - requestMap.put(REQUEST_UPDATE_TEST_SERVER, Boolean.toString(hasAllocatedTestServer)); - dialogParams.put("updateTestServer", "#{" + REQUEST_UPDATE_TEST_SERVER + "}"); - UIActionLink deploy = createAction(context, mainStore, username, - ACT_SANDBOX_DEPLOY, "/images/icons/deploy.gif", - "#{DialogManager.setupParameters}", "dialog:deployWebsite", - null, dialogParams, false); - deploy.setTooltip(Application.getMessage(context, ACT_SANDBOX_DEPLOY) + " (" + username + " " + Application.getMessage(context, "sandbox_title_extension") + ")"); - menu.getChildren().add(deploy); - } - - // View deployment report action - if (hasPreviousDeployments) - { - UIActionLink reports = createAction(context, mainStore, username, - ACT_SANDBOX_DEPLOY_REPORT, "/images/icons/deployment_report.gif", - "#{DialogManager.setupParameters}", "dialog:viewDeploymentReport", - null, null, false); - reports.setTooltip(Application.getMessage(context, ACT_SANDBOX_DEPLOY_REPORT) + " (" + username + " " + Application.getMessage(context, "sandbox_title_extension") + ")"); - menu.getChildren().add(reports); - } - - // Release Test Server action - if (hasAllocatedTestServer) - { - UIActionLink releaseServer = createAction(context, mainStore, username, - ACT_SANDBOX_RELEASE_SERVER, "/images/icons/release_server.gif", - "#{DialogManager.setupParameters}", "dialog:releaseTestServer", - null, null, false); - releaseServer.setTooltip(Application.getMessage(context, ACT_SANDBOX_RELEASE_SERVER) + " (" + username + " " + Application.getMessage(context, "sandbox_title_extension") + ")"); - menu.getChildren().add(releaseServer); - } - - // Refresh Sandbox action - UIActionLink refresh = createAction(context, mainStore, username, - ACT_SANDBOX_REFRESH, "/images/icons/reset.gif", - "#{AVMBrowseBean.refreshSandbox}", null, null, null, false); - refresh.setTooltip(Application.getMessage(context, ACT_SANDBOX_REFRESH) + " (" + username + " " + Application.getMessage(context, "sandbox_title_extension") + ")"); - menu.getChildren().add(refresh); - - // Delete Sandbox action - if (WCMUtil.ROLE_CONTENT_MANAGER.equals(currentUserRole)) - { - UIActionLink delete = createAction(context, mainStore, username, - ACT_REMOVE_SANDBOX, "/images/icons/delete_sandbox.gif", - "#{AVMBrowseBean.setupSandboxAction}", "dialog:deleteSandbox", - null, null, false); - delete.setTooltip(Application.getMessage(context, ACT_REMOVE_SANDBOX) + " (" + username + " " + Application.getMessage(context, "sandbox_title_extension") + ")"); - menu.getChildren().add(delete); - } - - // render the menu - Utils.encodeRecursive(context, menu); - - out.write("
"); - String panelImage = WebResources.IMAGE_COLLAPSED; - if (this.expandedPanels.contains(username + PANEL_MODIFIED)) - { - panelImage = WebResources.IMAGE_EXPANDED; - } - - String title = Application.getMessage(context, MSG_MODIFIED_ITEMS) + " (" + username + " " + Application.getMessage(context, "sandbox_title_extension") + ")"; - String submitScript = Utils.generateFormSubmit(context, this, getClientId(context) + PANEL_MODIFIED, username + PANEL_MODIFIED); - out.write(""); - out.write(Utils.buildImageTag(context, panelImage, 11, 11, title)); - out.write(""); - - out.write(" "); - out.write(bundle.getString(MSG_MODIFIED_ITEMS)); - out.write(""); - - if (this.expandedPanels.contains(username + PANEL_MODIFIED)) - { - out.write("
"); - - // list the modified docs for this sandbox user - renderUserFiles(context, out, username, storeRoot, index); - } - out.write("
"); - panelImage = WebResources.IMAGE_COLLAPSED; - if (this.expandedPanels.contains(username + PANEL_FORMS)) - { - panelImage = WebResources.IMAGE_EXPANDED; - } - - title = Application.getMessage(context, MSG_CONTENT_FORMS) + " (" + username + " " + Application.getMessage(context, "sandbox_title_extension") + ")"; - submitScript = Utils.generateFormSubmit(context, this, getClientId(context) + PANEL_FORMS, username + PANEL_FORMS); - out.write(""); - out.write(Utils.buildImageTag(context, panelImage, 11, 11, title)); - out.write(""); - - out.write(" "); - out.write(bundle.getString(MSG_CONTENT_FORMS)); - out.write(""); - if (this.expandedPanels.contains(username + PANEL_FORMS)) - { - out.write("
"); - - // list the content forms for this sandbox user - renderContentForms(context, out, websiteRef, username, storeRoot); - } - out.write("
"); - - // end the outer panel for this sandbox - PanelGenerator.generatePanelEnd(out, - context.getExternalContext().getRequestContextPath(), - "innerwhite"); - - // spacer row - if (index++ < userRoleWrappers.size() - 1) - { - out.write("

"); - } - } - } - } - - tx.commit(); - } - catch (Throwable err) - { - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - throw new RuntimeException(err); - } - } - - /** - * Build a sorted list of objects representing the users of the website. - *

- * User role data and the current user is also stored. The current user sandbox - * is inserted at the top of the list if present. - */ - private static List buildSortedUserRoles( - NodeService nodeService, String currentUser, Map userRoles) - { - // build a list of wrappers to hold the fields we need for each user and role - UserRoleWrapper currentUserWrapper = null; - List wrappers = new LinkedList(); - for (Map.Entry userRole : userRoles.entrySet()) - { - String username = userRole.getKey(); - String userrole = userRole.getValue(); - - UserRoleWrapper wrapper = new UserRoleWrapper(username, userrole); - - if (currentUser.equals(username)) - { - wrapper.IsCurrentUser = true; - currentUserWrapper = wrapper; - } - else - { - wrappers.add(wrapper); - } - } - - // sort list by username - QuickSort sorter = new QuickSort(wrappers, "UserName", true, IDataContainer.SORT_CASEINSENSITIVE); - sorter.sort(); - - // if present, insert the current user to the top of the list - if (currentUserWrapper != null) - { - wrappers.add(0, currentUserWrapper); - } - - return wrappers; - } - - /** - * Build a list containing one item representing the current user role for the website. - */ - private static List buildCurrentUserRole( - WebProjectService wpService, NodeRef webProjectRef, String username) - { - // build a list of wrappers to hold the fields we need for each user and role - List wrappers = new ArrayList(0); - String userrole = wpService.getWebUserRole(webProjectRef, username); - if (userrole != null) - { - wrappers = new ArrayList(1); - - UserRoleWrapper wrapper = new UserRoleWrapper(username, userrole); - wrapper.IsCurrentUser = true; - wrappers.add(0, wrapper); - } - return wrappers; - } - - /** - * Render the list of user modified files/folders in the layered sandbox area. - * - * @param fc FacesContext - * @param out ResponseWriter - * @param username The username to render the modified files for - * @param index Index of the sandbox in the list of sandboxes - * @param storeRoot Root name of the store containing the users sandbox - * - * @throws IOException - */ - private void renderUserFiles( - FacesContext fc, ResponseWriter out, String username, String storeRoot, int index) - throws IOException - { - PermissionService permissionService = getPermissionService(fc); - SandboxService sandboxService = getSandboxService(fc); - - DateFormat df = Utils.getDateTimeFormat(fc); - ResourceBundle bundle = Application.getBundle(fc); - - // compare user sandbox to staging sandbox - filter by current webapp, include deleted items - String userStore = AVMUtil.buildUserMainStoreName(storeRoot, username); - String userStorePath = AVMUtil.buildStoreWebappPath(userStore, getWebapp()); - String stagingStore = AVMUtil.buildStagingStoreName(storeRoot); - String stagingStorePath = AVMUtil.buildStoreWebappPath(stagingStore, getWebapp()); - - long start = System.currentTimeMillis(); - - List assets = sandboxService.listChangedWebApp(userStore, getWebapp(), true); - - if (logger.isDebugEnabled()) - { - logger.debug("List "+assets.size()+" changes webapp in "+(System.currentTimeMillis()-start)+" msecs"); - } - - if (assets.size() != 0) - { - start = System.currentTimeMillis(); - - // output confict header, only if conflicts exist - int diffCount = 0; - for (AssetInfo asset : assets) - { - if (asset.getDiffCode() == AVMDifference.CONFLICT) - { - diffCount++; - } - } - - if (diffCount > 0) - { - out.write(""); - out.write(""); - out.write(""); - out.write(""); - out.write(""); - out.write("
"); - - out.write(Utils.buildImageTag(fc, CONFLICTED_ICON, 16, 16, "", null, "-25%")); - out.write(" "); - out.write(MessageFormat.format(bundle.getString(MSG_COUNT_CONFLICTED_ITEMS), diffCount)); - - out.write(""); - Utils.encodeRecursive(fc, createRevertAllItemsButton(fc, bundle, username, userStorePath, stagingStorePath)); - out.write("
"); - out.write("

"); - } - - // info we need to calculate preview paths for assets - int rootPathIndex = AVMUtil.buildSandboxRootPath(userStore).length(); - - // get the UIActions component responsible for rendering context related user actions - // TODO: we may need a component per user instance? (or use evaluators for roles...) - UIActions uiFileActions = aquireUIActions(ACTIONS_FILE, userStore); - UIActions uiFolderActions = aquireUIActions(ACTIONS_FOLDER, userStore); - UIActions uiDeletedActions = aquireUIActions(ACTIONS_DELETED, userStore); - - String id = getClientId(fc); - - // TODO - refactor to AssetInfo and getSelected calls ... etc - List nodes = new ArrayList(assets.size()); - for (AssetInfo asset : assets) - { - // TODO - nodes.add(((AssetInfoImpl)asset).getAVMNodeDescriptor()); - } - // store lookup of username to list of modified nodes - this.userNodes.put(username, nodes); - - // output the table of modified items - // TODO: apply tag style - removed hardcoded - out.write(""); - - // output multi-select actions for this user - out.write(""); - - // header row - out.write(""); - - // assets copy to set checkbox value by node index - List assetsCopy = new ArrayList(assets); - - // move conflicts to top of list - if (diffCount > 0) - { - List conflicted = new ArrayList(); - - for(Iterator it = assets.iterator(); it.hasNext();) - { - AssetInfo diff = (AssetInfo) it.next(); - if (diff.getDiffCode() == AVMDifference.CONFLICT) - { - conflicted.add(diff); - it.remove(); - } - } - assets.addAll(0, conflicted); - } - - // output each of the modified files as a row in the table - int rowIndex = 0; - for (AssetInfo node : assets) - { - // TODO: different display cases for diff.getDifferenceCode()? - boolean isGhost = node.isDeleted(); - String sourcePath = node.getAvmPath(); - - // output multi-select checkbox - out.write(""); - rowIndex++; - - if (isGhost == false) - { - // icon and name of the file/folder - files are clickable to see the content - String name = node.getName(); - String linkPrefix = - ""; - - if (node.isFile()) - { - out.write(""); - out.write(""); - out.write(""); - out.write(""); - out.write(""); - } - - // end table - out.write("
"); - out.write(bundle.getString(MSG_SELECTED)); - out.write(":  "); - NodeRef userStoreRef = AVMNodeConverter.ToNodeRef(-1, AVMUtil.buildSandboxRootPath(userStore)); - if (permissionService.hasPermission(userStoreRef, PermissionService.WRITE) == AccessStatus.ALLOWED || - permissionService.hasPermission(userStoreRef, PermissionService.ADD_CHILDREN) == AccessStatus.ALLOWED) - { - Utils.encodeRecursive(fc, aquireAction( - fc, userStore, username, ACT_SANDBOX_SUBMITSELECTED, "/images/icons/submit_all.gif", - "#{AVMBrowseBean.setupSandboxAction}", "dialog:submitSandboxItems")); - out.write("  "); - Utils.encodeRecursive(fc, aquireAction( - fc, userStore, username, ACT_SANDBOX_REVERTSELECTED, "/images/icons/revert_all.gif", - "#{AVMBrowseBean.setupSandboxAction}", "dialog:revertSelectedItems")); - } - out.write("
"); - // multi-select checkbox - out.write(""); - out.write(bundle.getString(MSG_NAME)); - out.write(""); - out.write(bundle.getString(MSG_CREATED)); - out.write(""); - out.write(bundle.getString(MSG_MODIFIED)); - out.write(""); - out.write(bundle.getString(MSG_SIZE)); - out.write(""); - out.write(bundle.getString(MSG_ACTIONS)); - out.write("
"); - if (node.getDiffCode() == AVMDifference.CONFLICT) - { - out.write(Utils.buildImageTag(fc, CONFLICTED_ICON, 16, 16, "")); - } - out.write(""); - UIAVMLockIcon lockIcon = (UIAVMLockIcon)fc.getApplication().createComponent(UIAVMLockIcon.ALFRESCO_FACES_AVMLOCKICON); - lockIcon.setId("avmlock_" + Integer.toString(rowIndex)); - lockIcon.setValue(node); - Utils.encodeRecursive(fc, lockIcon); - out.write(""); - out.write(linkPrefix); - out.write(Utils.buildImageTag(fc, FileTypeImageUtils.getFileTypeImage(fc, name, true), "")); - out.write(""); - out.write(""); - out.write(linkPrefix); - out.write(Utils.encode(name)); - out.write(""); - } - else - { - out.write(""); - out.write(Utils.buildImageTag(fc, SPACE_ICON, 16, 16, "")); - out.write(""); - out.write(Utils.encode(name)); - } - out.write(""); - - // created date - out.write(df.format(node.getCreatedDate())); - out.write(""); - - // modified date - out.write(df.format(node.getModifiedDate())); - out.write(""); - - // build node context required for actions - AVMNode avmNode = new AVMNode(node); - String assetPath = sourcePath.substring(rootPathIndex); - String previewUrl = AVMUtil.getPreviewURI(userStore, JNDIConstants.DIR_DEFAULT_WWW_APPBASE + assetPath); - avmNode.getProperties().put("previewUrl", previewUrl); - avmNode.getProperties().put("avmDiff", node.getDiffCode()); - - // size of files - if (node.isFile()) - { - out.write(getSizeConverter().getAsString(fc, this, node.getFileSize())); - out.write(""); - - // add UI actions for this item - uiFileActions.setContext(avmNode); - Utils.encodeRecursive(fc, uiFileActions); - } - else - { - out.write(""); - - // add UI actions for this item - uiFolderActions.setContext(avmNode); - Utils.encodeRecursive(fc, uiFolderActions); - } - } - else - { - // must have been deleted from this sandbox - show as ghosted - String name = node.getName(); - out.write(""); - if (node.isFile() && node.isDeleted()) - { - out.write(Utils.buildImageTag(fc, FileTypeImageUtils.getFileTypeImage(fc, name, true), "")); - out.write(""); - out.write(Utils.encode(name) + " [" + bundle.getString(MSG_DELETED_ITEM) + "]"); - out.write(""); - } - else - { - out.write(Utils.buildImageTag(fc, SPACE_ICON, 16, 16, "")); - out.write(""); - out.write(Utils.encode(name) + " [" + bundle.getString(MSG_DELETED_ITEM) + "]"); - } - out.write(""); - - // created date - out.write(df.format(node.getCreatedDate())); - out.write(""); - - // modified date - out.write(df.format(node.getModifiedDate())); - out.write(""); - - // size of files - if (node.isFile()) - { - out.write(getSizeConverter().getAsString(fc, this, node.getFileSize())); - } - out.write(""); - - // deleted UI actions for this item - uiDeletedActions.setContext(new AVMNode(node)); - Utils.encodeRecursive(fc, uiDeletedActions); - } - out.write("
"); - - if (logger.isDebugEnabled()) - { - logger.debug("Wrote table in "+(System.currentTimeMillis()-start)+" msecs"); - } - } - else - { - // output "no modified files found" message - out.write("
"); - out.write(bundle.getString(MSG_NO_MODIFIED_ITEMS)); - out.write("
"); - } - } - - /** - * Render the list of content forms available for this sandbox. - * - * @param fc FacesContext - * @param out ResponseWriter - * - * @throws IOException - */ - @SuppressWarnings("unchecked") - private void renderContentForms( - FacesContext fc, ResponseWriter out, NodeRef websiteRef, String username, String storeRoot) - throws IOException - { - Map requestMap = fc.getExternalContext().getRequestMap(); - String userStorePrefix = AVMUtil.buildUserMainStoreName(storeRoot, username); - - // only need to collect the list of forms once per render - // TODO: execute permission evaluations on a per user basis against each form? - if (this.forms == null) - { - this.forms = new WebProject(websiteRef).getForms(); - } - - ResourceBundle bundle = Application.getBundle(fc); - if (this.forms.size() != 0) - { - // output the table of available forms - // TODO: apply tag style - removed hardcoded - out.write(""); - - // header row - out.write(""); - - for (Form f : this.forms) - { - out.write(""); - } - - out.write("
"); - out.write(bundle.getString(MSG_NAME)); - out.write(""); - out.write(bundle.getString(MSG_TITLE)); - out.write(""); - out.write(bundle.getString(MSG_DESCRIPTION)); - out.write(""); - out.write(bundle.getString(MSG_ACTIONS)); - out.write("
"); - String name = f.getName(); - out.write(name != null ? Utils.encode(name) : ""); - out.write(""); - String title= f.getTitle(); - out.write(title != null ? Utils.encode(title) : ""); - out.write(""); - String desc = f.getDescription(); - out.write(desc != null ? Utils.encode(desc) : ""); - out.write(""); - - // set the form-id into the request scope for actions data binding - requestMap.put(REQUEST_FORM_REF, f); - - // actions - UIActionLink action = findAction(ACT_CREATE_FORM_CONTENT, userStorePrefix); - if (action == null) - { - // create content action passes the ID of the Form to uses - Map params = new HashMap(4, 1.0f); - // setup a data-binding param for the Form ID - params.put(PARAM_FORM_NAME, "#{" + REQUEST_FORM_REF + ".name}"); - params.put("username", username); - params.put("store", userStorePrefix); - action = createAction(fc, - userStorePrefix, - username, - ACT_CREATE_FORM_CONTENT, - "/images/icons/new_content.gif", - "#{AVMBrowseBean.createFormContent}", - null, null, params, true); - } - Utils.encodeRecursive(fc, action); - - out.write("  "); - - action = findAction(ACT_FIND_FORM_CONTENT, userStorePrefix); - if (action == null) - { - // create content action passes the ID of the Form to uses - Map params = new HashMap(4, 1.0f); - // setup a data-binding param for the Form ID - params.put(PARAM_FORM_NAME, "#{" + REQUEST_FORM_REF + ".name}"); - params.put("username", username); - params.put("store", userStorePrefix); - action = createAction(fc, - userStorePrefix, - username, - ACT_FIND_FORM_CONTENT, - "/images/icons/search_icon.gif", - "#{AVMBrowseBean.searchFormContent}", - "browseSandbox", - null, params, true); - } - Utils.encodeRecursive(fc, action); - - requestMap.remove(REQUEST_FORM_REF); - - out.write("
"); - } - else - { - // output "no web forms" message - out.write("
"); - out.write(bundle.getString(MSG_NO_WEB_FORMS)); - out.write("
"); - } - } - - /** - * @return Byte size converter - */ - private ByteSizeConverter getSizeConverter() - { - if (this.sizeConverter == null) - { - this.sizeConverter = new ByteSizeConverter(); - } - return this.sizeConverter; - } - - /** - * Aquire the UIActions component for the specified action group ID. - * Search for the component in the child list or create as needed. - * - * @param id ActionGroup id of the UIActions component - * - * @return UIActions component - */ - @SuppressWarnings("unchecked") - private UIActions aquireUIActions(String id, String store) - { - UIActions uiActions = null; - String componentId = id + '_' + FacesHelper.makeLegalId(store); - if (logger.isDebugEnabled()) - logger.debug("Find UIActions component id: " + componentId); - for (UIComponent component : (List)getChildren()) - { - if (componentId.equals(component.getId())) - { - if (logger.isDebugEnabled()) - logger.debug("...found UIActions component id: " + componentId); - uiActions = (UIActions)component; - break; - } - } - if (uiActions == null) - { - if (logger.isDebugEnabled()) - logger.debug("...creating UIActions component id: " + componentId); - javax.faces.application.Application facesApp = FacesContext.getCurrentInstance().getApplication(); - uiActions = (UIActions)facesApp.createComponent(COMPONENT_ACTIONS); - uiActions.setShowLink(false); - uiActions.getAttributes().put("styleClass", "inlineAction"); - uiActions.setId(componentId); - uiActions.setParent(this); - uiActions.setValue(id); - - this.getChildren().add(uiActions); - } - return uiActions; - } - - /** - * Aquire a UIActionLink component for the specified action - * - * @param fc FacesContext - * @param store Root store name for the user sandbox - * @param username Username of the user for the action - * @param name Action name - will be used for I18N message lookup - * @param icon Icon to display for the action - * @param actionListener Actionlistener for the action - * @param outcome Navigation outcome for the action - * - * @return UIActionLink component - */ - private UIActionLink aquireAction(FacesContext fc, String store, String username, - String name, String icon, String actionListener, String outcome) - { - return aquireAction(fc, store, username, name, icon, actionListener, outcome, null, null); - } - - private HtmlCommandButton createRevertAllItemsButton(FacesContext fc, ResourceBundle bundle, String name, String userStorePath, String stagingStorePath) - { - javax.faces.application.Application facesApp = fc.getApplication(); - String id = "revert_all_conflict" + new Date().getTime() + FacesHelper.makeLegalId(name); - HtmlCommandButton cb = (HtmlCommandButton) facesApp.createComponent(HtmlCommandButton.COMPONENT_TYPE); - cb.setId(id); - cb.setValue(bundle.getString(MSG_REVERT_ALL_CONFLICTS)); - cb.setActionListener(facesApp.createMethodBinding( - "#{AVMBrowseBean.revertAllConflict}", UIActions.ACTION_CLASS_ARGS)); - - UIParameter param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER); - param.setId(id + "_1"); - param.setName("userStorePath"); - param.setValue(userStorePath); - cb.getChildren().add(param); - param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER); - param.setId(id + "_2"); - param.setName("stagingStorePath"); - param.setValue(stagingStorePath); - cb.getChildren().add(param); - - this.getChildren().add(cb); - return cb; - } - - /** - * Aquire a UIActionLink component for the specified action - * - * @param fc FacesContext - * @param store Root store name for the user sandbox - * @param username Username of the user for the action - * @param name Action name - will be used for I18N message lookup - * @param icon Icon to display for the action - * @param actionListener Actionlistener for the action - * @param outcome Navigation outcome for the action - * @param url HREF URL for the action - * @param params Parameters name/values for the action listener args - * - * @return UIActionLink component - */ - private UIActionLink aquireAction(FacesContext fc, String store, String username, String name, - String icon, String actionListener, String outcome, String url, Map params) - { - UIActionLink action = findAction(name, store); - if (action == null) - { - action = createAction(fc, store, username, name, icon, actionListener, - outcome, url, params, true); - } - return action; - } - - /** - * Locate a child UIActionLink component by name. - * - * @param name Of the action component to find - * @param store Store the action component is tied to - * @param username Username of the user owner of the action - * - * @return UIActionLink component if found, else null if not created yet - */ - @SuppressWarnings("unchecked") - private UIActionLink findAction(String name, String store) - { - UIActionLink action = null; - String actionId = name + '_' + FacesHelper.makeLegalId(store); - if (logger.isDebugEnabled()) - logger.debug("Finding action Id: " + actionId); - for (UIComponent component : (List)getChildren()) - { - if (actionId.equals(component.getId())) - { - action = (UIActionLink)component; - if (logger.isDebugEnabled()) - logger.debug("...found action Id: " + actionId); - break; - } - } - return action; - } - - /** - * Create a UIActionLink child component. - * - * @param fc FacesContext - * @param store Root store name for the user sandbox - * @param username Username of the user for the action - * @param name Action name - will be used for I18N message lookup - * @param icon Icon to display for the action - * @param actionListener Actionlistener for the action - * @param outcome Navigation outcome for the action - * @param url HREF URL for the action - * @param params Parameters name/values for the action listener args - * @param addAsChild true to add the action as a child of this component - * - * @return UIActionLink child component - */ - @SuppressWarnings("unchecked") - private UIActionLink createAction(FacesContext fc, String store, String username, String name, - String icon, String actionListener, String outcome, String url, Map params, - boolean addAsChild) - { - javax.faces.application.Application facesApp = fc.getApplication(); - UIActionLink control = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK); - - String id = name + '_' + FacesHelper.makeLegalId(store); - if (logger.isDebugEnabled()) - logger.debug("...creating action Id: " + id); - control.setRendererType(UIActions.RENDERER_ACTIONLINK); - control.setId(id); - control.setValue(Application.getMessage(fc, name)); - //control.setShowLink(icon != null ? false : true); - control.setImage(icon); - - if (actionListener != null) - { - control.setActionListener(facesApp.createMethodBinding( - actionListener, UIActions.ACTION_CLASS_ARGS)); - - // add the store and username as default action listener parameters - if (params == null) - { - UIParameter param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER); - param.setId(id + "_1"); - param.setName("store"); - param.setValue(store); - control.getChildren().add(param); - param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER); - param.setId(id + "_2"); - param.setName("username"); - param.setValue(username); - control.getChildren().add(param); - } - else - { - // if a specific set of parameters are supplied, then add them instead - int idIndex = 1; - for (String key : params.keySet()) - { - UIParameter param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER); - param.setId(id + '_' + Integer.toString(idIndex++)); - param.setName(key); - String value = params.get(key); - if (value.startsWith("#{") == true) - { - ValueBinding vb = facesApp.createValueBinding(value); - param.setValueBinding("value", vb); - } - else - { - param.setValue(params.get(key)); - } - control.getChildren().add(param); - } - } - } - if (outcome != null) - { - control.setAction(new ConstantMethodBinding(outcome)); - } - if (url != null) - { - if (url.startsWith("#{") == true) - { - ValueBinding vb = facesApp.createValueBinding(url); - control.setValueBinding("href", vb); - } - else - { - control.setHref(url); - } - control.setTarget("new"); - } - - if (addAsChild) - { - this.getChildren().add(control); - } - - return control; - } - - /** - * Locate a child UIMenu component by name. - * - * @param store Store the action component is tied to - * - * @return UIMenu component if found, else null if not created yet - */ - @SuppressWarnings("unchecked") - private UIMenu findMenu(String store) - { - UIMenu menu = null; - String menuId = "menu_" + FacesHelper.makeLegalId(store); - - if (logger.isDebugEnabled()) - logger.debug("Finding action Id: " + menuId); - - for (UIComponent component : (List)getChildren()) - { - if (menuId.equals(component.getId())) - { - menu = (UIMenu)component; - - if (logger.isDebugEnabled()) - logger.debug("...found action Id: " + menuId); - - break; - } - } - - return menu; - } - - /** - * Creates a menu component to hold the 'more actions' for a sandbox - * - * @param context FacesContext - * @param store The store to create the menu for - * @return The UIMenu component (with no children) - */ - @SuppressWarnings("unchecked") - private UIMenu createMenu(FacesContext context, String store) - { - UIMenu menu = (UIMenu)context.getApplication().createComponent("org.alfresco.faces.Menu"); - - String id = "menu_" + FacesHelper.makeLegalId(store); - menu.setId(id); - menu.setLabel(Application.getMessage(context, "more_actions") + " "); - menu.getAttributes().put("itemSpacing", 4); - menu.getAttributes().put("image", "/images/icons/menu.gif"); - menu.getAttributes().put("menuStyleClass", "moreActionsMenu"); - menu.getAttributes().put("style", "white-space:nowrap; margin-left: 4px; margin-right: 6px;"); - - return menu; - } - - private WebProjectService getWebProjectService(FacesContext fc) - { - return Repository.getServiceRegistry(fc).getWebProjectService(); - } - - private NodeService getNodeService(FacesContext fc) - { - return Repository.getServiceRegistry(fc).getNodeService(); - } - - private PermissionService getPermissionService(FacesContext fc) - { - return Repository.getServiceRegistry(fc).getPermissionService(); - } - - private SandboxService getSandboxService(FacesContext fc) - { - return Repository.getServiceRegistry(fc).getSandboxService(); - } - - - // ------------------------------------------------------------------------------ - // Strongly typed component property accessors - - /** - * Returns the NodeRef to the website to show the sandboxes for - * - * @return The website NodeRef instance - */ - public NodeRef getValue() - { - ValueBinding vb = getValueBinding("value"); - if (vb != null) - { - this.value = (NodeRef)vb.getValue(getFacesContext()); - } - - return this.value; - } - - /** - * Sets the NodeRef to the website to show the sandboxes for - * - * @param value The NodeRef to the website to show the sandboxes for - */ - public void setValue(NodeRef value) - { - this.value = value; - } - - /** - * @return Returns the webapp to filter file list by - */ - public String getWebapp() - { - ValueBinding vb = getValueBinding("webapp"); - if (vb != null) - { - this.webapp = (String)vb.getValue(getFacesContext()); - } - - return this.webapp; - } - - /** - * @param webapp The webapp to filter file list by - */ - public void setWebapp(String webapp) - { - this.webapp = webapp; - } - - /** - * Get the selected nodes for a specified sandbox user - * - * @param username User in the user sandbox list - * - * @return List of AVMNodeDescriptor object representing the selected items - */ - public List getSelectedNodes(String username) - { - return getSelectedNodes(username, this.rowToUserLookup.get(username)); - } - - /** - * Get the selected nodes for a specified sandbox index - * - * @param sandbox Index of sandbox in the user sandbox list - * - * @return List of AVMNodeDescriptor object representing the selected items - */ - public List getSelectedNodes(int sandbox) - { - return getSelectedNodes(this.userToRowLookup.get(sandbox), sandbox); - } - - private List getSelectedNodes(String username, int sandbox) - { - List nodes = null; - - if (username != null && this.checkedItems != null) - { - List paths = this.userNodes.get(username); - if (paths != null) - { - nodes = new ArrayList(paths.size()); - String sandboxPrefix = Integer.toString(sandbox) + '_'; - - // check against the selected items - for (int i=0; i. - */ -package org.alfresco.web.ui.wcm.renderer; - -import javax.faces.context.FacesContext; - -import org.alfresco.service.cmr.avm.AVMNodeDescriptor; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.wcm.AVMNode; -import org.alfresco.web.ui.common.component.data.UIRichList; -import org.alfresco.web.ui.common.renderer.data.RichListRenderer; - -/** - * @author kevinr - */ -public class AVMListRenderer extends RichListRenderer -{ - // ------------------------------------------------------------------------------ - // Inner classes - - /** - * Class to implement a Details view for the RichList component - * - * @author kevinr - */ - public static class DetailsViewRenderer extends RichListRenderer.DetailsViewRenderer - { - private static final long serialVersionUID = -2753231623981676638L; - - @Override - public String getRowStyle(FacesContext context, UIRichList richList, Object row) - { - String rowStyle = (String)richList.getAttributes().get("rowStyleClass"); - String altStyle = (String)richList.getAttributes().get("altRowStyleClass"); - if (altStyle != null && (this.rowIndex++ & 1) == 1) - { - rowStyle = altStyle; - } - - if (row instanceof AVMNode) - { - AVMNodeDescriptor avmRef = ((AVMNode)row).getDescriptor(); - - if ((avmRef.isLayeredDirectory() && avmRef.isPrimary()) || avmRef.isLayeredFile()) - { - AVMService avmService = Repository.getServiceRegistry(context).getAVMService(); - if ((avmService.lookup(avmRef.getIndirectionVersion(), avmRef.getIndirection()) == null) && - (! avmRef.getOpacity())) - { - rowStyle = STALE_CSS; - } - } - } - - return rowStyle; - } - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/tag/AVMListTag.java b/source/java/org/alfresco/web/ui/wcm/tag/AVMListTag.java deleted file mode 100644 index cc08acec84..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/tag/AVMListTag.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.tag; - -import org.alfresco.web.ui.common.tag.data.RichListTag; - -/** - * @author kevinr - */ -public class AVMListTag extends RichListTag -{ - // ------------------------------------------------------------------------------ - // Component methods - - /** - * @see javax.faces.webapp.UIComponentTag#getComponentType() - */ - @Override - public String getComponentType() - { - return "org.alfresco.faces.AVMList"; - } - - /** - * @see javax.faces.webapp.UIComponentTag#getRendererType() - */ - @Override - public String getRendererType() - { - return "org.alfresco.faces.AVMListRenderer"; - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/tag/AVMLockIconTag.java b/source/java/org/alfresco/web/ui/wcm/tag/AVMLockIconTag.java deleted file mode 100644 index e508640fdf..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/tag/AVMLockIconTag.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.tag; - -import org.alfresco.web.ui.repo.tag.LockIconTag; - -/** - * @author Ariel Backenroth - */ -public class AVMLockIconTag extends LockIconTag -{ - /** - * @see javax.faces.webapp.UIComponentTag#getComponentType() - */ - public String getComponentType() - { - return "org.alfresco.faces.AVMLockIcon"; - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/tag/DeployWebsiteTag.java b/source/java/org/alfresco/web/ui/wcm/tag/DeployWebsiteTag.java deleted file mode 100644 index aac2c73cdf..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/tag/DeployWebsiteTag.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.tag; - -import javax.faces.component.UIComponent; - -import org.springframework.extensions.webscripts.ui.common.tag.BaseComponentTag; - -/** - * Tag class that allows the DeployWebsite component to be used on a JSP page. - * - * @author gavinc - */ -public class DeployWebsiteTag extends BaseComponentTag -{ - private String value; - private String website; - private String store; - private String monitor; - private String monitorIds; - private String snapshotVersion; - private String deployMode; - - /** - * @see javax.faces.webapp.UIComponentTag#getComponentType() - */ - public String getComponentType() - { - return "org.alfresco.faces.DeployWebsite"; - } - - /** - * @see javax.faces.webapp.UIComponentTag#getRendererType() - */ - public String getRendererType() - { - return null; - } - - /** - * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent) - */ - protected void setProperties(UIComponent component) - { - super.setProperties(component); - - setStringProperty(component, "value", this.value); - setStringProperty(component, "website", this.website); - setStringProperty(component, "store", this.store); - setBooleanProperty(component, "monitor", this.monitor); - setStringProperty(component, "monitorIds", this.monitorIds); - setIntProperty(component, "snapshotVersion", this.snapshotVersion); - setStringProperty(component, "deployMode", this.deployMode); - } - - /** - * @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release() - */ - public void release() - { - super.release(); - this.value = null; - this.website = null; - this.store = null; - this.monitor = null; - this.monitorIds = null; - this.snapshotVersion = null; - this.deployMode = null; - } - - /** - * @param value the value (the list of servers to deploy to) - */ - public void setValue(String value) - { - this.value = value; - } - - /** - * @param monitor Flag to indicate whether to select servers or show deployment progress - */ - public void setMonitor(String monitor) - { - this.monitor = monitor; - } - - /** - * @param monitorIds List of deployment monitor IDs to look for - */ - public void setMonitorIds(String monitorIds) - { - this.monitorIds = monitorIds; - } - - /** - * @param website NodeRef of the web project being deployed - */ - public void setWebsite(String website) - { - this.website = website; - } - - /** - * @param store The store being deployed to - */ - public void setStore(String store) - { - this.store = store; - } - - /** - * @param snapshotVersion The version of the snapshot to deploy to - */ - public void setSnapshotVersion(String snapshotVersion) - { - this.snapshotVersion = snapshotVersion; - } - - /** - * @param deployMode The type of server being deployed to - */ - public void setDeployMode(String deployMode) - { - this.deployMode = deployMode; - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/tag/DeploymentReportsTag.java b/source/java/org/alfresco/web/ui/wcm/tag/DeploymentReportsTag.java deleted file mode 100644 index b3d53eff7e..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/tag/DeploymentReportsTag.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.tag; - -import javax.faces.component.UIComponent; - -import org.springframework.extensions.webscripts.ui.common.tag.BaseComponentTag; - -/** - * Tag class that allows the DeploymentReports component to be used on a JSP page. - * - * @author gavinc - */ -public class DeploymentReportsTag extends BaseComponentTag -{ - private String value; - private String showPrevious; - private String dateFilter; - private String attempt; - - /** - * @see javax.faces.webapp.UIComponentTag#getComponentType() - */ - public String getComponentType() - { - return "org.alfresco.faces.DeploymentReports"; - } - - /** - * @see javax.faces.webapp.UIComponentTag#getRendererType() - */ - public String getRendererType() - { - return null; - } - - /** - * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent) - */ - protected void setProperties(UIComponent component) - { - super.setProperties(component); - - setStringProperty(component, "value", this.value); - setStringProperty(component, "dateFilter", this.dateFilter); - setStringProperty(component, "attempt", this.attempt); - setBooleanProperty(component, "showPrevious", this.showPrevious); - } - - /** - * @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release() - */ - public void release() - { - super.release(); - this.value = null; - this.showPrevious = null; - this.dateFilter = null; - this.attempt = null; - } - - /** - * Set the value (NodeRef of the web project) - * - * @param value the value - */ - public void setValue(String value) - { - this.value = value; - } - - public void setShowPrevious(String showPrevious) - { - this.showPrevious = showPrevious; - } - - public void setDateFilter(String dateFilter) - { - this.dateFilter = dateFilter; - } - - public void setAttempt(String attempt) - { - this.attempt = attempt; - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/tag/DeploymentServersTag.java b/source/java/org/alfresco/web/ui/wcm/tag/DeploymentServersTag.java deleted file mode 100644 index a023689855..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/tag/DeploymentServersTag.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.tag; - -import javax.faces.component.UIComponent; - -import org.springframework.extensions.webscripts.ui.common.tag.BaseComponentTag; - -/** - * Tag class that allows the DeploymentServers component to be used on a JSP page. - * - * @author gavinc - */ -public class DeploymentServersTag extends BaseComponentTag -{ - private String value; - private String currentServer; - private String inAddMode; - private String addType; - - /** - * @see javax.faces.webapp.UIComponentTag#getComponentType() - */ - public String getComponentType() - { - return "org.alfresco.faces.DeploymentServers"; - } - - /** - * @see javax.faces.webapp.UIComponentTag#getRendererType() - */ - public String getRendererType() - { - return null; - } - - /** - * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent) - */ - protected void setProperties(UIComponent component) - { - super.setProperties(component); - - setStringProperty(component, "value", this.value); - setStringProperty(component, "currentServer", this.currentServer); - setStringProperty(component, "addType", this.addType); - setBooleanProperty(component, "inAddMode", this.inAddMode); - } - - /** - * @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release() - */ - public void release() - { - super.release(); - this.value = null; - this.currentServer = null; - this.addType = null; - this.inAddMode = null; - } - - /** - * @param value the value (the list of servers to show) - */ - public void setValue(String value) - { - this.value = value; - } - - /** - * @param currentServer The server being edited or added - */ - public void setCurrentServer(String currentServer) - { - this.currentServer = currentServer; - } - - /** - * @param inAddMode Flag to determine whether a new server should be added - */ - public void setInAddMode(String inAddMode) - { - this.inAddMode = inAddMode; - } - - /** - * @param addType The type of server receiver to add - */ - public void setAddType(String addType) - { - this.addType = addType; - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/tag/FormProcessorTag.java b/source/java/org/alfresco/web/ui/wcm/tag/FormProcessorTag.java deleted file mode 100644 index 661f93fca3..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/tag/FormProcessorTag.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.tag; - -import javax.faces.application.Application; -import javax.faces.component.UIComponent; -import javax.faces.el.MethodBinding; -import javax.faces.el.ValueBinding; -import org.springframework.extensions.webscripts.ui.common.tag.BaseComponentTag; - -/** - * @author Ariel Backenroth - */ -public class FormProcessorTag - extends BaseComponentTag -{ - private String formInstanceData = null; - private String formInstanceDataName = null; - private String form = null; - private String formProcessorSession = null; - - /** - * @see javax.faces.webapp.UIComponentTag#getComponentType() - */ - public String getComponentType() - { - return "org.alfresco.faces.FormProcessor"; - } - - /** - * @see javax.faces.webapp.UIComponentTag#getRendererType() - */ - public String getRendererType() - { - return null; - } - - /** - * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent) - */ - protected void setProperties(final UIComponent component) - { - super.setProperties(component); - final Application app = this.getFacesContext().getApplication(); - if (this.formInstanceData != null) - { - assert isValueReference(this.formInstanceData); - final ValueBinding vb = app.createValueBinding(this.formInstanceData); - component.setValueBinding("formInstanceData", vb); - } - if (this.formInstanceDataName != null) - { - assert isValueReference(this.formInstanceDataName); - final ValueBinding vb = app.createValueBinding(this.formInstanceDataName); - component.setValueBinding("formInstanceDataName", vb); - } - if (this.form != null) - { - assert this.isValueReference(this.form); - final ValueBinding vb = app.createValueBinding(this.form); - component.setValueBinding("form", vb); - } - if (this.formProcessorSession != null) - { - assert this.isValueReference(this.formProcessorSession); - final ValueBinding vb = app.createValueBinding(this.formProcessorSession); - component.setValueBinding("formProcessorSession", vb); - } - } - - /** - * @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release() - */ - public void release() - { - super.release(); - this.formInstanceData = null; - this.formInstanceDataName = null; - this.form = null; - this.formProcessorSession = null; - } - - /** - * Set the instance data - * - * @param formInstanceData the instance data for the processor - */ - public void setFormInstanceData(final String formInstanceData) - { - this.formInstanceData = formInstanceData; - } - - /** - * Set the form instance data name - * - * @param formInstanceDataName the form instance data name - */ - public void setFormInstanceDataName(final String formInstanceDataName) - { - this.formInstanceDataName = formInstanceDataName; - } - - /** - * Sets the tempalte type - * - * @param form the tempalteType for the processor. - */ - public void setForm(final String form) - { - this.form = form; - } - - /** - * Sets the form processor session - * - * @param formProcessorSession the binding for the form processor session - */ - public void setFormProcessorSession(final String formProcessorSession) - { - this.formProcessorSession = formProcessorSession; - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/tag/LinkValidationProgressTag.java b/source/java/org/alfresco/web/ui/wcm/tag/LinkValidationProgressTag.java deleted file mode 100644 index 7562ef4b2a..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/tag/LinkValidationProgressTag.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.tag; - -import org.alfresco.web.ui.common.tag.HtmlComponentTag; - -/** - * Tag class for adding the UILinkValidationProgress component to a JSP page. - * - * @author gavinc - */ -public class LinkValidationProgressTag extends HtmlComponentTag -{ - /** - * @see javax.faces.webapp.UIComponentTag#getComponentType() - */ - public String getComponentType() - { - return "org.alfresco.faces.LinkValidationProgress"; - } - - /** - * @see javax.faces.webapp.UIComponentTag#getRendererType() - */ - public String getRendererType() - { - return null; - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/tag/LinkValidationReportTag.java b/source/java/org/alfresco/web/ui/wcm/tag/LinkValidationReportTag.java deleted file mode 100644 index e6e8bbd42a..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/tag/LinkValidationReportTag.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.tag; - -import javax.faces.component.UIComponent; - -import org.alfresco.web.ui.common.tag.HtmlComponentTag; - -/** - * Tag class for adding the UILinkValidationReport component to a JSP page. - * - * @author gavinc - */ -public class LinkValidationReportTag extends HtmlComponentTag -{ - private String value; - private String itemsExpanded; - private String initialTab; - - /** - * @see javax.faces.webapp.UIComponentTag#getComponentType() - */ - public String getComponentType() - { - return "org.alfresco.faces.LinkValidationReport"; - } - - /** - * @see javax.faces.webapp.UIComponentTag#getRendererType() - */ - public String getRendererType() - { - return null; - } - - /** - * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent) - */ - protected void setProperties(UIComponent component) - { - super.setProperties(component); - - setStringProperty(component, "value", this.value); - setStringProperty(component, "initialTab", this.initialTab); - setBooleanProperty(component, "itemsExpanded", this.itemsExpanded); - } - - /** - * @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release() - */ - public void release() - { - super.release(); - this.value = null; - this.itemsExpanded = null; - this.initialTab = null; - } - - /** - * @param value the value (the list of servers to deploy to) - */ - public void setValue(String value) - { - this.value = value; - } - - /** - * @param value true to render the report with all broken links and - * generated files expanded - */ - public void setItemsExpanded(String value) - { - this.itemsExpanded = value; - } - - /** - * @param initialTab The initial tab to be selected - */ - public void setInitialTab(String initialTab) - { - this.initialTab = initialTab; - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/tag/LinkValidationSummaryTag.java b/source/java/org/alfresco/web/ui/wcm/tag/LinkValidationSummaryTag.java deleted file mode 100644 index 892dbd97b6..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/tag/LinkValidationSummaryTag.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.tag; - -import javax.faces.component.UIComponent; - -import org.alfresco.web.ui.common.tag.HtmlComponentTag; - -/** - * Tag class for adding the UILinkValidationSummary component to a JSP page. - * - * @author gavinc - */ -public class LinkValidationSummaryTag extends HtmlComponentTag -{ - private String value; - private String showPanel; - private String showTitle; - - /** - * @see javax.faces.webapp.UIComponentTag#getComponentType() - */ - public String getComponentType() - { - return "org.alfresco.faces.LinkValidationSummary"; - } - - /** - * @see javax.faces.webapp.UIComponentTag#getRendererType() - */ - public String getRendererType() - { - return null; - } - - /** - * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent) - */ - protected void setProperties(UIComponent component) - { - super.setProperties(component); - - setStringProperty(component, "value", this.value); - setBooleanProperty(component, "showPanel", this.showPanel); - setBooleanProperty(component, "showTitle", this.showTitle); - } - - /** - * @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release() - */ - public void release() - { - super.release(); - this.value = null; - this.showPanel = null; - this.showTitle = null; - } - - /** - * @param value the value (the list of servers to deploy to) - */ - public void setValue(String value) - { - this.value = value; - } - - /** - * @param showPanel false to hide the surrounding panel - */ - public void setShowPanel(String showPanel) - { - this.showPanel = showPanel; - } - - /** - * @param showTitle false to hide the title within the panel - */ - public void setShowTitle(String showTitle) - { - this.showTitle = showTitle; - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/tag/PendingSubmissionsTag.java b/source/java/org/alfresco/web/ui/wcm/tag/PendingSubmissionsTag.java deleted file mode 100644 index 84942b8c03..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/tag/PendingSubmissionsTag.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.tag; - -import javax.faces.component.UIComponent; - -import org.springframework.extensions.webscripts.ui.common.tag.BaseComponentTag; - -/** - * Tag to allow the UIPendingSubmissions component to be placed - * on a JSP page. - * - * @author Gavin Cornwell - */ -public class PendingSubmissionsTag extends BaseComponentTag -{ - /** the value (sandbox to display pending submissions for) */ - private String value; - - /** - * @see javax.faces.webapp.UIComponentTag#getComponentType() - */ - public String getComponentType() - { - return "org.alfresco.faces.PendingSubmissions"; - } - - /** - * @see javax.faces.webapp.UIComponentTag#getRendererType() - */ - public String getRendererType() - { - return null; - } - - /** - * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent) - */ - protected void setProperties(UIComponent component) - { - super.setProperties(component); - - setStringProperty(component, "value", this.value); - } - - /** - * @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release() - */ - public void release() - { - super.release(); - this.value = null; - } - - /** - * Set the value (sandbox to display pending submissions for) - * - * @param value the value - */ - public void setValue(String value) - { - this.value = value; - } -} diff --git a/source/java/org/alfresco/web/ui/wcm/tag/SandboxSnapshotsTag.java b/source/java/org/alfresco/web/ui/wcm/tag/SandboxSnapshotsTag.java deleted file mode 100644 index 62acad5812..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/tag/SandboxSnapshotsTag.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.tag; - -import javax.faces.component.UIComponent; - -import org.springframework.extensions.webscripts.ui.common.tag.BaseComponentTag; - -/** - * @author Kevin Roast - */ -public class SandboxSnapshotsTag extends BaseComponentTag -{ - /** - * @see javax.faces.webapp.UIComponentTag#getComponentType() - */ - public String getComponentType() - { - return "org.alfresco.faces.SandboxSnapshots"; - } - - /** - * @see javax.faces.webapp.UIComponentTag#getRendererType() - */ - public String getRendererType() - { - return null; - } - - /** - * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent) - */ - protected void setProperties(UIComponent component) - { - super.setProperties(component); - - setStringProperty(component, "value", this.value); - setStringProperty(component, "dateFilter", this.dateFilter); - } - - /** - * @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release() - */ - public void release() - { - super.release(); - this.value = null; - this.dateFilter = null; - } - - /** - * Set the value (sandbox to display snapshots for) - * - * @param value the value - */ - public void setValue(String value) - { - this.value = value; - } - - /** - * Set the dateFilter - * - * @param dateFilter the dateFilter - */ - public void setDateFilter(String dateFilter) - { - this.dateFilter = dateFilter; - } - - - /** the dateFilter */ - private String dateFilter; - - /** the value (sandbox to display snapshots for) */ - private String value; -} diff --git a/source/java/org/alfresco/web/ui/wcm/tag/UserSandboxesTag.java b/source/java/org/alfresco/web/ui/wcm/tag/UserSandboxesTag.java deleted file mode 100644 index 3ae25f1ea8..0000000000 --- a/source/java/org/alfresco/web/ui/wcm/tag/UserSandboxesTag.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.web.ui.wcm.tag; - -import javax.faces.component.UIComponent; - -import org.springframework.extensions.webscripts.ui.common.tag.BaseComponentTag; - -/** - * @author Kevin Roast - */ -public class UserSandboxesTag extends BaseComponentTag -{ - /** - * @see javax.faces.webapp.UIComponentTag#getComponentType() - */ - public String getComponentType() - { - return "org.alfresco.faces.UserSandboxes"; - } - - /** - * @see javax.faces.webapp.UIComponentTag#getRendererType() - */ - public String getRendererType() - { - return null; - } - - /** - * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent) - */ - protected void setProperties(UIComponent component) - { - super.setProperties(component); - - setStringProperty(component, "value", this.value); - setStringProperty(component, "webapp", this.webapp); - } - - /** - * @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release() - */ - public void release() - { - super.release(); - this.value = null; - this.webapp = null; - } - - /** - * Set the value (root store name to display sandboxes for) - * - * @param value the value - */ - public void setValue(String value) - { - this.value = value; - } - - /** - * Set the webapp - * - * @param webapp the webapp - */ - public void setWebapp(String webapp) - { - this.webapp = webapp; - } - - - /** the webapp */ - private String webapp; - - /** the value (root store name to display sandboxes for) */ - private String value; -} diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index 6322e17645..c4da3c1c33 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -40,25 +40,6 @@ - - - The bean for Manage WCM Permissions. - - ManagePermissionsDialog - - org.alfresco.web.bean.wcm.ManagePermissionsDialog - - session - - personService - #{PersonService} - - - avmBrowseBean - #{AVMBrowseBean} - - - The bean that makes a document multilingual @@ -2571,128 +2552,6 @@ workflowService #{WorkflowService} - - avmService - #{AVMLockingAwareService} - - - avmSyncService - #{AVMSyncService} - - - - - - The bean that backs up the Manage Change Request Task Dialog - - ManageChangeRequestTaskDialog - org.alfresco.web.bean.wcm.ManageChangeRequestTaskDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - workflowService - #{WorkflowService} - - - avmService - #{AVMLockingAwareService} - - - avmSyncService - #{AVMSyncService} - - - avmLockingService - #{AVMLockingService} - - - avmBrowseBean - #{AVMBrowseBean} - - - - - - The bean that backs up the Manage Review Task Dialog - - ManageReviewTaskDialog - org.alfresco.web.bean.wcm.ManageReviewTaskDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - workflowService - #{WorkflowService} - - - avmService - #{AVMLockingAwareService} - - - avmSyncService - #{AVMSyncService} - - - avmBrowseBean - #{AVMBrowseBean} - - - permissionService - #{PermissionService} - @@ -3075,665 +2934,6 @@ session - - - - - The bean that backs up the Create XML Content Type Wizard - - CreateFormWizard - org.alfresco.web.bean.wcm.CreateFormWizard - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - namespaceService - #{NamespaceService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - contentService - #{ContentService} - - - mimetypeService - #{MimetypeService} - - - workflowService - #{WorkflowService} - - - formsService - #{FormsService} - - - - - - The bean that backs up the Edit Form Wizard - - EditFormWizard - org.alfresco.web.bean.wcm.EditFormWizard - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - namespaceService - #{NamespaceService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - contentService - #{ContentService} - - - mimetypeService - #{MimetypeService} - - - workflowService - #{WorkflowService} - - - formsService - #{FormsService} - - - - - - The bean that backs up the Create XML Content Type Wizard (WCM) - - CreateWebFormWizard - org.alfresco.web.bean.wcm.CreateFormWizard - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - namespaceService - #{NamespaceService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - contentService - #{ContentService} - - - mimetypeService - #{MimetypeService} - - - workflowService - #{WorkflowService} - - - formsService - #{FormsService} - - - - - - The bean that backs up the Edit Web Form Wizard (WCM) - - EditWebFormWizard - org.alfresco.web.bean.wcm.EditFormWizard - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - namespaceService - #{NamespaceService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - contentService - #{ContentService} - - - mimetypeService - #{MimetypeService} - - - workflowService - #{WorkflowService} - - - formsService - #{FormsService} - - - - - - The bean that backs up the Regenerate Renditions Wizard - - RegenerateRenditionsWizard - org.alfresco.web.bean.wcm.RegenerateRenditionsWizard - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - browseBean - #{BrowseBean} - - - webProjectService - #{WebProjectService} - - - avmService - #{AVMLockingAwareService} - - - avmLockingService - #{AVMLockingService} - - - avmSyncService - #{AVMSyncService} - - - formsService - #{FormsService} - - - permissionService - #{PermissionService} - - - - - - The bean that backs up the Create Web Content Wizard - - CreateWebContentWizard - org.alfresco.web.bean.wcm.CreateWebContentWizard - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - contentService - #{ContentService} - - - dictionaryService - #{DictionaryService} - - - avmService - #{AVMLockingAwareService} - - - avmLockingService - #{AVMLockingService} - - - avmSyncService - #{AVMSyncService} - - - avmBrowseBean - #{AVMBrowseBean} - - - filePickerBean - #{FilePickerBean} - - - formsService - #{FormsService} - - - - - - The bean that backs up the Edit Web Content Wizard - - EditWebContentWizard - org.alfresco.web.bean.wcm.EditWebContentWizard - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - contentService - #{ContentService} - - - dictionaryService - #{DictionaryService} - - - avmService - #{AVMLockingAwareService} - - - avmLockingService - #{AVMLockingService} - - - avmSyncService - #{AVMSyncService} - - - avmBrowseBean - #{AVMBrowseBean} - - - filePickerBean - #{FilePickerBean} - - - formsService - #{FormsService} - - - - - - The bean that backs up the Create Website Wizard - - CreateWebsiteWizard - org.alfresco.web.bean.wcm.CreateWebsiteWizard - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - navigator - #{NavigationBean} - - - searchService - #{SearchService} - - - workflowService - #{WorkflowService} - - - personService - #{PersonService} - - - formsService - #{FormsService} - - - webProjectService - #{WebProjectService} - - - - - - The bean that backs up the Edit Website Wizard - - EditWebsiteWizard - org.alfresco.web.bean.wcm.EditWebsiteWizard - session - - browseBean - #{BrowseBean} - - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - navigator - #{NavigationBean} - - - searchService - #{SearchService} - - - workflowService - #{WorkflowService} - - - personService - #{PersonService} - - - formsService - #{FormsService} - - - avmBrowseBean - #{AVMBrowseBean} - - - - - - The bean that backs up the Import Website Dialog - - ImportWebsiteDialog - org.alfresco.web.bean.wcm.ImportWebsiteDialog - session - - assetService - #{AssetService} - - - avmBrowseBean - #{AVMBrowseBean} - - - - - - The bean that backs up the Invite Users Wizard a website - - InviteWebsiteUsersWizard - org.alfresco.web.bean.wcm.InviteWebsiteUsersWizard - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - namespaceService - #{NamespaceService} - - - permissionService - #{PermissionService} - - - personService - #{PersonService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - mailSender - #{mailService} - - - authorityService - #{AuthorityService} - - - webProjectService - #{WebProjectService} - - - - - - The bean that backs up the website file/folder browsing screens - - AVMBrowseBean - org.alfresco.web.bean.wcm.AVMBrowseBean - session - - webProjectService - #{WebProjectService} - - - avmService - #{AVMLockingAwareService} - - - navigationBean - #{NavigationBean} - - - nodeService - #{NodeService} - - - actionService - #{ActionService} - - - workflowService - #{WorkflowService} - - - formsService - #{FormsService} - - - searchService - #{SearchService} - - - permissionService - #{PermissionService} - - - - - - The bean that backs up the AVM file editing screens - - AVMEditBean - org.alfresco.web.bean.wcm.AVMEditBean - session - - avmService - #{AVMLockingAwareService} - - - avmBrowseBean - #{AVMBrowseBean} - - - formsService - #{FormsService} - - - - - - The bean that backs up the AVM file editing screens - - EditAvmFileDialog - org.alfresco.web.bean.wcm.EditAvmFileDialog - session - - avmService - #{AVMLockingAwareService} - - - avmBrowseBean - #{AVMBrowseBean} - - - - - - The bean that backs up the dialog for associating form instance data with a form - - PromptForWebFormDialog - org.alfresco.web.bean.wcm.PromptForWebFormDialog - session - - avmService - #{AVMLockingAwareService} - - - avmBrowseBean - #{AVMBrowseBean} - - - formsService - #{FormsService} - - - - - - The bean that backs up the Snapshot Sandbox Dialog - - SnapshotSandboxDialog - org.alfresco.web.bean.wcm.SnapshotSandboxDialog - session - - avmService - #{AVMLockingAwareService} - - - avmBrowseBean - #{AVMBrowseBean} - - - - - - The bean that backs up the Delete AVM File Dialog - - DeleteFileDialog - org.alfresco.web.bean.wcm.DeleteFileDialog - session - - avmService - #{AVMLockingAwareService} - - - avmBrowseBean - #{AVMBrowseBean} - - - formsService - #{FormsService} - - - The bean that backs up the Delete Content Association Dialog @@ -3771,717 +2971,6 @@ - - - The bean that backs up the Delete AVM Folder Dialog - - DeleteFolderDialog - org.alfresco.web.bean.wcm.DeleteFolderDialog - session - - avmService - #{AVMLockingAwareService} - - - avmBrowseBean - #{AVMBrowseBean} - - - - - - The bean that backs up the Delete then browse AVM File Dialog - - DeleteFileBrowseDialog - org.alfresco.web.bean.wcm.DeleteFileBrowseDialog - session - - avmService - #{AVMLockingAwareService} - - - avmBrowseBean - #{AVMBrowseBean} - - - formsService - #{FormsService} - - - - - - The bean that backs up the Delete then browse AVM Folder Dialog - - DeleteFolderBrowseDialog - org.alfresco.web.bean.wcm.DeleteFolderBrowseDialog - session - - avmService - #{AVMLockingAwareService} - - - avmBrowseBean - #{AVMBrowseBean} - - - - - - The bean that backs up the Delete Layered then browse AVM Folder Dialog - - DeleteLayeredFolderBrowseDialog - org.alfresco.web.bean.wcm.DeleteLayeredFolderBrowseDialog - session - - avmService - #{AVMLockingAwareService} - - - avmBrowseBean - #{AVMBrowseBean} - - - - - - The bean that backs up the Delete User Sandbox Dialog - - DeleteSandboxDialog - org.alfresco.web.bean.wcm.DeleteSandboxDialog - session - - avmBrowseBean - #{AVMBrowseBean} - - - nodeService - #{NodeService} - - - webProjectService - #{WebProjectService} - - - - - - The bean that backs up the Unlock File Dialog - - UnlockFileDialog - org.alfresco.web.bean.wcm.UnlockFileDialog - session - - avmService - #{AVMLockingAwareService} - - - avmLockingService - #{AVMLockingService} - - - avmBrowseBean - #{AVMBrowseBean} - - - - - - The bean that backs up the Create AVM Folder Dialog - - CreateFolderDialog - org.alfresco.web.bean.wcm.CreateFolderDialog - session - - assetService - #{AssetService} - - - avmBrowseBean - #{AVMBrowseBean} - - - - - - The bean that backs up the Create Layered Folder Dialog - - CreateLayeredFolderDialog - org.alfresco.web.bean.wcm.CreateLayeredFolderDialog - session - - webProjectService - #{WebProjectService} - - - avmService - #{AVMLockingAwareService} - - - avmBrowseBean - #{AVMBrowseBean} - - - nodeService - #{NodeService} - - - - - - The bean that backs up the Create AVM Webapp Folder Dialog - - CreateWebappDialog - org.alfresco.web.bean.wcm.CreateWebappDialog - session - - avmBrowseBean - #{AVMBrowseBean} - - - nodeService - #{NodeService} - - - webProjectService - #{WebProjectService} - - - - - - The bean that backs up the AVM Add Content Dialog - - AddAvmContentDialog - org.alfresco.web.bean.wcm.AddAvmContentDialog - session - - nodeService - #{NodeService} - - - contentService - #{ContentService} - - - dictionaryService - #{DictionaryService} - - - avmService - #{AVMLockingAwareService} - - - avmBrowseBean - #{AVMBrowseBean} - - - - - - Backing bean used by the AVM File details dialog - - FileDetailsBean - org.alfresco.web.bean.wcm.FileDetailsBean - session - - nodeService - #{NodeService} - - - avmService - #{AVMLockingAwareService} - - - avmBrowseBean - #{AVMBrowseBean} - - - actionService - #{ActionService} - - - - - - Backing bean used by the AVM Folder details dialog - - FolderDetailsBean - org.alfresco.web.bean.wcm.FolderDetailsBean - session - - nodeService - #{NodeService} - - - avmService - #{AVMLockingAwareService} - - - avmBrowseBean - #{AVMBrowseBean} - - - - - - Backing bean used by the WebSite details dialog - - WebSiteDetailsDialog - org.alfresco.web.bean.wcm.WebSiteDetailsDialog - session - - browseBean - #{BrowseBean} - - - navigator - #{NavigationBean} - - - nodeService - #{NodeService} - - - permissionService - #{PermissionService} - - - - - - The bean that backs up the Edit AVM File Properties Dialog - - EditFilePropertiesDialog - org.alfresco.web.bean.wcm.EditFilePropertiesDialog - session - - nodeService - #{NodeService} - - - avmService - #{AVMLockingAwareService} - - - formsService - #{FormsService} - - - fileFolderService - #{FileFolderService} - - - dictionaryService - #{DictionaryService} - - - avmBrowseBean - #{AVMBrowseBean} - - - - - - The bean that backs up the Edit AVM Folder Properties Dialog - - EditFolderPropertiesDialog - org.alfresco.web.bean.wcm.EditFolderPropertiesDialog - session - - nodeService - #{NodeService} - - - avmService - #{AVMLockingAwareService} - - - fileFolderService - #{FileFolderService} - - - dictionaryService - #{DictionaryService} - - - avmBrowseBean - #{AVMBrowseBean} - - - - - - The bean that backs up the Delete Website Space Dialog - - DeleteWebsiteDialog - org.alfresco.web.bean.wcm.DeleteWebsiteDialog - session - - webProjectService - #{WebProjectService} - - - navigator - #{NavigationBean} - - - nodeService - #{NodeService} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - - - - The bean that backs up the Form Template Details dialog - - FormDetailsDialog - org.alfresco.web.bean.wcm.FormDetailsDialog - session - - avmService - #{AVMLockingAwareService} - - - createWebsiteWizard - #{CreateWebsiteWizard} - - - workflowService - #{WorkflowService} - - - - - - The bean that backs up the Form Template Templates dialog - - FormTemplatesDialog - org.alfresco.web.bean.wcm.FormTemplatesDialog - session - - avmService - #{AVMLockingAwareService} - - - createWebsiteWizard - #{CreateWebsiteWizard} - - - - - - The bean that backs up the Form Template Workflow dialog - - FormWorkflowDialog - org.alfresco.web.bean.wcm.FormWorkflowDialog - session - - createWebsiteWizard - #{CreateWebsiteWizard} - - - workflowService - #{WorkflowService} - - - - - - The bean that backs up the Edit Form Template Details dialog - - EditFormDetailsDialog - org.alfresco.web.bean.wcm.FormDetailsDialog - session - - avmService - #{AVMLockingAwareService} - - - createWebsiteWizard - #{EditWebsiteWizard} - - - workflowService - #{WorkflowService} - - - - - - The bean that backs up the Edit Form Template Templates dialog - - EditFormTemplatesDialog - org.alfresco.web.bean.wcm.FormTemplatesDialog - session - - avmService - #{AVMLockingAwareService} - - - createWebsiteWizard - #{EditWebsiteWizard} - - - - - - The bean that backs up the Edit Form Template Workflow dialog - - EditFormWorkflowDialog - org.alfresco.web.bean.wcm.FormWorkflowDialog - session - - createWebsiteWizard - #{EditWebsiteWizard} - - - workflowService - #{WorkflowService} - - - - - - The bean that backs up the Submit dialog - - SubmitDialog - org.alfresco.web.bean.wcm.SubmitDialog - session - - avmService - #{AVMLockingAwareService} - - - avmSyncService - #{AVMSyncService} - - - avmBrowseBean - #{AVMBrowseBean} - - - workflowService - #{WorkflowService} - - - nodeService - #{NodeService} - - - nameMatcher - #{globalPathExcluder} - - - formsService - #{FormsService} - - - sandboxFactory - #{sandboxFactory} - - - - - - The bean that backs up the Submit Configure Workflow dialog - - SubmitConfigureWorkflowDialog - org.alfresco.web.bean.wcm.SubmitConfigureWorkflowDialog - session - - submitDialog - #{SubmitDialog} - - - workflowService - #{WorkflowService} - - - - - - The bean that backs up the Revert selected items Dialog - - RevertSelectedDialog - org.alfresco.web.bean.wcm.RevertSelectedDialog - session - - avmBrowseBean - #{AVMBrowseBean} - - - - - - The bean that backs up the Revert all items Dialog - - RevertAllDialog - org.alfresco.web.bean.wcm.RevertAllDialog - session - - avmBrowseBean - #{AVMBrowseBean} - - - - - - The bean that backs up the Revert Snapshot Dialog - - RevertSnapshotDialog - org.alfresco.web.bean.wcm.RevertSnapshotDialog - session - - avmBrowseBean - #{AVMBrowseBean} - - - - - - The bean that backs up the Deploy Website Dialog - - DeployWebsiteDialog - org.alfresco.web.bean.wcm.DeployWebsiteDialog - session - - avmBrowseBean - #{AVMBrowseBean} - - - avmService - #{AVMLockingAwareService} - - - actionService - #{ActionService} - - - nodeService - #{NodeService} - - - - - - - The bean that AVM Compure to current snapshot - - CompareToCurrentSnapshot - org.alfresco.web.bean.wcm.CompareToCurrentSnapshotDialog - session - - avmBrowseBean - #{AVMBrowseBean} - - - - - - - - The bean that AVM Compure to prev snapshot - - CompareToPreviousSnapshot - org.alfresco.web.bean.wcm.CompareToPreviousSnapshotDialog - session - - avmBrowseBean - #{AVMBrowseBean} - - - - - - - CompareToAnySnapshot - org.alfresco.web.bean.wcm.CompareToAnySnapshotDialog - session - - avmBrowseBean - #{AVMBrowseBean} - - - - - - - The bean that backs up the Change Expiration Date Dialog - - ChangeExpirationDateDialog - org.alfresco.web.bean.wcm.ChangeExpirationDateDialog - session - - - - - The bean that backs up the Monitor Deployment Dialog - - MonitorDeploymentDialog - org.alfresco.web.bean.wcm.MonitorDeploymentDialog - session - - avmBrowseBean - #{AVMBrowseBean} - - - nodeService - #{NodeService} - - - - - - The bean that backs up the View Deployment Report Dialog - - ViewDeploymentReportDialog - org.alfresco.web.bean.wcm.ViewDeploymentReportDialog - session - - nodeService - #{NodeService} - - - - - - The bean that backs up the Delete Deployment Reports Dialog - - DeleteDeploymentReportsDialog - org.alfresco.web.bean.wcm.DeleteDeploymentReportsDialog - session - - nodeService - #{NodeService} - - - avmBrowseBean - #{AVMBrowseBean} - - - - - - The bean that backs up the Release Test Server Dialog - - ReleaseTestServerDialog - org.alfresco.web.bean.wcm.ReleaseTestServerDialog - session - - nodeService - #{NodeService} - - - @@ -4896,73 +3385,6 @@ - - - Bean that returns information on a node - - XFormsBean - org.alfresco.web.forms.xforms.XFormsBean - session - - avmBrowseBean - #{AVMBrowseBean} - - - navigator - #{NavigationBean} - - - schema2XFormsProperties - #{Schema2XFormsProperties} - - - - - - Bean that returns information on a node - - FilePickerBean - org.alfresco.web.bean.wcm.FilePickerBean - session - - avmService - #{AVMLockingAwareService} - - - namespaceService - #{NamespaceService} - - - avmBrowseBean - #{AVMBrowseBean} - - - searchService - #{SearchService} - - - nodeService - #{NodeService} - - - dictionaryService - #{DictionaryService} - - - contentService - #{ContentService} - - - - - - Bean that returns deployment progress status - - DeploymentProgressBean - org.alfresco.web.bean.wcm.DeploymentProgressBean - request - - @@ -5928,76 +4350,4 @@ - - - - - - - - The bean that backs up the view of the Set Permissions - - SetPermissionsDialog - - org.alfresco.web.bean.wcm.SetPermissionsDialog - - session - - authorityService - #{AuthorityService} - - - personService - #{PersonService} - - - avmBrowseBean - #{AVMBrowseBean} - - - - nodeService - #{NodeService} - - - - - - The bean that backs up the view of the Remove Permissions - - RemovePermissionsDialog - - org.alfresco.web.bean.wcm.RemovePermissionsDialog - - session - - avmBrowseBean - #{AVMBrowseBean} - - - avmLockingService - #{AVMLockingService} - - - - - - The bean that backs up the view of the Edit Permissions - - EditPermissionsDialog - - org.alfresco.web.bean.wcm.EditPermissionsDialog - - session - - avmBrowseBean - #{AVMBrowseBean} - - - avmLockingService - #{AVMLockingService} - - - - diff --git a/source/web/WEB-INF/faces-config-wcm.xml b/source/web/WEB-INF/faces-config-wcm.xml deleted file mode 100644 index 1248ed7589..0000000000 --- a/source/web/WEB-INF/faces-config-wcm.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - org.alfresco.faces.UserSandboxes - org.alfresco.web.ui.wcm.component.UIUserSandboxes - - - - org.alfresco.faces.SandboxSnapshots - org.alfresco.web.ui.wcm.component.UISandboxSnapshots - - - - org.alfresco.faces.AVMLockIcon - org.alfresco.web.ui.wcm.component.UIAVMLockIcon - - - - org.alfresco.faces.FormProcessor - org.alfresco.web.ui.wcm.component.UIFormProcessor - - - - org.alfresco.faces.DeploymentReports - org.alfresco.web.ui.wcm.component.UIDeploymentReports - - - - org.alfresco.faces.DeployWebsite - org.alfresco.web.ui.wcm.component.UIDeployWebsite - - - - org.alfresco.faces.DeploymentServers - org.alfresco.web.ui.wcm.component.UIDeploymentServers - - - - org.alfresco.faces.PendingSubmissions - org.alfresco.web.ui.wcm.component.UIPendingSubmissions - - - - org.alfresco.faces.AVMList - org.alfresco.web.ui.wcm.component.UIAVMList - - - - - - - - - org.alfresco.faces.Data - org.alfresco.faces.AVMListRenderer - org.alfresco.web.ui.wcm.renderer.AVMListRenderer - - - - \ No newline at end of file diff --git a/source/web/WEB-INF/wcm.tld b/source/web/WEB-INF/wcm.tld deleted file mode 100644 index b9078af20d..0000000000 --- a/source/web/WEB-INF/wcm.tld +++ /dev/null @@ -1,672 +0,0 @@ - - - - - - 1.0 - 1.2 - w - Alfresco WCM JSF Components - Tag library consisting of Alfresco WCM JSF components i.e. those that can only be used in Alfresco WCM based projects - - - userSandboxes - org.alfresco.web.ui.wcm.tag.UserSandboxesTag - JSP - User Sandboxes - Displays the user sandboxes for a website - - - id - false - true - The component identifier for this component - - - - value - true - true - The noderef of the website to display sandboxes for - - - - binding - false - true - The value binding expression linking this component to a property in a backing bean - - - - rendered - false - true - - - - webapp - true - true - - - - - sandboxSnapshots - org.alfresco.web.ui.wcm.tag.SandboxSnapshotsTag - JSP - Sandbox Snapshots List - Displays the list of snapshots for a sandbox - - - id - false - true - The component identifier for this component - - - - value - true - true - The sandbox to show the list of snapshots for - - - - binding - false - true - The value binding expression linking this component to a property in a backing bean - - - - rendered - false - true - - - - dateFilter - false - true - - - - - pendingSubmissions - org.alfresco.web.ui.wcm.tag.PendingSubmissionsTag - JSP - Pending Submissions List - Displays the list of pending submissions for a sandbox - - - id - false - true - The component identifier for this component - - - - value - true - true - The sandbox to show the list of pending submissions for - - - - binding - false - true - The value binding expression linking this component to a property in a backing bean - - - - rendered - false - true - - - - - formProcessor - org.alfresco.web.ui.wcm.tag.FormProcessorTag - JSP - Form Processor - Renders a form - - - id - false - true - The component identifier for this component - - - - formInstanceData - true - true - The instance data for the form processor - - - - formInstanceDataName - true - true - The name of the form instance data being modified - - - - form - true - true - The form to use to render this form. - - - - formProcessorSession - true - true - The form processor session value binding. - - - - binding - false - true - The value binding expression linking this component to a property in a backing bean - - - - rendered - false - true - - - - - deploymentReports - org.alfresco.web.ui.wcm.tag.DeploymentReportsTag - JSP - Deployment Reports - Renders the latest deployment reports for a web project - - - id - false - true - The component identifier for this component - - - - value - true - true - The sandbox to show the list of snapshots for - - - - rendered - false - true - - - - showPrevious - false - true - Flag to determine whether the previous reports should be shown - - - - dateFilter - false - true - The date filter for reducing the number of reports displayed - - - - attempt - false - true - The NodeRef of the deploymentattempt to show - - - - - deploymentServers - org.alfresco.web.ui.wcm.tag.DeploymentServersTag - JSP - Deployment Servers - - Renders a list of deployment servers and allows new ones to be - added and existing servers to be edited and removed - - - - id - false - true - The component identifier for this component - - - - value - true - true - The list of deployment servers to show - - - - rendered - false - true - - - - currentServer - false - true - The deployment server currently being added or edited - - - - inAddMode - false - true - - - - addType - false - true - - - - - deployWebsite - org.alfresco.web.ui.wcm.tag.DeployWebsiteTag - JSP - Deploy Website - Renders a list of servers to deploy to or show deployment progress for - - - id - false - true - The component identifier for this component - - - - rendered - false - true - Flag to determine whether component should be rendered - - - - website - true - true - The NodeRef of the website to deploy or being deployed - - - - snapshotVersion - false - true - The version of the snapshot to deploy or being deployed - - - - value - true - true - The list of servers to deploy to - - - - deployMode - false - true - The type of servers being deployed to, 'live' or 'test' - - - - store - false - true - The store being deployed - - - - monitor - false - true - Whether the component is monitoring a deployment - - - - monitorIds - false - true - List of deployment monitor ids to look for - - - - - linkValidationProgress - org.alfresco.web.ui.wcm.tag.LinkValidationProgressTag - JSP - Link Validation Progress - Monitors the progress of the current link validation check being executed. - - - id - false - true - - - - rendered - false - true - Flag to determine whether component should be rendered - - - - - linkValidationSummary - org.alfresco.web.ui.wcm.tag.LinkValidationSummaryTag - JSP - Link Validation Sumary - Displays summary information for a link validation report - - - value - true - true - The link validation state object holding the report data - - - - showPanel - false - true - Hides the surrounding panel if set to false, true by default - - - - showTitle - false - true - Hides the summary report title if set to false, true by default - - - - id - false - true - The component identifier for this component - - - - rendered - false - true - Flag to determine whether component should be rendered - - - - styleClass - false - true - CSS class to apply to the summary panel (applies to outer div element) - - - - - linkValidationReport - org.alfresco.web.ui.wcm.tag.LinkValidationReportTag - JSP - Link Validation Report - Displays the results of a link validation report - - - value - true - true - The link validation state object holding the report data - - - - id - false - true - The component identifier for this component - - - - rendered - false - true - Flag to determine whether component should be rendered - - - - itemsExpanded - false - true - - Flag to determine whether component should render the broken - links and generated files sections expanded - - - - - initialTab - false - true - The tab to be initially selected - - - - - avmLockIcon - org.alfresco.web.ui.wcm.tag.AVMLockIconTag - JSP - - - id - false - true - - - - binding - false - true - - - - rendered - false - true - - - - style - false - true - - - - styleClass - false - true - - - - lockImage - false - true - - - - lockOwnerImage - false - true - - - - align - false - true - - - - width - false - true - - - - height - false - true - - - - lockedOwnerTooltip - false - true - - - - lockedUserTooltip - false - true - - - - value - true - true - - - - - avmList - org.alfresco.web.ui.wcm.tag.AVMListTag - JSP - - - The AVMList component is capable of rendering a list of java bean objects in a single rendering - mode. A List of objects is bound to the component through the value attribute and components - within the list can bind to specific fields (columns) through getter methods for each bean object - within the list. The component provides mechanism to page and sort data through additional - components - - - - id - false - true - - - - value - false - true - - - - binding - false - true - - - - rendered - false - true - - - - styleClass - false - true - - - - style - false - true - - - - headerStyleClass - false - true - - - - rowStyleClass - false - true - - - - altRowStyleClass - false - true - - - - width - false - true - - - - var - false - true - - - - initialSortColumn - false - true - - - - initialSortDescending - false - true - - - - listConfig - false - true - - - - viewMode - false - true - - - - pageSize - false - true - - - - refreshOnBind - false - true - - - - diff --git a/source/web/WEB-INF/web.xml b/source/web/WEB-INF/web.xml index 6268dd04c5..97045229dd 100644 --- a/source/web/WEB-INF/web.xml +++ b/source/web/WEB-INF/web.xml @@ -25,7 +25,7 @@ javax.faces.CONFIG_FILES - /WEB-INF/faces-config-app.xml,/WEB-INF/faces-config-beans.xml,/WEB-INF/faces-config-navigation.xml,/WEB-INF/faces-config-common.xml,/WEB-INF/faces-config-repo.xml,/WEB-INF/faces-config-wcm.xml,/WEB-INF/faces-config-custom.xml + /WEB-INF/faces-config-app.xml,/WEB-INF/faces-config-beans.xml,/WEB-INF/faces-config-navigation.xml,/WEB-INF/faces-config-common.xml,/WEB-INF/faces-config-repo.xml,/WEB-INF/faces-config-custom.xml diff --git a/source/web/jsp/admin/avm-console-help.txt b/source/web/jsp/admin/avm-console-help.txt deleted file mode 100644 index 950712286d..0000000000 --- a/source/web/jsp/admin/avm-console-help.txt +++ /dev/null @@ -1,399 +0,0 @@ -Help For The AVM Console. -------------------------- - -Basic Syntax: -Enter commands into the Command box of the form: - - command, arg1, arg2, arg3, ... argn - -Enter further data into the Optional Data box for -command like write, create that require input data. - -Click Execute to run the command. - -To quit / exit, close this window or tab (and logout from Alfresco Explorer or close the web browser). - -Individual Commands: - ------- - -ls - Lists the contents of the given directory. - -ls, avmpath, #versionnumber# - -avmpath is a valid avm path which are of the form: - - storename:/name/name/name.../name - - The root of the store is simply - storename:/ - -#versionnumber# is an integer constant indicating -the version number. -1 is used to reference the 'HEAD' -version. - ------- - -lsr - Lists the contents of the given directory recursively. - -lsr, avmpath, #versionnumber# - -avmpath and #versionnumber# as above. - ------- - -lsrep - Lists all the avmstores. - -lsrep - ------- - -lsver - Lists the versions in a given store. - -lsver, storename -lsver, storename, fromDate -lsver, storename, fromDate, toDate - -storename - name of the store (alphanumeric). - -fromDate, toDate in ISO 8601 format (eg. 'YYYY-MM-DDThh:mm:ss.sss' where = 'Z' or '+hh:mm' or '-hh:mm') - ------- - -mkrep - Create a new store. - -mkrep, storename - -storename - as above. - ------- - -setstoreproperty - Set the value of store property. - -setstoreproperty, storename, qname, value - -storename - as above. - -value - the new property value - the type will be auto-detected. At present only TEXT -and INT types are suppored as well as collections of these types. Collections -can be specified using a comma seperated list enclosed in square brackets. - -qname - the property name in the form {namespaceURI}localName - ------- - -setstorepermission - Set a permission mask on a store. - -setstorepermission, storename, authority, permission - -storename - as above. - -authority - the user or group identifier. - -permission - the permission name to set. - ------- - -clearstorepermission - Clears a permission mask on a store for a given authority. - -clearstorepermission, storename, authority - -storename - as above. - -authority - the user or group identifier. - ------- - -load - Loads content recursively into an avm directory. - -load, fspath, avmpath - -fspath is a local filesystem path. Use '/'s to -be safe, even on windows. -avmpath as above and must be a path to a directory. - ------- - -mkdir - Create a new directory - -mkdir, avmpath, name - -avmpath is as above and must point to a directory. -name must be a valid Alfresco path component name. - ------- - -mkbr - Create a branch - -mkbr, srcavmpath, dstavmpath, name, #versionnumber# - -srcavmpath is a valid avmpath -dstavmpath is a valid avmpath to a directory -name is a valid path component name. - ------- - -mkldir - Create a new layered directory - -mkldir, targetavmpath, avmpath, name - -targetavmpath is a valid avmpath to a directory which - will be what the new layered directory is transparent to. -avmpath is and avmpath to the directory which will contain - the new layered directory. -name is a valid path component name. - ------- - -setopacity - Set layered directory to be opaque (or not) to its indirection - -setopacity, avmpath, bool - -avmpath is avmpath to the layered directory - -bool is "true" (opaque) or "false" (not opaque) - ------- - -rename - Renames a node from one place to another. - -rename, srcdiravmpath, srcname, dstdiravmpath, dstname - -srcdiravmpath is the avm directory that contains the node - to be renamed. -srcname is the name of the node to rename. -dstdiravmpath is the avm directory that the renamed - node will live in. -dstname is the name of the renamed node. - ------- - -cp - Copies a file from one place to another. - -cp, avmpath, #versionnumber#, diravmpath, name - -avmpath is the path to the file to copy. -#versionnumber# is as above. -diravmpath is the directory in which the copy will -reside. -name is the name of the copy. - ------- - -snap - Creates a snapshot (a new version of an -avmstore). - -snap, storename, tag, description - -storename is the name of the store to snapshot. -tag is the short label - note: cannot contain ',' using this interface -description is the longer description - note: cannot contain ',' using this interface - ------- - -cat - Shows the textual content of a node. Sorry no binary -viewing. - -cat, avmpath, #versionnumber# - -avmpath as above. -#versionnumber# as above. - ------- - -rm - Remove a node. - -rm, avmpath, name - -avmpath is a pointer to a directory. -name is the name of the node in that directory -to remove. - ------- - -rmrep - Purges a store, i.e. makes it truly go away. - -rmrep, storename - -storename - as above. - ------- - -rmver - Purges a particular version of a store. - -rmver, storename, #versionnumber# - -storename - as above. - -#versionnmber# is the version to purge. - ------- - -rmvers - Purges versions of a store between two dates (inclusive). - -rmvers, storename, fromDate, toDate - -storename - as above. - -fromDate, toDate in ISO 8601 format (eg. 'YYYY-MM-DDThh:mm:ss.sss' where = 'Z' or '+hh:mm' or '-hh:mm') - ------- - -write - Writes content to an existing file. - -write, avmpath - -avmpath is a path to a file. - -This command expects the content to be written in -the Optional Data box. - ------- - -create - Create a new file. - -create, avmpath, name - -avmpath is a path to a directory. -name is the name to give the new file. - -This command expects the content to be written in -the Optional Data box. - ------- - -stat - Get information on a node. - -stat, avmpath, #versionnumber# - -avmpath as above. - -#versionnumber# as above. - ------- - -getnodeproperties - List all properties of a node. - -getnodeproperties, avmpath, #versionnumber# - -avmpath as above. - -#versionnumber# as above. - ------- - -descnode - Describes a node (including lock information). - -descnode, avmpath, #versionnumber# - -avmpath as above. - -#versionnumber# as above. - ------- - -deletenodeproperty - Delete a property of a node. - -deletenodeproperty, avmpath, #versionnumber#, qname - -avmpath as above. - -#versionnumber# as above. - -qname - a property name in the form {namespaceURI}localName - ------- - -setnodeproperty - Set the value of node property. - -setnodeproperty, avmpath, qname, value - -value - the new property value - the type will be auto-detected. At present only TEXT, -NODE_REF and INT types are suppored as well as collections of these types. Collections -can be specified using a comma seperated list enclosed in square brackets. - -qname - the property name in the form {namespaceURI}localName - ------- - -setnodepermission - Set a permission mask on a node. - -setnodepermission, avmpath, authority, permission - -authority - the user or group identifier. - -permission - the permission name to set. - ------- - -clearnodepermission - Clears a permission mask on a node for a given authority. - -clearnodepermission, avmpath, authority - -authority - the user or group identifier. - ------- - -history - Get a list of the previous versions -of a node. - -history, avmpath, #versionnumber#, #count# - -avmpath as above. -#versionnumber# as above. -#count# The number of versions into the past to list. --1 means all. - ------- - -statstore - Show information about a store. - -statstore, storename - -storename The name of the store. - ------- - -compare - Compares two trees. - -compare, avmpath, #versionnumber#, avmpath, #versionnumber# - ------- - -update - Promotes a node from one tree to another. - -update, avmpath, #versionnumber#, avmpath - ------- - -resetLayer - Resets a layer. - -resetLayer, avmpath - ------- - -flatten - Flattens a layer against a target tree. - -flatten, avmpath, avmpath - ------- - -getnodeaspects - List all aspects of a node. - -getnodeaspects, avmpath, #versionnumber# - ------- - -addnodeaspect - Add an aspect to a node. - -addnodeaspect, avmpath, qname - -qname - an aspect name in the form {namespaceURI}localName - ------- - -deletenodeaspect - Remove an aspect and it's properties from a node. - -deletenodeaspect, avmpath, qname - -qname - an aspect name in the form {namespaceURI}localName \ No newline at end of file diff --git a/source/web/jsp/admin/avm-console.jsp b/source/web/jsp/admin/avm-console.jsp deleted file mode 100644 index 90d4ba6b8d..0000000000 --- a/source/web/jsp/admin/avm-console.jsp +++ /dev/null @@ -1,125 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> -<%@ page import="java.util.*,java.io.*,org.alfresco.repo.avm.*,org.alfresco.repo.avm.util.*,org.alfresco.service.cmr.avm.*,org.alfresco.service.cmr.repository.*,org.alfresco.repo.security.authentication.*,org.alfresco.service.cmr.avmsync.*,org.alfresco.service.cmr.security.*,org.alfresco.service.cmr.avm.locking.*" %> - -<%! - static AVMService fgService; - static BulkLoader fgLoader; - static AVMInterpreter fgInterpreter; - - static - { - fgService = (AVMService)RawServices.Instance().getContext().getBean("AVMService"); - fgLoader = new BulkLoader(); - fgLoader.setAvmService(fgService); - fgInterpreter = new AVMInterpreter(); - fgInterpreter.setAvmService(fgService); - fgInterpreter.setAvmSyncService( - (AVMSyncService)RawServices.Instance().getContext().getBean("AVMSyncService")); - fgInterpreter.setAvmLockingService( - (AVMLockingService)RawServices.Instance().getContext().getBean("AVMLockingService")); - fgInterpreter.setPermissionService( - (PermissionService)RawServices.Instance().getContext().getBean("PermissionService")); - fgInterpreter.setBulkLoader(fgLoader); - } - - static String EscapeForHTML(String data) - { - StringBuilder builder = new StringBuilder(); - int count = data.length(); - for (int i = 0; i < count; i++) - { - char c = data.charAt(i); - switch (c) - { - case '<' : - builder.append("<"); - break; - case '>' : - builder.append(">"); - break; - case '"' : - builder.append("""); - break; - case '&' : - builder.append("&"); - break; - case '\'' : - builder.append("'"); - break; - case '\\' : - builder.append("\"); - break; - default : - builder.append(c); - break; - } - } - return builder.toString(); - } -%> - - - - - - - -
- Alfresco - - AVM Console -
- - <% - String command = request.getParameter("command"); - if (command != null) - { - long start = System.currentTimeMillis(); - String data = request.getParameter("data"); - data = data + "\n\n"; - BufferedReader in = new BufferedReader(new StringReader(data)); - String result = fgInterpreter.interpretCommand(command, in); - out.println("
Output:
"); - out.println(EscapeForHTML(command)); - out.println(); - out.println(EscapeForHTML(result)); - out.println((System.currentTimeMillis() - start) + "ms"); - out.println("
"); - } - else - { - command = ""; - } - %> - - -

Command:

-

Optional Data:

- -

-
Help! - - - - - diff --git a/source/web/jsp/wcm/add-content-dialog.jsp b/source/web/jsp/wcm/add-content-dialog.jsp deleted file mode 100644 index 55123311a7..0000000000 --- a/source/web/jsp/wcm/add-content-dialog.jsp +++ /dev/null @@ -1,188 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a"%> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r"%> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8"%> -<%@ page isELIgnored="false"%> -<%@ page import="javax.faces.context.FacesContext"%> -<%@ page import="org.alfresco.web.app.Application"%> -<%@ page import="org.alfresco.web.bean.wcm.AddAvmContentDialog"%> -<%@ page import="org.alfresco.web.app.servlet.FacesHelper"%> -<%@ page import="org.alfresco.web.ui.common.PanelGenerator"%> - - -<% - boolean fileUploaded = false; - - AddAvmContentDialog dialog = (AddAvmContentDialog) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "AddAvmContentDialog"); - if (dialog != null && dialog.getFileName() != null) - { - fileUploaded = true; - } -%> - - <% - if (fileUploaded) - { - PanelGenerator.generatePanelStart(out, request.getContextPath(), "yellowInner", "#ffffcc"); - out.write("  "); - out.write(dialog.getFileUploadSuccessMsg()); - PanelGenerator.generatePanelEnd(out, request.getContextPath(), "yellowInner"); - out.write("
"); - } - %> - - - <% - if (fileUploaded == false) - { - %> - - - - - - - -<% - } -%> -<% - if (fileUploaded) - { -%> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <% - } - %> - -
- - - -
- - - - - - - - -
- - - - - - - - -
-
-
  - - - -
- - - - - - - - - - - -
- - - - - - - -
- - - - - - - -
- - -
\ No newline at end of file diff --git a/source/web/jsp/wcm/browse-sandbox.jsp b/source/web/jsp/wcm/browse-sandbox.jsp deleted file mode 100644 index 61d89e730a..0000000000 --- a/source/web/jsp/wcm/browse-sandbox.jsp +++ /dev/null @@ -1,443 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> - -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> -<%@ taglib uri="/WEB-INF/wcm.tld" prefix="w" %> - -<%@ page buffer="64kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> -<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> - - - - - - - <%-- load a bundle of properties with I18N strings --%> - - - - - <%-- Main outer table --%> - - - <%-- Title bar --%> - - - - - <%-- Main area --%> - - <%-- Shelf --%> - - - <%-- Work Area --%> - - -
- <%@ include file="../parts/titlebar.jsp" %> -
- <%@ include file="../parts/shelf.jsp" %> - "> - - <%-- Breadcrumb --%> - <%@ include file="../parts/breadcrumb.jsp" %> - - <%-- Status and Actions --%> - - - - - - - <%-- separator row with gradient shadow --%> - - - - - - - <%-- Error Messages --%> - - - - - - - <%-- Website Path Breadcrumb --%> - - - - - - - <%-- Custom Template View --%> - - - - - - - - - <%-- Details - Folders --%> - - - - - - - <%-- Details - Files --%> - - - - - - - <%-- separator row with bottom panel graphics --%> - - - - - - -
- - <%-- Status and Actions inner contents table --%> - <%-- Generally this consists of an icon, textual summary and actions for the current object --%> - - - - <%-- actions for browse mode --%> - - - - - - - - - - <%-- actions for search results mode --%> - - - - - - -
- - <%-- Summary --%> -
-
-
-
- - - <%-- Create actions menu --%> - - - - - - - <%-- Summary --%> -
-
- -
- - -
-
-
- <%-- Close Search action --%> - -
- -
- <%-- messages tag to show messages not handled by other specific message tags --%> - -
-
-
- - - -
-
- - - - -
- - - - - - -
-
-
-
- - - - - <%-- Primary column with folder name --%> - - - - - - - - - - - - - - - - <%-- Path column for search results mode --%> - - - - - - - - - - <%-- Creator column --%> - - - - - - - - <%-- Created Date column --%> - - - - - - - - - - <%-- Modifier column --%> - - - - - - - - <%-- Modified Date column --%> - - - - - - - - - - <%-- Type column --%> - - - - - - - - <%-- Folder Actions column --%> - - - - - - <%-- actions are configured in web-client-config-wcm-actions.xml --%> - - - - - - - - -
- - - - - - -
-
-
-
- - - - - <%-- Primary column for details view mode --%> - - - - - - - - - - - - <%-- Path column for search results mode --%> - - - - - - - - - - <%-- Size column --%> - - - - - - - - - - <%-- Creator column --%> - - - - - - - - <%-- Created Date column --%> - - - - - - - - - - <%-- Modifier column --%> - - - - - - - - <%-- Modified Date column --%> - - - - - - - - - - <%-- Type column --%> - - - - - - - - <%-- Content Actions column --%> - - - - - - <%-- actions are configured in web-client-config-wcm-actions.xml --%> - - - - - - - - - -
-
- -
- -
- -
diff --git a/source/web/jsp/wcm/browse-website.jsp b/source/web/jsp/wcm/browse-website.jsp deleted file mode 100644 index 88fbd66937..0000000000 --- a/source/web/jsp/wcm/browse-website.jsp +++ /dev/null @@ -1,256 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> - -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> -<%@ taglib uri="/WEB-INF/wcm.tld" prefix="w" %> - -<%@ page buffer="64kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> -<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> - - - - - <%-- load a bundle of properties with I18N strings --%> - - - - - <%-- Main outer table --%> - - - <%-- Title bar --%> - - - - - <%-- Main area --%> - - <%-- Shelf --%> - - - <%-- Work Area --%> - - -
- <%@ include file="../parts/titlebar.jsp" %> -
- <%@ include file="../parts/shelf.jsp" %> - "> - - <%-- Breadcrumb --%> - <%@ include file="../parts/breadcrumb.jsp" %> - - <%-- Status and Actions --%> - - - - - - - <%-- separator row with gradient shadow --%> - - - - - - - <%-- Error Messages --%> - - - - - - - <%-- Details - Staging sandbox --%> - - - - - - - <%-- Details - User sandboxes --%> - - - - - - - <%-- separator row with bottom panel graphics --%> - - - - - - -
- - <%-- Status and Actions inner contents table --%> - <%-- Generally this consists of an icon, textual summary and actions for the current object --%> - - - - - - -
- - <%-- Summary --%> -
-
-
-
- - <%-- More actions menu --%> - - - - -
- -
- <%-- messages tag to show messages not handled by other specific message tags --%> - -
- <%-- Current Webapp selection - only displayed if >1 webapps are present --%> - - - - - -
-
- - - - <%-- Staging Sandbox Info --%> - <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "innerwhite", "white"); %> - - - - - - - - - - - - - - - - - - -
- - -   - -   - -   - -   - - - - - <%-- Disabled action for GA - - --%> -
-
- -
-
- -
- <%-- Sandbox snapshots list --%> - - - - - - -
: - - - - - - -
-
- -
-
-
- -
- <%-- Pending submission list --%> - -
-
-
- <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "innerwhite"); %> - -
- -
- - <%-- used by the panel to add additional component facets --%> - - - - - - - - - - - <%-- User Sandboxes List --%> - - - - -
-
- -
- -
- -
diff --git a/source/web/jsp/wcm/change-expiration-date.jsp b/source/web/jsp/wcm/change-expiration-date.jsp deleted file mode 100644 index d334742859..0000000000 --- a/source/web/jsp/wcm/change-expiration-date.jsp +++ /dev/null @@ -1,37 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - - - - - - - - \ No newline at end of file diff --git a/source/web/jsp/wcm/compare-to-any-snapshot.jsp b/source/web/jsp/wcm/compare-to-any-snapshot.jsp deleted file mode 100644 index cbe862c70f..0000000000 --- a/source/web/jsp/wcm/compare-to-any-snapshot.jsp +++ /dev/null @@ -1,78 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a"%> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r"%> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8"%> - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/source/web/jsp/wcm/compare-to-current-snapshot.jsp b/source/web/jsp/wcm/compare-to-current-snapshot.jsp deleted file mode 100644 index 758559b222..0000000000 --- a/source/web/jsp/wcm/compare-to-current-snapshot.jsp +++ /dev/null @@ -1,49 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a"%> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r"%> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8"%> - - - - - - - - - - - - - - - - - - - - - - - diff --git a/source/web/jsp/wcm/create-folder-dialog.jsp b/source/web/jsp/wcm/create-folder-dialog.jsp deleted file mode 100644 index 8756df655a..0000000000 --- a/source/web/jsp/wcm/create-folder-dialog.jsp +++ /dev/null @@ -1,102 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - - - - - - - - - -
- - - - - - - -
- - - - - - - -
-
diff --git a/source/web/jsp/wcm/create-form-wizard/configure-rendering-engines.jsp b/source/web/jsp/wcm/create-form-wizard/configure-rendering-engines.jsp deleted file mode 100644 index 25fdab32c9..0000000000 --- a/source/web/jsp/wcm/create-form-wizard/configure-rendering-engines.jsp +++ /dev/null @@ -1,325 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/source/web/jsp/wcm/create-form-wizard/details.jsp b/source/web/jsp/wcm/create-form-wizard/details.jsp deleted file mode 100644 index 07c4fea7e0..0000000000 --- a/source/web/jsp/wcm/create-form-wizard/details.jsp +++ /dev/null @@ -1,253 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/source/web/jsp/wcm/create-form-wizard/form-summary.jsp b/source/web/jsp/wcm/create-form-wizard/form-summary.jsp deleted file mode 100644 index 03a68d8c8e..0000000000 --- a/source/web/jsp/wcm/create-form-wizard/form-summary.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - --%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> -<%@ page isELIgnored="false" %> - - - - - - - - - - - - \ No newline at end of file diff --git a/source/web/jsp/wcm/create-form-wizard/select-default-workflow.jsp b/source/web/jsp/wcm/create-form-wizard/select-default-workflow.jsp deleted file mode 100644 index 07d84d35a3..0000000000 --- a/source/web/jsp/wcm/create-form-wizard/select-default-workflow.jsp +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - -
 
- - - - - - - - -
-
diff --git a/source/web/jsp/wcm/create-form-wizard/web-form-summary.jsp b/source/web/jsp/wcm/create-form-wizard/web-form-summary.jsp deleted file mode 100644 index cb43f0ef45..0000000000 --- a/source/web/jsp/wcm/create-form-wizard/web-form-summary.jsp +++ /dev/null @@ -1,94 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> - -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> -<%@ page isELIgnored="false" %> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/source/web/jsp/wcm/create-layered-folder-dialog.jsp b/source/web/jsp/wcm/create-layered-folder-dialog.jsp deleted file mode 100644 index b820b0a4f3..0000000000 --- a/source/web/jsp/wcm/create-layered-folder-dialog.jsp +++ /dev/null @@ -1,156 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - - - - - - - - - -
- - - - - - - -
- - - -
- - - - - - - - - - - - - -
- - - - - - - - - - - -
-
diff --git a/source/web/jsp/wcm/create-web-content-wizard/create-html.jsp b/source/web/jsp/wcm/create-web-content-wizard/create-html.jsp deleted file mode 100644 index ce00124005..0000000000 --- a/source/web/jsp/wcm/create-web-content-wizard/create-html.jsp +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - - - - - -
- -
- -
diff --git a/source/web/jsp/wcm/create-web-content-wizard/create-text.jsp b/source/web/jsp/wcm/create-web-content-wizard/create-text.jsp deleted file mode 100644 index c24905fd50..0000000000 --- a/source/web/jsp/wcm/create-web-content-wizard/create-text.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - - - - \ No newline at end of file diff --git a/source/web/jsp/wcm/create-web-content-wizard/create-xml.jsp b/source/web/jsp/wcm/create-web-content-wizard/create-xml.jsp deleted file mode 100644 index 6b0db84e67..0000000000 --- a/source/web/jsp/wcm/create-web-content-wizard/create-xml.jsp +++ /dev/null @@ -1,40 +0,0 @@ - - - - - diff --git a/source/web/jsp/wcm/create-web-content-wizard/details.jsp b/source/web/jsp/wcm/create-web-content-wizard/details.jsp deleted file mode 100644 index e11a7b48e7..0000000000 --- a/source/web/jsp/wcm/create-web-content-wizard/details.jsp +++ /dev/null @@ -1,95 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/source/web/jsp/wcm/create-web-content-wizard/summary.jsp b/source/web/jsp/wcm/create-web-content-wizard/summary.jsp deleted file mode 100644 index 36f20587b5..0000000000 --- a/source/web/jsp/wcm/create-web-content-wizard/summary.jsp +++ /dev/null @@ -1,100 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - --%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> -<%@ page isELIgnored="false" %> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/source/web/jsp/wcm/create-webapp.jsp b/source/web/jsp/wcm/create-webapp.jsp deleted file mode 100644 index d91968ebc8..0000000000 --- a/source/web/jsp/wcm/create-webapp.jsp +++ /dev/null @@ -1,90 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - - - - - - - - - - - - - - - - - - -
- - - -
- - - - - - - - - - - -
- - - - - - - -
-
diff --git a/source/web/jsp/wcm/create-website-wizard/create-from.jsp b/source/web/jsp/wcm/create-website-wizard/create-from.jsp deleted file mode 100644 index cc665e27c5..0000000000 --- a/source/web/jsp/wcm/create-website-wizard/create-from.jsp +++ /dev/null @@ -1,43 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - - - - - - - -
- - - -
-
- -
- - -
-
-
\ No newline at end of file diff --git a/source/web/jsp/wcm/create-website-wizard/deployment.jsp b/source/web/jsp/wcm/create-website-wizard/deployment.jsp deleted file mode 100644 index c2182f24a2..0000000000 --- a/source/web/jsp/wcm/create-website-wizard/deployment.jsp +++ /dev/null @@ -1,38 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> -<%@ taglib uri="/WEB-INF/wcm.tld" prefix="w" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - - - - - - \ No newline at end of file diff --git a/source/web/jsp/wcm/create-website-wizard/details.jsp b/source/web/jsp/wcm/create-website-wizard/details.jsp deleted file mode 100644 index 9a913d248d..0000000000 --- a/source/web/jsp/wcm/create-website-wizard/details.jsp +++ /dev/null @@ -1,201 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - - - diff --git a/source/web/jsp/wcm/create-website-wizard/form-details.jsp b/source/web/jsp/wcm/create-website-wizard/form-details.jsp deleted file mode 100644 index ae1e2b4e0e..0000000000 --- a/source/web/jsp/wcm/create-website-wizard/form-details.jsp +++ /dev/null @@ -1,184 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - - - - - - - <%-- Form properties --%> - - - - - - -
- - - -
- - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - -
-
-
- - <%-- Save location --%> - - - - - - - - - -
- - - -
- - - -
- - - - - - - - - -
- - - - - - - - - - - - - -
- -
-
-
- - <%-- Workflow --%> - - - - - - - - - - - - -
- - - -
- - - -
- - <%-- Workflow selection list - scrollable DIV area --%> - -
- - - -
-
- -
-
-
- -
diff --git a/source/web/jsp/wcm/create-website-wizard/form-templates.jsp b/source/web/jsp/wcm/create-website-wizard/form-templates.jsp deleted file mode 100644 index 8745e27797..0000000000 --- a/source/web/jsp/wcm/create-website-wizard/form-templates.jsp +++ /dev/null @@ -1,152 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - - - - - - - <%-- Template selection list --%> - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/source/web/jsp/wcm/create-website-wizard/form-workflow.jsp b/source/web/jsp/wcm/create-website-wizard/form-workflow.jsp deleted file mode 100644 index cb3670913c..0000000000 --- a/source/web/jsp/wcm/create-website-wizard/form-workflow.jsp +++ /dev/null @@ -1,42 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/source/web/jsp/wcm/create-website-wizard/forms.jsp b/source/web/jsp/wcm/create-website-wizard/forms.jsp deleted file mode 100644 index e68fb4d34b..0000000000 --- a/source/web/jsp/wcm/create-website-wizard/forms.jsp +++ /dev/null @@ -1,108 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - - <%-- Form selection list - scrollable DIV area --%> - - -
- - - - -
-
- - - <%-- Selected Form table, with configuration buttons and info text --%> -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/source/web/jsp/wcm/create-website-wizard/invite.jsp b/source/web/jsp/wcm/create-website-wizard/invite.jsp deleted file mode 100644 index 54492fd05b..0000000000 --- a/source/web/jsp/wcm/create-website-wizard/invite.jsp +++ /dev/null @@ -1,64 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/source/web/jsp/wcm/create-website-wizard/notify.jsp b/source/web/jsp/wcm/create-website-wizard/notify.jsp deleted file mode 100644 index c049468cf5..0000000000 --- a/source/web/jsp/wcm/create-website-wizard/notify.jsp +++ /dev/null @@ -1,98 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - - - - - - - - - - - - - - - - - -  * - - - - - - - - - - - - - - - diff --git a/source/web/jsp/wcm/create-website-wizard/settings.jsp b/source/web/jsp/wcm/create-website-wizard/settings.jsp deleted file mode 100644 index afa17c244c..0000000000 --- a/source/web/jsp/wcm/create-website-wizard/settings.jsp +++ /dev/null @@ -1,77 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - - <%-- Workflow selection list - scrollable DIV area --%> - - -
- - - - -
-
- - <%-- Selected Workflow table, with configuration buttons and info text --%> -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/source/web/jsp/wcm/create-website-wizard/summary.jsp b/source/web/jsp/wcm/create-website-wizard/summary.jsp deleted file mode 100644 index 34374fe5fb..0000000000 --- a/source/web/jsp/wcm/create-website-wizard/summary.jsp +++ /dev/null @@ -1,105 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> -<%@ page isELIgnored="false" %> - - - - - - - - - - - - - - - <%-- Web Content Forms --%> - - - - - - - - - - - - - - <%-- Selected Workflows --%> - - - - - - - - - - - - - - <%-- Users and Roles --%> - - - - - - - - - - - diff --git a/source/web/jsp/wcm/deploy.jsp b/source/web/jsp/wcm/deploy.jsp deleted file mode 100644 index ed4da76244..0000000000 --- a/source/web/jsp/wcm/deploy.jsp +++ /dev/null @@ -1,31 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> -<%@ taglib uri="/WEB-INF/wcm.tld" prefix="w" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - diff --git a/source/web/jsp/wcm/deployment-report.jsp b/source/web/jsp/wcm/deployment-report.jsp deleted file mode 100644 index 548c749fad..0000000000 --- a/source/web/jsp/wcm/deployment-report.jsp +++ /dev/null @@ -1,71 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> -<%@ taglib uri="/WEB-INF/wcm.tld" prefix="w" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/source/web/jsp/wcm/edit-file.jsp b/source/web/jsp/wcm/edit-file.jsp deleted file mode 100644 index 933f74a1a4..0000000000 --- a/source/web/jsp/wcm/edit-file.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - - - - - - - <%-- downloadable file link --%> - - - - - - - diff --git a/source/web/jsp/wcm/edit-folder-properties.jsp b/source/web/jsp/wcm/edit-folder-properties.jsp deleted file mode 100644 index 8743a318c5..0000000000 --- a/source/web/jsp/wcm/edit-folder-properties.jsp +++ /dev/null @@ -1,49 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> -<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> - - - - - - -
-<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "yellowInner", "#ffffcc"); %> - - - - - -
-<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "yellowInner"); %> -
-
- - - - - - diff --git a/source/web/jsp/wcm/edit-permissions.jsp b/source/web/jsp/wcm/edit-permissions.jsp deleted file mode 100644 index a4c89e6fe5..0000000000 --- a/source/web/jsp/wcm/edit-permissions.jsp +++ /dev/null @@ -1,118 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> -<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> - - - - - - - - <%-- Details --%> - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1. 
- - - - - -
- 2.  -
- - - - - - - - - - - - - - - - - - - - - -
-
-
- -
- -
\ No newline at end of file diff --git a/source/web/jsp/wcm/file-details.jsp b/source/web/jsp/wcm/file-details.jsp deleted file mode 100644 index 9140610505..0000000000 --- a/source/web/jsp/wcm/file-details.jsp +++ /dev/null @@ -1,141 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a"%> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r"%> - -<%@ page import="org.alfresco.web.ui.common.PanelGenerator"%> - - - - - - - - -
- - - - - - - - -
-
- -
- - - - - - - - - - - - - - - - - -
- - <%-- icon image for the doc --%> - - - - - - - - -
-
- -
-
-
- <%-- properties for the doc --%> - -
-
- -
- - - - - - <%-- Primary column --%> - - - - - - - - <%-- Modified Date column --%> - - - - - - - - - - <%-- actions --%> - - - - - - - - - - - - - - - - - - - -
- - <%-- Document Actions --%> - - - -
\ No newline at end of file diff --git a/source/web/jsp/wcm/folder-details.jsp b/source/web/jsp/wcm/folder-details.jsp deleted file mode 100644 index 8b7e8f0557..0000000000 --- a/source/web/jsp/wcm/folder-details.jsp +++ /dev/null @@ -1,86 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a"%> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r"%> - - - - - - - - -
- - - - - - -
-
- -
- - - - - - - - - - - - - - - -
- <%-- icon image for the folder --%> - - - - - - - - -
-
-
-
-
- <%-- properties for the folder --%> - -
-
-
- - <%-- Document Actions --%> - - - -
\ No newline at end of file diff --git a/source/web/jsp/wcm/import-content-dialog.jsp b/source/web/jsp/wcm/import-content-dialog.jsp deleted file mode 100644 index 3dd409d2b5..0000000000 --- a/source/web/jsp/wcm/import-content-dialog.jsp +++ /dev/null @@ -1,113 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a"%> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r"%> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8"%> -<%@ page isELIgnored="false"%> -<%@ page import="javax.faces.context.FacesContext"%> -<%@ page import="org.alfresco.web.app.Application"%> -<%@ page import="org.alfresco.web.bean.wcm.ImportWebsiteDialog"%> -<%@ page import="org.alfresco.web.app.servlet.FacesHelper"%> -<%@ page import="org.alfresco.web.ui.common.PanelGenerator"%> - - - - - - - - <% - ImportWebsiteDialog bean = (ImportWebsiteDialog) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "ImportWebsiteDialog"); - boolean foundFile = (bean != null && bean.getFileName() != null); - if (foundFile == false) - { - %> - - - - - - - - - <% } - if (foundFile) - { - %> - - - - - - - - - - - - <%}%> - -
- - - - - - - - -
- - - - - - - -
- -
-
- -
-   - -
-
\ No newline at end of file diff --git a/source/web/jsp/wcm/manage-change-request-task-dialog.jsp b/source/web/jsp/wcm/manage-change-request-task-dialog.jsp deleted file mode 100644 index 5fd3751399..0000000000 --- a/source/web/jsp/wcm/manage-change-request-task-dialog.jsp +++ /dev/null @@ -1,172 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> -<%@ taglib uri="/WEB-INF/wcm.tld" prefix="w" %> - - - - - - - - - - - - - - - - - - - - - - - - - - <%-- Name column --%> - - - - - - - - - - - - - - - - <%-- Description column --%> - - - - - - - - <%-- Path column --%> - - - - - - - - <%-- Created Date column --%> - - - - - - - - - - <%-- Modified Date column --%> - - - - - - - - - - <%-- Expiration Date column --%> - - - - - - - - - - <%-- Actions column --%> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
- - - - - - - - diff --git a/source/web/jsp/wcm/manage-permissions.jsp b/source/web/jsp/wcm/manage-permissions.jsp deleted file mode 100644 index eff5804b42..0000000000 --- a/source/web/jsp/wcm/manage-permissions.jsp +++ /dev/null @@ -1,132 +0,0 @@ - -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a"%> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r"%> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8"%> -<%@ page isELIgnored="false"%> -<%@ page import="org.alfresco.web.ui.common.PanelGenerator"%> - - -<%-- load a bundle of properties with I18N strings --%> - - - - - - - <%-- Primary column with full name --%> - - - - - - - - - - - <%-- Username column --%> - - - - - - - <%-- Created Date column for details view mode --%> - - <%-- Column to show whether the rule is local --%> - - - - - - - - - - <%-- Permission column --%> - - - - - - - - <%-- Actions column --%> - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -   -
-
diff --git a/source/web/jsp/wcm/manage-review-task-dialog.jsp b/source/web/jsp/wcm/manage-review-task-dialog.jsp deleted file mode 100644 index 7b71a378db..0000000000 --- a/source/web/jsp/wcm/manage-review-task-dialog.jsp +++ /dev/null @@ -1,186 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> -<%@ taglib uri="/WEB-INF/wcm.tld" prefix="w" %> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <%-- Name column --%> - - - - - - - - - - - - - - - - <%-- Description column --%> - - - - - - - - <%-- Path column --%> - - - - - - - - <%-- Created Date column --%> - - - - - - - - - - <%-- Modified Date column --%> - - - - - - - - - - <%-- Expiration Date column --%> - - - - - - - - - - <%-- Actions column --%> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
- - - - - - - - diff --git a/source/web/jsp/wcm/manage-task-dialog.jsp b/source/web/jsp/wcm/manage-task-dialog.jsp deleted file mode 100644 index 69066d0c3e..0000000000 --- a/source/web/jsp/wcm/manage-task-dialog.jsp +++ /dev/null @@ -1,162 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> -<%@ taglib uri="/WEB-INF/wcm.tld" prefix="w" %> - - - - - - - - - - - - - - - - - - - - - - - - - - <%-- Name column --%> - - - - - - - - - - - - - - - - <%-- Description column --%> - - - - - - - - <%-- Path column --%> - - - - - - - - <%-- Created Date column --%> - - - - - - - - - - <%-- Modified Date column --%> - - - - - - - - - - <%-- Actions column --%> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
- - - - - - - - diff --git a/source/web/jsp/wcm/monitor-deployment.jsp b/source/web/jsp/wcm/monitor-deployment.jsp deleted file mode 100644 index f22328b047..0000000000 --- a/source/web/jsp/wcm/monitor-deployment.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> -<%@ taglib uri="/WEB-INF/wcm.tld" prefix="w" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - \ No newline at end of file diff --git a/source/web/jsp/wcm/output-path-pattern-help.jsp b/source/web/jsp/wcm/output-path-pattern-help.jsp deleted file mode 100644 index 59d5cf5d4b..0000000000 --- a/source/web/jsp/wcm/output-path-pattern-help.jsp +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - diff --git a/source/web/jsp/wcm/prompt-for-web-form.jsp b/source/web/jsp/wcm/prompt-for-web-form.jsp deleted file mode 100644 index eef9345a23..0000000000 --- a/source/web/jsp/wcm/prompt-for-web-form.jsp +++ /dev/null @@ -1,51 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - - - - - - - - - - - - - - - - - - - diff --git a/source/web/jsp/wcm/regenerate-renditions-wizard/select_renditions.jsp b/source/web/jsp/wcm/regenerate-renditions-wizard/select_renditions.jsp deleted file mode 100644 index 1842677caf..0000000000 --- a/source/web/jsp/wcm/regenerate-renditions-wizard/select_renditions.jsp +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/source/web/jsp/wcm/regenerate-renditions-wizard/summary.jsp b/source/web/jsp/wcm/regenerate-renditions-wizard/summary.jsp deleted file mode 100644 index 4567b0e902..0000000000 --- a/source/web/jsp/wcm/regenerate-renditions-wizard/summary.jsp +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/source/web/jsp/wcm/remove-permissions.jsp b/source/web/jsp/wcm/remove-permissions.jsp deleted file mode 100644 index d2339f066e..0000000000 --- a/source/web/jsp/wcm/remove-permissions.jsp +++ /dev/null @@ -1,49 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - - - - - - - - - diff --git a/source/web/jsp/wcm/revert.jsp b/source/web/jsp/wcm/revert.jsp deleted file mode 100644 index 0d05c83c8e..0000000000 --- a/source/web/jsp/wcm/revert.jsp +++ /dev/null @@ -1,28 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - diff --git a/source/web/jsp/wcm/set-permissions.jsp b/source/web/jsp/wcm/set-permissions.jsp deleted file mode 100644 index d71c19c504..0000000000 --- a/source/web/jsp/wcm/set-permissions.jsp +++ /dev/null @@ -1,86 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/source/web/jsp/wcm/snapshot-sandbox.jsp b/source/web/jsp/wcm/snapshot-sandbox.jsp deleted file mode 100644 index 2f9aed7f3d..0000000000 --- a/source/web/jsp/wcm/snapshot-sandbox.jsp +++ /dev/null @@ -1,66 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - - - - - - - - - - - - - - - - - - - diff --git a/source/web/jsp/wcm/submit-config-workflow.jsp b/source/web/jsp/wcm/submit-config-workflow.jsp deleted file mode 100644 index 6439b3e0fc..0000000000 --- a/source/web/jsp/wcm/submit-config-workflow.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - - - diff --git a/source/web/jsp/wcm/submit-dialog.jsp b/source/web/jsp/wcm/submit-dialog.jsp deleted file mode 100644 index ca69062de5..0000000000 --- a/source/web/jsp/wcm/submit-dialog.jsp +++ /dev/null @@ -1,296 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - -<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "yellowInner", "#ffffcc"); %> - - - - - <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "yellowInner"); %> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "yellowInner", "#ffffcc"); %> - - - - - <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "yellowInner"); %> - - - - <%-- Primary column for details view mode --%> - - - - - - - - - - - - <%-- Description column --%> - - - - - - - - <%-- Path column --%> - - - - - - - - <%-- Modified Date column --%> - - - - - - - - - - - - - - - <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "yellowInner", "#ffffcc"); %> - - - - - <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "yellowInner"); %> - - - - <%-- Primary column for details view mode --%> - - - - - - - - - - - - - - - <%-- Description column --%> - - - - - - - - <%-- Path column --%> - - - - - - - - <%-- Modified Date column --%> - - - - - - - - - - <%-- Expiration Date column --%> - - - - - - - - - - <%-- Actions column --%> - - - - - - - - - - - - - - - diff --git a/source/web/jsp/wcm/update-file.jsp b/source/web/jsp/wcm/update-file.jsp deleted file mode 100644 index 214e399e98..0000000000 --- a/source/web/jsp/wcm/update-file.jsp +++ /dev/null @@ -1,50 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a"%> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r"%> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8"%> - - - - - - - - - -
- - - - - - - - - - - - - - -
-
diff --git a/source/web/jsp/wcm/website-details.jsp b/source/web/jsp/wcm/website-details.jsp deleted file mode 100644 index bf6e863ccd..0000000000 --- a/source/web/jsp/wcm/website-details.jsp +++ /dev/null @@ -1,97 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a"%> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r"%> - -<%@ page buffer="64kb" contentType="text/html;charset=UTF-8"%> -<%@ page isELIgnored="false"%> -<%@ page import="org.alfresco.web.ui.common.PanelGenerator"%> - - - - - - - -
- - - - - - - - - -
-
-
- -
- - <%-- wrapper comment used by the panel to add additional component facets --%> - - - - - - - - - - - - - - -
<%-- icon image for the space --%> - - - - - - - - -
-
-
-
- - <%-- properties for the space --%> - - -
-
-
- - - - - <%-- Website Actions --%> - - -
-
\ No newline at end of file diff --git a/source/web/jsp/wcm/workflow-file-details.jsp b/source/web/jsp/wcm/workflow-file-details.jsp deleted file mode 100644 index 1194b382af..0000000000 --- a/source/web/jsp/wcm/workflow-file-details.jsp +++ /dev/null @@ -1,115 +0,0 @@ -<%-- - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . ---%> -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a"%> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r"%> -<%@ taglib uri="/WEB-INF/wcm.tld" prefix="w" %> - -<%@ page import="org.alfresco.web.ui.common.PanelGenerator"%> - - - - - - -
- - - - - - - - -
-
- -
- - - - - - - - - -
- - <%-- icon image for the doc --%> - - - - - - - - -
-
- -
-
-
- <%-- properties for the doc --%> - -
-
- -
- - - - - - <%-- Primary column --%> - - - - - - - - <%-- Modified Date column --%> - - - - - - - - - - <%-- actions --%> - - - - - - - - - -
\ No newline at end of file