From a450598ecbb6fa028c0e4afc2472f2e6897f45ed Mon Sep 17 00:00:00 2001 From: Gavin Cornwell Date: Fri, 15 Feb 2008 14:59:11 +0000 Subject: [PATCH] Merge of all UI clustering changes originally applied to 2.2 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8292 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/web/action/ActionEvaluator.java | 4 +- .../evaluator/AddTranslationEvaluator.java | 180 +- .../action/evaluator/ApproveDocEvaluator.java | 2 + .../ApproveNonDraftDocEvaluator.java | 2 + .../evaluator/CancelCheckoutDocEvaluator.java | 2 + .../evaluator/CancelWorkflowEvaluator.java | 2 + .../action/evaluator/CheckinDocEvaluator.java | 2 + .../evaluator/CheckoutDocEvaluator.java | 2 + .../action/evaluator/CreateFormEvaluator.java | 2 + .../evaluator/CreateForumNodeEvaluator.java | 2 + .../evaluator/CreateWebProjectEvaluator.java | 2 + .../action/evaluator/CutNodeEvaluator.java | 2 + .../action/evaluator/DeleteDocEvaluator.java | 2 + .../evaluator/DiscussNodeEvaluator.java | 2 + .../evaluator/DiscussionCopyEvaluator.java | 2 + .../evaluator/DiscussionCutEvaluator.java | 2 + .../evaluator/EditDocCIFSEvaluator.java | 2 + .../evaluator/EditDocHttpEvaluator.java | 2 + .../evaluator/EditDocWebDavEvaluator.java | 2 + .../action/evaluator/EditFormEvaluator.java | 2 + .../evaluator/ForumsCheckinDocEvaluator.java | 2 + .../evaluator/MakeMultilingualEvaluator.java | 2 + .../MultilingualDetailsEvaluator.java | 2 + .../action/evaluator/NewEditionEvaluator.java | 2 + .../RegenerateRenditionsEvaluator.java | 2 + .../action/evaluator/RejectDocEvaluator.java | 2 + .../evaluator/RejectNonDraftDocEvaluator.java | 2 + .../evaluator/ShortcutNodeEvaluator.java | 2 + .../evaluator/StartWorkflowEvaluator.java | 2 + .../evaluator/TakeOwnershipDocEvaluator.java | 2 + .../action/evaluator/UnlockDocEvaluator.java | 2 + .../action/evaluator/UpdateDocEvaluator.java | 2 + .../action/evaluator/WCMLockEvaluator.java | 2 + .../WCMStagingReadonlyEvaluator.java | 2 + .../WCMWorkflowDeletedEvaluator.java | 2 + .../evaluator/WCMWorkflowEvaluator.java | 2 + .../web/app/ResourceBundleWrapper.java | 534 +- .../web/app/context/IContextListener.java | 4 +- .../web/app/context/UIContextService.java | 5 +- .../java/org/alfresco/web/bean/AboutBean.java | 34 +- .../alfresco/web/bean/BaseDetailsBean.java | 74 +- .../org/alfresco/web/bean/BrowseBean.java | 4268 +++--- .../java/org/alfresco/web/bean/ErrorBean.java | 5 +- .../org/alfresco/web/bean/FileUploadBean.java | 5 +- .../web/bean/LinkPropertiesDialog.java | 14 +- .../java/org/alfresco/web/bean/LoginBean.java | 53 +- .../web/bean/MultiValueEditorBean.java | 5 +- .../org/alfresco/web/bean/NavigationBean.java | 2229 ++-- .../alfresco/web/bean/NodeEventListener.java | 4 +- .../org/alfresco/web/bean/SidebarBean.java | 5 +- .../web/bean/SpaceLinkDetailsDialog.java | 5 +- .../web/bean/TemplateMailHelperBean.java | 35 +- .../web/bean/TemplateSupportBean.java | 36 +- .../web/bean/actions/BaseActionWizard.java | 88 +- .../alfresco/web/bean/actions/IHandler.java | 2 +- .../web/bean/actions/RunActionWizard.java | 10 +- .../actions/handlers/AddFeaturesHandler.java | 2 + .../bean/actions/handlers/CheckInHandler.java | 2 + .../actions/handlers/CheckOutHandler.java | 2 + .../bean/actions/handlers/CopyHandler.java | 2 + .../handlers/CopyToWebProjectHandler.java | 2 + .../bean/actions/handlers/ImportHandler.java | 2 + .../actions/handlers/LinkCategoryHandler.java | 2 + .../bean/actions/handlers/MailHandler.java | 2 + .../bean/actions/handlers/MoveHandler.java | 2 + .../handlers/RemoveFeaturesHandler.java | 2 + .../bean/actions/handlers/ScriptHandler.java | 4 +- .../handlers/SimpleWorkflowHandler.java | 2 + .../handlers/SpecialiseTypeHandler.java | 2 + .../actions/handlers/TransformHandler.java | 2 + .../handlers/TransformImageHandler.java | 2 + .../web/bean/admin/AdminNodeBrowseBean.java | 151 +- .../alfresco/web/bean/admin/ExportDialog.java | 25 +- .../alfresco/web/bean/admin/ImportDialog.java | 65 +- .../web/bean/ajax/ContentUpdateBean.java | 4 +- .../web/bean/ajax/FileUploadBean.java | 4 +- .../alfresco/web/bean/ajax/MySpacesBean.java | 4 +- .../web/bean/ajax/NavigatorPluginBean.java | 62 +- .../alfresco/web/bean/ajax/NodeInfoBean.java | 20 +- .../web/bean/ajax/PortletActionsBean.java | 13 +- .../alfresco/web/bean/ajax/TaskInfoBean.java | 19 +- .../web/bean/categories/CategoriesDialog.java | 11 +- .../bean/categories/CreateCategoryDialog.java | 2 +- .../bean/categories/DeleteCategoryDialog.java | 4 +- .../bean/categories/EditCategoryDialog.java | 10 +- .../categories/EditNodeCategoriesDialog.java | 9 +- .../web/bean/clipboard/AVMClipboardItem.java | 2 + .../bean/clipboard/AbstractClipboardItem.java | 5 +- .../web/bean/clipboard/ClipboardBean.java | 5 +- .../web/bean/clipboard/ClipboardItem.java | 4 +- .../clipboard/WorkspaceClipboardItem.java | 2 + .../web/bean/coci/CCCheckoutFileDialog.java | 8 +- .../web/bean/coci/CheckinCheckoutDialog.java | 19 +- .../web/bean/content/AddContentDialog.java | 3 +- .../web/bean/content/BaseContentWizard.java | 27 +- .../web/bean/content/CreateContentWizard.java | 4 +- .../web/bean/content/DeleteContentDialog.java | 19 +- .../bean/content/DocumentDetailsDialog.java | 109 +- .../content/DocumentLinkDetailsDialog.java | 5 +- .../content/DocumentPropertiesDialog.java | 55 +- .../content/EditContentPropertiesDialog.java | 26 +- .../web/bean/content/EditContentWizard.java | 8 +- .../content/EditSimpleWorkflowDialog.java | 4 +- .../content/InviteContentUsersWizard.java | 4 +- .../content/SetContentPropertiesDialog.java | 2 + .../VersionedDocumentDetailsDialog.java | 95 +- .../content/ViewContentPropertiesDialog.java | 2 + .../web/bean/dashboard/DashboardManager.java | 15 +- .../web/bean/dashboard/DashboardWizard.java | 2 + .../bean/dashboard/GettingStartedBean.java | 6 +- .../web/bean/dashboard/PageConfig.java | 13 +- .../web/bean/dialog/BaseDialogBean.java | 60 +- .../web/bean/dialog/DialogManager.java | 5 +- .../alfresco/web/bean/dialog/DialogState.java | 6 +- .../alfresco/web/bean/dialog/IDialogBean.java | 3 +- .../bean/forums/CreateDiscussionDialog.java | 16 +- .../web/bean/forums/CreateForumDialog.java | 2 + .../web/bean/forums/CreateForumsDialog.java | 2 + .../web/bean/forums/CreatePostDialog.java | 2 + .../web/bean/forums/CreateReplyDialog.java | 6 +- .../web/bean/forums/CreateTopicDialog.java | 24 +- .../web/bean/forums/DeleteForumDialog.java | 8 +- .../web/bean/forums/DeleteForumsDialog.java | 6 +- .../web/bean/forums/DeletePostDialog.java | 2 + .../web/bean/forums/DeleteTopicDialog.java | 6 +- .../web/bean/forums/EditPostDialog.java | 10 +- .../web/bean/forums/ForumDetailsDialog.java | 5 +- .../alfresco/web/bean/forums/ForumsBean.java | 107 +- .../web/bean/forums/ForumsDetailsDialog.java | 5 +- .../web/bean/forums/TopicDetailsDialog.java | 5 +- .../web/bean/groups/AddUsersDialog.java | 10 +- .../web/bean/groups/GroupsDialog.java | 51 +- .../web/bean/ml/AddTranslationDialog.java | 343 +- .../AddTranslationWithoutContentDialog.java | 26 +- .../web/bean/ml/EditMLContainerDialog.java | 19 +- .../web/bean/ml/MakeMultilingualDialog.java | 39 +- .../web/bean/ml/MultilingualManageDialog.java | 14 +- .../web/bean/ml/MultilingualUtils.java | 7 +- .../web/bean/ml/NewEditionWizard.java | 106 +- .../web/bean/ml/SingleEditionBean.java | 6 +- .../web/bean/preview/BasePreviewBean.java | 397 +- .../web/bean/preview/DocumentPreviewBean.java | 360 +- .../web/bean/preview/SpacePreviewBean.java | 412 +- .../alfresco/web/bean/repository/Node.java | 4 +- .../bean/repository/NodePropertyResolver.java | 4 +- .../web/bean/repository/Preferences.java | 8 +- .../web/bean/repository/QNameNodeMap.java | 15 +- .../alfresco/web/bean/repository/User.java | 524 +- .../web/bean/rules/CreateRuleWizard.java | 44 +- .../web/bean/rules/EditRuleWizard.java | 8 +- .../alfresco/web/bean/rules/RulesDialog.java | 50 +- .../handlers/CompareMimeTypeHandler.java | 2 + .../bean/rules/handlers/HasAspectHandler.java | 2 + .../rules/handlers/InCategoryHandler.java | 2 + .../bean/rules/handlers/IsSubTypeHandler.java | 2 + .../rules/handlers/PropertyValueHandler.java | 2 + .../web/bean/search/AdvancedSearchDialog.java | 36 +- .../web/bean/search/EditSearchDialog.java | 6 +- .../web/bean/search/SaveSearchDialog.java | 2 +- .../bean/spaces/ApplyDocTemplateDialog.java | 4 +- .../bean/spaces/ApplyRssTemplateDialog.java | 4 +- .../bean/spaces/ApplySpaceTemplateDialog.java | 4 +- .../web/bean/spaces/CreateSpaceDialog.java | 3 + .../web/bean/spaces/CreateSpaceWizard.java | 1522 +-- .../web/bean/spaces/DeleteSpaceDialog.java | 24 +- .../bean/spaces/EditSimpleWorkflowDialog.java | 4 +- .../web/bean/spaces/EditSpaceDialog.java | 22 +- .../bean/spaces/InviteSpaceUsersWizard.java | 4 +- .../web/bean/spaces/RecentSpacesBean.java | 2 + .../web/bean/spaces/SpaceDetailsDialog.java | 23 +- .../web/bean/trashcan/TrashcanDialog.java | 60 +- .../web/bean/users/ContentUsersBean.java | 2 + .../web/bean/users/CreateUserWizard.java | 22 +- .../web/bean/users/DeleteUserDialog.java | 2 +- .../web/bean/users/EditUserDetailsDialog.java | 12 +- .../web/bean/users/EditUserWizard.java | 26 +- .../web/bean/users/EmailSpaceUsersDialog.java | 76 +- .../web/bean/users/SpaceUsersBean.java | 2 + .../web/bean/users/UserMembersBean.java | 94 +- .../web/bean/users/UserPreferencesBean.java | 42 +- .../web/bean/users/UserShortcutsBean.java | 32 +- .../alfresco/web/bean/users/UsersDialog.java | 2 + .../alfresco/web/bean/wcm/AVMBrowseBean.java | 120 +- .../alfresco/web/bean/wcm/AVMDetailsBean.java | 35 +- .../alfresco/web/bean/wcm/AVMEditBean.java | 52 +- .../org/alfresco/web/bean/wcm/AVMNode.java | 14 +- .../web/bean/wcm/AddAvmContentDialog.java | 22 +- .../bean/wcm/ChangeExpirationDateDialog.java | 2 + .../web/bean/wcm/CreateFolderDialog.java | 20 +- .../web/bean/wcm/CreateFormWizard.java | 100 +- .../web/bean/wcm/CreateWebContentWizard.java | 298 +- .../web/bean/wcm/CreateWebappDialog.java | 12 +- .../web/bean/wcm/CreateWebsiteWizard.java | 183 +- .../web/bean/wcm/DeleteFileBrowseDialog.java | 2 + .../web/bean/wcm/DeleteFileDialog.java | 41 +- .../bean/wcm/DeleteFolderBrowseDialog.java | 2 + .../web/bean/wcm/DeleteFolderDialog.java | 16 +- .../web/bean/wcm/DeleteSandboxDialog.java | 41 +- .../web/bean/wcm/DeleteWebsiteDialog.java | 22 +- .../web/bean/wcm/DeploySnapshotDialog.java | 42 +- .../web/bean/wcm/DeploymentMonitor.java | 4 +- .../web/bean/wcm/DeploymentProgressBean.java | 5 +- .../web/bean/wcm/EditAvmFileDialog.java | 286 +- .../bean/wcm/EditFilePropertiesDialog.java | 56 +- .../bean/wcm/EditFolderPropertiesDialog.java | 35 +- .../alfresco/web/bean/wcm/EditFormWizard.java | 42 +- .../web/bean/wcm/EditWebContentWizard.java | 498 +- .../web/bean/wcm/EditWebsiteWizard.java | 24 +- .../web/bean/wcm/FileDetailsBean.java | 25 +- .../alfresco/web/bean/wcm/FilePickerBean.java | 809 +- .../web/bean/wcm/FolderDetailsBean.java | 2 + .../web/bean/wcm/FormDetailsDialog.java | 29 +- .../web/bean/wcm/FormTemplatesDialog.java | 18 +- .../web/bean/wcm/FormWorkflowDialog.java | 20 +- .../web/bean/wcm/ImportWebsiteDialog.java | 89 +- .../bean/wcm/InviteWebsiteUsersWizard.java | 22 +- .../web/bean/wcm/LinkValidationDialog.java | 38 +- .../bean/wcm/LinkValidationProgressBean.java | 5 +- .../web/bean/wcm/LinkValidationState.java | 5 +- .../wcm/ManageChangeRequestTaskDialog.java | 37 +- .../wcm/ManageLinkValidationTaskDialog.java | 4 +- .../web/bean/wcm/MonitorDeploymentDialog.java | 2 + .../web/bean/wcm/PromptForWebFormDialog.java | 495 +- .../bean/wcm/RegenerateRenditionsWizard.java | 92 +- .../web/bean/wcm/RevertAllDialog.java | 48 +- .../web/bean/wcm/RevertSelectedDialog.java | 19 +- .../alfresco/web/bean/wcm/SandboxInfo.java | 110 +- .../web/bean/wcm/SnapshotSandboxDialog.java | 18 +- .../wcm/SubmitConfigureWorkflowDialog.java | 2 + .../alfresco/web/bean/wcm/SubmitDialog.java | 134 +- .../bean/wcm/ViewDeploymentReportDialog.java | 2 + .../org/alfresco/web/bean/wcm/WebProject.java | 14 +- .../web/bean/wcm/WebSiteDetailsDialog.java | 5 +- .../web/bean/wcm/WorkflowConfiguration.java | 2 +- .../web/bean/wizard/AbstractWizardBean.java | 33 +- .../bean/wizard/BaseInviteUsersWizard.java | 111 +- .../web/bean/wizard/NewUserWizard.java | 2090 +-- .../web/bean/wizard/WizardManager.java | 5 +- .../alfresco/web/bean/wizard/WizardState.java | 5 +- .../bean/workflow/CancelWorkflowDialog.java | 45 +- .../web/bean/workflow/ManageTaskDialog.java | 145 +- .../web/bean/workflow/ReassignTaskDialog.java | 38 +- .../bean/workflow/ReassignWorkItemDialog.java | 38 +- .../bean/workflow/StartWorkflowWizard.java | 110 +- .../workflow/ViewCompletedTaskDialog.java | 4 +- .../web/bean/workflow/WorkflowBean.java | 37 +- .../bean/workflow/WorkflowConsoleBean.java | 28 +- .../config/AdvancedSearchConfigElement.java | 5 +- .../web/config/ClientConfigElement.java | 2 + .../web/config/DashboardsConfigElement.java | 9 +- .../web/config/DialogsConfigElement.java | 11 +- .../web/config/SidebarConfigElement.java | 9 +- .../web/config/ViewsConfigElement.java | 5 +- .../web/config/WizardsConfigElement.java | 29 +- .../java/org/alfresco/web/forms/FormImpl.java | 19 +- .../alfresco/web/forms/FormInstanceData.java | 230 +- .../web/forms/FormInstanceDataImpl.java | 22 +- .../org/alfresco/web/forms/FormProcessor.java | 230 +- .../org/alfresco/web/forms/FormsService.java | 24 +- .../org/alfresco/web/forms/FormsTest.java | 608 +- .../forms/RenderingEngineTemplateImpl.java | 18 +- .../org/alfresco/web/forms/RenditionImpl.java | 528 +- .../web/forms/xforms/Schema2XForms.java | 3 +- .../alfresco/web/forms/xforms/XFormsBean.java | 86 +- .../web/forms/xforms/XFormsProcessor.java | 34 +- .../ui/common/component/UIGenericPicker.java | 4 +- .../web/ui/common/component/UIListItem.java | 6 +- .../web/ui/common/component/UIPanel.java | 5 +- .../ui/common/component/UIStatusMessage.java | 6 +- .../common/component/data/IGridDataModel.java | 4 +- .../ui/common/component/data/UIRichList.java | 5 +- .../component/description/UIDescription.java | 6 +- .../renderer/data/IRichListRenderer.java | 3 +- .../renderer/data/RichListRenderer.java | 7 + .../web/ui/repo/component/UITree.java | 6 +- .../component/shelf/UIClipboardShelfItem.java | 4 +- .../shelf/UIRecentSpacesShelfItem.java | 4 +- .../web/ui/repo/component/shelf/UIShelf.java | 4 +- .../component/shelf/UIShortcutsShelfItem.java | 8 +- .../web/ui/wcm/component/UIUserSandboxes.java | 7 +- source/web/WEB-INF/faces-config-beans.xml | 11118 ++++++++-------- 281 files changed, 17771 insertions(+), 15322 deletions(-) diff --git a/source/java/org/alfresco/web/action/ActionEvaluator.java b/source/java/org/alfresco/web/action/ActionEvaluator.java index 01f7a375be..094885206e 100644 --- a/source/java/org/alfresco/web/action/ActionEvaluator.java +++ b/source/java/org/alfresco/web/action/ActionEvaluator.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.action; +import java.io.Serializable; + import org.alfresco.web.bean.repository.Node; /** @@ -36,7 +38,7 @@ import org.alfresco.web.bean.repository.Node; * * @author Kevin Roast */ -public interface ActionEvaluator +public interface ActionEvaluator extends Serializable { /** * The evaluator should decide if the action precondition is valid based on the appropriate diff --git a/source/java/org/alfresco/web/action/evaluator/AddTranslationEvaluator.java b/source/java/org/alfresco/web/action/evaluator/AddTranslationEvaluator.java index 92d08cf438..7cce8aed56 100644 --- a/source/java/org/alfresco/web/action/evaluator/AddTranslationEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/AddTranslationEvaluator.java @@ -1,90 +1,92 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.web.action.evaluator; - -import javax.faces.context.FacesContext; - -import org.alfresco.model.ContentModel; -import org.alfresco.service.cmr.ml.MultilingualContentService; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.bean.users.UserPreferencesBean; -import org.alfresco.web.bean.ml.MultilingualUtils; -import org.alfresco.web.bean.repository.Node; - -/** - * Evaluates whether the Add Translation (with or without content) action should be visible. - * - * If the node is not already Multilingual, locked, or if a translation exists for each available - * filter language, don't allow the action. - * - * The current user can add a translation to a translation set only if he has enough right to add - * a content to the space where the pivot translation is located in. - * - * @author Yannick Pignot - */ -public class AddTranslationEvaluator extends BaseActionEvaluator -{ - /** - * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) - */ - public boolean evaluate(Node node) - { - boolean isNodeMultililingal = node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT); - boolean isMLContainer = node.getType().equals(ContentModel.TYPE_MULTILINGUAL_CONTAINER); - - // the node must be multiligual (translation or ml container) - if(isNodeMultililingal || isMLContainer) - { - FacesContext fc = FacesContext.getCurrentInstance(); - - // the current user must have enough right to add a content to the space - // where the pivot translation is located in - if(MultilingualUtils.canAddChildrenToPivotSpace(node, fc)) - { - MultilingualContentService mlservice = - (MultilingualContentService) FacesHelper.getManagedBean(fc, "MultilingualContentService"); - - UserPreferencesBean userprefs = - (UserPreferencesBean) FacesHelper.getManagedBean(fc, "UserPreferencesBean"); - - // the number of translation of this document - int availableTranslationCount = mlservice.getTranslations(node.getNodeRef()).size(); - // the total number of available languages for the translation - int contentFilterLanguagesCount = userprefs.getContentFilterLanguages(false).length; - - // the number of translation must be < to the total number of available language for the content filter - return (availableTranslationCount < contentFilterLanguagesCount); - } - else - { - return false; - } - } - else - { - return false; - } - } +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.action.evaluator; + +import javax.faces.context.FacesContext; + +import org.alfresco.model.ContentModel; +import org.alfresco.service.cmr.ml.MultilingualContentService; +import org.alfresco.web.app.servlet.FacesHelper; +import org.alfresco.web.bean.users.UserPreferencesBean; +import org.alfresco.web.bean.ml.MultilingualUtils; +import org.alfresco.web.bean.repository.Node; + +/** + * Evaluates whether the Add Translation (with or without content) action should be visible. + * + * If the node is not already Multilingual, locked, or if a translation exists for each available + * filter language, don't allow the action. + * + * The current user can add a translation to a translation set only if he has enough right to add + * a content to the space where the pivot translation is located in. + * + * @author Yannick Pignot + */ +public class AddTranslationEvaluator extends BaseActionEvaluator +{ + private static final long serialVersionUID = -1513219397606505237L; + + /** + * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) + */ + public boolean evaluate(Node node) + { + boolean isNodeMultililingal = node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT); + boolean isMLContainer = node.getType().equals(ContentModel.TYPE_MULTILINGUAL_CONTAINER); + + // the node must be multiligual (translation or ml container) + if(isNodeMultililingal || isMLContainer) + { + FacesContext fc = FacesContext.getCurrentInstance(); + + // the current user must have enough right to add a content to the space + // where the pivot translation is located in + if(MultilingualUtils.canAddChildrenToPivotSpace(node, fc)) + { + MultilingualContentService mlservice = + (MultilingualContentService) FacesHelper.getManagedBean(fc, "MultilingualContentService"); + + UserPreferencesBean userprefs = + (UserPreferencesBean) FacesHelper.getManagedBean(fc, "UserPreferencesBean"); + + // the number of translation of this document + int availableTranslationCount = mlservice.getTranslations(node.getNodeRef()).size(); + // the total number of available languages for the translation + int contentFilterLanguagesCount = userprefs.getContentFilterLanguages(false).length; + + // the number of translation must be < to the total number of available language for the content filter + return (availableTranslationCount < contentFilterLanguagesCount); + } + else + { + return false; + } + } + else + { + return false; + } + } } \ No newline at end of file diff --git a/source/java/org/alfresco/web/action/evaluator/ApproveDocEvaluator.java b/source/java/org/alfresco/web/action/evaluator/ApproveDocEvaluator.java index 0924d66286..a2d8c2c445 100644 --- a/source/java/org/alfresco/web/action/evaluator/ApproveDocEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/ApproveDocEvaluator.java @@ -33,6 +33,8 @@ import org.alfresco.web.bean.repository.Node; */ public class ApproveDocEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = 2958297435415449179L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/ApproveNonDraftDocEvaluator.java b/source/java/org/alfresco/web/action/evaluator/ApproveNonDraftDocEvaluator.java index cd812cb321..5f50591577 100644 --- a/source/java/org/alfresco/web/action/evaluator/ApproveNonDraftDocEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/ApproveNonDraftDocEvaluator.java @@ -34,6 +34,8 @@ import org.alfresco.web.bean.repository.Node; */ public class ApproveNonDraftDocEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = -277600395385704689L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/CancelCheckoutDocEvaluator.java b/source/java/org/alfresco/web/action/evaluator/CancelCheckoutDocEvaluator.java index ad09aaf0f8..4895b83ee9 100644 --- a/source/java/org/alfresco/web/action/evaluator/CancelCheckoutDocEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/CancelCheckoutDocEvaluator.java @@ -35,6 +35,8 @@ import org.alfresco.web.bean.repository.Node; */ public class CancelCheckoutDocEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = -9015403093449070254L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/CancelWorkflowEvaluator.java b/source/java/org/alfresco/web/action/evaluator/CancelWorkflowEvaluator.java index b4df9de8d3..170abb5d52 100644 --- a/source/java/org/alfresco/web/action/evaluator/CancelWorkflowEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/CancelWorkflowEvaluator.java @@ -45,6 +45,8 @@ import org.alfresco.web.bean.repository.User; */ public class CancelWorkflowEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = 7663087149225546333L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/CheckinDocEvaluator.java b/source/java/org/alfresco/web/action/evaluator/CheckinDocEvaluator.java index 5abc310bed..f468fec736 100644 --- a/source/java/org/alfresco/web/action/evaluator/CheckinDocEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/CheckinDocEvaluator.java @@ -35,6 +35,8 @@ import org.alfresco.web.bean.repository.Node; */ public class CheckinDocEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = 5398249535631219663L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/CheckoutDocEvaluator.java b/source/java/org/alfresco/web/action/evaluator/CheckoutDocEvaluator.java index f46ab6b2ae..c76ebda474 100644 --- a/source/java/org/alfresco/web/action/evaluator/CheckoutDocEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/CheckoutDocEvaluator.java @@ -39,6 +39,8 @@ import org.alfresco.web.bean.repository.Repository; */ public class CheckoutDocEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = 5510366635124591353L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/CreateFormEvaluator.java b/source/java/org/alfresco/web/action/evaluator/CreateFormEvaluator.java index 0b15b6d4f7..25afe84c24 100644 --- a/source/java/org/alfresco/web/action/evaluator/CreateFormEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/CreateFormEvaluator.java @@ -42,6 +42,8 @@ import org.alfresco.web.bean.repository.Repository; */ public class CreateFormEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = 4475319627518524432L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/CreateForumNodeEvaluator.java b/source/java/org/alfresco/web/action/evaluator/CreateForumNodeEvaluator.java index 30ddfa8e04..13201bfd05 100644 --- a/source/java/org/alfresco/web/action/evaluator/CreateForumNodeEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/CreateForumNodeEvaluator.java @@ -34,6 +34,8 @@ import org.alfresco.web.bean.repository.Node; */ public class CreateForumNodeEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = -5132048668011887505L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/CreateWebProjectEvaluator.java b/source/java/org/alfresco/web/action/evaluator/CreateWebProjectEvaluator.java index 0d29099737..a2f1e637e5 100644 --- a/source/java/org/alfresco/web/action/evaluator/CreateWebProjectEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/CreateWebProjectEvaluator.java @@ -42,6 +42,8 @@ import org.alfresco.web.bean.repository.Repository; */ public class CreateWebProjectEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = 9061864145360361349L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/CutNodeEvaluator.java b/source/java/org/alfresco/web/action/evaluator/CutNodeEvaluator.java index a3f8f26792..05b8981962 100644 --- a/source/java/org/alfresco/web/action/evaluator/CutNodeEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/CutNodeEvaluator.java @@ -46,6 +46,8 @@ import org.alfresco.web.bean.repository.Node; */ public class CutNodeEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = 5162681242056158214L; + public boolean evaluate(Node node) { diff --git a/source/java/org/alfresco/web/action/evaluator/DeleteDocEvaluator.java b/source/java/org/alfresco/web/action/evaluator/DeleteDocEvaluator.java index e1cd7ec65f..adb00c3b8f 100644 --- a/source/java/org/alfresco/web/action/evaluator/DeleteDocEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/DeleteDocEvaluator.java @@ -39,6 +39,8 @@ import org.alfresco.web.bean.repository.Node; */ public class DeleteDocEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = 5742287199692844685L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/DiscussNodeEvaluator.java b/source/java/org/alfresco/web/action/evaluator/DiscussNodeEvaluator.java index a22744f1c1..e1f9e55fe4 100644 --- a/source/java/org/alfresco/web/action/evaluator/DiscussNodeEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/DiscussNodeEvaluator.java @@ -42,6 +42,8 @@ import org.alfresco.web.bean.repository.Repository; */ public class DiscussNodeEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = 8754174908349998903L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/DiscussionCopyEvaluator.java b/source/java/org/alfresco/web/action/evaluator/DiscussionCopyEvaluator.java index f574e0ce96..9400d56bb9 100644 --- a/source/java/org/alfresco/web/action/evaluator/DiscussionCopyEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/DiscussionCopyEvaluator.java @@ -43,6 +43,8 @@ import org.alfresco.web.bean.repository.Repository; */ public class DiscussionCopyEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = -4080878553011296677L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/DiscussionCutEvaluator.java b/source/java/org/alfresco/web/action/evaluator/DiscussionCutEvaluator.java index b0118ba3e4..0ec49f9a5c 100644 --- a/source/java/org/alfresco/web/action/evaluator/DiscussionCutEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/DiscussionCutEvaluator.java @@ -42,6 +42,8 @@ import org.alfresco.web.bean.repository.Repository; */ public class DiscussionCutEvaluator extends CutNodeEvaluator { + private static final long serialVersionUID = 7260556874788184200L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/EditDocCIFSEvaluator.java b/source/java/org/alfresco/web/action/evaluator/EditDocCIFSEvaluator.java index 99f136d7a7..8ee1031a7a 100644 --- a/source/java/org/alfresco/web/action/evaluator/EditDocCIFSEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/EditDocCIFSEvaluator.java @@ -41,6 +41,8 @@ import org.alfresco.web.bean.repository.Repository; */ public class EditDocCIFSEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = -8988276140748731926L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/EditDocHttpEvaluator.java b/source/java/org/alfresco/web/action/evaluator/EditDocHttpEvaluator.java index f845377ac3..596979fb82 100644 --- a/source/java/org/alfresco/web/action/evaluator/EditDocHttpEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/EditDocHttpEvaluator.java @@ -41,6 +41,8 @@ import org.alfresco.web.bean.repository.Repository; */ public class EditDocHttpEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = -3694679925715830430L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/EditDocWebDavEvaluator.java b/source/java/org/alfresco/web/action/evaluator/EditDocWebDavEvaluator.java index 51cc7dba17..e72939ad0a 100644 --- a/source/java/org/alfresco/web/action/evaluator/EditDocWebDavEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/EditDocWebDavEvaluator.java @@ -41,6 +41,8 @@ import org.alfresco.web.bean.repository.Repository; */ public class EditDocWebDavEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = 293342561997588700L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/EditFormEvaluator.java b/source/java/org/alfresco/web/action/evaluator/EditFormEvaluator.java index ab7712d957..ca14c667ed 100644 --- a/source/java/org/alfresco/web/action/evaluator/EditFormEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/EditFormEvaluator.java @@ -40,6 +40,8 @@ import org.alfresco.web.bean.repository.Repository; */ public class EditFormEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = -509493291648778510L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/ForumsCheckinDocEvaluator.java b/source/java/org/alfresco/web/action/evaluator/ForumsCheckinDocEvaluator.java index 01727f7c8b..06834ced06 100644 --- a/source/java/org/alfresco/web/action/evaluator/ForumsCheckinDocEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/ForumsCheckinDocEvaluator.java @@ -41,6 +41,8 @@ import org.alfresco.web.bean.repository.Repository; */ public class ForumsCheckinDocEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = -924897450989526336L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/MakeMultilingualEvaluator.java b/source/java/org/alfresco/web/action/evaluator/MakeMultilingualEvaluator.java index 0f0e8095fb..d0c40e9e7f 100644 --- a/source/java/org/alfresco/web/action/evaluator/MakeMultilingualEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/MakeMultilingualEvaluator.java @@ -40,6 +40,8 @@ import org.alfresco.web.bean.repository.Node; */ public class MakeMultilingualEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = 4417014487557744219L; + public boolean evaluate(Node node) { FacesContext fc = FacesContext.getCurrentInstance(); diff --git a/source/java/org/alfresco/web/action/evaluator/MultilingualDetailsEvaluator.java b/source/java/org/alfresco/web/action/evaluator/MultilingualDetailsEvaluator.java index 24b609db44..ffe67865cd 100644 --- a/source/java/org/alfresco/web/action/evaluator/MultilingualDetailsEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/MultilingualDetailsEvaluator.java @@ -36,6 +36,8 @@ import org.alfresco.web.bean.repository.Node; */ public class MultilingualDetailsEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = 1154993208046462796L; + public boolean evaluate(Node node) { return (node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT) == true); diff --git a/source/java/org/alfresco/web/action/evaluator/NewEditionEvaluator.java b/source/java/org/alfresco/web/action/evaluator/NewEditionEvaluator.java index d3872d8a39..2ce194415c 100644 --- a/source/java/org/alfresco/web/action/evaluator/NewEditionEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/NewEditionEvaluator.java @@ -39,6 +39,8 @@ import org.alfresco.web.bean.repository.Node; */ public class NewEditionEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = -7511956951071280506L; + public boolean evaluate(Node node) { FacesContext fc = FacesContext.getCurrentInstance(); diff --git a/source/java/org/alfresco/web/action/evaluator/RegenerateRenditionsEvaluator.java b/source/java/org/alfresco/web/action/evaluator/RegenerateRenditionsEvaluator.java index 3eb419899e..153dc8e2fb 100644 --- a/source/java/org/alfresco/web/action/evaluator/RegenerateRenditionsEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/RegenerateRenditionsEvaluator.java @@ -43,6 +43,8 @@ import org.alfresco.web.bean.repository.Repository; */ public class RegenerateRenditionsEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = -3479861093052578775L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/RejectDocEvaluator.java b/source/java/org/alfresco/web/action/evaluator/RejectDocEvaluator.java index 1f4fd91be0..ca0c4278b1 100644 --- a/source/java/org/alfresco/web/action/evaluator/RejectDocEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/RejectDocEvaluator.java @@ -33,6 +33,8 @@ import org.alfresco.web.bean.repository.Node; */ public class RejectDocEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = -7733947744617999298L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/RejectNonDraftDocEvaluator.java b/source/java/org/alfresco/web/action/evaluator/RejectNonDraftDocEvaluator.java index cdcf384ff6..2e5f2ce12e 100644 --- a/source/java/org/alfresco/web/action/evaluator/RejectNonDraftDocEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/RejectNonDraftDocEvaluator.java @@ -34,6 +34,8 @@ import org.alfresco.web.bean.repository.Node; */ public class RejectNonDraftDocEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = 6296671033469500696L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/ShortcutNodeEvaluator.java b/source/java/org/alfresco/web/action/evaluator/ShortcutNodeEvaluator.java index 757ef126ca..25cc3df832 100644 --- a/source/java/org/alfresco/web/action/evaluator/ShortcutNodeEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/ShortcutNodeEvaluator.java @@ -37,6 +37,8 @@ import org.alfresco.web.bean.repository.Node; */ public class ShortcutNodeEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = 8768692540125721144L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/StartWorkflowEvaluator.java b/source/java/org/alfresco/web/action/evaluator/StartWorkflowEvaluator.java index 3bc06f9ab1..b6c62a2ecc 100644 --- a/source/java/org/alfresco/web/action/evaluator/StartWorkflowEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/StartWorkflowEvaluator.java @@ -38,6 +38,8 @@ import org.alfresco.web.bean.repository.Node; */ public class StartWorkflowEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = 3110333488835027710L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/TakeOwnershipDocEvaluator.java b/source/java/org/alfresco/web/action/evaluator/TakeOwnershipDocEvaluator.java index 5bc6e1e664..6164ba7442 100644 --- a/source/java/org/alfresco/web/action/evaluator/TakeOwnershipDocEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/TakeOwnershipDocEvaluator.java @@ -33,6 +33,8 @@ import org.alfresco.web.bean.repository.Node; */ public class TakeOwnershipDocEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = 3966463533922521230L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/UnlockDocEvaluator.java b/source/java/org/alfresco/web/action/evaluator/UnlockDocEvaluator.java index a17d03734d..b4e5e2e0ca 100644 --- a/source/java/org/alfresco/web/action/evaluator/UnlockDocEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/UnlockDocEvaluator.java @@ -33,6 +33,8 @@ import org.alfresco.web.bean.repository.Node; */ public class UnlockDocEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = -7056759932698306087L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/UpdateDocEvaluator.java b/source/java/org/alfresco/web/action/evaluator/UpdateDocEvaluator.java index 55eabad4a8..2ff48dafbe 100644 --- a/source/java/org/alfresco/web/action/evaluator/UpdateDocEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/UpdateDocEvaluator.java @@ -38,6 +38,8 @@ import org.alfresco.web.bean.repository.Repository; */ public class UpdateDocEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = 6030963610213633893L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/WCMLockEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMLockEvaluator.java index 22c95ce8fb..a6bfac46cf 100644 --- a/source/java/org/alfresco/web/action/evaluator/WCMLockEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/WCMLockEvaluator.java @@ -43,6 +43,8 @@ import org.alfresco.web.bean.wcm.WebProject; */ public class WCMLockEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = -816856825850017138L; + /** * @return true if the item is not locked by another user */ diff --git a/source/java/org/alfresco/web/action/evaluator/WCMStagingReadonlyEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMStagingReadonlyEvaluator.java index 57f321387a..9835407838 100644 --- a/source/java/org/alfresco/web/action/evaluator/WCMStagingReadonlyEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/WCMStagingReadonlyEvaluator.java @@ -35,6 +35,8 @@ import org.alfresco.web.bean.wcm.AVMUtil; */ public class WCMStagingReadonlyEvaluator extends BaseActionEvaluator { + private static final long serialVersionUID = 2588681368739253602L; + /** * @return true if the item is not locked by another user */ diff --git a/source/java/org/alfresco/web/action/evaluator/WCMWorkflowDeletedEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMWorkflowDeletedEvaluator.java index df87a52bf8..e42b2de882 100644 --- a/source/java/org/alfresco/web/action/evaluator/WCMWorkflowDeletedEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/WCMWorkflowDeletedEvaluator.java @@ -41,6 +41,8 @@ import org.alfresco.web.bean.wcm.AVMUtil; */ public class WCMWorkflowDeletedEvaluator extends WCMLockEvaluator { + private static final long serialVersionUID = -4341942166433855200L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/action/evaluator/WCMWorkflowEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMWorkflowEvaluator.java index 72ab39905f..d6bf4e3aa1 100644 --- a/source/java/org/alfresco/web/action/evaluator/WCMWorkflowEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/WCMWorkflowEvaluator.java @@ -41,6 +41,8 @@ import org.alfresco.web.bean.wcm.AVMUtil; */ public class WCMWorkflowEvaluator extends WCMLockEvaluator { + private static final long serialVersionUID = -5847066921917855781L; + /** * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) */ diff --git a/source/java/org/alfresco/web/app/ResourceBundleWrapper.java b/source/java/org/alfresco/web/app/ResourceBundleWrapper.java index 1188c8add1..03cdb7ebb9 100644 --- a/source/java/org/alfresco/web/app/ResourceBundleWrapper.java +++ b/source/java/org/alfresco/web/app/ResourceBundleWrapper.java @@ -1,254 +1,280 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.web.app; - -import java.util.Enumeration; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import java.util.Vector; - -import javax.servlet.ServletContext; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.repo.i18n.MessageService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.web.bean.repository.Repository; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.web.context.support.WebApplicationContextUtils; - - -/** - * Wrapper around Alfresco Resource Bundle objects. Used to catch and handle missing - * resource exception to help identify missing I18N strings in client apps. - * Also used to look for the requested string in a custom resource bundle. - * - * @author Kevin Roast - */ -public final class ResourceBundleWrapper extends ResourceBundle -{ - private static Log logger = LogFactory.getLog(ResourceBundleWrapper.class); - - private ResourceBundle delegate; - private ResourceBundle delegateCustom; - - private MessageService messageService; - - public static final String BEAN_RESOURCE_BUNDLE_WRAPPER = "resourceBundleWrapper"; - - public static final String PATH = "app:company_home/app:dictionary/app:webclient_extension"; - - public ResourceBundleWrapper(MessageService messageService) - { - this.messageService = messageService; - } - - // Helper to get the ResourceBundleWrapper instance with access to the repository - public static ResourceBundleWrapper getResourceBundleWrapper(ServletContext context) - { - return (ResourceBundleWrapper)WebApplicationContextUtils.getRequiredWebApplicationContext(context).getBean( - BEAN_RESOURCE_BUNDLE_WRAPPER); - } - - /** - * Constructor - * - * @param bundle The ResourceBundle to route calls too - * @param customBundle A custom version of bundle to look in if the string is - * not found in bundle - */ - private ResourceBundleWrapper(ResourceBundle bundle, ResourceBundle customBundle) - { - this.delegate = bundle; - this.delegateCustom = customBundle; - } - - /** - * @see java.util.ResourceBundle#getKeys() - */ - public Enumeration getKeys() - { - if (this.delegateCustom == null) - { - return this.delegate.getKeys(); - } - else - { - // get existing keys - Enumeration keys = this.delegate.getKeys(); - Enumeration customKeys = this.delegateCustom.getKeys(); - - // combine keys into one list - Vector allKeys = new Vector(100, 2); - while (keys.hasMoreElements()) - { - allKeys.add(keys.nextElement()); - } - while (customKeys.hasMoreElements()) - { - allKeys.add(customKeys.nextElement()); - } - - return allKeys.elements(); - } - } - - /** - * @see java.util.ResourceBundle#handleGetObject(java.lang.String) - */ - protected Object handleGetObject(String key) - { - Object result = null; - - try - { - result = this.delegate.getObject(key); - } - catch (MissingResourceException err) - { - // if the string wasn't found in the normal bundle - // try the custom bundle if there is one - try - { - if (this.delegateCustom != null) - { - result = this.delegateCustom.getObject(key); - } - } - catch (MissingResourceException mre) - { - // don't do anything here, dealt with below - } - - // if the key was not found return a default string - if (result == null) - { - if (logger.isWarnEnabled()) - logger.warn("Failed to find I18N message string key: " + key); - - result = "$$" + key + "$$"; - } - } - - return result; - } - - /** - * Factory method to get a named wrapped resource bundle for a particular locale. - * - * @param name Bundle name - * @param locale Locale to retrieve bundle for - * - * @return Wrapped ResourceBundle instance for specified locale - */ - public ResourceBundle getResourceBundle(String name, Locale locale) - { - ResourceBundle bundle = ResourceBundle.getBundle(name, locale); - if (bundle == null) - { - throw new AlfrescoRuntimeException("Unable to load Alfresco messages bundle: " + name); - } - - // also look up the custom version of the bundle in the extension package - ResourceBundle customBundle = null; - - // first try in the repo otherwise try the classpath - StoreRef storeRef = null; - String path = null; - - try - { - String customName = null; - int idx = name.lastIndexOf("."); - if (idx != -1) - { - customName = name.substring(idx+1, name.length()); - } - else - { - customName = name; - } - - storeRef = Repository.getStoreRef(); - - // TODO - make path configurable in one place ... - // Note: path here is XPath for selectNodes query - path = PATH + "/cm:" + customName; - customBundle = messageService.getRepoResourceBundle(Repository.getStoreRef(), path, locale); - } - catch (Throwable t) - { - // for now ... ignore the error, cannot be found or read from repo - logger.debug("Custom Web Client properties not found: " + storeRef + path); - } - - if (customBundle == null) - { - // classpath - String customName = determineCustomBundleName(name); - try - { - customBundle = ResourceBundle.getBundle(customName, locale); - - if (logger.isDebugEnabled()) - logger.debug("Located and loaded custom bundle: " + customName); - } - catch (MissingResourceException mre) - { - // ignore the error, just leave custom bundle as null - } - } - - // apply our wrapper to catch MissingResourceException - return new ResourceBundleWrapper(bundle, customBundle); - } - - /** - * Determines the name for the custom bundle to lookup based on the given - * bundle name - * - * @param bundleName The standard bundle - * @return The name of the custom bundle (in the alfresco.extension package) - */ - protected static String determineCustomBundleName(String bundleName) - { - String extensionPackage = "alfresco.extension."; - String customBundleName = null; - - int idx = bundleName.lastIndexOf("."); - if (idx == -1) - { - customBundleName = extensionPackage + bundleName; - } - else - { - customBundleName = extensionPackage + - bundleName.substring(idx+1, bundleName.length()); - } - - return customBundleName; - } -} +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.app; + +import java.io.Serializable; +import java.util.Enumeration; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; +import java.util.Vector; + +import javax.servlet.ServletContext; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.repo.i18n.MessageService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.web.bean.repository.Repository; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.web.context.support.WebApplicationContextUtils; + + +/** + * Wrapper around Alfresco Resource Bundle objects. Used to catch and handle missing + * resource exception to help identify missing I18N strings in client apps. + * Also used to look for the requested string in a custom resource bundle. + * + * @author Kevin Roast + */ +public final class ResourceBundleWrapper extends ResourceBundle implements Serializable +{ + private static final long serialVersionUID = -3230653664902689948L; + + private static Log logger = LogFactory.getLog(ResourceBundleWrapper.class); + + private String name; + private Locale locale; + + transient private ResourceBundle delegate; + transient private ResourceBundle delegateCustom; + + private MessageService messageService; + + public static final String BEAN_RESOURCE_BUNDLE_WRAPPER = "resourceBundleWrapper"; + + public static final String PATH = "app:company_home/app:dictionary/app:webclient_extension"; + + public ResourceBundleWrapper(MessageService messageService) + { + this.messageService = messageService; + } + + // Helper to get the ResourceBundleWrapper instance with access to the repository + public static ResourceBundleWrapper getResourceBundleWrapper(ServletContext context) + { + return (ResourceBundleWrapper)WebApplicationContextUtils.getRequiredWebApplicationContext(context).getBean( + BEAN_RESOURCE_BUNDLE_WRAPPER); + } + + /** + * Constructor + * + * @param bundle The ResourceBundle to route calls too + * @param customBundle A custom version of bundle to look in if the string is + * not found in bundle + */ + private ResourceBundleWrapper(String name, Locale locale) + { + this.name = name; + this.locale = locale; + retreiveBundles(); + } + + private void retreiveBundles() + { + ResourceBundle bundle = ResourceBundle.getBundle(name, locale); + if (bundle == null) + { + throw new AlfrescoRuntimeException("Unable to load Alfresco messages bundle: " + name); + } + + // also look up the custom version of the bundle in the extension package + ResourceBundle customBundle = null; + + // first try in the repo otherwise try the classpath + StoreRef storeRef = null; + String path = null; + + try + { + String customName = null; + int idx = name.lastIndexOf("."); + if (idx != -1) + { + customName = name.substring(idx+1, name.length()); + } + else + { + customName = name; + } + + storeRef = Repository.getStoreRef(); + + // TODO - make path configurable in one place ... + // Note: path here is XPath for selectNodes query + path = PATH + "/cm:" + customName; + customBundle = messageService.getRepoResourceBundle(Repository.getStoreRef(), path, locale); + } + catch (Throwable t) + { + // for now ... ignore the error, cannot be found or read from repo + logger.debug("Custom Web Client properties not found: " + storeRef + path); + } + + if (customBundle == null) + { + // classpath + String customName = determineCustomBundleName(name); + try + { + customBundle = ResourceBundle.getBundle(customName, locale); + + if (logger.isDebugEnabled()) + logger.debug("Located and loaded custom bundle: " + customName); + } + catch (MissingResourceException mre) + { + // ignore the error, just leave custom bundle as null + } + } + + this.delegate = bundle; + this.delegateCustom = customBundle; + } + + /** + * @see java.util.ResourceBundle#getKeys() + */ + public Enumeration getKeys() + { + if (this.delegate == null) + { + // restore if the session was [de]serialised - as bundles themselves are not serialised + retreiveBundles(); + } + + if (this.delegateCustom == null) + { + return this.delegate.getKeys(); + } + else + { + // get existing keys + Enumeration keys = this.delegate.getKeys(); + Enumeration customKeys = this.delegateCustom.getKeys(); + + // combine keys into one list + Vector allKeys = new Vector(100, 2); + while (keys.hasMoreElements()) + { + allKeys.add(keys.nextElement()); + } + while (customKeys.hasMoreElements()) + { + allKeys.add(customKeys.nextElement()); + } + + return allKeys.elements(); + } + } + + /** + * @see java.util.ResourceBundle#handleGetObject(java.lang.String) + */ + protected Object handleGetObject(String key) + { + Object result = null; + + if (this.delegate == null) + { + // restore if the session was [de]serialised - as bundles themselves are not serialised + retreiveBundles(); + } + + try + { + result = this.delegate.getObject(key); + } + catch (MissingResourceException err) + { + // if the string wasn't found in the normal bundle + // try the custom bundle if there is one + try + { + if (this.delegateCustom != null) + { + result = this.delegateCustom.getObject(key); + } + } + catch (MissingResourceException mre) + { + // don't do anything here, dealt with below + } + + // if the key was not found return a default string + if (result == null) + { + if (logger.isWarnEnabled()) + logger.warn("Failed to find I18N message string key: " + key); + + result = "$$" + key + "$$"; + } + } + + return result; + } + + /** + * Factory method to get a named wrapped resource bundle for a particular locale. + * + * @param name Bundle name + * @param locale Locale to retrieve bundle for + * + * @return Wrapped ResourceBundle instance for specified locale + */ + public static ResourceBundle getResourceBundle(String name, Locale locale) + { + // apply our wrapper to catch MissingResourceException + return new ResourceBundleWrapper(name, locale); + } + + /** + * Determines the name for the custom bundle to lookup based on the given + * bundle name + * + * @param bundleName The standard bundle + * @return The name of the custom bundle (in the alfresco.extension package) + */ + protected static String determineCustomBundleName(String bundleName) + { + String extensionPackage = "alfresco.extension."; + String customBundleName = null; + + int idx = bundleName.lastIndexOf("."); + if (idx == -1) + { + customBundleName = extensionPackage + bundleName; + } + else + { + customBundleName = extensionPackage + + bundleName.substring(idx+1, bundleName.length()); + } + + return customBundleName; + } + +} diff --git a/source/java/org/alfresco/web/app/context/IContextListener.java b/source/java/org/alfresco/web/app/context/IContextListener.java index 4f8fe629e9..6f911de780 100644 --- a/source/java/org/alfresco/web/app/context/IContextListener.java +++ b/source/java/org/alfresco/web/app/context/IContextListener.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.app.context; +import java.io.Serializable; + /** * Interface used to allow Beans to register themselves as interested in UI context events. *

@@ -36,7 +38,7 @@ package org.alfresco.web.app.context; * * @author Kevin Roast */ -public interface IContextListener +public interface IContextListener extends Serializable { /** * Method called by UIContextService.notifyBeans() to inform all registered beans that diff --git a/source/java/org/alfresco/web/app/context/UIContextService.java b/source/java/org/alfresco/web/app/context/UIContextService.java index b68eb09656..fc5d1ff8da 100644 --- a/source/java/org/alfresco/web/app/context/UIContextService.java +++ b/source/java/org/alfresco/web/app/context/UIContextService.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.app.context; +import java.io.Serializable; import java.util.HashMap; import java.util.Map; @@ -39,8 +40,10 @@ import javax.faces.context.FacesContext; * * @author Kevin Roast */ -public final class UIContextService +public final class UIContextService implements Serializable { + private static final long serialVersionUID = -866750823190499704L; + /** * Private constructor */ diff --git a/source/java/org/alfresco/web/bean/AboutBean.java b/source/java/org/alfresco/web/bean/AboutBean.java index 5b8668b416..162bb21617 100644 --- a/source/java/org/alfresco/web/bean/AboutBean.java +++ b/source/java/org/alfresco/web/bean/AboutBean.java @@ -26,9 +26,16 @@ package org.alfresco.web.bean; import javax.faces.context.FacesContext; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.Serializable; + +import javax.faces.context.FacesContext; + import org.alfresco.service.descriptor.DescriptorService; import org.alfresco.web.app.Application; import org.alfresco.web.bean.dialog.BaseDialogBean; +import org.alfresco.web.bean.repository.Repository; /** * Simple backing bean used by the about page to display the version. @@ -37,10 +44,12 @@ import org.alfresco.web.bean.dialog.BaseDialogBean; */ public class AboutBean extends BaseDialogBean { + private static final long serialVersionUID = -3777479360531145878L; + private final static String MSG_VERSION = "version"; private final static String MSG_CLOSE = "close"; - DescriptorService descriptorService; + transient private DescriptorService descriptorService; /** * Retrieves the version of the repository. @@ -49,7 +58,7 @@ public class AboutBean extends BaseDialogBean */ public String getVersion() { - return this.descriptorService.getServerDescriptor().getVersion(); + return this.getDescriptorService().getServerDescriptor().getVersion(); } /** @@ -59,7 +68,7 @@ public class AboutBean extends BaseDialogBean */ public String getEdition() { - return this.descriptorService.getServerDescriptor().getEdition(); + return this.getDescriptorService().getServerDescriptor().getEdition(); } /** @@ -82,7 +91,16 @@ public class AboutBean extends BaseDialogBean public String getContainerDescription() { return Application.getMessage(FacesContext.getCurrentInstance(), MSG_VERSION) + " :" + getEdition() + " - v" + getVersion(); -} + } + + DescriptorService getDescriptorService() + { + if (descriptorService == null) + { + descriptorService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDescriptorService(); + } + return descriptorService; + } @Override public String getCancelButtonLabel() @@ -92,8 +110,8 @@ public class AboutBean extends BaseDialogBean } @Override -protected String getDefaultCancelOutcome() { - - return "dialog:close:browse"; -} + protected String getDefaultCancelOutcome() + { + return "dialog:close:browse"; + } } diff --git a/source/java/org/alfresco/web/bean/BaseDetailsBean.java b/source/java/org/alfresco/web/bean/BaseDetailsBean.java index 47c348d172..c8a09bbe61 100644 --- a/source/java/org/alfresco/web/bean/BaseDetailsBean.java +++ b/source/java/org/alfresco/web/bean/BaseDetailsBean.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.bean; +import java.io.IOException; +import java.io.ObjectInputStream; import java.io.Serializable; import java.text.MessageFormat; import java.util.HashMap; @@ -75,16 +77,16 @@ public abstract class BaseDetailsBean extends BaseDialogBean protected NavigationBean navigator; /** NodeServuce bean reference */ - protected NodeService nodeService; + transient private NodeService nodeService; /** OwnableService bean reference */ - protected OwnableService ownableService; + transient private OwnableService ownableService; /** CopyService bean reference */ - protected CopyService copyService; + transient private CopyService copyService; /** The PermissionService reference */ - protected PermissionService permissionService; + transient private PermissionService permissionService; /** Selected template Id */ protected String template; @@ -134,6 +136,15 @@ public abstract class BaseDetailsBean extends BaseDialogBean this.nodeService = nodeService; } + protected NodeService getNodeService() + { + if (nodeService == null) + { + nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + } + return nodeService; + } + /** * Sets the ownable service instance the bean should use * @@ -144,6 +155,15 @@ public abstract class BaseDetailsBean extends BaseDialogBean this.ownableService = ownableService; } + protected OwnableService getOwnableService() + { + if (ownableService == null) + { + ownableService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getOwnableService(); + } + return ownableService; + } + /** * Sets the copy service instance the bean should use * @@ -154,6 +174,15 @@ public abstract class BaseDetailsBean extends BaseDialogBean this.copyService = copyService; } + protected CopyService getCopyService() + { + if (copyService == null) + { + copyService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getCopyService(); + } + return copyService; + } + /** * @param permissionService The PermissionService to set. */ @@ -162,6 +191,15 @@ public abstract class BaseDetailsBean extends BaseDialogBean this.permissionService = permissionService; } + protected PermissionService getPermissionService() + { + if (permissionService == null) + { + permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService(); + } + return permissionService; + } + /** * @return Returns the panels expanded state map. */ @@ -289,8 +327,8 @@ public abstract class BaseDetailsBean extends BaseDialogBean if (getNode().hasAspect(ContentModel.ASPECT_TEMPLATABLE)) { NodeRef templateRef = (NodeRef)getNode().getProperties().get(ContentModel.PROP_TEMPLATE); - return (templateRef != null && this.nodeService.exists(templateRef) && - this.permissionService.hasPermission(templateRef, PermissionService.READ) == AccessStatus.ALLOWED); + return (templateRef != null && this.getNodeService().exists(templateRef) && + this.getPermissionService().hasPermission(templateRef, PermissionService.READ) == AccessStatus.ALLOWED); } return false; } @@ -332,8 +370,10 @@ public abstract class BaseDetailsBean extends BaseDialogBean public abstract Map getTemplateModel(); /** Template Image resolver helper */ - protected TemplateImageResolver imageResolver = new TemplateImageResolver() + protected TemplateImageResolver imageResolver = new TemplateImageResolver() { + private static final long serialVersionUID = 1539708282743314697L; + public String resolveImagePathForName(String filename, FileTypeImageSize size) { return Utils.getFileTypeImage(FacesContext.getCurrentInstance(), filename, size); @@ -426,7 +466,7 @@ public abstract class BaseDetailsBean extends BaseDialogBean public Object execute() throws Throwable { // firstly retrieve all the properties for the current node - Map updateProps = nodeService.getProperties( + Map updateProps = getNodeService().getProperties( getNode().getNodeRef()); // update the simple workflow properties @@ -487,7 +527,7 @@ public abstract class BaseDetailsBean extends BaseDialogBean } // set the properties on the node - nodeService.setProperties(getNode().getNodeRef(), updateProps); + getNodeService().setProperties(getNode().getNodeRef(), updateProps); return null; } }; @@ -550,7 +590,7 @@ public abstract class BaseDetailsBean extends BaseDialogBean public Object execute() throws Throwable { // call the service to perform the approve - WorkflowUtil.approve(docNodeRef, nodeService, copyService); + WorkflowUtil.approve(docNodeRef, getNodeService(), getCopyService()); return null; } }; @@ -615,7 +655,7 @@ public abstract class BaseDetailsBean extends BaseDialogBean public Object execute() throws Throwable { // call the service to perform the reject - WorkflowUtil.reject(docNodeRef, nodeService, copyService); + WorkflowUtil.reject(docNodeRef, getNodeService(), getCopyService()); return null; } }; @@ -653,14 +693,14 @@ public abstract class BaseDetailsBean extends BaseDialogBean // apply the templatable aspect if required if (getNode().hasAspect(ContentModel.ASPECT_TEMPLATABLE) == false) { - this.nodeService.addAspect(getNode().getNodeRef(), ContentModel.ASPECT_TEMPLATABLE, null); + this.getNodeService().addAspect(getNode().getNodeRef(), ContentModel.ASPECT_TEMPLATABLE, null); } // get the selected template from the Template Picker NodeRef templateRef = new NodeRef(Repository.getStoreRef(), this.template); // set the template NodeRef into the templatable aspect property - this.nodeService.setProperty(getNode().getNodeRef(), ContentModel.PROP_TEMPLATE, templateRef); + this.getNodeService().setProperty(getNode().getNodeRef(), ContentModel.PROP_TEMPLATE, templateRef); // reset node details for next refresh of details page getNode().reset(); @@ -681,9 +721,9 @@ public abstract class BaseDetailsBean extends BaseDialogBean try { // clear template property - this.nodeService.setProperty(getNode().getNodeRef(), ContentModel.PROP_TEMPLATE, null); - this.nodeService.removeAspect(getNode().getNodeRef(), ContentModel.ASPECT_TEMPLATABLE); - this.nodeService.removeAspect(getNode().getNodeRef(), ContentModel.ASPECT_WEBSCRIPTABLE); + this.getNodeService().setProperty(getNode().getNodeRef(), ContentModel.PROP_TEMPLATE, null); + this.getNodeService().removeAspect(getNode().getNodeRef(), ContentModel.ASPECT_TEMPLATABLE); + this.getNodeService().removeAspect(getNode().getNodeRef(), ContentModel.ASPECT_WEBSCRIPTABLE); // reset node details for next refresh of details page getNode().reset(); @@ -709,7 +749,7 @@ public abstract class BaseDetailsBean extends BaseDialogBean { public Object execute() throws Throwable { - ownableService.takeOwnership(getNode().getNodeRef()); + getOwnableService().takeOwnership(getNode().getNodeRef()); String msg = Application.getMessage(fc, MSG_SUCCESS_OWNERSHIP); FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg); diff --git a/source/java/org/alfresco/web/bean/BrowseBean.java b/source/java/org/alfresco/web/bean/BrowseBean.java index 75944348d6..6f50507358 100644 --- a/source/java/org/alfresco/web/bean/BrowseBean.java +++ b/source/java/org/alfresco/web/bean/BrowseBean.java @@ -1,2085 +1,2183 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.web.bean; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; - -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; -import javax.transaction.UserTransaction; - -import org.alfresco.config.Config; -import org.alfresco.config.ConfigElement; -import org.alfresco.config.ConfigService; -import org.alfresco.model.ApplicationModel; -import org.alfresco.model.ContentModel; -import org.alfresco.repo.search.SearcherException; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.TypeDefinition; -import org.alfresco.service.cmr.lock.LockService; -import org.alfresco.service.cmr.ml.MultilingualContentService; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -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.cmr.repository.NodeService; -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.PermissionService; -import org.alfresco.service.namespace.QName; -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.content.DocumentDetailsDialog; -import org.alfresco.web.bean.repository.MapNode; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.NodePropertyResolver; -import org.alfresco.web.bean.repository.QNameNodeMap; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.search.SearchContext; -import org.alfresco.web.bean.spaces.CreateSpaceWizard; -import org.alfresco.web.bean.users.UserPreferencesBean; -import org.alfresco.web.config.ClientConfigElement; -import org.alfresco.web.config.ViewsConfigElement; -import org.alfresco.web.ui.common.Utils; -import org.alfresco.web.ui.common.Utils.URLMode; -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.UIStatusMessage; -import org.alfresco.web.ui.common.component.UIPanel.ExpandedEvent; -import org.alfresco.web.ui.common.component.data.UIRichList; -import org.alfresco.web.ui.repo.component.IRepoBreadcrumbHandler; -import org.alfresco.web.ui.repo.component.UINodeDescendants; -import org.alfresco.web.ui.repo.component.UINodePath; -import org.alfresco.web.ui.repo.component.UISimpleSearch; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - - -/** - * Bean providing properties and behaviour for the main folder/document browse screen and - * search results screens. - * - * @author Kevin Roast - */ -public class BrowseBean implements IContextListener -{ - /** Public JSF Bean name */ - public static final String BEAN_NAME = "BrowseBean"; - - - // ------------------------------------------------------------------------------ - // Construction - - /** - * Default Constructor - */ - public BrowseBean() - { - UIContextService.getInstance(FacesContext.getCurrentInstance()).registerBean(this); - - initFromClientConfig(); - } - - - // ------------------------------------------------------------------------------ - // Bean property getters and setters - - /** - * @param nodeService The NodeService to set. - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param searchService The Searcher to set. - */ - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - - /** - * @param userPreferencesBean The UserPreferencesBean to set. - */ - public void setUserPreferencesBean(UserPreferencesBean userPreferencesBean) - { - this.userPreferencesBean = userPreferencesBean; - } - - /** - * @param lockService The Lock Service to set. - */ - public void setLockService(LockService lockService) - { - this.lockService = lockService; - } - - /** - * @param navigator The NavigationBean to set. - */ - public void setNavigator(NavigationBean navigator) - { - this.navigator = navigator; - } - - /** - * @param dictionaryService The DictionaryService to set. - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param multilingualContentService The Multilingual Content Service to set. - */ - public void setMultilingualContentService(MultilingualContentService multilingualContentService) - { - this.multilingualContentService = multilingualContentService; - } - - /** - * @param fileFolderService The FileFolderService to set. - */ - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - /** - * @return Returns the browse View mode. See UIRichList - */ - public String getBrowseViewMode() - { - return this.browseViewMode; - } - - /** - * @param browseViewMode The browse View mode to set. See UIRichList. - */ - public void setBrowseViewMode(String browseViewMode) - { - this.browseViewMode = browseViewMode; - } - - /** - * @return Returns true if dashboard view is available for the current node. - */ - public boolean isDashboardView() - { - return this.dashboardView; - } - - /** - * @param dashboardView The dashboard view mode to set. - */ - public void setDashboardView(boolean dashboardView) - { - this.dashboardView = dashboardView; - if (dashboardView == true) - { - FacesContext fc = FacesContext.getCurrentInstance(); - fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dashboard"); - } - } - - public int getPageSizeContent() - { - return this.pageSizeContent; - } - - public void setPageSizeContent(int pageSizeContent) - { - this.pageSizeContent = pageSizeContent; - this.pageSizeContentStr = Integer.toString(pageSizeContent); - } - - public int getPageSizeSpaces() - { - return this.pageSizeSpaces; - } - - public void setPageSizeSpaces(int pageSizeSpaces) - { - this.pageSizeSpaces = pageSizeSpaces; - this.pageSizeSpacesStr = Integer.toString(pageSizeSpaces); - } - - public String getPageSizeContentStr() - { - return this.pageSizeContentStr; - } - - public void setPageSizeContentStr(String pageSizeContentStr) - { - this.pageSizeContentStr = pageSizeContentStr; - } - - public String getPageSizeSpacesStr() - { - return this.pageSizeSpacesStr; - } - - public void setPageSizeSpacesStr(String pageSizeSpacesStr) - { - this.pageSizeSpacesStr = pageSizeSpacesStr; - } - - /** - * @return Returns the minimum length of a valid search string. - */ - public static int getMinimumSearchLength() - { - return Application.getClientConfig(FacesContext.getCurrentInstance()).getSearchMinimum(); - } - - /** - * @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 Returns the Space Node being used for the current browse screen action. - */ - public Node getActionSpace() - { - return this.actionSpace; - } - - /** - * @param actionSpace Set the Space Node to be used for the current browse screen action. - */ - public void setActionSpace(Node actionSpace) - { - if (actionSpace != null) - { - for (NodeEventListener listener : getNodeEventListeners()) - { - listener.created(actionSpace, actionSpace.getType()); - } - } - this.actionSpace = actionSpace; - } - - /** - * @return The document node being used for the current operation - */ - public Node getDocument() - { - return this.document; - } - - /** - * @param document The document node to be used for the current operation - */ - public void setDocument(Node document) - { - if (document != null) - { - for (NodeEventListener listener : getNodeEventListeners()) - { - listener.created(document, document.getType()); - } - } - this.document = document; - } - - /** - * @param contentRichList The contentRichList to set. - */ - public void setContentRichList(UIRichList contentRichList) - { - this.contentRichList = contentRichList; - if (this.contentRichList != null) - { - this.contentRichList.setInitialSortColumn( - this.viewsConfig.getDefaultSortColumn(PAGE_NAME_BROWSE)); - this.contentRichList.setInitialSortDescending( - this.viewsConfig.hasDescendingSort(PAGE_NAME_BROWSE)); - } - // special case to handle an External Access URL - // these URLs restart the JSF lifecycle but an old UIRichList is restored from - // the component tree - which needs clearing "late" in the lifecycle process - if (externalForceRefresh) - { - this.contentRichList.setValue(null); - externalForceRefresh = false; - } - } - - /** - * @return Returns the contentRichList. - */ - public UIRichList getContentRichList() - { - return this.contentRichList; - } - - /** - * @param spacesRichList The spacesRichList to set. - */ - public void setSpacesRichList(UIRichList spacesRichList) - { - this.spacesRichList = spacesRichList; - if (this.spacesRichList != null) - { - // set the initial sort column and direction - this.spacesRichList.setInitialSortColumn( - this.viewsConfig.getDefaultSortColumn(PAGE_NAME_BROWSE)); - this.spacesRichList.setInitialSortDescending( - this.viewsConfig.hasDescendingSort(PAGE_NAME_BROWSE)); - } - if (externalForceRefresh) - { - this.spacesRichList.setValue(null); - } - } - - /** - * @return Returns the spacesRichList. - */ - public UIRichList getSpacesRichList() - { - return this.spacesRichList; - } - - /** - * @return Returns the statusMessage component. - */ - public UIStatusMessage getStatusMessage() - { - return this.statusMessage; - } - - /** - * @param statusMessage The statusMessage component to set. - */ - public void setStatusMessage(UIStatusMessage statusMessage) - { - this.statusMessage = statusMessage; - } - - /** - * @return Returns the deleteMessage. - */ - public String getDeleteMessage() - { - return this.deleteMessage; - } - - /** - * @param deleteMessage The deleteMessage to set. - */ - public void setDeleteMessage(String deleteMessage) - { - this.deleteMessage = deleteMessage; - } - - /** - * Page accessed bean method to get the container nodes currently being browsed - * - * @return List of container Node objects for the current browse location - */ - public List getNodes() - { - // the references to container nodes and content nodes are transient for one use only - // we do this so we only query/search once - as we cannot distinguish between node types - // until after the query. The logic is a bit confusing but otherwise we would need to - // perform the same query or search twice for every screen refresh. - if (this.containerNodes == null) - { - if (this.navigator.getSearchContext() == null) - { - queryBrowseNodes(this.navigator.getCurrentNodeId()); - } - else - { - searchBrowseNodes(this.navigator.getSearchContext()); - } - } - List result = this.containerNodes; - - // we clear the member variable during invalidateComponents() - - return result; - } - - /** - * Page accessed bean method to get the content nodes currently being browsed - * - * @return List of content Node objects for the current browse location - */ - public List getContent() - { - // see comment in getNodes() above for reasoning here - if (this.contentNodes == null) - { - if (this.navigator.getSearchContext() == null) - { - queryBrowseNodes(this.navigator.getCurrentNodeId()); - } - else - { - searchBrowseNodes(this.navigator.getSearchContext()); - } - } - List result = this.contentNodes; - - // we clear the member variable during invalidateComponents() - - return result; - } - - /** - * Page accessed bean method to get the parent container nodes currently being browsed - * - * @return List of parent container Node objects for the current browse location - */ - public List getParentNodes(NodeRef currNodeRef) - { - // As per AWC-1507 there are two scenarios for navigating to the space details. First - // scenario is to show space details of the current space. Second scenario is to show - // space details of a child space of the current space. For now, added an extra query - // so that existing context remains unaffected for second scenario, although it does - // mean that in first scenario there will be an extra query even though parentContainerNodes - // and containerNodes will contain the same list. - - if (this.parentContainerNodes == null) - { - long startTime = 0; - if (logger.isDebugEnabled()) - startTime = System.currentTimeMillis(); - - UserTransaction tx = null; - try - { - FacesContext context = FacesContext.getCurrentInstance(); - tx = Repository.getUserTransaction(context, true); - tx.begin(); - - NodeRef parentRef = nodeService.getPrimaryParent(currNodeRef).getParentRef(); - - List children = this.fileFolderService.list(parentRef); - this.parentContainerNodes = new ArrayList(children.size()); - for (FileInfo fileInfo : children) - { - // create our Node representation from the NodeRef - NodeRef nodeRef = fileInfo.getNodeRef(); - - // find it's type so we can see if it's a node we are interested in - QName type = this.nodeService.getType(nodeRef); - - // make sure the type is defined in the data dictionary - TypeDefinition typeDef = this.dictionaryService.getType(type); - - if (typeDef != null) - { - MapNode node = null; - - // look for Space folder node - if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_FOLDER)) - { - // create our Node representation - node = new MapNode(nodeRef, this.nodeService, fileInfo.getProperties()); - node.addPropertyResolver("icon", this.resolverSpaceIcon); - node.addPropertyResolver("smallIcon", this.resolverSmallIcon); - - this.parentContainerNodes.add(node); - } - else if (ApplicationModel.TYPE_FOLDERLINK.equals(type)) - { - // create our Folder Link Node representation - node = new MapNode(nodeRef, this.nodeService, fileInfo.getProperties()); - node.addPropertyResolver("icon", this.resolverSpaceIcon); - node.addPropertyResolver("smallIcon", this.resolverSmallIcon); - - this.parentContainerNodes.add(node); - } - } - else - { - if (logger.isWarnEnabled()) - logger.warn("Found invalid object in database: id = " + nodeRef + ", type = " + type); - } - } - - // commit the transaction - tx.commit(); - } - catch (InvalidNodeRefException refErr) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {refErr.getNodeRef()}), refErr ); - this.parentContainerNodes = Collections.emptyList(); - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - } - catch (Throwable err) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); - this.parentContainerNodes = Collections.emptyList(); - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - } - - if (logger.isDebugEnabled()) - { - long endTime = System.currentTimeMillis(); - logger.debug("Time to query and build map parent nodes: " + (endTime - startTime) + "ms"); - } - } - - List result = this.parentContainerNodes; - - // we clear the member variable during invalidateComponents() - - return result; - } - - - /** - * Setup the common properties required at data-binding time. - *

- * These are properties used by components on the page when iterating over the nodes. - * The properties are available as the Node is a Map so they can be accessed directly - * by name. Information such as download URL, size and filetype are provided etc. - *

- * We use a set of anonymous inner classes to provide the implemention for the property - * getters. The interfaces are only called when the properties are first requested. - * - * @param node Node to add the properties too - */ - public void setupCommonBindingProperties(Node node) - { - // special properties to be used by the value binding components on the page - node.addPropertyResolver("url", this.resolverUrl); - node.addPropertyResolver("webdavUrl", this.resolverWebdavUrl); - node.addPropertyResolver("cifsPath", this.resolverCifsPath); - node.addPropertyResolver("fileType16", this.resolverFileType16); - node.addPropertyResolver("fileType32", this.resolverFileType32); - node.addPropertyResolver("size", this.resolverSize); - node.addPropertyResolver("lang", this.resolverLang); - } - - - // ------------------------------------------------------------------------------ - // IContextListener implementation - - /** - * @see org.alfresco.web.app.context.IContextListener#contextUpdated() - */ - public void contextUpdated() - { - invalidateComponents(); - } - - /** - * @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 - } - - - // ------------------------------------------------------------------------------ - // NodeEventListener listeners - - /** - * Add a listener to those called by the BrowseBean when nodes are created - */ - public void addNodeEventListener(NodeEventListener listener) - { - if (this.nodeEventListeners == null) - { - this.nodeEventListeners = new HashSet(); - } - this.nodeEventListeners.add(listener); - } - - /** - * Remove a listener from the list of those called by BrowseBean - */ - public void removeNodeEventListener(NodeEventListener listener) - { - if (this.nodeEventListeners != null) - { - this.nodeEventListeners.remove(listener); - } - } - - - // ------------------------------------------------------------------------------ - // Navigation action event handlers - - /** - * Change the current view mode based on user selection - * - * @param event ActionEvent - */ - public void viewModeChanged(ActionEvent event) - { - UIModeList viewList = (UIModeList)event.getComponent(); - - // get the view mode ID - String viewMode = viewList.getValue().toString(); - - if (VIEWMODE_DASHBOARD.equals(viewMode) == false) - { - // set the page size based on the style of display - int pageSize = this.viewsConfig.getDefaultPageSize(PAGE_NAME_BROWSE, viewMode); - setPageSizeContent(pageSize); - setPageSizeSpaces(pageSize); - - if (logger.isDebugEnabled()) - logger.debug("Browse view page size set to: " + pageSize); - - setDashboardView(false); - - // push the view mode into the lists - setBrowseViewMode(viewMode); - - // setup dispatch context for custom views - this.navigator.setupDispatchContext(this.navigator.getCurrentNode()); - - // browse to appropriate view - FacesContext fc = FacesContext.getCurrentInstance(); - String outcome = null; - String viewId = fc.getViewRoot().getViewId(); - if (viewId.equals(BROWSE_VIEW_ID) == false && viewId.equals(CATEGORY_VIEW_ID) == false) - { - outcome = "browse"; - } - fc.getApplication().getNavigationHandler().handleNavigation(fc, null, outcome); - } - else - { - // special case for Dashboard view - setDashboardView(true); - } - } - - - // ------------------------------------------------------------------------------ - // Helper methods - - /** - * Query a list of nodes for the specified parent node Id - * - * @param parentNodeId Id of the parent node or null for the root node - */ - private void queryBrowseNodes(String parentNodeId) - { - long startTime = 0; - if (logger.isDebugEnabled()) - startTime = System.currentTimeMillis(); - - UserTransaction tx = null; - try - { - FacesContext context = FacesContext.getCurrentInstance(); - tx = Repository.getUserTransaction(context, true); - tx.begin(); - - NodeRef parentRef; - if (parentNodeId == null) - { - // no specific parent node specified - use the root node - parentRef = this.nodeService.getRootNode(Repository.getStoreRef()); - } - else - { - // build a NodeRef for the specified Id and our store - parentRef = new NodeRef(Repository.getStoreRef(), parentNodeId); - } - - List children = this.fileFolderService.list(parentRef); - this.containerNodes = new ArrayList(children.size()); - this.contentNodes = new ArrayList(children.size()); - - // in case of dynamic config, only lookup once - Set nodeEventListeners = getNodeEventListeners(); - - for (FileInfo fileInfo : children) - { - // create our Node representation from the NodeRef - NodeRef nodeRef = fileInfo.getNodeRef(); - - // find it's type so we can see if it's a node we are interested in - QName type = this.nodeService.getType(nodeRef); - - // make sure the type is defined in the data dictionary - TypeDefinition typeDef = this.dictionaryService.getType(type); - - if (typeDef != null) - { - MapNode node = null; - - // look for File content node - if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT)) - { - // create our Node representation - node = new MapNode(nodeRef, this.nodeService, fileInfo.getProperties()); - setupCommonBindingProperties(node); - - this.contentNodes.add(node); - } - // look for Space folder node - else if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_FOLDER)) - { - // create our Node representation - node = new MapNode(nodeRef, this.nodeService, fileInfo.getProperties()); - node.addPropertyResolver("icon", this.resolverSpaceIcon); - node.addPropertyResolver("smallIcon", this.resolverSmallIcon); - - this.containerNodes.add(node); - } - // look for File Link object node - else if (ApplicationModel.TYPE_FILELINK.equals(type)) - { - // create our File Link Node representation - node = new MapNode(nodeRef, this.nodeService, fileInfo.getProperties()); - // only display the user has the permissions to navigate to the target of the link - NodeRef destRef = (NodeRef)node.getProperties().get(ContentModel.PROP_LINK_DESTINATION); - if (destRef != null && new Node(destRef).hasPermission(PermissionService.READ) == true) - { - node.addPropertyResolver("url", this.resolverLinkUrl); - node.addPropertyResolver("webdavUrl", this.resolverLinkWebdavUrl); - node.addPropertyResolver("cifsPath", this.resolverLinkCifsPath); - node.addPropertyResolver("fileType16", this.resolverFileType16); - node.addPropertyResolver("fileType32", this.resolverFileType32); - node.addPropertyResolver("size", this.resolverSize); - node.addPropertyResolver("lang", this.resolverLang); - - this.contentNodes.add(node); - } - } - else if (ApplicationModel.TYPE_FOLDERLINK.equals(type)) - { - // create our Folder Link Node representation - node = new MapNode(nodeRef, this.nodeService, fileInfo.getProperties()); - // only display the user has the permissions to navigate to the target of the link - NodeRef destRef = (NodeRef)node.getProperties().get(ContentModel.PROP_LINK_DESTINATION); - if (destRef != null && new Node(destRef).hasPermission(PermissionService.READ) == true) - { - node.addPropertyResolver("icon", this.resolverSpaceIcon); - node.addPropertyResolver("smallIcon", this.resolverSmallIcon); - - this.containerNodes.add(node); - } - } - - // inform any listeners that a Node wrapper has been created - if (node != null) - { - for (NodeEventListener listener : nodeEventListeners) - { - listener.created(node, type); - } - } - } - else - { - if (logger.isWarnEnabled()) - logger.warn("Found invalid object in database: id = " + nodeRef + ", type = " + type); - } - } - - // commit the transaction - tx.commit(); - } - catch (InvalidNodeRefException refErr) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {refErr.getNodeRef()}), refErr ); - this.containerNodes = Collections.emptyList(); - this.contentNodes = Collections.emptyList(); - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - } - catch (Throwable err) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); - this.containerNodes = Collections.emptyList(); - this.contentNodes = Collections.emptyList(); - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - } - - if (logger.isDebugEnabled()) - { - long endTime = System.currentTimeMillis(); - logger.debug("Time to query and build map nodes: " + (endTime - startTime) + "ms"); - } - } - - /** - * Search for a list of nodes using the specific search context - * - * @param searchContext To use to perform the search - */ - private void searchBrowseNodes(SearchContext searchContext) - { - long startTime = 0; - if (logger.isDebugEnabled()) - startTime = System.currentTimeMillis(); - - // get the searcher object to build the query - String query = searchContext.buildQuery(getMinimumSearchLength()); - if (query == 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(), MSG_SEARCH_MINIMUM), - new Object[] {getMinimumSearchLength()})); - this.containerNodes = Collections.emptyList(); - this.contentNodes = Collections.emptyList(); - return; - } - - // perform the search against the repo - UserTransaction tx = null; - ResultSet results = null; - try - { - tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); - tx.begin(); - - // build up the search parameters - SearchParameters sp = new SearchParameters(); - sp.setLanguage(SearchService.LANGUAGE_LUCENE); - sp.setQuery(query); - sp.addStore(Repository.getStoreRef()); - - // limit search results size as configured - int searchLimit = Application.getClientConfig(FacesContext.getCurrentInstance()).getSearchMaxResults(); - if (searchLimit > 0) - { - sp.setLimitBy(LimitBy.FINAL_SIZE); - sp.setLimit(searchLimit); - } - - results = this.searchService.query(sp); - if (logger.isDebugEnabled()) - logger.debug("Search results returned: " + results.length()); - - // create a list of items from the results - this.containerNodes = new ArrayList(results.length()); - this.contentNodes = new ArrayList(results.length()); - if (results.length() != 0) - { - // in case of dynamic config, only lookup once - Set nodeEventListeners = getNodeEventListeners(); - - for (ResultSetRow row: results) - { - NodeRef nodeRef = row.getNodeRef(); - - if (this.nodeService.exists(nodeRef)) - { - // find it's type so we can see if it's a node we are interested in - QName type = this.nodeService.getType(nodeRef); - - // make sure the type is defined in the data dictionary - TypeDefinition typeDef = this.dictionaryService.getType(type); - - if (typeDef != null) - { - MapNode node = null; - - // look for Space or File nodes - if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_FOLDER) && - this.dictionaryService.isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false) - { - // create our Node representation - node = new MapNode(nodeRef, this.nodeService, false); - - node.addPropertyResolver("path", this.resolverPath); - node.addPropertyResolver("displayPath", this.resolverDisplayPath); - node.addPropertyResolver("icon", this.resolverSpaceIcon); - node.addPropertyResolver("smallIcon", this.resolverSmallIcon); - - this.containerNodes.add(node); - } - else if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT)) - { - // create our Node representation - node = new MapNode(nodeRef, this.nodeService, false); - - setupCommonBindingProperties(node); - - node.addPropertyResolver("path", this.resolverPath); - node.addPropertyResolver("displayPath", this.resolverDisplayPath); - - this.contentNodes.add(node); - } - // look for File Link object node - else if (ApplicationModel.TYPE_FILELINK.equals(type)) - { - // create our File Link Node representation - node = new MapNode(nodeRef, this.nodeService, false); - // only display the user has the permissions to navigate to the target of the link - NodeRef destRef = (NodeRef)node.getProperties().get(ContentModel.PROP_LINK_DESTINATION); - if (new Node(destRef).hasPermission(PermissionService.READ) == true) - { - node.addPropertyResolver("url", this.resolverLinkUrl); - node.addPropertyResolver("webdavUrl", this.resolverLinkWebdavUrl); - node.addPropertyResolver("cifsPath", this.resolverLinkCifsPath); - node.addPropertyResolver("fileType16", this.resolverFileType16); - node.addPropertyResolver("fileType32", this.resolverFileType32); - node.addPropertyResolver("size", this.resolverSize); - node.addPropertyResolver("lang", this.resolverLang); - node.addPropertyResolver("path", this.resolverPath); - node.addPropertyResolver("displayPath", this.resolverDisplayPath); - - this.contentNodes.add(node); - } - } - else if (ApplicationModel.TYPE_FOLDERLINK.equals(type)) - { - // create our Folder Link Node representation - node = new MapNode(nodeRef, this.nodeService, false); - // only display the user has the permissions to navigate to the target of the link - NodeRef destRef = (NodeRef)node.getProperties().get(ContentModel.PROP_LINK_DESTINATION); - if (new Node(destRef).hasPermission(PermissionService.READ) == true) - { - node.addPropertyResolver("icon", this.resolverSpaceIcon); - node.addPropertyResolver("smallIcon", this.resolverSmallIcon); - node.addPropertyResolver("path", this.resolverPath); - node.addPropertyResolver("displayPath", this.resolverDisplayPath); - - this.containerNodes.add(node); - } - } - - // inform any listeners that a Node wrapper has been created - if (node != null) - { - for (NodeEventListener listener : nodeEventListeners) - { - listener.created(node, type); - } - } - } - else - { - if (logger.isWarnEnabled()) - logger.warn("Found invalid object in database: id = " + nodeRef + ", type = " + type); - } - } - else - { - if (logger.isWarnEnabled()) - logger.warn("Missing object returned from search indexes: id = " + nodeRef + " search query: " + query); - } - } - } - - // commit the transaction - tx.commit(); - } - catch (InvalidNodeRefException refErr) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {refErr.getNodeRef()}), refErr ); - this.containerNodes = Collections.emptyList(); - this.contentNodes = Collections.emptyList(); - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - } - catch (SearcherException serr) - { - logger.info("Search failed for: " + query, serr); - Utils.addErrorMessage(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_QUERY)); - this.containerNodes = Collections.emptyList(); - this.contentNodes = Collections.emptyList(); - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - } - catch (Throwable err) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_SEARCH), new Object[] {err.getMessage()}), err ); - this.containerNodes = Collections.emptyList(); - this.contentNodes = Collections.emptyList(); - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - } - finally - { - if (results != null) - { - results.close(); - } - } - - if (logger.isDebugEnabled()) - { - long endTime = System.currentTimeMillis(); - logger.debug("Time to query and build map nodes: " + (endTime - startTime) + "ms"); - } - } - - - // ------------------------------------------------------------------------------ - // Property Resolvers - - public NodePropertyResolver resolverDownload = new NodePropertyResolver() { - public Object get(Node node) { - return DownloadContentServlet.generateDownloadURL(node.getNodeRef(), node.getName()); - } - }; - - public NodePropertyResolver resolverUrl = new NodePropertyResolver() { - public Object get(Node node) { - return DownloadContentServlet.generateBrowserURL(node.getNodeRef(), node.getName()); - } - }; - - public NodePropertyResolver resolverWebdavUrl = new NodePropertyResolver() { - public Object get(Node node) { - return Utils.generateURL(FacesContext.getCurrentInstance(), node, URLMode.WEBDAV); - } - }; - - public NodePropertyResolver resolverCifsPath = new NodePropertyResolver() { - public Object get(Node node) { - return Utils.generateURL(FacesContext.getCurrentInstance(), node, URLMode.CIFS); - } - }; - - public NodePropertyResolver resolverLinkDownload = new NodePropertyResolver() { - public Object get(Node node) { - NodeRef destRef = (NodeRef)node.getProperties().get(ContentModel.PROP_LINK_DESTINATION); - if (nodeService.exists(destRef) == true) - { - String destName = Repository.getNameForNode(nodeService, destRef); - return DownloadContentServlet.generateDownloadURL(node.getNodeRef(), destName); - } - else - { - // TODO: link object is missing - navigate to a page with appropriate message - return "#"; - } - } - }; - - public NodePropertyResolver resolverLinkUrl = new NodePropertyResolver() { - public Object get(Node node) { - NodeRef destRef = (NodeRef)node.getProperties().get(ContentModel.PROP_LINK_DESTINATION); - if (nodeService.exists(destRef) == true) - { - String destName = Repository.getNameForNode(nodeService, destRef); - return DownloadContentServlet.generateBrowserURL(destRef, destName); - } - else - { - // TODO: link object is missing - navigate to a page with appropriate message - return "#"; - } - } - }; - - public NodePropertyResolver resolverLinkWebdavUrl = new NodePropertyResolver() { - public Object get(Node node) { - NodeRef destRef = (NodeRef)node.getProperties().get(ContentModel.PROP_LINK_DESTINATION); - if (nodeService.exists(destRef) == true) - { - return Utils.generateURL(FacesContext.getCurrentInstance(), new Node(destRef), URLMode.WEBDAV); - } - else - { - // TODO: link object is missing - navigate to a page with appropriate message - return "#"; - } - } - }; - - public NodePropertyResolver resolverLinkCifsPath = new NodePropertyResolver() { - public Object get(Node node) { - NodeRef destRef = (NodeRef)node.getProperties().get(ContentModel.PROP_LINK_DESTINATION); - if (nodeService.exists(destRef) == true) - { - return Utils.generateURL(FacesContext.getCurrentInstance(), new Node(destRef), URLMode.CIFS); - } - else - { - // TODO: link object is missing - navigate to a page with appropriate message - return "#"; - } - } - }; - - public NodePropertyResolver resolverFileType16 = new NodePropertyResolver() { - public Object get(Node node) { - return Utils.getFileTypeImage(node.getName(), true); - } - }; - - public NodePropertyResolver resolverFileType32 = new NodePropertyResolver() { - public Object get(Node node) { - return Utils.getFileTypeImage(node.getName(), false); - } - }; - - public NodePropertyResolver resolverPath = new NodePropertyResolver() { - public Object get(Node node) { - return node.getNodePath(); - } - }; - - public NodePropertyResolver resolverDisplayPath = new NodePropertyResolver() { - public Object get(Node node) { - // TODO: replace this with a method that shows the full display name - not QNames? - return Repository.getDisplayPath(node.getNodePath()); - } - }; - - public NodePropertyResolver resolverSpaceIcon = new NodePropertyResolver() { - public Object get(Node node) { - QNameNodeMap props = (QNameNodeMap)node.getProperties(); - String icon = (String)props.getRaw("app:icon"); - return (icon != null ? icon : CreateSpaceWizard.DEFAULT_SPACE_ICON_NAME); - } - }; - - public NodePropertyResolver resolverSmallIcon = new NodePropertyResolver() { - public Object get(Node node) { - QNameNodeMap props = (QNameNodeMap)node.getProperties(); - String icon = (String)props.getRaw("app:icon"); - return (icon != null ? icon + "-16" : SPACE_SMALL_DEFAULT); - } - }; - - public NodePropertyResolver resolverMimetype = new NodePropertyResolver() { - public Object get(Node node) { - ContentData content = (ContentData)node.getProperties().get(ContentModel.PROP_CONTENT); - return (content != null ? content.getMimetype() : null); - } - }; - - public NodePropertyResolver resolverEncoding = new NodePropertyResolver() { - public Object get(Node node) { - ContentData content = (ContentData)node.getProperties().get(ContentModel.PROP_CONTENT); - return (content != null ? content.getEncoding() : null); - } - }; - - public NodePropertyResolver resolverSize = new NodePropertyResolver() { - public Object get(Node node) { - ContentData content = (ContentData)node.getProperties().get(ContentModel.PROP_CONTENT); - return (content != null ? new Long(content.getSize()) : 0L); - } - }; - - public NodePropertyResolver resolverLang = new NodePropertyResolver() { - public Object get(Node node) { - - String lang = null; - - if (node.getAspects().contains(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT)) - { - Locale locale = null; - - if(node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION)) - { - // if the translation is empty, the lang of the content is the lang of it's pivot. - NodeRef pivot = multilingualContentService.getPivotTranslation(node.getNodeRef()); - locale = (Locale) nodeService.getProperty(pivot, ContentModel.PROP_LOCALE); - } - else - { - locale = (Locale) node.getProperties().get(ContentModel.PROP_LOCALE); - } - // the content filter lang defined by the user - String userLang = userPreferencesBean.getContentFilterLanguage(); - // the node lang - String nodeLang = locale.getLanguage(); - - // if filter equals all languages : display the lang for each translation - if (nodeLang == null) - { - lang = nodeLang; - } - - // if filter is different : display the lang - else if (!nodeLang.equalsIgnoreCase(userLang)) - { - lang = nodeLang; - } - - // else if the filter is equal to the lang node : nothing to do [lang = null] - } - - return lang; - } - }; - - - // ------------------------------------------------------------------------------ - // Navigation action event handlers - - /** - * Action called from the Simple Search component. - * Sets up the SearchContext object with the values from the simple search menu. - */ - public void search(ActionEvent event) - { - // setup the search text string on the top-level navigation handler - UISimpleSearch search = (UISimpleSearch)event.getComponent(); - this.navigator.setSearchContext(search.getSearchContext()); - - navigateBrowseScreen(); - } - - /** - * Action called to Close the search dialog by returning to the last view node Id - */ - public void closeSearch(ActionEvent event) - { - // set the current node Id ready for page refresh - this.navigator.setCurrentNodeId( this.navigator.getCurrentNodeId() ); - } - - /** - * Update page size based on user selection - */ - public void updateSpacesPageSize(ActionEvent event) - { - try - { - int size = Integer.parseInt(this.pageSizeSpacesStr); - if (size >= 0) - { - this.pageSizeSpaces = size; - } - else - { - // reset to known value if this occurs - this.pageSizeSpacesStr = Integer.toString(this.pageSizeSpaces); - } - } - catch (NumberFormatException err) - { - // reset to known value if this occurs - this.pageSizeSpacesStr = Integer.toString(this.pageSizeSpaces); - } - } - - /** - * Update page size based on user selection - */ - public void updateContentPageSize(ActionEvent event) - { - try - { - int size = Integer.parseInt(this.pageSizeContentStr); - if (size >= 0) - { - this.pageSizeContent = size; - } - else - { - // reset to known value if this occurs - this.pageSizeContentStr = Integer.toString(this.pageSizeContent); - } - } - catch (NumberFormatException err) - { - // reset to known value if this occurs - this.pageSizeContentStr = Integer.toString(this.pageSizeContent); - } - } - - /** - * Action called when a folder space is clicked. - * Navigate into the space. - */ - public void clickSpace(ActionEvent event) - { - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - String id = params.get("id"); - if (id != null && id.length() != 0) - { - try - { - NodeRef ref = new NodeRef(Repository.getStoreRef(), id); - - // handle special folder link node case - if (ApplicationModel.TYPE_FOLDERLINK.equals(this.nodeService.getType(ref))) - { - ref = (NodeRef)this.nodeService.getProperty(ref, ContentModel.PROP_LINK_DESTINATION); - } - - clickSpace(ref); - } - catch (InvalidNodeRefException refErr) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {id}) ); - } - } - } - - /** - * Action called when a folder space is clicked. - * - * @param nodeRef The node being clicked - */ - public void clickSpace(NodeRef nodeRef) - { - // refresh UI based on node selection - updateUILocation(nodeRef); - } - - /** - * Handler called when a path element is clicked - navigate to the appropriate Space - */ - public void clickSpacePath(ActionEvent event) - { - UINodePath.PathElementEvent pathEvent = (UINodePath.PathElementEvent)event; - NodeRef ref = pathEvent.NodeReference; - try - { - // refresh UI based on node selection - this.updateUILocation(ref); - } - catch (InvalidNodeRefException refErr) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {ref.getId()}) ); - } - } - - /** - * Action called when a folders direct descendant (in the 'list' browse mode) is clicked. - * Navigate into the the descendant space. - */ - public void clickDescendantSpace(ActionEvent event) - { - UINodeDescendants.NodeSelectedEvent nodeEvent = (UINodeDescendants.NodeSelectedEvent)event; - NodeRef nodeRef = nodeEvent.NodeReference; - if (nodeRef == null) - { - throw new IllegalStateException("NodeRef returned from UINodeDescendants.NodeSelectedEvent cannot be null!"); - } - - if (logger.isDebugEnabled()) - logger.debug("Selected noderef Id: " + nodeRef.getId()); - - try - { - // user can either select a descendant of a node display on the page which means we - // must add the it's parent and itself to the breadcrumb - ChildAssociationRef parentAssocRef = nodeService.getPrimaryParent(nodeRef); - - if (logger.isDebugEnabled()) - { - logger.debug("Selected item getPrimaryParent().getChildRef() noderef Id: " + parentAssocRef.getChildRef().getId()); - logger.debug("Selected item getPrimaryParent().getParentRef() noderef Id: " + parentAssocRef.getParentRef().getId()); - logger.debug("Current value getNavigator().getCurrentNodeId() noderef Id: " + this.navigator.getCurrentNodeId()); - } - - if (nodeEvent.IsParent == false) - { - // a descendant of the displayed node was selected - // first refresh based on the parent and add to the breadcrumb - updateUILocation(parentAssocRef.getParentRef()); - - // now add our selected node - updateUILocation(nodeRef); - } - else - { - // else the parent ellipses i.e. the displayed node was selected - updateUILocation(nodeRef); - } - } - catch (InvalidNodeRefException refErr) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {nodeRef.getId()}) ); - } - } - - /** - * Action event called by all Browse actions that need to setup a Space context - * before an action page/wizard is called. The context will be a Node in setActionSpace() which - * can be retrieved on the action page from BrowseBean.getActionSpace(). - * - * @param event ActionEvent - */ - public void setupSpaceAction(ActionEvent event) - { - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - String id = params.get("id"); - setupSpaceAction(id, true); - } - - /** - * Public helper to setup action pages with Space context - * - * @param id of the Space node to setup context for - */ - public void setupSpaceAction(String id, boolean invalidate) - { - if (id != null && id.length() != 0) - { - if (logger.isDebugEnabled()) - logger.debug("Setup for action, setting current space to: " + id); - - try - { - // create the node ref, then our node representation - NodeRef ref = new NodeRef(Repository.getStoreRef(), id); - Node node = new Node(ref); - - // resolve icon in-case one has not been set - node.addPropertyResolver("icon", this.resolverSpaceIcon); - - // prepare a node for the action context - setActionSpace(node); - - // setup the dispatch context in case it is required - this.navigator.setupDispatchContext(node); - } - catch (InvalidNodeRefException refErr) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {id}) ); - } - } - else - { - setActionSpace(null); - } - - // clear the UI state in preparation for finishing the next action - if (invalidate == true) - { - // use the context service to notify all registered beans - UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); - } - } - - /** - * Acrtion event called by Delete Space actions. We setup the action space as normal, then prepare - * any special case message string to be shown to the user if they are trying to delete specific spaces. - */ - public void setupDeleteAction(ActionEvent event) - { - String message = null; - - setupSpaceAction(event); - - Node node = getActionSpace(); - if (node != null) - { - FacesContext fc = FacesContext.getCurrentInstance(); - NodeRef companyRootRef = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId(fc)); - if (node.getNodeRef().equals(companyRootRef)) - { - message = Application.getMessage(fc, MSG_DELETE_COMPANYROOT); - } - } - - setDeleteMessage(message); - } - - /** - * Action event called by all actions that need to setup a Content Document context on the - * BrowseBean before an action page/wizard is called. The context will be a Node in - * setDocument() which can be retrieved on the action page from BrowseBean.getDocument(). - */ - public void setupContentAction(ActionEvent event) - { - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - setupContentAction(params.get("id"), true); - } - - /** - * Action event called by all actions that need to setup a Multilingual Content Document context on the - * BrowseBean before an action page/wizard is called. The context will be a Node in - * setDocument() which can be retrieved on the action page from BrowseBean.getDocument(). - */ - public void setupMLContainerContentAction(ActionEvent event) - { - UIActionLink link = (UIActionLink)event.getComponent(); - Map params = link.getParameterMap(); - - String id = params.get("id"); - - NodeRef translation = new NodeRef(Repository.getStoreRef(), id); - - // remember the bean from wich the action comes - DocumentDetailsDialog docDetails = (DocumentDetailsDialog)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("DocumentDetailsDialog"); - docDetails.setTranslationDocument(new Node(translation)); - - // set the ml container as the current document - NodeRef mlContainer = multilingualContentService.getTranslationContainer(translation); - - setupContentAction(mlContainer.getId(), true); - } - - /** - * Public helper to setup action pages with content context - * - * @param id of the content node to setup context for - */ - public void setupContentAction(String id, boolean invalidate) - { - if (id != null && id.length() != 0) - { - if (logger.isDebugEnabled()) - logger.debug("Setup for action, setting current document to: " + id); - - try - { - // create the node ref, then our node representation - NodeRef ref = new NodeRef(Repository.getStoreRef(), id); - Node node = new Node(ref); - - // store the URL to for downloading the content - if (ApplicationModel.TYPE_FILELINK.equals(node.getType())) - { - node.addPropertyResolver("url", this.resolverLinkDownload); - } - else - { - node.addPropertyResolver("url", this.resolverDownload); - } - node.addPropertyResolver("fileType32", this.resolverFileType32); - node.addPropertyResolver("mimetype", this.resolverMimetype); - node.addPropertyResolver("encoding", this.resolverEncoding); - node.addPropertyResolver("size", this.resolverSize); - node.addPropertyResolver("lang", this.resolverLang); - - for (NodeEventListener listener : getNodeEventListeners()) - { - listener.created(node, node.getType()); - } - - // get hold of the DocumentDetailsDialog and reset it - DocumentDetailsDialog docDetails = (DocumentDetailsDialog)FacesContext.getCurrentInstance(). - getExternalContext().getSessionMap().get("DocumentDetailsDialog"); - if (docDetails != null) - { - docDetails.reset(); - } - - // remember the document - setDocument(node); - - // setup the dispatch context in case it is required - this.navigator.setupDispatchContext(node); - } - catch (InvalidNodeRefException refErr) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {id}) ); - } - } - else - { - setDocument(null); - } - - // clear the UI state in preparation for finishing the next action - if (invalidate == true) - { - // use the context service to notify all registered beans - UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); - } - } - - /** - * Removes the given node from the breadcrumb i.e. following a delete - * - * @param node The space to remove from the breadcrumb - */ - public void removeSpaceFromBreadcrumb(Node node) - { - List location = navigator.getLocation(); - IBreadcrumbHandler handler = location.get(location.size() - 1); - if (handler instanceof IRepoBreadcrumbHandler) - { - // see if the current breadcrumb location is our node - if ( ((IRepoBreadcrumbHandler)handler).getNodeRef().equals(node.getNodeRef()) == true ) - { - location.remove(location.size() - 1); - - // now work out which node to set the list to refresh against - if (location.size() != 0) - { - handler = location.get(location.size() - 1); - - if (handler instanceof IRepoBreadcrumbHandler) - { - // change the current node Id - navigator.setCurrentNodeId(((IRepoBreadcrumbHandler)handler).getNodeRef().getId()); - } - else - { - // if we don't have access to the NodeRef to go to next then go to the home space - navigator.processToolbarLocation(NavigationBean.LOCATION_HOME, false); - } - } - else - { - // if there is no breadcrumb left go to the user's home space - navigator.processToolbarLocation(NavigationBean.LOCATION_HOME, false); - } - } - } - } - - /** - * Support for refresh of lists via special case for an External Access URL. - * these URLs restart the JSF lifecycle but an old UIRichList is restored from - * the component tree - which needs clearing "late" in the lifecycle process. - */ - public void externalAccessRefresh() - { - this.externalForceRefresh = true; - } - - /** - * 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); - } - } - - - // ------------------------------------------------------------------------------ - // Private helpers - - /** - * Initialise default values from client configuration - */ - private void initFromClientConfig() - { - // TODO - review implications of these default values on dynamic/MT client: viewsConfig & browseViewMode, as well as page size content/spaces ... - ConfigService config = Application.getConfigService(FacesContext.getCurrentInstance()); - - this.viewsConfig = (ViewsConfigElement)config.getConfig("Views"). - getConfigElement(ViewsConfigElement.CONFIG_ELEMENT_ID); - - this.browseViewMode = this.viewsConfig.getDefaultView(PAGE_NAME_BROWSE); - int pageSize = this.viewsConfig.getDefaultPageSize(PAGE_NAME_BROWSE, this.browseViewMode); - setPageSizeContent(pageSize); - setPageSizeSpaces(pageSize); - } - - /** - * @return the Set of NodeEventListeners registered against this bean - */ - private Set getNodeEventListeners() - { - if ((this.nodeEventListeners == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) - { - Set allNodeEventListeners = new HashSet(); - - if (Application.isDynamicConfig(FacesContext.getCurrentInstance()) && (this.nodeEventListeners != null)) - { - // for dynamic config, can add/remove node event listeners dynamically ... - // however, in case anyone is using public methods (add/removeNodeEventListener) - // we merge list here with list returned from the config - allNodeEventListeners.addAll(this.nodeEventListeners); - } - - FacesContext fc = FacesContext.getCurrentInstance(); - Config listenerConfig = Application.getConfigService(fc).getConfig("Node Event Listeners"); - if (listenerConfig != null) - { - ConfigElement listenerElement = listenerConfig.getConfigElement("node-event-listeners"); - if (listenerElement != null) - { - for (ConfigElement child : listenerElement.getChildren()) - { - if (child.getName().equals("listener")) - { - // retrieved the JSF Managed Bean identified in the config - String listenerName = child.getValue().trim(); - Object bean = FacesHelper.getManagedBean(fc, listenerName); - if (bean instanceof NodeEventListener) - { - allNodeEventListeners.add((NodeEventListener)bean); - } - } - } - } - } - - if (Application.isDynamicConfig(FacesContext.getCurrentInstance())) - { - return allNodeEventListeners; - } - else - { - this.nodeEventListeners = allNodeEventListeners; - } - } - return this.nodeEventListeners; - } - - /** - * Refresh the UI after a Space selection change. Adds the selected space to the breadcrumb - * location path and also updates the list components in the UI. - * - * @param ref NodeRef of the selected space - */ - public void updateUILocation(NodeRef ref) - { - // get the current breadcrumb location and append a new handler to it - // our handler know the ID of the selected node and the display label for it - List location = this.navigator.getLocation(); - if (location.size() != 0) - { - // attempt to find the ID - if it's already in the breadcrumb then we - // navigate directly to that node - rather than add duplication to the breadcrumb path - boolean foundNode = false; - for (int i=0; i newLocation = new ArrayList(i+1); - //newLocation.addAll(location.subList(0, i + 1)); - //this.navigator.setLocation(newLocation); - // TODO: but instead for now we do this: - int count = location.size(); - for (int n=i+1; n nodeEventListeners = null; - - /** Collapsable Panel state */ - private Map panels = new HashMap(4, 1.0f); - - /** Component references */ - protected UIRichList spacesRichList; - protected UIRichList contentRichList; - private UIStatusMessage statusMessage; - - /** Transient lists of container and content nodes for display */ - protected List containerNodes = null; - protected List contentNodes = null; - protected List parentContainerNodes = null; - - /** The current space and it's properties - if any */ - protected Node actionSpace; - - /** The current document */ - protected Node document; - - /** Special message to display when user deleting certain folders e.g. Company Home */ - private String deleteMessage; - - /** The current browse view mode - set to a well known IRichListRenderer identifier */ - private String browseViewMode; - - /** The current browse view page sizes */ - private int pageSizeSpaces; - private int pageSizeContent; - private String pageSizeSpacesStr; - private String pageSizeContentStr; - - /** True if current space has a dashboard (template) view available */ - private boolean dashboardView; - - private boolean externalForceRefresh = false; -} +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.Serializable; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; + +import javax.faces.context.FacesContext; +import javax.faces.event.ActionEvent; +import javax.transaction.UserTransaction; + +import org.alfresco.config.Config; +import org.alfresco.config.ConfigElement; +import org.alfresco.config.ConfigService; +import org.alfresco.model.ApplicationModel; +import org.alfresco.model.ContentModel; +import org.alfresco.repo.search.SearcherException; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.dictionary.TypeDefinition; +import org.alfresco.service.cmr.lock.LockService; +import org.alfresco.service.cmr.ml.MultilingualContentService; +import org.alfresco.service.cmr.model.FileFolderService; +import org.alfresco.service.cmr.model.FileInfo; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +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.cmr.repository.NodeService; +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.PermissionService; +import org.alfresco.service.namespace.QName; +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.content.DocumentDetailsDialog; +import org.alfresco.web.bean.repository.MapNode; +import org.alfresco.web.bean.repository.Node; +import org.alfresco.web.bean.repository.NodePropertyResolver; +import org.alfresco.web.bean.repository.QNameNodeMap; +import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.bean.search.SearchContext; +import org.alfresco.web.bean.spaces.CreateSpaceWizard; +import org.alfresco.web.bean.users.UserPreferencesBean; +import org.alfresco.web.config.ClientConfigElement; +import org.alfresco.web.config.ViewsConfigElement; +import org.alfresco.web.ui.common.Utils; +import org.alfresco.web.ui.common.Utils.URLMode; +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.UIStatusMessage; +import org.alfresco.web.ui.common.component.UIPanel.ExpandedEvent; +import org.alfresco.web.ui.common.component.data.UIRichList; +import org.alfresco.web.ui.repo.component.IRepoBreadcrumbHandler; +import org.alfresco.web.ui.repo.component.UINodeDescendants; +import org.alfresco.web.ui.repo.component.UINodePath; +import org.alfresco.web.ui.repo.component.UISimpleSearch; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + + +/** + * Bean providing properties and behaviour for the main folder/document browse screen and + * search results screens. + * + * @author Kevin Roast + */ +public class BrowseBean implements IContextListener, Serializable +{ + private static final long serialVersionUID = -3234262484615161360L; + + /** Public JSF Bean name */ + public static final String BEAN_NAME = "BrowseBean"; + + + // ------------------------------------------------------------------------------ + // Construction + + /** + * Default Constructor + */ + public BrowseBean() + { + UIContextService.getInstance(FacesContext.getCurrentInstance()).registerBean(this); + + initFromClientConfig(); + } + + + // ------------------------------------------------------------------------------ + // 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 searchService The Searcher to set. + */ + public void setSearchService(SearchService searchService) + { + this.searchService = searchService; + } + + protected SearchService getSearchService() + { + if (searchService == null) + { + searchService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSearchService(); + } + return searchService; + } + + /** + * @param userPreferencesBean The UserPreferencesBean to set. + */ + public void setUserPreferencesBean(UserPreferencesBean userPreferencesBean) + { + this.userPreferencesBean = userPreferencesBean; + } + + /** + * @param lockService The Lock Service to set. + */ + public void setLockService(LockService lockService) + { + this.lockService = lockService; + } + + protected LockService getLockService() + { + if (lockService == null) + { + lockService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getLockService(); + } + return lockService; + } + + /** + * @param navigator The NavigationBean to set. + */ + public void setNavigator(NavigationBean navigator) + { + this.navigator = navigator; + } + + /** + * @param dictionaryService The DictionaryService to set. + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + protected DictionaryService getDictionaryService() + { + if (dictionaryService == null) + { + dictionaryService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService(); + } + return dictionaryService; + } + + /** + * @param multilingualContentService The Multilingual Content Service to set. + */ + public void setMultilingualContentService(MultilingualContentService multilingualContentService) + { + this.multilingualContentService = multilingualContentService; + } + + protected MultilingualContentService getMultilingualContentService() + { + if (multilingualContentService == null) + { + multilingualContentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMultilingualContentService(); + } + return multilingualContentService; + } + + /** + * @param fileFolderService The FileFolderService to set. + */ + public void setFileFolderService(FileFolderService fileFolderService) + { + this.fileFolderService = fileFolderService; + } + + protected FileFolderService getFileFolderService() + { + if (fileFolderService == null) + { + fileFolderService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getFileFolderService(); + } + return fileFolderService; + } + + /** + * @return Returns the browse View mode. See UIRichList + */ + public String getBrowseViewMode() + { + return this.browseViewMode; + } + + /** + * @param browseViewMode The browse View mode to set. See UIRichList. + */ + public void setBrowseViewMode(String browseViewMode) + { + this.browseViewMode = browseViewMode; + } + + /** + * @return Returns true if dashboard view is available for the current node. + */ + public boolean isDashboardView() + { + return this.dashboardView; + } + + /** + * @param dashboardView The dashboard view mode to set. + */ + public void setDashboardView(boolean dashboardView) + { + this.dashboardView = dashboardView; + if (dashboardView == true) + { + FacesContext fc = FacesContext.getCurrentInstance(); + fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dashboard"); + } + } + + public int getPageSizeContent() + { + return this.pageSizeContent; + } + + public void setPageSizeContent(int pageSizeContent) + { + this.pageSizeContent = pageSizeContent; + this.pageSizeContentStr = Integer.toString(pageSizeContent); + } + + public int getPageSizeSpaces() + { + return this.pageSizeSpaces; + } + + public void setPageSizeSpaces(int pageSizeSpaces) + { + this.pageSizeSpaces = pageSizeSpaces; + this.pageSizeSpacesStr = Integer.toString(pageSizeSpaces); + } + + public String getPageSizeContentStr() + { + return this.pageSizeContentStr; + } + + public void setPageSizeContentStr(String pageSizeContentStr) + { + this.pageSizeContentStr = pageSizeContentStr; + } + + public String getPageSizeSpacesStr() + { + return this.pageSizeSpacesStr; + } + + public void setPageSizeSpacesStr(String pageSizeSpacesStr) + { + this.pageSizeSpacesStr = pageSizeSpacesStr; + } + + /** + * @return Returns the minimum length of a valid search string. + */ + public static int getMinimumSearchLength() + { + return Application.getClientConfig(FacesContext.getCurrentInstance()).getSearchMinimum(); + } + + /** + * @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 Returns the Space Node being used for the current browse screen action. + */ + public Node getActionSpace() + { + return this.actionSpace; + } + + /** + * @param actionSpace Set the Space Node to be used for the current browse screen action. + */ + public void setActionSpace(Node actionSpace) + { + if (actionSpace != null) + { + for (NodeEventListener listener : getNodeEventListeners()) + { + listener.created(actionSpace, actionSpace.getType()); + } + } + this.actionSpace = actionSpace; + } + + /** + * @return The document node being used for the current operation + */ + public Node getDocument() + { + return this.document; + } + + /** + * @param document The document node to be used for the current operation + */ + public void setDocument(Node document) + { + if (document != null) + { + for (NodeEventListener listener : getNodeEventListeners()) + { + listener.created(document, document.getType()); + } + } + this.document = document; + } + + /** + * @param contentRichList The contentRichList to set. + */ + public void setContentRichList(UIRichList contentRichList) + { + this.contentRichList = contentRichList; + if (this.contentRichList != null) + { + this.contentRichList.setInitialSortColumn( + this.viewsConfig.getDefaultSortColumn(PAGE_NAME_BROWSE)); + this.contentRichList.setInitialSortDescending( + this.viewsConfig.hasDescendingSort(PAGE_NAME_BROWSE)); + } + // special case to handle an External Access URL + // these URLs restart the JSF lifecycle but an old UIRichList is restored from + // the component tree - which needs clearing "late" in the lifecycle process + if (externalForceRefresh) + { + this.contentRichList.setValue(null); + externalForceRefresh = false; + } + } + + /** + * @return Returns the contentRichList. + */ + public UIRichList getContentRichList() + { + return this.contentRichList; + } + + /** + * @param spacesRichList The spacesRichList to set. + */ + public void setSpacesRichList(UIRichList spacesRichList) + { + this.spacesRichList = spacesRichList; + if (this.spacesRichList != null) + { + // set the initial sort column and direction + this.spacesRichList.setInitialSortColumn( + this.viewsConfig.getDefaultSortColumn(PAGE_NAME_BROWSE)); + this.spacesRichList.setInitialSortDescending( + this.viewsConfig.hasDescendingSort(PAGE_NAME_BROWSE)); + } + if (externalForceRefresh) + { + this.spacesRichList.setValue(null); + } + } + + /** + * @return Returns the spacesRichList. + */ + public UIRichList getSpacesRichList() + { + return this.spacesRichList; + } + + /** + * @return Returns the statusMessage component. + */ + public UIStatusMessage getStatusMessage() + { + return this.statusMessage; + } + + /** + * @param statusMessage The statusMessage component to set. + */ + public void setStatusMessage(UIStatusMessage statusMessage) + { + this.statusMessage = statusMessage; + } + + /** + * @return Returns the deleteMessage. + */ + public String getDeleteMessage() + { + return this.deleteMessage; + } + + /** + * @param deleteMessage The deleteMessage to set. + */ + public void setDeleteMessage(String deleteMessage) + { + this.deleteMessage = deleteMessage; + } + + /** + * Page accessed bean method to get the container nodes currently being browsed + * + * @return List of container Node objects for the current browse location + */ + public List getNodes() + { + // the references to container nodes and content nodes are transient for one use only + // we do this so we only query/search once - as we cannot distinguish between node types + // until after the query. The logic is a bit confusing but otherwise we would need to + // perform the same query or search twice for every screen refresh. + if (this.containerNodes == null) + { + if (this.navigator.getSearchContext() == null) + { + queryBrowseNodes(this.navigator.getCurrentNodeId()); + } + else + { + searchBrowseNodes(this.navigator.getSearchContext()); + } + } + List result = this.containerNodes; + + // we clear the member variable during invalidateComponents() + + return result; + } + + /** + * Page accessed bean method to get the content nodes currently being browsed + * + * @return List of content Node objects for the current browse location + */ + public List getContent() + { + // see comment in getNodes() above for reasoning here + if (this.contentNodes == null) + { + if (this.navigator.getSearchContext() == null) + { + queryBrowseNodes(this.navigator.getCurrentNodeId()); + } + else + { + searchBrowseNodes(this.navigator.getSearchContext()); + } + } + List result = this.contentNodes; + + // we clear the member variable during invalidateComponents() + + return result; + } + + /** + * Page accessed bean method to get the parent container nodes currently being browsed + * + * @return List of parent container Node objects for the current browse location + */ + public List getParentNodes(NodeRef currNodeRef) + { + // As per AWC-1507 there are two scenarios for navigating to the space details. First + // scenario is to show space details of the current space. Second scenario is to show + // space details of a child space of the current space. For now, added an extra query + // so that existing context remains unaffected for second scenario, although it does + // mean that in first scenario there will be an extra query even though parentContainerNodes + // and containerNodes will contain the same list. + + if (this.parentContainerNodes == null) + { + long startTime = 0; + if (logger.isDebugEnabled()) + startTime = System.currentTimeMillis(); + + UserTransaction tx = null; + try + { + FacesContext context = FacesContext.getCurrentInstance(); + tx = Repository.getUserTransaction(context, true); + tx.begin(); + + NodeRef parentRef = getNodeService().getPrimaryParent(currNodeRef).getParentRef(); + + List children = this.getFileFolderService().list(parentRef); + this.parentContainerNodes = new ArrayList(children.size()); + for (FileInfo fileInfo : children) + { + // create our Node representation from the NodeRef + NodeRef nodeRef = fileInfo.getNodeRef(); + + // 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 + TypeDefinition typeDef = this.getDictionaryService().getType(type); + + if (typeDef != null) + { + MapNode node = null; + + // look for Space folder node + if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_FOLDER) == true && + this.getDictionaryService().isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false) + { + // create our Node representation + node = new MapNode(nodeRef, this.getNodeService(), fileInfo.getProperties()); + node.addPropertyResolver("icon", this.resolverSpaceIcon); + node.addPropertyResolver("smallIcon", this.resolverSmallIcon); + + this.parentContainerNodes.add(node); + } + else if (ApplicationModel.TYPE_FOLDERLINK.equals(type)) + { + // create our Folder Link Node representation + node = new MapNode(nodeRef, this.getNodeService(), fileInfo.getProperties()); + node.addPropertyResolver("icon", this.resolverSpaceIcon); + node.addPropertyResolver("smallIcon", this.resolverSmallIcon); + + this.parentContainerNodes.add(node); + } + } + else + { + if (logger.isWarnEnabled()) + logger.warn("Found invalid object in database: id = " + nodeRef + ", type = " + type); + } + } + + // commit the transaction + tx.commit(); + } + catch (InvalidNodeRefException refErr) + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage( + FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {refErr.getNodeRef()}), refErr ); + this.parentContainerNodes = Collections.emptyList(); + try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} + } + catch (Throwable err) + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage( + FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); + this.parentContainerNodes = Collections.emptyList(); + try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} + } + + if (logger.isDebugEnabled()) + { + long endTime = System.currentTimeMillis(); + logger.debug("Time to query and build map parent nodes: " + (endTime - startTime) + "ms"); + } + } + + List result = this.parentContainerNodes; + + // we clear the member variable during invalidateComponents() + + return result; + } + + + /** + * Setup the common properties required at data-binding time. + *

+ * These are properties used by components on the page when iterating over the nodes. + * The properties are available as the Node is a Map so they can be accessed directly + * by name. Information such as download URL, size and filetype are provided etc. + *

+ * We use a set of anonymous inner classes to provide the implemention for the property + * getters. The interfaces are only called when the properties are first requested. + * + * @param node Node to add the properties too + */ + public void setupCommonBindingProperties(Node node) + { + // special properties to be used by the value binding components on the page + node.addPropertyResolver("url", this.resolverUrl); + node.addPropertyResolver("webdavUrl", this.resolverWebdavUrl); + node.addPropertyResolver("cifsPath", this.resolverCifsPath); + node.addPropertyResolver("fileType16", this.resolverFileType16); + node.addPropertyResolver("fileType32", this.resolverFileType32); + node.addPropertyResolver("size", this.resolverSize); + node.addPropertyResolver("lang", this.resolverLang); + } + + + // ------------------------------------------------------------------------------ + // IContextListener implementation + + /** + * @see org.alfresco.web.app.context.IContextListener#contextUpdated() + */ + public void contextUpdated() + { + invalidateComponents(); + } + + /** + * @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 + } + + + // ------------------------------------------------------------------------------ + // NodeEventListener listeners + + /** + * Add a listener to those called by the BrowseBean when nodes are created + */ + public void addNodeEventListener(NodeEventListener listener) + { + if (this.nodeEventListeners == null) + { + this.nodeEventListeners = new HashSet(); + } + this.nodeEventListeners.add(listener); + } + + /** + * Remove a listener from the list of those called by BrowseBean + */ + public void removeNodeEventListener(NodeEventListener listener) + { + if (this.nodeEventListeners != null) + { + this.nodeEventListeners.remove(listener); + } + } + + + // ------------------------------------------------------------------------------ + // Navigation action event handlers + + /** + * Change the current view mode based on user selection + * + * @param event ActionEvent + */ + public void viewModeChanged(ActionEvent event) + { + UIModeList viewList = (UIModeList)event.getComponent(); + + // get the view mode ID + String viewMode = viewList.getValue().toString(); + + if (VIEWMODE_DASHBOARD.equals(viewMode) == false) + { + // set the page size based on the style of display + int pageSize = this.viewsConfig.getDefaultPageSize(PAGE_NAME_BROWSE, viewMode); + setPageSizeContent(pageSize); + setPageSizeSpaces(pageSize); + + if (logger.isDebugEnabled()) + logger.debug("Browse view page size set to: " + pageSize); + + setDashboardView(false); + + // push the view mode into the lists + setBrowseViewMode(viewMode); + + // setup dispatch context for custom views + this.navigator.setupDispatchContext(this.navigator.getCurrentNode()); + + // browse to appropriate view + FacesContext fc = FacesContext.getCurrentInstance(); + String outcome = null; + String viewId = fc.getViewRoot().getViewId(); + if (viewId.equals(BROWSE_VIEW_ID) == false && viewId.equals(CATEGORY_VIEW_ID) == false) + { + outcome = "browse"; + } + fc.getApplication().getNavigationHandler().handleNavigation(fc, null, outcome); + } + else + { + // special case for Dashboard view + setDashboardView(true); + } + } + + + // ------------------------------------------------------------------------------ + // Helper methods + + /** + * Query a list of nodes for the specified parent node Id + * + * @param parentNodeId Id of the parent node or null for the root node + */ + private void queryBrowseNodes(String parentNodeId) + { + long startTime = 0; + if (logger.isDebugEnabled()) + startTime = System.currentTimeMillis(); + + UserTransaction tx = null; + try + { + FacesContext context = FacesContext.getCurrentInstance(); + tx = Repository.getUserTransaction(context, true); + tx.begin(); + + NodeRef parentRef; + if (parentNodeId == null) + { + // no specific parent node specified - use the root node + parentRef = this.getNodeService().getRootNode(Repository.getStoreRef()); + } + else + { + // build a NodeRef for the specified Id and our store + parentRef = new NodeRef(Repository.getStoreRef(), parentNodeId); + } + + List children = this.getFileFolderService().list(parentRef); + this.containerNodes = new ArrayList(children.size()); + this.contentNodes = new ArrayList(children.size()); + + // in case of dynamic config, only lookup once + Set nodeEventListeners = getNodeEventListeners(); + + for (FileInfo fileInfo : children) + { + // create our Node representation from the NodeRef + NodeRef nodeRef = fileInfo.getNodeRef(); + + // 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 + TypeDefinition typeDef = this.getDictionaryService().getType(type); + + if (typeDef != null) + { + MapNode node = null; + + // look for File content node + if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_CONTENT)) + { + // create our Node representation + node = new MapNode(nodeRef, this.getNodeService(), fileInfo.getProperties()); + setupCommonBindingProperties(node); + + this.contentNodes.add(node); + } + // look for Space folder node + else if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_FOLDER) == true && + this.getDictionaryService().isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false) + { + // create our Node representation + node = new MapNode(nodeRef, this.getNodeService(), fileInfo.getProperties()); + node.addPropertyResolver("icon", this.resolverSpaceIcon); + node.addPropertyResolver("smallIcon", this.resolverSmallIcon); + + this.containerNodes.add(node); + } + // look for File Link object node + else if (ApplicationModel.TYPE_FILELINK.equals(type)) + { + // create our File Link Node representation + node = new MapNode(nodeRef, this.getNodeService(), fileInfo.getProperties()); + // only display the user has the permissions to navigate to the target of the link + NodeRef destRef = (NodeRef)node.getProperties().get(ContentModel.PROP_LINK_DESTINATION); + if (destRef != null && new Node(destRef).hasPermission(PermissionService.READ) == true) + { + node.addPropertyResolver("url", this.resolverLinkUrl); + node.addPropertyResolver("webdavUrl", this.resolverLinkWebdavUrl); + node.addPropertyResolver("cifsPath", this.resolverLinkCifsPath); + node.addPropertyResolver("fileType16", this.resolverFileType16); + node.addPropertyResolver("fileType32", this.resolverFileType32); + node.addPropertyResolver("size", this.resolverSize); + node.addPropertyResolver("lang", this.resolverLang); + + this.contentNodes.add(node); + } + } + else if (ApplicationModel.TYPE_FOLDERLINK.equals(type)) + { + // create our Folder Link Node representation + node = new MapNode(nodeRef, this.getNodeService(), fileInfo.getProperties()); + // only display the user has the permissions to navigate to the target of the link + NodeRef destRef = (NodeRef)node.getProperties().get(ContentModel.PROP_LINK_DESTINATION); + if (destRef != null && new Node(destRef).hasPermission(PermissionService.READ) == true) + { + node.addPropertyResolver("icon", this.resolverSpaceIcon); + node.addPropertyResolver("smallIcon", this.resolverSmallIcon); + + this.containerNodes.add(node); + } + } + + // inform any listeners that a Node wrapper has been created + if (node != null) + { + for (NodeEventListener listener : nodeEventListeners) + { + listener.created(node, type); + } + } + } + else + { + if (logger.isWarnEnabled()) + logger.warn("Found invalid object in database: id = " + nodeRef + ", type = " + type); + } + } + + // commit the transaction + tx.commit(); + } + catch (InvalidNodeRefException refErr) + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage( + FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {refErr.getNodeRef()}), refErr ); + this.containerNodes = Collections.emptyList(); + this.contentNodes = Collections.emptyList(); + try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} + } + catch (Throwable err) + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage( + FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); + this.containerNodes = Collections.emptyList(); + this.contentNodes = Collections.emptyList(); + try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} + } + + if (logger.isDebugEnabled()) + { + long endTime = System.currentTimeMillis(); + logger.debug("Time to query and build map nodes: " + (endTime - startTime) + "ms"); + } + } + + /** + * Search for a list of nodes using the specific search context + * + * @param searchContext To use to perform the search + */ + private void searchBrowseNodes(SearchContext searchContext) + { + long startTime = 0; + if (logger.isDebugEnabled()) + startTime = System.currentTimeMillis(); + + // get the searcher object to build the query + String query = searchContext.buildQuery(getMinimumSearchLength()); + if (query == 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(), MSG_SEARCH_MINIMUM), + new Object[] {getMinimumSearchLength()})); + this.containerNodes = Collections.emptyList(); + this.contentNodes = Collections.emptyList(); + return; + } + + // perform the search against the repo + UserTransaction tx = null; + ResultSet results = null; + try + { + tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); + tx.begin(); + + // build up the search parameters + SearchParameters sp = new SearchParameters(); + sp.setLanguage(SearchService.LANGUAGE_LUCENE); + sp.setQuery(query); + sp.addStore(Repository.getStoreRef()); + + // limit search results size as configured + int searchLimit = Application.getClientConfig(FacesContext.getCurrentInstance()).getSearchMaxResults(); + if (searchLimit > 0) + { + sp.setLimitBy(LimitBy.FINAL_SIZE); + sp.setLimit(searchLimit); + } + + results = this.getSearchService().query(sp); + if (logger.isDebugEnabled()) + logger.debug("Search results returned: " + results.length()); + + // create a list of items from the results + this.containerNodes = new ArrayList(results.length()); + this.contentNodes = new ArrayList(results.length()); + if (results.length() != 0) + { + // in case of dynamic config, only lookup once + Set nodeEventListeners = getNodeEventListeners(); + + for (ResultSetRow row: results) + { + NodeRef nodeRef = row.getNodeRef(); + + 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); + + // make sure the type is defined in the data dictionary + TypeDefinition typeDef = this.getDictionaryService().getType(type); + + if (typeDef != null) + { + MapNode node = null; + + // look for Space or File nodes + if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_FOLDER) && + this.getDictionaryService().isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false) + { + // create our Node representation + node = new MapNode(nodeRef, this.getNodeService(), false); + + node.addPropertyResolver("path", this.resolverPath); + node.addPropertyResolver("displayPath", this.resolverDisplayPath); + node.addPropertyResolver("icon", this.resolverSpaceIcon); + node.addPropertyResolver("smallIcon", this.resolverSmallIcon); + + this.containerNodes.add(node); + } + else if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_CONTENT)) + { + // create our Node representation + node = new MapNode(nodeRef, this.getNodeService(), false); + + setupCommonBindingProperties(node); + + node.addPropertyResolver("path", this.resolverPath); + node.addPropertyResolver("displayPath", this.resolverDisplayPath); + + this.contentNodes.add(node); + } + // look for File Link object node + else if (ApplicationModel.TYPE_FILELINK.equals(type)) + { + // create our File Link Node representation + node = new MapNode(nodeRef, this.getNodeService(), false); + // only display the user has the permissions to navigate to the target of the link + NodeRef destRef = (NodeRef)node.getProperties().get(ContentModel.PROP_LINK_DESTINATION); + if (new Node(destRef).hasPermission(PermissionService.READ) == true) + { + node.addPropertyResolver("url", this.resolverLinkUrl); + node.addPropertyResolver("webdavUrl", this.resolverLinkWebdavUrl); + node.addPropertyResolver("cifsPath", this.resolverLinkCifsPath); + node.addPropertyResolver("fileType16", this.resolverFileType16); + node.addPropertyResolver("fileType32", this.resolverFileType32); + node.addPropertyResolver("size", this.resolverSize); + node.addPropertyResolver("lang", this.resolverLang); + node.addPropertyResolver("path", this.resolverPath); + node.addPropertyResolver("displayPath", this.resolverDisplayPath); + + this.contentNodes.add(node); + } + } + else if (ApplicationModel.TYPE_FOLDERLINK.equals(type)) + { + // create our Folder Link Node representation + node = new MapNode(nodeRef, this.getNodeService(), false); + // only display the user has the permissions to navigate to the target of the link + NodeRef destRef = (NodeRef)node.getProperties().get(ContentModel.PROP_LINK_DESTINATION); + if (new Node(destRef).hasPermission(PermissionService.READ) == true) + { + node.addPropertyResolver("icon", this.resolverSpaceIcon); + node.addPropertyResolver("smallIcon", this.resolverSmallIcon); + node.addPropertyResolver("path", this.resolverPath); + node.addPropertyResolver("displayPath", this.resolverDisplayPath); + + this.containerNodes.add(node); + } + } + + // inform any listeners that a Node wrapper has been created + if (node != null) + { + for (NodeEventListener listener : nodeEventListeners) + { + listener.created(node, type); + } + } + } + else + { + if (logger.isWarnEnabled()) + logger.warn("Found invalid object in database: id = " + nodeRef + ", type = " + type); + } + } + else + { + if (logger.isWarnEnabled()) + logger.warn("Missing object returned from search indexes: id = " + nodeRef + " search query: " + query); + } + } + } + + // commit the transaction + tx.commit(); + } + catch (InvalidNodeRefException refErr) + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage( + FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {refErr.getNodeRef()}), refErr ); + this.containerNodes = Collections.emptyList(); + this.contentNodes = Collections.emptyList(); + try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} + } + catch (SearcherException serr) + { + logger.info("Search failed for: " + query, serr); + Utils.addErrorMessage(Application.getMessage( + FacesContext.getCurrentInstance(), Repository.ERROR_QUERY)); + this.containerNodes = Collections.emptyList(); + this.contentNodes = Collections.emptyList(); + try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} + } + catch (Throwable err) + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage( + FacesContext.getCurrentInstance(), Repository.ERROR_SEARCH), new Object[] {err.getMessage()}), err ); + this.containerNodes = Collections.emptyList(); + this.contentNodes = Collections.emptyList(); + try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} + } + finally + { + if (results != null) + { + results.close(); + } + } + + if (logger.isDebugEnabled()) + { + long endTime = System.currentTimeMillis(); + logger.debug("Time to query and build map nodes: " + (endTime - startTime) + "ms"); + } + } + + + // ------------------------------------------------------------------------------ + // Property Resolvers + + public NodePropertyResolver resolverDownload = new NodePropertyResolver() { + private static final long serialVersionUID = 4048859853585650378L; + + public Object get(Node node) { + return DownloadContentServlet.generateDownloadURL(node.getNodeRef(), node.getName()); + } + }; + + public NodePropertyResolver resolverUrl = new NodePropertyResolver() { + private static final long serialVersionUID = -5264085143622470386L; + + public Object get(Node node) { + return DownloadContentServlet.generateBrowserURL(node.getNodeRef(), node.getName()); + } + }; + + public NodePropertyResolver resolverWebdavUrl = new NodePropertyResolver() { + private static final long serialVersionUID = 9127234483419089006L; + + public Object get(Node node) { + return Utils.generateURL(FacesContext.getCurrentInstance(), node, URLMode.WEBDAV); + } + }; + + public NodePropertyResolver resolverCifsPath = new NodePropertyResolver() { + private static final long serialVersionUID = -5804924617772163104L; + + public Object get(Node node) { + return Utils.generateURL(FacesContext.getCurrentInstance(), node, URLMode.CIFS); + } + }; + + public NodePropertyResolver resolverLinkDownload = new NodePropertyResolver() { + private static final long serialVersionUID = 7208696954599958859L; + + public Object get(Node node) { + NodeRef destRef = (NodeRef)node.getProperties().get(ContentModel.PROP_LINK_DESTINATION); + if (getNodeService().exists(destRef) == true) + { + String destName = Repository.getNameForNode(getNodeService(), destRef); + return DownloadContentServlet.generateDownloadURL(node.getNodeRef(), destName); + } + else + { + // TODO: link object is missing - navigate to a page with appropriate message + return "#"; + } + } + }; + + public NodePropertyResolver resolverLinkUrl = new NodePropertyResolver() { + private static final long serialVersionUID = -1280702397805414147L; + + public Object get(Node node) { + NodeRef destRef = (NodeRef)node.getProperties().get(ContentModel.PROP_LINK_DESTINATION); + if (getNodeService().exists(destRef) == true) + { + String destName = Repository.getNameForNode(getNodeService(), destRef); + return DownloadContentServlet.generateBrowserURL(destRef, destName); + } + else + { + // TODO: link object is missing - navigate to a page with appropriate message + return "#"; + } + } + }; + + public NodePropertyResolver resolverLinkWebdavUrl = new NodePropertyResolver() { + private static final long serialVersionUID = -3097558079118837397L; + + public Object get(Node node) { + NodeRef destRef = (NodeRef)node.getProperties().get(ContentModel.PROP_LINK_DESTINATION); + if (getNodeService().exists(destRef) == true) + { + return Utils.generateURL(FacesContext.getCurrentInstance(), new Node(destRef), URLMode.WEBDAV); + } + else + { + // TODO: link object is missing - navigate to a page with appropriate message + return "#"; + } + } + }; + + public NodePropertyResolver resolverLinkCifsPath = new NodePropertyResolver() { + private static final long serialVersionUID = 673020173327603487L; + + public Object get(Node node) { + NodeRef destRef = (NodeRef)node.getProperties().get(ContentModel.PROP_LINK_DESTINATION); + if (getNodeService().exists(destRef) == true) + { + return Utils.generateURL(FacesContext.getCurrentInstance(), new Node(destRef), URLMode.CIFS); + } + else + { + // TODO: link object is missing - navigate to a page with appropriate message + return "#"; + } + } + }; + + public NodePropertyResolver resolverFileType16 = new NodePropertyResolver() { + private static final long serialVersionUID = -2690520488415178029L; + + public Object get(Node node) { + return Utils.getFileTypeImage(node.getName(), true); + } + }; + + public NodePropertyResolver resolverFileType32 = new NodePropertyResolver() { + private static final long serialVersionUID = 1991254398502584389L; + + public Object get(Node node) { + return Utils.getFileTypeImage(node.getName(), false); + } + }; + + public NodePropertyResolver resolverPath = new NodePropertyResolver() { + private static final long serialVersionUID = 8008094870888545035L; + + public Object get(Node node) { + return node.getNodePath(); + } + }; + + public NodePropertyResolver resolverDisplayPath = new NodePropertyResolver() { + private static final long serialVersionUID = -918422848579179425L; + + public Object get(Node node) { + // TODO: replace this with a method that shows the full display name - not QNames? + return Repository.getDisplayPath(node.getNodePath()); + } + }; + + public NodePropertyResolver resolverSpaceIcon = new NodePropertyResolver() { + private static final long serialVersionUID = -5644418026591098018L; + + public Object get(Node node) { + QNameNodeMap props = (QNameNodeMap)node.getProperties(); + String icon = (String)props.getRaw("app:icon"); + return (icon != null ? icon : CreateSpaceWizard.DEFAULT_SPACE_ICON_NAME); + } + }; + + public NodePropertyResolver resolverSmallIcon = new NodePropertyResolver() { + private static final long serialVersionUID = -150483121767183580L; + + public Object get(Node node) { + QNameNodeMap props = (QNameNodeMap)node.getProperties(); + String icon = (String)props.getRaw("app:icon"); + return (icon != null ? icon + "-16" : SPACE_SMALL_DEFAULT); + } + }; + + public NodePropertyResolver resolverMimetype = new NodePropertyResolver() { + private static final long serialVersionUID = -8864267975247235172L; + + public Object get(Node node) { + ContentData content = (ContentData)node.getProperties().get(ContentModel.PROP_CONTENT); + return (content != null ? content.getMimetype() : null); + } + }; + + public NodePropertyResolver resolverEncoding = new NodePropertyResolver() { + private static final long serialVersionUID = -1130974681844152101L; + + public Object get(Node node) { + ContentData content = (ContentData)node.getProperties().get(ContentModel.PROP_CONTENT); + return (content != null ? content.getEncoding() : null); + } + }; + + public NodePropertyResolver resolverSize = new NodePropertyResolver() { + private static final long serialVersionUID = 1273541660444385276L; + + public Object get(Node node) { + ContentData content = (ContentData)node.getProperties().get(ContentModel.PROP_CONTENT); + return (content != null ? new Long(content.getSize()) : 0L); + } + }; + + public NodePropertyResolver resolverLang = new NodePropertyResolver() { + + private static final long serialVersionUID = 5412446489528560367L; + + public Object get(Node node) { + + String lang = null; + + if (node.getAspects().contains(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT)) + { + Locale locale = null; + + if(node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION)) + { + // if the translation is empty, the lang of the content is the lang of it's pivot. + NodeRef pivot = getMultilingualContentService().getPivotTranslation(node.getNodeRef()); + locale = (Locale) getNodeService().getProperty(pivot, ContentModel.PROP_LOCALE); + } + else + { + locale = (Locale) node.getProperties().get(ContentModel.PROP_LOCALE); + } + // the content filter lang defined by the user + String userLang = userPreferencesBean.getContentFilterLanguage(); + // the node lang + String nodeLang = locale.getLanguage(); + + // if filter equals all languages : display the lang for each translation + if (nodeLang == null) + { + lang = nodeLang; + } + + // if filter is different : display the lang + else if (!nodeLang.equalsIgnoreCase(userLang)) + { + lang = nodeLang; + } + + // else if the filter is equal to the lang node : nothing to do [lang = null] + } + + return lang; + } + }; + + + // ------------------------------------------------------------------------------ + // Navigation action event handlers + + /** + * Action called from the Simple Search component. + * Sets up the SearchContext object with the values from the simple search menu. + */ + public void search(ActionEvent event) + { + // setup the search text string on the top-level navigation handler + UISimpleSearch search = (UISimpleSearch)event.getComponent(); + this.navigator.setSearchContext(search.getSearchContext()); + + navigateBrowseScreen(); + } + + /** + * Action called to Close the search dialog by returning to the last view node Id + */ + public void closeSearch(ActionEvent event) + { + // set the current node Id ready for page refresh + this.navigator.setCurrentNodeId( this.navigator.getCurrentNodeId() ); + } + + /** + * Update page size based on user selection + */ + public void updateSpacesPageSize(ActionEvent event) + { + try + { + int size = Integer.parseInt(this.pageSizeSpacesStr); + if (size >= 0) + { + this.pageSizeSpaces = size; + } + else + { + // reset to known value if this occurs + this.pageSizeSpacesStr = Integer.toString(this.pageSizeSpaces); + } + } + catch (NumberFormatException err) + { + // reset to known value if this occurs + this.pageSizeSpacesStr = Integer.toString(this.pageSizeSpaces); + } + } + + /** + * Update page size based on user selection + */ + public void updateContentPageSize(ActionEvent event) + { + try + { + int size = Integer.parseInt(this.pageSizeContentStr); + if (size >= 0) + { + this.pageSizeContent = size; + } + else + { + // reset to known value if this occurs + this.pageSizeContentStr = Integer.toString(this.pageSizeContent); + } + } + catch (NumberFormatException err) + { + // reset to known value if this occurs + this.pageSizeContentStr = Integer.toString(this.pageSizeContent); + } + } + + /** + * Action called when a folder space is clicked. + * Navigate into the space. + */ + public void clickSpace(ActionEvent event) + { + UIActionLink link = (UIActionLink)event.getComponent(); + Map params = link.getParameterMap(); + String id = params.get("id"); + if (id != null && id.length() != 0) + { + try + { + NodeRef ref = new NodeRef(Repository.getStoreRef(), id); + + // handle special folder link node case + if (ApplicationModel.TYPE_FOLDERLINK.equals(this.getNodeService().getType(ref))) + { + ref = (NodeRef)this.getNodeService().getProperty(ref, ContentModel.PROP_LINK_DESTINATION); + } + + clickSpace(ref); + } + catch (InvalidNodeRefException refErr) + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage( + FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {id}) ); + } + } + } + + /** + * Action called when a folder space is clicked. + * + * @param nodeRef The node being clicked + */ + public void clickSpace(NodeRef nodeRef) + { + // refresh UI based on node selection + updateUILocation(nodeRef); + } + + /** + * Handler called when a path element is clicked - navigate to the appropriate Space + */ + public void clickSpacePath(ActionEvent event) + { + UINodePath.PathElementEvent pathEvent = (UINodePath.PathElementEvent)event; + NodeRef ref = pathEvent.NodeReference; + try + { + // refresh UI based on node selection + this.updateUILocation(ref); + } + catch (InvalidNodeRefException refErr) + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage( + FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {ref.getId()}) ); + } + } + + /** + * Action called when a folders direct descendant (in the 'list' browse mode) is clicked. + * Navigate into the the descendant space. + */ + public void clickDescendantSpace(ActionEvent event) + { + UINodeDescendants.NodeSelectedEvent nodeEvent = (UINodeDescendants.NodeSelectedEvent)event; + NodeRef nodeRef = nodeEvent.NodeReference; + if (nodeRef == null) + { + throw new IllegalStateException("NodeRef returned from UINodeDescendants.NodeSelectedEvent cannot be null!"); + } + + if (logger.isDebugEnabled()) + logger.debug("Selected noderef Id: " + nodeRef.getId()); + + try + { + // user can either select a descendant of a node display on the page which means we + // must add the it's parent and itself to the breadcrumb + ChildAssociationRef parentAssocRef = getNodeService().getPrimaryParent(nodeRef); + + if (logger.isDebugEnabled()) + { + logger.debug("Selected item getPrimaryParent().getChildRef() noderef Id: " + parentAssocRef.getChildRef().getId()); + logger.debug("Selected item getPrimaryParent().getParentRef() noderef Id: " + parentAssocRef.getParentRef().getId()); + logger.debug("Current value getNavigator().getCurrentNodeId() noderef Id: " + this.navigator.getCurrentNodeId()); + } + + if (nodeEvent.IsParent == false) + { + // a descendant of the displayed node was selected + // first refresh based on the parent and add to the breadcrumb + updateUILocation(parentAssocRef.getParentRef()); + + // now add our selected node + updateUILocation(nodeRef); + } + else + { + // else the parent ellipses i.e. the displayed node was selected + updateUILocation(nodeRef); + } + } + catch (InvalidNodeRefException refErr) + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage( + FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {nodeRef.getId()}) ); + } + } + + /** + * Action event called by all Browse actions that need to setup a Space context + * before an action page/wizard is called. The context will be a Node in setActionSpace() which + * can be retrieved on the action page from BrowseBean.getActionSpace(). + * + * @param event ActionEvent + */ + public void setupSpaceAction(ActionEvent event) + { + UIActionLink link = (UIActionLink)event.getComponent(); + Map params = link.getParameterMap(); + String id = params.get("id"); + setupSpaceAction(id, true); + } + + /** + * Public helper to setup action pages with Space context + * + * @param id of the Space node to setup context for + */ + public void setupSpaceAction(String id, boolean invalidate) + { + if (id != null && id.length() != 0) + { + if (logger.isDebugEnabled()) + logger.debug("Setup for action, setting current space to: " + id); + + try + { + // create the node ref, then our node representation + NodeRef ref = new NodeRef(Repository.getStoreRef(), id); + Node node = new Node(ref); + + // resolve icon in-case one has not been set + node.addPropertyResolver("icon", this.resolverSpaceIcon); + + // prepare a node for the action context + setActionSpace(node); + + // setup the dispatch context in case it is required + this.navigator.setupDispatchContext(node); + } + catch (InvalidNodeRefException refErr) + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage( + FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {id}) ); + } + } + else + { + setActionSpace(null); + } + + // clear the UI state in preparation for finishing the next action + if (invalidate == true) + { + // use the context service to notify all registered beans + UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); + } + } + + /** + * Acrtion event called by Delete Space actions. We setup the action space as normal, then prepare + * any special case message string to be shown to the user if they are trying to delete specific spaces. + */ + public void setupDeleteAction(ActionEvent event) + { + String message = null; + + setupSpaceAction(event); + + Node node = getActionSpace(); + if (node != null) + { + FacesContext fc = FacesContext.getCurrentInstance(); + NodeRef companyRootRef = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId(fc)); + if (node.getNodeRef().equals(companyRootRef)) + { + message = Application.getMessage(fc, MSG_DELETE_COMPANYROOT); + } + } + + setDeleteMessage(message); + } + + /** + * Action event called by all actions that need to setup a Content Document context on the + * BrowseBean before an action page/wizard is called. The context will be a Node in + * setDocument() which can be retrieved on the action page from BrowseBean.getDocument(). + */ + public void setupContentAction(ActionEvent event) + { + UIActionLink link = (UIActionLink)event.getComponent(); + Map params = link.getParameterMap(); + setupContentAction(params.get("id"), true); + } + + /** + * Action event called by all actions that need to setup a Multilingual Content Document context on the + * BrowseBean before an action page/wizard is called. The context will be a Node in + * setDocument() which can be retrieved on the action page from BrowseBean.getDocument(). + */ + public void setupMLContainerContentAction(ActionEvent event) + { + UIActionLink link = (UIActionLink)event.getComponent(); + Map params = link.getParameterMap(); + + String id = params.get("id"); + + NodeRef translation = new NodeRef(Repository.getStoreRef(), id); + + // remember the bean from wich the action comes + DocumentDetailsDialog docDetails = (DocumentDetailsDialog)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("DocumentDetailsDialog"); + docDetails.setTranslationDocument(new Node(translation)); + + // set the ml container as the current document + NodeRef mlContainer = getMultilingualContentService().getTranslationContainer(translation); + + setupContentAction(mlContainer.getId(), true); + } + + /** + * Public helper to setup action pages with content context + * + * @param id of the content node to setup context for + */ + public void setupContentAction(String id, boolean invalidate) + { + if (id != null && id.length() != 0) + { + if (logger.isDebugEnabled()) + logger.debug("Setup for action, setting current document to: " + id); + + try + { + // create the node ref, then our node representation + NodeRef ref = new NodeRef(Repository.getStoreRef(), id); + Node node = new Node(ref); + + // store the URL to for downloading the content + if (ApplicationModel.TYPE_FILELINK.equals(node.getType())) + { + node.addPropertyResolver("url", this.resolverLinkDownload); + } + else + { + node.addPropertyResolver("url", this.resolverDownload); + } + node.addPropertyResolver("fileType32", this.resolverFileType32); + node.addPropertyResolver("mimetype", this.resolverMimetype); + node.addPropertyResolver("encoding", this.resolverEncoding); + node.addPropertyResolver("size", this.resolverSize); + node.addPropertyResolver("lang", this.resolverLang); + + for (NodeEventListener listener : getNodeEventListeners()) + { + listener.created(node, node.getType()); + } + + // get hold of the DocumentDetailsDialog and reset it + DocumentDetailsDialog docDetails = (DocumentDetailsDialog)FacesContext.getCurrentInstance(). + getExternalContext().getSessionMap().get("DocumentDetailsDialog"); + if (docDetails != null) + { + docDetails.reset(); + } + + // remember the document + setDocument(node); + + // setup the dispatch context in case it is required + this.navigator.setupDispatchContext(node); + } + catch (InvalidNodeRefException refErr) + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage( + FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {id}) ); + } + } + else + { + setDocument(null); + } + + // clear the UI state in preparation for finishing the next action + if (invalidate == true) + { + // use the context service to notify all registered beans + UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); + } + } + + /** + * Removes the given node from the breadcrumb i.e. following a delete + * + * @param node The space to remove from the breadcrumb + */ + public void removeSpaceFromBreadcrumb(Node node) + { + List location = navigator.getLocation(); + IBreadcrumbHandler handler = location.get(location.size() - 1); + if (handler instanceof IRepoBreadcrumbHandler) + { + // see if the current breadcrumb location is our node + if ( ((IRepoBreadcrumbHandler)handler).getNodeRef().equals(node.getNodeRef()) == true ) + { + location.remove(location.size() - 1); + + // now work out which node to set the list to refresh against + if (location.size() != 0) + { + handler = location.get(location.size() - 1); + + if (handler instanceof IRepoBreadcrumbHandler) + { + // change the current node Id + navigator.setCurrentNodeId(((IRepoBreadcrumbHandler)handler).getNodeRef().getId()); + } + else + { + // if we don't have access to the NodeRef to go to next then go to the home space + navigator.processToolbarLocation(NavigationBean.LOCATION_HOME, false); + } + } + else + { + // if there is no breadcrumb left go to the user's home space + navigator.processToolbarLocation(NavigationBean.LOCATION_HOME, false); + } + } + } + } + + /** + * Support for refresh of lists via special case for an External Access URL. + * these URLs restart the JSF lifecycle but an old UIRichList is restored from + * the component tree - which needs clearing "late" in the lifecycle process. + */ + public void externalAccessRefresh() + { + this.externalForceRefresh = true; + } + + /** + * 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); + } + } + + + // ------------------------------------------------------------------------------ + // Private helpers + + /** + * Initialise default values from client configuration + */ + private void initFromClientConfig() + { + // TODO - review implications of these default values on dynamic/MT client: viewsConfig & browseViewMode, as well as page size content/spaces ... + ConfigService config = Application.getConfigService(FacesContext.getCurrentInstance()); + + this.viewsConfig = (ViewsConfigElement)config.getConfig("Views"). + getConfigElement(ViewsConfigElement.CONFIG_ELEMENT_ID); + + this.browseViewMode = this.viewsConfig.getDefaultView(PAGE_NAME_BROWSE); + int pageSize = this.viewsConfig.getDefaultPageSize(PAGE_NAME_BROWSE, this.browseViewMode); + setPageSizeContent(pageSize); + setPageSizeSpaces(pageSize); + } + + /** + * @return the Set of NodeEventListeners registered against this bean + */ + private Set getNodeEventListeners() + { + if ((this.nodeEventListeners == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) + { + Set allNodeEventListeners = new HashSet(); + + if (Application.isDynamicConfig(FacesContext.getCurrentInstance()) && (this.nodeEventListeners != null)) + { + // for dynamic config, can add/remove node event listeners dynamically ... + // however, in case anyone is using public methods (add/removeNodeEventListener) + // we merge list here with list returned from the config + allNodeEventListeners.addAll(this.nodeEventListeners); + } + + FacesContext fc = FacesContext.getCurrentInstance(); + Config listenerConfig = Application.getConfigService(fc).getConfig("Node Event Listeners"); + if (listenerConfig != null) + { + ConfigElement listenerElement = listenerConfig.getConfigElement("node-event-listeners"); + if (listenerElement != null) + { + for (ConfigElement child : listenerElement.getChildren()) + { + if (child.getName().equals("listener")) + { + // retrieved the JSF Managed Bean identified in the config + String listenerName = child.getValue().trim(); + Object bean = FacesHelper.getManagedBean(fc, listenerName); + if (bean instanceof NodeEventListener) + { + allNodeEventListeners.add((NodeEventListener)bean); + } + } + } + } + } + + if (Application.isDynamicConfig(FacesContext.getCurrentInstance())) + { + return allNodeEventListeners; + } + else + { + this.nodeEventListeners = allNodeEventListeners; + } + } + return this.nodeEventListeners; + } + + /** + * Refresh the UI after a Space selection change. Adds the selected space to the breadcrumb + * location path and also updates the list components in the UI. + * + * @param ref NodeRef of the selected space + */ + public void updateUILocation(NodeRef ref) + { + // get the current breadcrumb location and append a new handler to it + // our handler know the ID of the selected node and the display label for it + List location = this.navigator.getLocation(); + if (location.size() != 0) + { + // attempt to find the ID - if it's already in the breadcrumb then we + // navigate directly to that node - rather than add duplication to the breadcrumb path + boolean foundNode = false; + for (int i=0; i newLocation = new ArrayList(i+1); + //newLocation.addAll(location.subList(0, i + 1)); + //this.navigator.setLocation(newLocation); + // TODO: but instead for now we do this: + int count = location.size(); + for (int n=i+1; n nodeEventListeners = null; + + /** Collapsable Panel state */ + private Map panels = new HashMap(4, 1.0f); + + /** Component references */ + protected UIRichList spacesRichList; + protected UIRichList contentRichList; + private UIStatusMessage statusMessage; + + /** Transient lists of container and content nodes for display */ + protected List containerNodes = null; + protected List contentNodes = null; + protected List parentContainerNodes = null; + + /** The current space and it's properties - if any */ + protected Node actionSpace; + + /** The current document */ + protected Node document; + + /** Special message to display when user deleting certain folders e.g. Company Home */ + private String deleteMessage; + + /** The current browse view mode - set to a well known IRichListRenderer identifier */ + private String browseViewMode; + + /** The current browse view page sizes */ + private int pageSizeSpaces; + private int pageSizeContent; + private String pageSizeSpacesStr; + private String pageSizeContentStr; + + /** True if current space has a dashboard (template) view available */ + private boolean dashboardView; + + private boolean externalForceRefresh = false; +} \ No newline at end of file diff --git a/source/java/org/alfresco/web/bean/ErrorBean.java b/source/java/org/alfresco/web/bean/ErrorBean.java index 569f92af7e..bbd57a014b 100644 --- a/source/java/org/alfresco/web/bean/ErrorBean.java +++ b/source/java/org/alfresco/web/bean/ErrorBean.java @@ -25,6 +25,7 @@ package org.alfresco.web.bean; import java.io.PrintWriter; +import java.io.Serializable; import java.io.StringWriter; import javax.servlet.ServletException; @@ -34,8 +35,10 @@ import javax.servlet.ServletException; * * @author gavinc */ -public class ErrorBean +public class ErrorBean implements Serializable { + private static final long serialVersionUID = -5101720299256547100L; + public static final String ERROR_BEAN_NAME = "alfresco.ErrorBean"; private String returnPage; diff --git a/source/java/org/alfresco/web/bean/FileUploadBean.java b/source/java/org/alfresco/web/bean/FileUploadBean.java index 3d9677124b..7197524284 100644 --- a/source/java/org/alfresco/web/bean/FileUploadBean.java +++ b/source/java/org/alfresco/web/bean/FileUploadBean.java @@ -25,15 +25,18 @@ package org.alfresco.web.bean; import java.io.File; +import java.io.Serializable; /** * Bean to hold the results of a file upload * * @author gavinc */ -public final class FileUploadBean +public final class FileUploadBean implements Serializable { + private static final long serialVersionUID = 7667383955924957544L; + public static final String FILE_UPLOAD_BEAN_NAME = "alfresco.UploadBean"; public static String getKey(final String id) diff --git a/source/java/org/alfresco/web/bean/LinkPropertiesDialog.java b/source/java/org/alfresco/web/bean/LinkPropertiesDialog.java index 48d6bf73e0..8857c1e2f5 100644 --- a/source/java/org/alfresco/web/bean/LinkPropertiesDialog.java +++ b/source/java/org/alfresco/web/bean/LinkPropertiesDialog.java @@ -34,11 +34,9 @@ import javax.faces.event.ActionEvent; import org.alfresco.model.ContentModel; 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.InvalidNodeRefException; 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.AlfrescoNavigationHandler; import org.alfresco.web.app.Application; @@ -56,6 +54,8 @@ import org.alfresco.web.ui.common.Utils.URLMode; */ public class LinkPropertiesDialog extends BaseDialogBean { + private static final long serialVersionUID = -167326851073011187L; + private Node editableNode; public Map getProperties() @@ -106,7 +106,7 @@ public class LinkPropertiesDialog extends BaseDialogBean { NodeRef destRef = (NodeRef)this.editableNode.getProperties().get(ContentModel.PROP_LINK_DESTINATION); return Repository.getNamePath( - this.nodeService, this.nodeService.getPath(destRef), null, "/", null); + this.getNodeService(), this.getNodeService().getPath(destRef), null, "/", null); } /** @@ -139,7 +139,7 @@ public class LinkPropertiesDialog extends BaseDialogBean NodeRef nodeRef = this.editableNode.getNodeRef(); Map props = this.editableNode.getProperties(); - Map properties = this.nodeService.getProperties(nodeRef); + Map properties = this.getNodeService().getProperties(nodeRef); // we need to put all the properties from the editable bag back into // the format expected by the repository @@ -150,7 +150,7 @@ public class LinkPropertiesDialog extends BaseDialogBean if (title != null || description != null) { // add the aspect to be sure it's present - nodeService.addAspect(nodeRef, ContentModel.ASPECT_TITLED, null); + getNodeService().addAspect(nodeRef, ContentModel.ASPECT_TITLED, null); // other props will get added later in setProperties() } @@ -168,7 +168,7 @@ public class LinkPropertiesDialog extends BaseDialogBean if ((propValue != null) && (propValue instanceof String) && (propValue.toString().length() == 0)) { - PropertyDefinition propDef = this.dictionaryService.getProperty(qname); + PropertyDefinition propDef = this.getDictionaryService().getProperty(qname); if (propDef != null) { if (propDef.getDataType().getName().equals(DataTypeDefinition.DOUBLE) || @@ -185,7 +185,7 @@ public class LinkPropertiesDialog extends BaseDialogBean } // send the properties back to the repository - this.nodeService.setProperties(nodeRef, properties); + this.getNodeService().setProperties(nodeRef, properties); // reset any document held by the browse bean as it's just been updated // if this is a space link then it doesn't matter anyway diff --git a/source/java/org/alfresco/web/bean/LoginBean.java b/source/java/org/alfresco/web/bean/LoginBean.java index bd75e33e39..801284d146 100644 --- a/source/java/org/alfresco/web/bean/LoginBean.java +++ b/source/java/org/alfresco/web/bean/LoginBean.java @@ -25,6 +25,8 @@ package org.alfresco.web.bean; import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.Serializable; import java.text.MessageFormat; import java.util.Map; @@ -58,12 +60,14 @@ import org.apache.commons.logging.LogFactory; * fields and action event fired in response to the Login button being pressed. * * @author Kevin Roast - */ -public class LoginBean + */ +public class LoginBean implements Serializable { // ------------------------------------------------------------------------------ // Managed bean properties + private static final long serialVersionUID = 7417882503323795282L; + /** * @param authenticationService The AuthenticationService to set. */ @@ -71,6 +75,13 @@ public class LoginBean { this.authenticationService = authenticationService; } + + protected AuthenticationService getAuthenticationService() + { + if (authenticationService == null) + authenticationService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAuthenticationService(); + return authenticationService; + } /** * @param personService The personService to set. @@ -79,6 +90,13 @@ public class LoginBean { this.personService = personService; } + + protected PersonService getPersonService() + { + if (personService == null) + personService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPersonService(); + return personService; + } /** * @param nodeService The nodeService to set. @@ -87,6 +105,13 @@ public class LoginBean { this.nodeService = nodeService; } + + protected NodeService getNodeService() + { + if (nodeService == null) + nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + return nodeService; + } /** * @param browseBean The BrowseBean to set. @@ -247,10 +272,10 @@ public class LoginBean // Authenticate via the authentication service, then save the details of user in an object // in the session - this is used by the servlet filter etc. on each page to check for login - this.authenticationService.authenticate(this.username, this.password.toCharArray()); + this.getAuthenticationService().authenticate(this.username, this.password.toCharArray()); // Set the user name as stored by the back end - this.username = this.authenticationService.getCurrentUserName(); + this.username = this.getAuthenticationService().getCurrentUserName(); // remove the session invalidated flag (used to remove last username cookie by AuthenticationFilter) session.remove(AuthenticationHelper.SESSION_INVALIDATED); @@ -258,13 +283,13 @@ public class LoginBean // setup User object and Home space ID User user = new User( this.username, - this.authenticationService.getCurrentTicket(), - personService.getPerson(this.username)); + this.getAuthenticationService().getCurrentTicket(), + getPersonService().getPerson(this.username)); - NodeRef homeSpaceRef = (NodeRef) this.nodeService.getProperty(personService.getPerson(this.username), ContentModel.PROP_HOMEFOLDER); + NodeRef homeSpaceRef = (NodeRef) this.getNodeService().getProperty(getPersonService().getPerson(this.username), ContentModel.PROP_HOMEFOLDER); // check that the home space node exists - else user cannot login - if (this.nodeService.exists(homeSpaceRef) == false) + if (this.getNodeService().exists(homeSpaceRef) == false) { throw new InvalidNodeRefException(homeSpaceRef); } @@ -366,8 +391,8 @@ public class LoginBean if (user != null) { // invalidate ticket and clear the Security context for this thread - authenticationService.invalidateTicket(user.getTicket()); - authenticationService.clearCurrentSecurityContext(); + getAuthenticationService().invalidateTicket(user.getTicket()); + getAuthenticationService().clearCurrentSecurityContext(); } // remove all objects from our session by hand // we do this as invalidating the Portal session would invalidate all other portlets! @@ -420,13 +445,13 @@ public class LoginBean private String password = null; /** PersonService bean reference */ - protected PersonService personService; + private transient PersonService personService; /** AuthenticationService bean reference */ - protected AuthenticationService authenticationService; + private transient AuthenticationService authenticationService; /** NodeService bean reference */ - protected NodeService nodeService; + private transient NodeService nodeService; /** The BrowseBean reference */ protected BrowseBean browseBean; @@ -436,4 +461,6 @@ public class LoginBean /** The user preferences bean reference */ protected UserPreferencesBean preferences; + + } diff --git a/source/java/org/alfresco/web/bean/MultiValueEditorBean.java b/source/java/org/alfresco/web/bean/MultiValueEditorBean.java index 4747ed7319..92072c82b5 100644 --- a/source/java/org/alfresco/web/bean/MultiValueEditorBean.java +++ b/source/java/org/alfresco/web/bean/MultiValueEditorBean.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.bean; +import java.io.Serializable; import java.util.HashMap; import java.util.Map; @@ -36,8 +37,10 @@ import java.util.Map; * * @author gavinc */ -public class MultiValueEditorBean +public class MultiValueEditorBean implements Serializable { + private static final long serialVersionUID = -5180578793877515158L; + private Map lastItemsAdded = new HashMap(10); public Map getLastItemsAdded() diff --git a/source/java/org/alfresco/web/bean/NavigationBean.java b/source/java/org/alfresco/web/bean/NavigationBean.java index c428696cf0..c295337196 100644 --- a/source/java/org/alfresco/web/bean/NavigationBean.java +++ b/source/java/org/alfresco/web/bean/NavigationBean.java @@ -1,1083 +1,1146 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.web.bean; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Enumeration; -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.error.AlfrescoRuntimeException; -import org.alfresco.filesys.CIFSServerBean; -import org.alfresco.filesys.ServerConfigurationBean; -import org.alfresco.filesys.repo.ContentContext; -import org.alfresco.filesys.repo.ContentDiskInterface; -import org.alfresco.jlan.server.core.SharedDevice; -import org.alfresco.jlan.server.core.SharedDeviceList; -import org.alfresco.jlan.server.filesys.DiskSharedDevice; -import org.alfresco.jlan.server.filesys.FilesystemsConfigSection; -import org.alfresco.model.ContentModel; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.repository.FileTypeImageSize; -import org.alfresco.service.cmr.repository.InvalidNodeRefException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.Path; -import org.alfresco.service.cmr.repository.TemplateImageResolver; -import org.alfresco.service.cmr.repository.TemplateService; -import org.alfresco.service.cmr.rule.RuleService; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.AuthenticationService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.context.UIContextService; -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.bean.spaces.CreateSpaceWizard; -import org.alfresco.web.bean.spaces.SpaceDetailsDialog; -import org.alfresco.web.bean.users.UserPreferencesBean; -import org.alfresco.web.config.ClientConfigElement; -import org.alfresco.web.ui.common.Utils; -import org.alfresco.web.ui.common.component.IBreadcrumbHandler; -import org.alfresco.web.ui.common.component.UIBreadcrumb; -import org.alfresco.web.ui.common.component.UIModeList; -import org.alfresco.web.ui.repo.component.IRepoBreadcrumbHandler; -import org.alfresco.web.ui.repo.component.shelf.UIShelf; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.web.jsf.FacesContextUtils; - -/** - * Bean providing access and management of the various global navigation mechanisms - * such as the My Home, Company Home, Guest Home toolbar shortcuts, breadcrumb and - * the current node id and associated properties. - * - * @author Kevin Roast - */ -public class NavigationBean -{ - /** Public JSF Bean name */ - public static final String BEAN_NAME = "NavigationBean"; - - - /** - * Default constructor - */ - public NavigationBean() - { - initFromClientConfig(); - } - - - // ------------------------------------------------------------------------------ - // Bean property getters and setters - - /** - * @param nodeService The nodeService to set. - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param searchService The searchService to set. - */ - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - - /** - * @param namespaceService The namespaceService to set. - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param ruleService The ruleService to use - */ - public void setRuleService(RuleService ruleService) - { - this.ruleService = ruleService; - } - - /** - * @param cifsServer The cifsServer to set. - */ - public void setCifsServer(CIFSServerBean cifsServer) - { - this.cifsServer = cifsServer; - } - - /** - * @param contentDiskDriver The contentDiskDriver to set. - */ - public void setContentDiskDriver(ContentDiskInterface contentDiskDriver) - { - this.contentDiskDriver = contentDiskDriver; - } - - /** - * @param preferences The UserPreferencesBean to set - */ - public void setUserPreferencesBean(UserPreferencesBean preferences) - { - this.preferences = preferences; - } - - /** - * @param authService The AuthenticationService to set. - */ - public void setAuthenticationService(AuthenticationService authService) - { - this.authService = authService; - } - - /** - * @param permissionService The PermissionService to set. - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @return the User object representing the current instance for this user - */ - public User getCurrentUser() - { - return Application.getCurrentUser(FacesContext.getCurrentInstance()); - } - - /** - * @return true if the system is running within a JSR-168 portal container - */ - public boolean getInPortalServer() - { - return Application.inPortalServer(); - } - - /** - * Return the expanded state of the Shelf panel wrapper component - * - * @return the expanded state of the Shelf panel wrapper component - */ - public boolean isShelfExpanded() - { - return this.shelfExpanded; - } - - /** - * Set the expanded state of the Shelf panel wrapper component - * - * @param expanded true to expanded the Shelf panel area, false to hide it - */ - public void setShelfExpanded(boolean expanded) - { - this.shelfExpanded = expanded; - } - - /** - * @return Returns the array containing the expanded state of the shelf items - */ - public boolean[] getShelfItemExpanded() - { - return this.shelfItemExpanded; - } - - /** - * @param shelfItemExpanded The array containing the expanded state of the shelf items - */ - public void setShelfItemExpanded(boolean[] shelfItemExpanded) - { - this.shelfItemExpanded = shelfItemExpanded; - } - - /** - * @return Returns the toolbar Location - initially set from the user preferences. - */ - public String getToolbarLocation() - { - if (this.toolbarLocation == null) - { - // if the toolbar location has not been set yet, try and get the - // default via the user preferences object - this.toolbarLocation = this.preferences.getStartLocation(); - - // test that the user still has access to the specified location - // the location will need to be reset if the user permissions are no longer valid - if (NavigationBean.LOCATION_COMPANY.equals(this.toolbarLocation)) - { - if (getCompanyHomeVisible() == false) - { - this.toolbarLocation = null; - } - } - else if (NavigationBean.LOCATION_GUEST.equals(this.toolbarLocation)) - { - if (getGuestHomeVisible() == false) - { - this.toolbarLocation = null; - } - } - - // if don't have a valid start location default to My Home - if (this.toolbarLocation == null) - { - this.toolbarLocation = LOCATION_HOME; - this.preferences.setStartLocation(this.toolbarLocation); - } - } - - return this.toolbarLocation; - } - - /** - * @param location The toolbar Location to set. - */ - public void setToolbarLocation(String location) - { - this.toolbarLocation = location; - } - - /** - * Process the selected toolbar location. Setup the breadcrumb with initial value and - * setup the current node ID. This method can also perform the navigatin setup if requested. - * - * @param location Toolbar location constant - * @param navigate True to perform navigation, false otherwise - */ - @SuppressWarnings("serial") - public void processToolbarLocation(String location, boolean navigate) - { - this.toolbarLocation = location; - - FacesContext context = FacesContext.getCurrentInstance(); - if (LOCATION_COMPANY.equals(location)) - { - List elements = new ArrayList(1); - Node companyHome = getCompanyHomeNode(); - elements.add(new NavigationBreadcrumbHandler(companyHome.getNodeRef(), companyHome.getName())); - setLocation(elements); - setCurrentNodeId(companyHome.getId()); - - if (s_logger.isDebugEnabled()) - s_logger.debug("Created breadcrumb for companyhome: " + elements); - - // inform registered beans that the current area has changed - UIContextService.getInstance(FacesContext.getCurrentInstance()).areaChanged(); - - // we need to force a navigation to refresh the browse screen breadcrumb - if (navigate) - { - context.getApplication().getNavigationHandler().handleNavigation(context, null, OUTCOME_BROWSE); - } - } - else if (LOCATION_HOME.equals(location)) - { - List elements = new ArrayList(1); - String homeSpaceId = Application.getCurrentUser(context).getHomeSpaceId(); - NodeRef homeSpaceRef = new NodeRef(Repository.getStoreRef(), homeSpaceId); - - if (this.clientConfig.getBreadcrumbMode().equals(ClientConfigElement.BREADCRUMB_LOCATION)) - { - Repository.setupBreadcrumbLocation(context, this, elements, homeSpaceRef); - - if (s_logger.isDebugEnabled()) - s_logger.debug("Created breadcrumb location for userhome: " + elements); - } - else - { - String homeSpaceName = Repository.getNameForNode(this.nodeService, homeSpaceRef); - elements.add(new NavigationBreadcrumbHandler(homeSpaceRef, homeSpaceName)); - - if (s_logger.isDebugEnabled()) - s_logger.debug("Created breadcrumb path for userhome: " + elements); - } - - setLocation(elements); - setCurrentNodeId(homeSpaceRef.getId()); - - // inform registered beans that the current area has changed - UIContextService.getInstance(FacesContext.getCurrentInstance()).areaChanged(); - - // we need to force a navigation to refresh the browse screen breadcrumb - if (navigate) - { - context.getApplication().getNavigationHandler().handleNavigation(context, null, OUTCOME_BROWSE); - } - } - else if (LOCATION_GUEST.equals(location)) - { - List elements = new ArrayList(1); - Node guestHome = getGuestHomeNode(); - - if (this.clientConfig.getBreadcrumbMode().equals(ClientConfigElement.BREADCRUMB_LOCATION)) - { - Repository.setupBreadcrumbLocation(context, this, elements, guestHome.getNodeRef()); - - if (s_logger.isDebugEnabled()) - s_logger.debug("Created breadcrumb location for guesthome: " + elements); - } - else - { - elements.add(new NavigationBreadcrumbHandler(guestHome.getNodeRef(), guestHome.getName())); - - if (s_logger.isDebugEnabled()) - s_logger.debug("Created breadcrumb path for guesthome: " + elements); - } - - setLocation(elements); - setCurrentNodeId(guestHome.getId()); - - // inform registered beans that the current area has changed - UIContextService.getInstance(FacesContext.getCurrentInstance()).areaChanged(); - - // we need to force a navigation to refresh the browse screen breadcrumb - if (navigate) - { - context.getApplication().getNavigationHandler().handleNavigation(context, null, OUTCOME_BROWSE); - } - } - else if (LOCATION_MYALFRESCO.equals(location)) - { - // make sure we set a current node ID as some screens expect this - if (getCurrentNodeId() == null) - { - String homeSpaceId = Application.getCurrentUser(context).getHomeSpaceId(); - NodeRef homeSpaceRef = new NodeRef(Repository.getStoreRef(), homeSpaceId); - setCurrentNodeId(homeSpaceRef.getId()); - } - - // create a breadcrumb handler for this special case location (not a node) - List elements = new ArrayList(1); - elements.add(new IBreadcrumbHandler() - { - @SuppressWarnings("unchecked") - public String navigationOutcome(UIBreadcrumb breadcrumb) - { - setLocation( (List)breadcrumb.getValue() ); - return OUTCOME_MYALFRESCO; - }; - - public String toString() - { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_MYALFRESCO); - }; - }); - - if (s_logger.isDebugEnabled()) - s_logger.debug("Created breadcrumb for myalfresco: " + elements); - - setLocation(elements); - - // inform registered beans that the current area has changed - UIContextService.getInstance(FacesContext.getCurrentInstance()).areaChanged(); - - // we need to force a navigation to refresh the browse screen breadcrumb - if (navigate) - { - context.getApplication().getNavigationHandler().handleNavigation(context, null, OUTCOME_MYALFRESCO); - } - } - else - { - // handle outcomes to any other custom location - context.getApplication().getNavigationHandler().handleNavigation(context, null, location); - } - } - - /** - * @return Returns the helpUrl. - */ - public String getHelpUrl() - { - return this.helpUrl; - } - - /** - * @param helpUrl The helpUrl to set. - */ - public void setHelpUrl(String helpUrl) - { - this.helpUrl = helpUrl; - } - - /** - * @return the number of rules associated with the current space - */ - public int getRuleCount() - { - Node node = getCurrentNode(); - return (node != null ? this.ruleService.countRules(node.getNodeRef()) : 0); - } - - /** - * @return Returns the search context object if any. - */ - public SearchContext getSearchContext() - { - return this.searchContext; - } - - /** - * @param searchContext The search context object to set or null to clear search. - */ - public void setSearchContext(SearchContext searchContext) - { - this.searchContext = searchContext; - - UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); - } - - /** - * @return Returns the currently browsing node Id. - */ - public String getCurrentNodeId() - { - return this.currentNodeId; - } - - /** - * Set the node Id of the current folder/space container node. - *

- * Setting this value causes the UI to update and display the specified node as current. - * - * @param currentNodeId The currently browsing node Id. - */ - public void setCurrentNodeId(String currentNodeId) - { - if (s_logger.isDebugEnabled()) - s_logger.debug("Setting current node id to: " + currentNodeId); - - if (currentNodeId == null) - { - throw new AlfrescoRuntimeException("Can not set the current node id to null"); - } - - // set the current Node Id for our UI context operations - this.currentNodeId = currentNodeId; - - // clear other context that is based on or relevant to the Node id - this.currentNode = null; - this.searchContext = null; - - // inform any interested beans that the UI needs updating after this change - UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); - - // clear current node context after the notify - this is to ensure that if any delegates - // performed operations on the current node, that we have fresh data for the next View - this.currentNode = null; - } - - /** - * @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() - { - Node node = getCurrentNode(); - if (node.hasAspect(ContentModel.ASPECT_TEMPLATABLE)) - { - NodeRef templateRef = (NodeRef)node.getProperties().get(ContentModel.PROP_TEMPLATE); - return (templateRef != null && this.nodeService.exists(templateRef) && - this.permissionService.hasPermission(templateRef, PermissionService.READ) == AccessStatus.ALLOWED); - } - return false; - } - - /** - * @return true if the current node has a Webscript based custom view available - */ - public boolean getHasWebscriptView() - { - Node node = getCurrentNode(); - 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)getCurrentNode().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)getCurrentNode().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(2, 1.0f); - - model.put("space", getCurrentNode().getNodeRef()); - model.put(TemplateService.KEY_IMAGE_RESOLVER, - new TemplateImageResolver() - { - public String resolveImagePathForName(String filename, FileTypeImageSize size) - { - return Utils.getFileTypeImage(FacesContext.getCurrentInstance(), filename, size); - } - }); - - return model; - } - - /** - * Clear state so that the current node properties cache for the next time they are requested - */ - public void resetCurrentNodeProperties() - { - this.currentNode = null; - } - - /** - * @return The Map of properties for the current Node. - */ - public Map getNodeProperties() - { - return getCurrentNode().getProperties(); - } - - /** - * @return The current Node object for UI context operations - */ - public Node getCurrentNode() - { - if (this.currentNode == null) - { - if (this.currentNodeId == null) - { - throw new AlfrescoRuntimeException("Cannot retrieve current Node if NodeId is null!"); - } - - if (s_logger.isDebugEnabled()) - s_logger.debug("Caching properties for node id: " + this.currentNodeId); - - NodeRef nodeRef; - Node node; - Map props; - try - { - // build a node which components on the JSP page can bind too - nodeRef = new NodeRef(Repository.getStoreRef(), this.currentNodeId); - node = new Node(nodeRef); - - // early init properties for this node (by getProperties() call) - // resolve icon in-case one has not been set - props = node.getProperties(); - } - catch (InvalidNodeRefException refErr) - { - FacesContext fc = FacesContext.getCurrentInstance(); - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - fc, ERROR_DELETED_FOLDER), new Object[] {this.currentNodeId}) ); - - nodeRef = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId(fc)); - node = new Node(nodeRef); - props = node.getProperties(); - } - String icon = (String)props.get("app:icon"); - props.put("icon", icon != null ? icon : CreateSpaceWizard.DEFAULT_SPACE_ICON_NAME); - Path path = node.getNodePath(); - - // resolve CIFS network folder location for this node - FilesystemsConfigSection filesysConfig = (FilesystemsConfigSection) cifsServer.getConfiguration().getConfigSection(FilesystemsConfigSection.SectionName); - DiskSharedDevice diskShare = null; - - SharedDeviceList shares = filesysConfig.getShares(); - Enumeration shareEnum = shares.enumerateShares(); - - while ( shareEnum.hasMoreElements() && diskShare == null) { - SharedDevice curShare = shareEnum.nextElement(); - if ( curShare.getContext() instanceof ContentContext) - diskShare = (DiskSharedDevice) curShare; - } - - if (diskShare != null) - { - ContentContext contentCtx = (ContentContext) diskShare.getContext(); - NodeRef rootNode = contentCtx.getRootNode(); - try - { - String cifsPath = Repository.getNamePath(this.nodeService, path, rootNode, "\\", "file:///" + getCIFSServerPath(diskShare)); - - node.getProperties().put("cifsPath", cifsPath); - node.getProperties().put("cifsPathLabel", cifsPath.substring(8)); // strip file:/// part - } - catch(AccessDeniedException ade) - { - node.getProperties().put("cifsPath", ""); - node.getProperties().put("cifsPathLabel",""); // strip file:/// part - } - } - - this.currentNode = node; - } - - return this.currentNode; - } - - /** - * @return Returns the breadcrumb handler elements representing the location path of the UI. - */ - public List getLocation() - { - if (this.location == null) - { - // get the initial location from the user preferences - processToolbarLocation(getToolbarLocation(), false); - } - - return this.location; - } - - /** - * @param location The UI location representation to set. - */ - public void setLocation(List location) - { - this.location = location; - } - - /** - * @return true if we are currently the special Guest user - */ - public boolean getIsGuest() - { - return Repository.getIsGuest(FacesContext.getCurrentInstance()); - } - - /** - * Sets up the dispatch context so that the navigation handler knows - * what object is being acted upon - * - * @param node The node to be added to the dispatch context - */ - public void setupDispatchContext(Node node) - { - this.dispatchContext = node; - } - - /** - * Resets the dispatch context - */ - public void resetDispatchContext() - { - this.dispatchContext = null; - } - - /** - * Returns the node currently set in the dispatch context - * - * @return The node being dispatched or null if there is no - * dispatch context - */ - public Node getDispatchContextNode() - { - return this.dispatchContext; - } - - /** - * @return Node representing the Company Home folder - */ - public Node getCompanyHomeNode() - { - if (this.companyHomeNode == null) - { - FacesContext fc = FacesContext.getCurrentInstance(); - String companyRootId = Application.getCompanyRootId(fc); - if (companyRootId != null) - { - NodeRef companyRootRef = new NodeRef(Repository.getStoreRef(), companyRootId); - this.companyHomeNode = new Node(companyRootRef); - } - } - return this.companyHomeNode; - } - - /** - * @return Node representing the Guest Home Space folder - */ - public Node getGuestHomeNode() - { - if (this.guestHomeNode == null) - { - try - { - FacesContext fc = FacesContext.getCurrentInstance(); - String xpath = Application.getRootPath(fc) + "/" + Application.getGuestHomeFolderName(fc); - List guestHomeRefs = this.searchService.selectNodes( - this.nodeService.getRootNode(Repository.getStoreRef()), - xpath, null, this.namespaceService, false); - if (guestHomeRefs.size() == 1) - { - this.guestHomeNode = new Node(guestHomeRefs.get(0)); - } - } - catch (InvalidNodeRefException err1) - { - // cannot continue if this occurs - } - catch (AccessDeniedException err2) - { - // cannot see node if this occurs - } - } - return this.guestHomeNode; - } - - /** - * @return true if the Company home node is accessable to the current user - */ - public boolean getCompanyHomeVisible() - { - Node companyHomeNode = getCompanyHomeNode(); - if (companyHomeNode != null) - { - return companyHomeNode.hasPermission(PermissionService.READ); - } - else - { - return false; - } - } - - /** - * @return true if the Guest home node is accessable to the current user - */ - public boolean getGuestHomeVisible() - { - if (this.authService.guestUserAuthenticationAllowed()) - { - Node guestHome = getGuestHomeNode(); - return guestHome != null && guestHome.hasPermission(PermissionService.READ); - } - else - { - return false; - } - } - - - // ------------------------------------------------------------------------------ - // Navigation action event handlers - - /** - * Action handler to toggle the expanded state of the shelf. - * The panel component wrapping the shelf area of the UI is value bound to the shelfExpanded property. - */ - public void toggleShelf(ActionEvent event) - { - this.shelfExpanded = !this.shelfExpanded; - } - - /** - * Action handler called after a Shelf Group has had its expanded state toggled by the user - */ - public void shelfGroupToggled(ActionEvent event) - { - UIShelf.ShelfEvent shelfEvent = (UIShelf.ShelfEvent)event; - this.shelfItemExpanded[shelfEvent.Index] = shelfEvent.Expanded; - } - - /** - * Action to change the toolbar location - * Currently this will changed the location from Company to the users Home space - */ - public void toolbarLocationChanged(ActionEvent event) - { - FacesContext context = FacesContext.getCurrentInstance(); - try - { - UIModeList locationList = (UIModeList)event.getComponent(); - String location = locationList.getValue().toString(); - processToolbarLocation(location, true); - } - catch (InvalidNodeRefException refErr) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_NOHOME), Application.getCurrentUser(context).getHomeSpaceId()), refErr ); - } - catch (Exception err) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); - } - } - - /** - * @param diskShare Filesystem shared device - * @return CIFS server path as network style string label - */ - public String getCIFSServerPath(DiskSharedDevice diskShare) - { - if (this.cifsServerPath == null) - { - StringBuilder buf = new StringBuilder(24); - - String serverName = this.cifsServer.getConfiguration().getServerName(); - if (serverName != null && serverName.length() != 0) - { - buf.append("\\\\"); - buf.append(serverName); - - // Check if there is a suffix to apply to the host name - - if ( clientConfig != null && clientConfig.getCifsURLSuffix() != null) - buf.append(clientConfig.getCifsURLSuffix()); - - buf.append("\\"); - buf.append(diskShare.getName()); - } - - this.cifsServerPath = buf.toString(); - } - - return this.cifsServerPath; - } - - /** - * @return true if the current space has an RSS feed applied - */ - public boolean isRSSFeed() - { - return SpaceDetailsDialog.hasRSSFeed(getCurrentNode()); - } - - /** - * @return RSS Feed URL for the current space - */ - public String getRSSFeedURL() - { - return SpaceDetailsDialog.buildRSSFeedURL(getCurrentNode()); - } - - - // ------------------------------------------------------------------------------ - // Helpers - - /** - * Initialise default values from client configuration - * - * Package visibility to allow LoginBean to re-init (for example, in context of tenant config) - */ - /* package */ void initFromClientConfig() - { - this.clientConfig = Application.getClientConfig(FacesContext.getCurrentInstance()); - this.helpUrl = clientConfig.getHelpUrl(); - this.shelfExpanded = clientConfig.isShelfVisible(); - } - - - // ------------------------------------------------------------------------------ - // Inner classes - - /** - * Class to handle breadcrumb interaction for top-level navigation pages - */ - public class NavigationBreadcrumbHandler implements IRepoBreadcrumbHandler - { - private static final long serialVersionUID = 4833194653193016638L; - - /** - * Constructor - * - * @param label Element label - */ - public NavigationBreadcrumbHandler(NodeRef ref, String label) - { - this.label = label; - this.ref = ref; - } - - /** - * @see java.lang.Object#toString() - */ - public String toString() - { - return this.label; - } - - /** - * @see org.alfresco.web.ui.common.component.IBreadcrumbHandler#navigationOutcome(org.alfresco.web.ui.common.component.UIBreadcrumb) - */ - @SuppressWarnings("unchecked") - public String navigationOutcome(UIBreadcrumb breadcrumb) - { - // set the current node to the specified top level node ID - FacesContext fc = FacesContext.getCurrentInstance(); - setCurrentNodeId(ref.getId()); - setLocation( (List)breadcrumb.getValue() ); - - // setup the dispatch context - setupDispatchContext(new Node(ref)); - - // inform any listeners that the current space has changed - UIContextService.getInstance(FacesContext.getCurrentInstance()).spaceChanged(); - - if (fc.getViewRoot().getViewId().equals(BrowseBean.BROWSE_VIEW_ID)) - { - return null; - } - else - { - return OUTCOME_BROWSE; - } - } - - public NodeRef getNodeRef() - { - return this.ref; - } - - private String label; - private NodeRef ref; - } - - - // ------------------------------------------------------------------------------ - // Private data - - private static Log s_logger = LogFactory.getLog(NavigationBean.class); - - /** constant values used by the toolbar location modelist control */ - public static final String LOCATION_COMPANY = "companyhome"; - public static final String LOCATION_HOME = "userhome"; - public static final String LOCATION_GUEST = "guesthome"; - public static final String LOCATION_MYALFRESCO = "myalfresco"; - - /** constant value representing the display lables for toolbar locations */ - public static final String MSG_MYALFRESCO = "my_alfresco"; - public static final String MSG_MYHOME = "my_home"; - public static final String MSG_COMPANYHOME = "company_home"; - public static final String MSG_GUESTHOME = "guest_home"; - - private static final String OUTCOME_MYALFRESCO = "myalfresco"; - private static final String OUTCOME_BROWSE = "browse"; - - private static final String ERROR_DELETED_FOLDER = "error_deleted_folder"; - - /** The NodeService to be used by the bean */ - protected NodeService nodeService; - - /** The SearchService to be used by the bean */ - protected SearchService searchService; - - /** NamespaceService bean reference */ - protected NamespaceService namespaceService; - - /** RuleService bean reference*/ - protected RuleService ruleService; - - /** CIFSServer bean reference */ - protected CIFSServerBean cifsServer; - - /** CIFS content disk driver bean reference */ - protected ContentDiskInterface contentDiskDriver; - - /** Client configuration object */ - protected ClientConfigElement clientConfig = null; - - /** The user preferences bean reference */ - protected UserPreferencesBean preferences; - - /** The Authentication service bean reference */ - protected AuthenticationService authService; - - /** The PermissionService reference */ - protected PermissionService permissionService; - - /** Cached path to our CIFS server and top level node DIR */ - private String cifsServerPath; - - /** Node Id we are using for UI context operations */ - private String currentNodeId; - - /** Node we are using for UI context operations */ - private Node currentNode = null; - - /** Node we are using for dispatching */ - private Node dispatchContext = null; - - /** Node representing the guest home */ - private Node guestHomeNode = null; - - /** Node representing the company home */ - private Node companyHomeNode = null; - - /** Current toolbar location */ - private String toolbarLocation = null; - - /** Search context object we are currently using or null for no search */ - private SearchContext searchContext; - - /** expanded state of the Shelf panel wrapper component */ - private boolean shelfExpanded = true; - - /** expanded state of the Shelf item components */ - private boolean[] shelfItemExpanded = new boolean[] {true, true, true, false, false}; - - /** list of the breadcrumb handler elements representing the location path of the UI */ - private List location = null; - - /** The client Help file url */ - private String helpUrl; -} +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.Serializable; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Enumeration; +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.error.AlfrescoRuntimeException; +import org.alfresco.filesys.CIFSServerBean; +import org.alfresco.filesys.ServerConfigurationBean; +import org.alfresco.filesys.repo.ContentContext; +import org.alfresco.filesys.repo.ContentDiskInterface; +import org.alfresco.jlan.server.config.ServerConfiguration; +import org.alfresco.jlan.server.core.SharedDevice; +import org.alfresco.jlan.server.core.SharedDeviceList; +import org.alfresco.jlan.server.filesys.DiskSharedDevice; +import org.alfresco.jlan.server.filesys.FilesystemsConfigSection; +import org.alfresco.model.ContentModel; +import org.alfresco.repo.security.permissions.AccessDeniedException; +import org.alfresco.service.cmr.repository.FileTypeImageSize; +import org.alfresco.service.cmr.repository.InvalidNodeRefException; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.Path; +import org.alfresco.service.cmr.repository.TemplateImageResolver; +import org.alfresco.service.cmr.repository.TemplateService; +import org.alfresco.service.cmr.rule.RuleService; +import org.alfresco.service.cmr.search.SearchService; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.security.AuthenticationService; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.web.app.Application; +import org.alfresco.web.app.context.UIContextService; +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.repository.User; +import org.alfresco.web.bean.search.SearchContext; +import org.alfresco.web.bean.spaces.CreateSpaceWizard; +import org.alfresco.web.bean.spaces.SpaceDetailsDialog; +import org.alfresco.web.bean.users.UserPreferencesBean; +import org.alfresco.web.config.ClientConfigElement; +import org.alfresco.web.ui.common.Utils; +import org.alfresco.web.ui.common.component.IBreadcrumbHandler; +import org.alfresco.web.ui.common.component.UIBreadcrumb; +import org.alfresco.web.ui.common.component.UIModeList; +import org.alfresco.web.ui.repo.component.IRepoBreadcrumbHandler; +import org.alfresco.web.ui.repo.component.shelf.UIShelf; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.web.jsf.FacesContextUtils; + +/** + * Bean providing access and management of the various global navigation mechanisms + * such as the My Home, Company Home, Guest Home toolbar shortcuts, breadcrumb and + * the current node id and associated properties. + * + * @author Kevin Roast + */ +public class NavigationBean implements Serializable +{ + private static final long serialVersionUID = -648110889585522227L; + + /** Public JSF Bean name */ + public static final String BEAN_NAME = "NavigationBean"; + + + /** + * Default constructor + */ + public NavigationBean() + { + initFromClientConfig(); + } + + + // ------------------------------------------------------------------------------ + // 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 searchService The searchService to set. + */ + public void setSearchService(SearchService searchService) + { + this.searchService = searchService; + } + + protected SearchService getSearchService() + { + if (searchService == null) + this.searchService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSearchService(); + return searchService; + } + + /** + * @param namespaceService The namespaceService to set. + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + protected NamespaceService getNamespaceService() + { + if (namespaceService == null) + this.namespaceService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNamespaceService(); + return namespaceService; + } + + /** + * @param ruleService The ruleService to use + */ + public void setRuleService(RuleService ruleService) + { + this.ruleService = ruleService; + } + + protected RuleService getRuleService() + { + if (ruleService == null) + this.ruleService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getRuleService(); + return ruleService; + } + + /** + * @param cifsServer The cifsServer to set. + */ + public void setCifsServer(CIFSServerBean cifsServer) + { + this.cifsServer = cifsServer; + } + + protected CIFSServerBean getCifsServer() + { + if (cifsServer == null) + this.cifsServer = (CIFSServerBean) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "cifsServer"); + return cifsServer; + } + + /** + * @param contentDiskDriver The contentDiskDriver to set. + */ + public void setContentDiskDriver(ContentDiskInterface contentDiskDriver) + { + this.contentDiskDriver = contentDiskDriver; + } + + protected ClientConfigElement getClientConfig() + { + if (clientConfig == null) + this.clientConfig = Application.getClientConfig(FacesContext.getCurrentInstance()); + return clientConfig; + } + + /** + * @param preferences The UserPreferencesBean to set + */ + public void setUserPreferencesBean(UserPreferencesBean preferences) + { + this.preferences = preferences; + } + + /** + * @param authService The AuthenticationService to set. + */ + public void setAuthenticationService(AuthenticationService authService) + { + this.authService = authService; + } + + protected AuthenticationService getAuthService() + { + if (authService == null) + this.authService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAuthenticationService(); + return authService; + } + + /** + * @param permissionService The PermissionService to set. + */ + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + + protected PermissionService getPermissionService() + { + if (permissionService == null) + this.permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService(); + return permissionService; + } + + /** + * @return the User object representing the current instance for this user + */ + public User getCurrentUser() + { + return Application.getCurrentUser(FacesContext.getCurrentInstance()); + } + + /** + * @return true if the system is running within a JSR-168 portal container + */ + public boolean getInPortalServer() + { + return Application.inPortalServer(); + } + + /** + * Return the expanded state of the Shelf panel wrapper component + * + * @return the expanded state of the Shelf panel wrapper component + */ + public boolean isShelfExpanded() + { + return this.shelfExpanded; + } + + /** + * Set the expanded state of the Shelf panel wrapper component + * + * @param expanded true to expanded the Shelf panel area, false to hide it + */ + public void setShelfExpanded(boolean expanded) + { + this.shelfExpanded = expanded; + } + + /** + * @return Returns the array containing the expanded state of the shelf items + */ + public boolean[] getShelfItemExpanded() + { + return this.shelfItemExpanded; + } + + /** + * @param shelfItemExpanded The array containing the expanded state of the shelf items + */ + public void setShelfItemExpanded(boolean[] shelfItemExpanded) + { + this.shelfItemExpanded = shelfItemExpanded; + } + + /** + * @return Returns the toolbar Location - initially set from the user preferences. + */ + public String getToolbarLocation() + { + if (this.toolbarLocation == null) + { + // if the toolbar location has not been set yet, try and get the + // default via the user preferences object + this.toolbarLocation = this.preferences.getStartLocation(); + + // test that the user still has access to the specified location + // the location will need to be reset if the user permissions are no longer valid + if (NavigationBean.LOCATION_COMPANY.equals(this.toolbarLocation)) + { + if (getCompanyHomeVisible() == false) + { + this.toolbarLocation = null; + } + } + else if (NavigationBean.LOCATION_GUEST.equals(this.toolbarLocation)) + { + if (getGuestHomeVisible() == false) + { + this.toolbarLocation = null; + } + } + + // if don't have a valid start location default to My Home + if (this.toolbarLocation == null) + { + this.toolbarLocation = LOCATION_HOME; + this.preferences.setStartLocation(this.toolbarLocation); + } + } + + return this.toolbarLocation; + } + + /** + * @param location The toolbar Location to set. + */ + public void setToolbarLocation(String location) + { + this.toolbarLocation = location; + } + + /** + * Process the selected toolbar location. Setup the breadcrumb with initial value and + * setup the current node ID. This method can also perform the navigatin setup if requested. + * + * @param location Toolbar location constant + * @param navigate True to perform navigation, false otherwise + */ + @SuppressWarnings("serial") + public void processToolbarLocation(String location, boolean navigate) + { + this.toolbarLocation = location; + + FacesContext context = FacesContext.getCurrentInstance(); + if (LOCATION_COMPANY.equals(location)) + { + List elements = new ArrayList(1); + Node companyHome = getCompanyHomeNode(); + elements.add(new NavigationBreadcrumbHandler(companyHome.getNodeRef(), companyHome.getName())); + setLocation(elements); + setCurrentNodeId(companyHome.getId()); + + if (s_logger.isDebugEnabled()) + s_logger.debug("Created breadcrumb for companyhome: " + elements); + + // inform registered beans that the current area has changed + UIContextService.getInstance(FacesContext.getCurrentInstance()).areaChanged(); + + // we need to force a navigation to refresh the browse screen breadcrumb + if (navigate) + { + context.getApplication().getNavigationHandler().handleNavigation(context, null, OUTCOME_BROWSE); + } + } + else if (LOCATION_HOME.equals(location)) + { + List elements = new ArrayList(1); + String homeSpaceId = Application.getCurrentUser(context).getHomeSpaceId(); + NodeRef homeSpaceRef = new NodeRef(Repository.getStoreRef(), homeSpaceId); + + if (this.clientConfig.getBreadcrumbMode().equals(ClientConfigElement.BREADCRUMB_LOCATION)) + { + Repository.setupBreadcrumbLocation(context, this, elements, homeSpaceRef); + + if (s_logger.isDebugEnabled()) + s_logger.debug("Created breadcrumb location for userhome: " + elements); + } + else + { + String homeSpaceName = Repository.getNameForNode(this.nodeService, homeSpaceRef); + elements.add(new NavigationBreadcrumbHandler(homeSpaceRef, homeSpaceName)); + + if (s_logger.isDebugEnabled()) + s_logger.debug("Created breadcrumb path for userhome: " + elements); + } + + setLocation(elements); + setCurrentNodeId(homeSpaceRef.getId()); + + // inform registered beans that the current area has changed + UIContextService.getInstance(FacesContext.getCurrentInstance()).areaChanged(); + + // we need to force a navigation to refresh the browse screen breadcrumb + if (navigate) + { + context.getApplication().getNavigationHandler().handleNavigation(context, null, OUTCOME_BROWSE); + } + } + else if (LOCATION_GUEST.equals(location)) + { + List elements = new ArrayList(1); + Node guestHome = getGuestHomeNode(); + + if (this.clientConfig.getBreadcrumbMode().equals(ClientConfigElement.BREADCRUMB_LOCATION)) + { + Repository.setupBreadcrumbLocation(context, this, elements, guestHome.getNodeRef()); + + if (s_logger.isDebugEnabled()) + s_logger.debug("Created breadcrumb location for guesthome: " + elements); + } + else + { + elements.add(new NavigationBreadcrumbHandler(guestHome.getNodeRef(), guestHome.getName())); + + if (s_logger.isDebugEnabled()) + s_logger.debug("Created breadcrumb path for guesthome: " + elements); + } + + setLocation(elements); + setCurrentNodeId(guestHome.getId()); + + // inform registered beans that the current area has changed + UIContextService.getInstance(FacesContext.getCurrentInstance()).areaChanged(); + + // we need to force a navigation to refresh the browse screen breadcrumb + if (navigate) + { + context.getApplication().getNavigationHandler().handleNavigation(context, null, OUTCOME_BROWSE); + } + } + else if (LOCATION_MYALFRESCO.equals(location)) + { + // make sure we set a current node ID as some screens expect this + if (getCurrentNodeId() == null) + { + String homeSpaceId = Application.getCurrentUser(context).getHomeSpaceId(); + NodeRef homeSpaceRef = new NodeRef(Repository.getStoreRef(), homeSpaceId); + setCurrentNodeId(homeSpaceRef.getId()); + } + + // create a breadcrumb handler for this special case location (not a node) + List elements = new ArrayList(1); + elements.add(new IBreadcrumbHandler() + { + @SuppressWarnings("unchecked") + public String navigationOutcome(UIBreadcrumb breadcrumb) + { + setLocation( (List)breadcrumb.getValue() ); + return OUTCOME_MYALFRESCO; + }; + + public String toString() + { + return Application.getMessage(FacesContext.getCurrentInstance(), MSG_MYALFRESCO); + }; + }); + + if (s_logger.isDebugEnabled()) + s_logger.debug("Created breadcrumb for myalfresco: " + elements); + + setLocation(elements); + + // inform registered beans that the current area has changed + UIContextService.getInstance(FacesContext.getCurrentInstance()).areaChanged(); + + // we need to force a navigation to refresh the browse screen breadcrumb + if (navigate) + { + context.getApplication().getNavigationHandler().handleNavigation(context, null, OUTCOME_MYALFRESCO); + } + } + else + { + // handle outcomes to any other custom location + context.getApplication().getNavigationHandler().handleNavigation(context, null, location); + } + } + + /** + * @return Returns the helpUrl. + */ + public String getHelpUrl() + { + return this.helpUrl; + } + + /** + * @param helpUrl The helpUrl to set. + */ + public void setHelpUrl(String helpUrl) + { + this.helpUrl = helpUrl; + } + + /** + * @return the number of rules associated with the current space + */ + public int getRuleCount() + { + Node node = getCurrentNode(); + return (node != null ? this.getRuleService().countRules(node.getNodeRef()) : 0); + } + + /** + * @return Returns the search context object if any. + */ + public SearchContext getSearchContext() + { + return this.searchContext; + } + + /** + * @param searchContext The search context object to set or null to clear search. + */ + public void setSearchContext(SearchContext searchContext) + { + this.searchContext = searchContext; + + UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); + } + + /** + * @return Returns the currently browsing node Id. + */ + public String getCurrentNodeId() + { + return this.currentNodeId; + } + + /** + * Set the node Id of the current folder/space container node. + *

+ * Setting this value causes the UI to update and display the specified node as current. + * + * @param currentNodeId The currently browsing node Id. + */ + public void setCurrentNodeId(String currentNodeId) + { + if (s_logger.isDebugEnabled()) + s_logger.debug("Setting current node id to: " + currentNodeId); + + if (currentNodeId == null) + { + throw new AlfrescoRuntimeException("Can not set the current node id to null"); + } + + // set the current Node Id for our UI context operations + this.currentNodeId = currentNodeId; + + // clear other context that is based on or relevant to the Node id + this.currentNode = null; + this.searchContext = null; + + // inform any interested beans that the UI needs updating after this change + UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); + + // clear current node context after the notify - this is to ensure that if any delegates + // performed operations on the current node, that we have fresh data for the next View + this.currentNode = null; + } + + /** + * @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() + { + Node node = getCurrentNode(); + if (node.hasAspect(ContentModel.ASPECT_TEMPLATABLE)) + { + NodeRef templateRef = (NodeRef)node.getProperties().get(ContentModel.PROP_TEMPLATE); + return (templateRef != null && this.getNodeService().exists(templateRef) && + this.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() + { + Node node = getCurrentNode(); + 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)getCurrentNode().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)getCurrentNode().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(2, 1.0f); + + model.put("space", getCurrentNode().getNodeRef()); + model.put(TemplateService.KEY_IMAGE_RESOLVER, + new TemplateImageResolver() + { + public String resolveImagePathForName(String filename, FileTypeImageSize size) + { + return Utils.getFileTypeImage(FacesContext.getCurrentInstance(), filename, size); + } + }); + + return model; + } + + /** + * Clear state so that the current node properties cache for the next time they are requested + */ + public void resetCurrentNodeProperties() + { + this.currentNode = null; + } + + /** + * @return The Map of properties for the current Node. + */ + public Map getNodeProperties() + { + return getCurrentNode().getProperties(); + } + + /** + * @return The current Node object for UI context operations + */ + public Node getCurrentNode() + { + if (this.currentNode == null) + { + if (this.currentNodeId == null) + { + throw new AlfrescoRuntimeException("Cannot retrieve current Node if NodeId is null!"); + } + + if (s_logger.isDebugEnabled()) + s_logger.debug("Caching properties for node id: " + this.currentNodeId); + + NodeRef nodeRef; + Node node; + Map props; + try + { + // build a node which components on the JSP page can bind too + nodeRef = new NodeRef(Repository.getStoreRef(), this.currentNodeId); + node = new Node(nodeRef); + + // early init properties for this node (by getProperties() call) + // resolve icon in-case one has not been set + props = node.getProperties(); + } + catch (InvalidNodeRefException refErr) + { + FacesContext fc = FacesContext.getCurrentInstance(); + Utils.addErrorMessage(MessageFormat.format(Application.getMessage( + fc, ERROR_DELETED_FOLDER), new Object[] {this.currentNodeId}) ); + + nodeRef = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId(fc)); + node = new Node(nodeRef); + props = node.getProperties(); + } + String icon = (String)props.get("app:icon"); + props.put("icon", icon != null ? icon : CreateSpaceWizard.DEFAULT_SPACE_ICON_NAME); + Path path = node.getNodePath(); + + // resolve CIFS network folder location for this node + FilesystemsConfigSection filesysConfig = (FilesystemsConfigSection) cifsServer.getConfiguration().getConfigSection(FilesystemsConfigSection.SectionName); + DiskSharedDevice diskShare = null; + + SharedDeviceList shares = filesysConfig.getShares(); + Enumeration shareEnum = shares.enumerateShares(); + + while ( shareEnum.hasMoreElements() && diskShare == null) { + SharedDevice curShare = shareEnum.nextElement(); + if ( curShare.getContext() instanceof ContentContext) + diskShare = (DiskSharedDevice) curShare; + } + + if (diskShare != null) + { + ContentContext contentCtx = (ContentContext) diskShare.getContext(); + NodeRef rootNode = contentCtx.getRootNode(); + try + { + String cifsPath = Repository.getNamePath(this.getNodeService(), path, rootNode, "\\", "file:///" + getCIFSServerPath(diskShare)); + + node.getProperties().put("cifsPath", cifsPath); + node.getProperties().put("cifsPathLabel", cifsPath.substring(8)); // strip file:/// part + } + catch(AccessDeniedException ade) + { + node.getProperties().put("cifsPath", ""); + node.getProperties().put("cifsPathLabel",""); // strip file:/// part + } + } + + this.currentNode = node; + } + + return this.currentNode; + } + + /** + * @return Returns the breadcrumb handler elements representing the location path of the UI. + */ + public List getLocation() + { + if (this.location == null) + { + // get the initial location from the user preferences + processToolbarLocation(getToolbarLocation(), false); + } + + return this.location; + } + + /** + * @param location The UI location representation to set. + */ + public void setLocation(List location) + { + this.location = location; + } + + /** + * @return true if we are currently the special Guest user + */ + public boolean getIsGuest() + { + return Repository.getIsGuest(FacesContext.getCurrentInstance()); + } + + /** + * Sets up the dispatch context so that the navigation handler knows + * what object is being acted upon + * + * @param node The node to be added to the dispatch context + */ + public void setupDispatchContext(Node node) + { + this.dispatchContext = node; + } + + /** + * Resets the dispatch context + */ + public void resetDispatchContext() + { + this.dispatchContext = null; + } + + /** + * Returns the node currently set in the dispatch context + * + * @return The node being dispatched or null if there is no + * dispatch context + */ + public Node getDispatchContextNode() + { + return this.dispatchContext; + } + + /** + * @return Node representing the Company Home folder + */ + public Node getCompanyHomeNode() + { + if (this.companyHomeNode == null) + { + FacesContext fc = FacesContext.getCurrentInstance(); + String companyRootId = Application.getCompanyRootId(fc); + if (companyRootId != null) + { + NodeRef companyRootRef = new NodeRef(Repository.getStoreRef(), companyRootId); + this.companyHomeNode = new Node(companyRootRef); + } + } + return this.companyHomeNode; + } + + /** + * @return Node representing the Guest Home Space folder + */ + public Node getGuestHomeNode() + { + if (this.guestHomeNode == null) + { + try + { + FacesContext fc = FacesContext.getCurrentInstance(); + String xpath = Application.getRootPath(fc) + "/" + Application.getGuestHomeFolderName(fc); + List guestHomeRefs = this.getSearchService().selectNodes( + this.getNodeService().getRootNode(Repository.getStoreRef()), + xpath, null, this.getNamespaceService(), false); + if (guestHomeRefs.size() == 1) + { + this.guestHomeNode = new Node(guestHomeRefs.get(0)); + } + } + catch (InvalidNodeRefException err1) + { + // cannot continue if this occurs + } + catch (AccessDeniedException err2) + { + // cannot see node if this occurs + } + } + return this.guestHomeNode; + } + + /** + * @return true if the Company home node is accessable to the current user + */ + public boolean getCompanyHomeVisible() + { + Node companyHomeNode = getCompanyHomeNode(); + if (companyHomeNode != null) + { + return companyHomeNode.hasPermission(PermissionService.READ); + } + else + { + return false; + } + } + + /** + * @return true if the Guest home node is accessable to the current user + */ + public boolean getGuestHomeVisible() + { + if (this.getAuthService().guestUserAuthenticationAllowed()) + { + Node guestHome = getGuestHomeNode(); + return guestHome != null && guestHome.hasPermission(PermissionService.READ); + } + else + { + return false; + } + } + + + // ------------------------------------------------------------------------------ + // Navigation action event handlers + + /** + * Action handler to toggle the expanded state of the shelf. + * The panel component wrapping the shelf area of the UI is value bound to the shelfExpanded property. + */ + public void toggleShelf(ActionEvent event) + { + this.shelfExpanded = !this.shelfExpanded; + } + + /** + * Action handler called after a Shelf Group has had its expanded state toggled by the user + */ + public void shelfGroupToggled(ActionEvent event) + { + UIShelf.ShelfEvent shelfEvent = (UIShelf.ShelfEvent)event; + this.shelfItemExpanded[shelfEvent.Index] = shelfEvent.Expanded; + } + + /** + * Action to change the toolbar location + * Currently this will changed the location from Company to the users Home space + */ + public void toolbarLocationChanged(ActionEvent event) + { + FacesContext context = FacesContext.getCurrentInstance(); + try + { + UIModeList locationList = (UIModeList)event.getComponent(); + String location = locationList.getValue().toString(); + processToolbarLocation(location, true); + } + catch (InvalidNodeRefException refErr) + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage( + FacesContext.getCurrentInstance(), Repository.ERROR_NOHOME), Application.getCurrentUser(context).getHomeSpaceId()), refErr ); + } + catch (Exception err) + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage( + FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); + } + } + + /** + * @param diskShare Filesystem shared device + * @return CIFS server path as network style string label + */ + public String getCIFSServerPath(DiskSharedDevice diskShare) + { + if (this.cifsServerPath == null) + { + StringBuilder buf = new StringBuilder(24); + + String serverName = this.getCifsServer().getConfiguration().getServerName(); + if (serverName != null && serverName.length() != 0) + { + buf.append("\\\\"); + buf.append(serverName); + + // Check if there is a suffix to apply to the host name + + if ( clientConfig != null && clientConfig.getCifsURLSuffix() != null) + buf.append(clientConfig.getCifsURLSuffix()); + + buf.append("\\"); + buf.append(diskShare.getName()); + } + + this.cifsServerPath = buf.toString(); + } + + return this.cifsServerPath; + } + + /** + * @return true if the current space has an RSS feed applied + */ + public boolean isRSSFeed() + { + return SpaceDetailsDialog.hasRSSFeed(getCurrentNode()); + } + + /** + * @return RSS Feed URL for the current space + */ + public String getRSSFeedURL() + { + return SpaceDetailsDialog.buildRSSFeedURL(getCurrentNode()); + } + + + // ------------------------------------------------------------------------------ + // Helpers + + /** + * Initialise default values from client configuration + * + * Package visibility to allow LoginBean to re-init (for example, in context of tenant config) + */ + /* package */ void initFromClientConfig() + { + this.clientConfig = Application.getClientConfig(FacesContext.getCurrentInstance()); + this.helpUrl = clientConfig.getHelpUrl(); + this.shelfExpanded = clientConfig.isShelfVisible(); + } + + + // ------------------------------------------------------------------------------ + // Inner classes + + /** + * Class to handle breadcrumb interaction for top-level navigation pages + */ + public class NavigationBreadcrumbHandler implements IRepoBreadcrumbHandler + { + private static final long serialVersionUID = 4833194653193016638L; + + /** + * Constructor + * + * @param label Element label + */ + public NavigationBreadcrumbHandler(NodeRef ref, String label) + { + this.label = label; + this.ref = ref; + } + + /** + * @see java.lang.Object#toString() + */ + public String toString() + { + return this.label; + } + + /** + * @see org.alfresco.web.ui.common.component.IBreadcrumbHandler#navigationOutcome(org.alfresco.web.ui.common.component.UIBreadcrumb) + */ + @SuppressWarnings("unchecked") + public String navigationOutcome(UIBreadcrumb breadcrumb) + { + // set the current node to the specified top level node ID + FacesContext fc = FacesContext.getCurrentInstance(); + setCurrentNodeId(ref.getId()); + setLocation( (List)breadcrumb.getValue() ); + + // setup the dispatch context + setupDispatchContext(new Node(ref)); + + // inform any listeners that the current space has changed + UIContextService.getInstance(FacesContext.getCurrentInstance()).spaceChanged(); + + if (fc.getViewRoot().getViewId().equals(BrowseBean.BROWSE_VIEW_ID)) + { + return null; + } + else + { + return OUTCOME_BROWSE; + } + } + + public NodeRef getNodeRef() + { + return this.ref; + } + + private String label; + private NodeRef ref; + } + + + // ------------------------------------------------------------------------------ + // Private data + + private static Log s_logger = LogFactory.getLog(NavigationBean.class); + + /** constant values used by the toolbar location modelist control */ + public static final String LOCATION_COMPANY = "companyhome"; + public static final String LOCATION_HOME = "userhome"; + public static final String LOCATION_GUEST = "guesthome"; + public static final String LOCATION_MYALFRESCO = "myalfresco"; + + /** constant value representing the display lables for toolbar locations */ + public static final String MSG_MYALFRESCO = "my_alfresco"; + public static final String MSG_MYHOME = "my_home"; + public static final String MSG_COMPANYHOME = "company_home"; + public static final String MSG_GUESTHOME = "guest_home"; + + private static final String OUTCOME_MYALFRESCO = "myalfresco"; + private static final String OUTCOME_BROWSE = "browse"; + + private static final String ERROR_DELETED_FOLDER = "error_deleted_folder"; + + /** The NodeService to be used by the bean */ + transient private NodeService nodeService; + + /** The SearchService to be used by the bean */ + transient private SearchService searchService; + + /** NamespaceService bean reference */ + transient private NamespaceService namespaceService; + + /** RuleService bean reference*/ + transient private RuleService ruleService; + + /** CIFSServer bean reference */ + transient private CIFSServerBean cifsServer; + + /** CIFS content disk driver bean reference */ + protected ContentDiskInterface contentDiskDriver; + + /** Client configuration object */ + protected ClientConfigElement clientConfig = null; + + /** The user preferences bean reference */ + UserPreferencesBean preferences; + + /** The Authentication service bean reference */ + transient private AuthenticationService authService; + + /** The PermissionService reference */ + transient private PermissionService permissionService; + + /** Cached path to our CIFS server and top level node DIR */ + private String cifsServerPath; + + /** Node Id we are using for UI context operations */ + private String currentNodeId; + + /** Node we are using for UI context operations */ + private Node currentNode = null; + + /** Node we are using for dispatching */ + private Node dispatchContext = null; + + /** Node representing the guest home */ + private Node guestHomeNode = null; + + /** Node representing the company home */ + private Node companyHomeNode = null; + + /** Current toolbar location */ + private String toolbarLocation = null; + + /** Search context object we are currently using or null for no search */ + private SearchContext searchContext; + + /** expanded state of the Shelf panel wrapper component */ + private boolean shelfExpanded = true; + + /** expanded state of the Shelf item components */ + private boolean[] shelfItemExpanded = new boolean[] {true, true, true, false, false}; + + /** list of the breadcrumb handler elements representing the location path of the UI */ + private List location = null; + + /** The client Help file url */ + private String helpUrl; +} \ No newline at end of file diff --git a/source/java/org/alfresco/web/bean/NodeEventListener.java b/source/java/org/alfresco/web/bean/NodeEventListener.java index e51d20f967..3f60d5cce5 100644 --- a/source/java/org/alfresco/web/bean/NodeEventListener.java +++ b/source/java/org/alfresco/web/bean/NodeEventListener.java @@ -24,13 +24,15 @@ */ package org.alfresco.web.bean; +import java.io.Serializable; + import org.alfresco.service.namespace.QName; import org.alfresco.web.bean.repository.Node; /** * @author Kevin Roast */ -public interface NodeEventListener +public interface NodeEventListener extends Serializable { /** * Callback executed when a Node wrapped object is created. This is generally used diff --git a/source/java/org/alfresco/web/bean/SidebarBean.java b/source/java/org/alfresco/web/bean/SidebarBean.java index 2aba37ea23..3a5f7530ab 100644 --- a/source/java/org/alfresco/web/bean/SidebarBean.java +++ b/source/java/org/alfresco/web/bean/SidebarBean.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.bean; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -42,8 +43,10 @@ import org.alfresco.web.ui.common.component.UIModeList; * * @author gavinc */ -public class SidebarBean +public class SidebarBean implements Serializable { + private static final long serialVersionUID = -2613219657864672539L; + protected String activePlugin; protected List plugins; protected SidebarConfigElement sidebarConfig; diff --git a/source/java/org/alfresco/web/bean/SpaceLinkDetailsDialog.java b/source/java/org/alfresco/web/bean/SpaceLinkDetailsDialog.java index 3c42e28800..88e5a1c912 100644 --- a/source/java/org/alfresco/web/bean/SpaceLinkDetailsDialog.java +++ b/source/java/org/alfresco/web/bean/SpaceLinkDetailsDialog.java @@ -64,7 +64,7 @@ public class SpaceLinkDetailsDialog extends BaseDetailsBean implements Navigatio if (ApplicationModel.TYPE_FOLDERLINK.equals(space.getType())) { NodeRef destRef = (NodeRef) space.getProperties().get(ContentModel.PROP_LINK_DESTINATION); - if (nodeService.exists(destRef)) + if (getNodeService().exists(destRef)) { space = new Node(destRef); } @@ -216,7 +216,8 @@ public class SpaceLinkDetailsDialog extends BaseDetailsBean implements Navigatio @Override public String getContainerSubTitle() { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + getSpace().getNodePath().toDisplayPath(nodeService, permissionService); + return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + + getSpace().getNodePath().toDisplayPath(getNodeService(), getPermissionService()); } public String getContainerTitle() diff --git a/source/java/org/alfresco/web/bean/TemplateMailHelperBean.java b/source/java/org/alfresco/web/bean/TemplateMailHelperBean.java index aab3a71eeb..3d09c43aaa 100644 --- a/source/java/org/alfresco/web/bean/TemplateMailHelperBean.java +++ b/source/java/org/alfresco/web/bean/TemplateMailHelperBean.java @@ -24,6 +24,9 @@ */ package org.alfresco.web.bean; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.Serializable; import java.text.MessageFormat; import java.util.Map; @@ -39,6 +42,7 @@ import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.web.app.Application; +import org.alfresco.web.app.servlet.FacesHelper; import org.alfresco.web.app.servlet.BaseTemplateContentServlet; import org.alfresco.web.app.servlet.BaseTemplateContentServlet.URLHelper; import org.alfresco.web.bean.repository.Repository; @@ -53,15 +57,17 @@ import org.springframework.mail.javamail.MimeMessagePreparator; /** * @author Kevin Roast */ -public class TemplateMailHelperBean +public class TemplateMailHelperBean implements Serializable { + private static final long serialVersionUID = 9117248002321651339L; + private static Log logger = LogFactory.getLog(TemplateMailHelperBean.class); /** JavaMailSender bean reference */ - protected JavaMailSender mailSender; + transient private JavaMailSender mailSender; /** NodeService bean reference */ - protected NodeService nodeService; + transient private NodeService nodeService; /** dialog state */ private String subject = null; @@ -79,6 +85,15 @@ public class TemplateMailHelperBean this.mailSender = mailSender; } + protected JavaMailSender getMailSender() + { + if (mailSender == null) + { + mailSender = (JavaMailSender) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "mailService"); + } + return mailSender; + } + /** * @param nodeService The nodeService to set. */ @@ -87,6 +102,15 @@ public class TemplateMailHelperBean this.nodeService = nodeService; } + protected NodeService getNodeService() + { + if (nodeService == null) + { + nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + } + return nodeService; + } + /** * Initialises the bean */ @@ -109,7 +133,7 @@ public class TemplateMailHelperBean */ public void notifyUser(NodeRef person, NodeRef node, final String from, String roleText) { - final String to = (String)this.nodeService.getProperty(person, ContentModel.PROP_EMAIL); + final String to = (String)this.getNodeService().getProperty(person, ContentModel.PROP_EMAIL); if (to != null && to.length() != 0) { @@ -151,7 +175,7 @@ public class TemplateMailHelperBean try { // Send the message - this.mailSender.send(mailPreparer); + this.getMailSender().send(mailPreparer); } catch (Throwable e) { @@ -277,4 +301,5 @@ public class TemplateMailHelperBean { this.usingTemplate = usingTemplate; } + } diff --git a/source/java/org/alfresco/web/bean/TemplateSupportBean.java b/source/java/org/alfresco/web/bean/TemplateSupportBean.java index b2f42ec0d9..6a2137f41b 100644 --- a/source/java/org/alfresco/web/bean/TemplateSupportBean.java +++ b/source/java/org/alfresco/web/bean/TemplateSupportBean.java @@ -24,6 +24,9 @@ */ package org.alfresco.web.bean; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -52,8 +55,10 @@ import org.alfresco.web.data.QuickSort; * * @author Kevin Roast */ -public class TemplateSupportBean +public class TemplateSupportBean implements Serializable { + private static final long serialVersionUID = 6698338879903536081L; + private static final String MSG_SELECT_TEMPLATE = "select_a_template"; private static final String MSG_SELECT_SCRIPT = "select_a_script"; @@ -61,10 +66,10 @@ public class TemplateSupportBean public static final String NO_SELECTION = "none"; /** NodeService instance */ - private NodeService nodeService; + transient private NodeService nodeService; /** The SearchService instance */ - private SearchService searchService; + transient private SearchService searchService; /** cache of content templates that lasts 30 seconds - enough for a couple of page refreshes */ private ExpiringValueCache> contentTemplates = new ExpiringValueCache>(1000*30); @@ -87,6 +92,15 @@ public class TemplateSupportBean this.nodeService = nodeService; } + private NodeService getNodeService() + { + if (nodeService == null) + { + nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + } + return nodeService; + } + /** * @param searchService The SearchService to set. */ @@ -95,6 +109,15 @@ public class TemplateSupportBean this.searchService = searchService; } + private SearchService getSearchService() + { + if (searchService == null) + { + searchService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSearchService(); + } + return searchService; + } + /** * @return the list of available Content Templates that can be applied to the current document. */ @@ -195,9 +218,9 @@ public class TemplateSupportBean try { - NodeRef rootNodeRef = this.nodeService.getRootNode(Repository.getStoreRef()); + NodeRef rootNodeRef = this.getNodeService().getRootNode(Repository.getStoreRef()); NamespaceService resolver = Repository.getServiceRegistry(fc).getNamespaceService(); - List results = this.searchService.selectNodes(rootNodeRef, xpath, null, resolver, false); + List results = this.getSearchService().selectNodes(rootNodeRef, xpath, null, resolver, false); wrappers = new ArrayList(results.size() + 1); if (results.size() != 0) @@ -205,7 +228,7 @@ public class TemplateSupportBean DictionaryService dd = Repository.getServiceRegistry(fc).getDictionaryService(); for (NodeRef ref : results) { - if (this.nodeService.exists(ref) == true) + if (this.getNodeService().exists(ref) == true) { Node childNode = new Node(ref); if (dd.isSubClass(childNode.getType(), ContentModel.TYPE_CONTENT)) @@ -234,4 +257,5 @@ public class TemplateSupportBean return wrappers; } + } diff --git a/source/java/org/alfresco/web/bean/actions/BaseActionWizard.java b/source/java/org/alfresco/web/bean/actions/BaseActionWizard.java index ec0fba33e5..873d68b806 100644 --- a/source/java/org/alfresco/web/bean/actions/BaseActionWizard.java +++ b/source/java/org/alfresco/web/bean/actions/BaseActionWizard.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.bean.actions; +import java.io.IOException; +import java.io.ObjectInputStream; import java.io.Serializable; import java.text.MessageFormat; import java.util.ArrayList; @@ -79,10 +81,10 @@ public abstract class BaseActionWizard extends BaseWizardBean protected static final String PROP_ACTION_SUMMARY = "actionSummary"; protected static final String NO_PARAMS_MARKER = "noParamsMarker"; - protected ActionService actionService; - protected MimetypeService mimetypeService; - protected PersonService personService; - protected AuthorityService authorityService; + transient private ActionService actionService; + transient private MimetypeService mimetypeService; + transient private PersonService personService; + transient private AuthorityService authorityService; protected List actions; protected List transformers; @@ -96,8 +98,8 @@ public abstract class BaseActionWizard extends BaseWizardBean protected List objectTypes; protected List emailRecipients; - protected DataModel allActionsDataModel; - protected DataModel emailRecipientsDataModel; + transient protected DataModel allActionsDataModel; + transient protected DataModel emailRecipientsDataModel; protected boolean editingAction; protected String action; @@ -216,7 +218,7 @@ public abstract class BaseActionWizard extends BaseWizardBean { if (this.actions == null) { - List ruleActions = this.actionService.getActionDefinitions(); + List ruleActions = this.getActionService().getActionDefinitions(); this.actions = new ArrayList(); for (ActionDefinition ruleActionDef : ruleActions) { @@ -389,15 +391,15 @@ public abstract class BaseActionWizard extends BaseWizardBean for (ConfigElement child : typesCfg.getChildren()) { QName idQName = Repository.resolveToQName(child.getAttribute("name")); - TypeDefinition typeDef = this.dictionaryService.getType(idQName); + TypeDefinition typeDef = this.getDictionaryService().getType(idQName); // make sure the type is a subtype of content or folder but not // the content or folder type itself if (typeDef != null && typeDef.getName().equals(ContentModel.TYPE_CONTENT) == false && typeDef.getName().equals(ContentModel.TYPE_FOLDER) == false && - (this.dictionaryService.isSubClass(typeDef.getName(), ContentModel.TYPE_CONTENT) || - this.dictionaryService.isSubClass(typeDef.getName(), ContentModel.TYPE_FOLDER))) + (this.getDictionaryService().isSubClass(typeDef.getName(), ContentModel.TYPE_CONTENT) || + this.getDictionaryService().isSubClass(typeDef.getName(), ContentModel.TYPE_FOLDER))) { // try and get the display label from config String label = Utils.getDisplayLabel(context, child); @@ -450,8 +452,8 @@ public abstract class BaseActionWizard extends BaseWizardBean { List userNodes = Repository.getUsers( FacesContext.getCurrentInstance(), - this.nodeService, - this.searchService); + this.getNodeService(), + this.getSearchService()); this.users = new ArrayList(); for (Node user : userNodes) { @@ -487,7 +489,7 @@ public abstract class BaseActionWizard extends BaseWizardBean if (transformersCfg != null) { FacesContext context = FacesContext.getCurrentInstance(); - Map mimeTypes = this.mimetypeService.getDisplaysByMimetype(); + Map mimeTypes = this.getMimetypeService().getDisplaysByMimetype(); this.transformers = new ArrayList(); for (ConfigElement child : transformersCfg.getChildren()) { @@ -540,7 +542,7 @@ public abstract class BaseActionWizard extends BaseWizardBean if (transformersCfg != null) { FacesContext context = FacesContext.getCurrentInstance(); - Map mimeTypes = this.mimetypeService.getDisplaysByMimetype(); + Map mimeTypes = this.getMimetypeService().getDisplaysByMimetype(); this.imageTransformers = new ArrayList(); for (ConfigElement child : transformersCfg.getChildren()) { @@ -618,7 +620,7 @@ public abstract class BaseActionWizard extends BaseWizardBean else { // just add the action to the list and use the title as the summary - ActionDefinition actionDef = this.actionService.getActionDefinition(this.action); + ActionDefinition actionDef = this.getActionService().getActionDefinition(this.action); actionProps.put(PROP_ACTION_SUMMARY, actionDef.getTitle()); // add the no params marker so we can disable the edit action actionProps.put(NO_PARAMS_MARKER, "no-params"); @@ -822,6 +824,15 @@ public abstract class BaseActionWizard extends BaseWizardBean this.actionService = actionService; } + protected ActionService getActionService() + { + if (actionService == null) + { + actionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getActionService(); + } + return actionService; + } + /** * Sets the mimetype service * @@ -832,6 +843,15 @@ public abstract class BaseActionWizard extends BaseWizardBean this.mimetypeService = mimetypeService; } + protected MimetypeService getMimetypeService() + { + if (mimetypeService == null) + { + mimetypeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMimetypeService(); + } + return mimetypeService; + } + /** * @param personService The personService to set. */ @@ -840,6 +860,15 @@ public abstract class BaseActionWizard extends BaseWizardBean this.personService = personService; } + protected PersonService getPersonService() + { + if (personService == null) + { + personService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPersonService(); + } + return personService; + } + /** * @param authorityService The authorityService to set. */ @@ -848,6 +877,15 @@ public abstract class BaseActionWizard extends BaseWizardBean this.authorityService = authorityService; } + protected AuthorityService getAuthorityService() + { + if (authorityService == null) + { + authorityService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAuthorityService(); + } + return authorityService; + } + // ------------------------------------------------------------------------------ // Helper methods @@ -856,10 +894,10 @@ public abstract class BaseActionWizard extends BaseWizardBean { String label = authority; - if (this.personService.personExists(authority)) + if (this.getPersonService().personExists(authority)) { // create the node ref, then our node representation - NodeRef ref = personService.getPerson(authority); + NodeRef ref = getPersonService().getPerson(authority); Node node = new Node(ref); // setup convience function for current user full name @@ -986,7 +1024,7 @@ public abstract class BaseActionWizard extends BaseWizardBean // if there wasn't a client based label try and get it from the dictionary if (label == null) { - AspectDefinition aspectDef = this.dictionaryService.getAspect(idQName); + AspectDefinition aspectDef = this.getDictionaryService().getAspect(idQName); if (aspectDef != null) { label = aspectDef.getTitle(); @@ -1014,8 +1052,10 @@ public abstract class BaseActionWizard extends BaseWizardBean /** * Simple wrapper class for email recipient fields */ - public static class RecipientWrapper + public static class RecipientWrapper implements Serializable { + private static final long serialVersionUID = -3331836277440957711L; + public RecipientWrapper(String name, String authority) { this.name = name; @@ -1052,4 +1092,14 @@ public abstract class BaseActionWizard extends BaseWizardBean private String name; private String authority; } + + private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException + { + in.defaultReadObject(); + + this.allActionsDataModel = new ListDataModel(); + this.allActionsDataModel.setWrappedData(this.allActionsProperties); + this.emailRecipientsDataModel = new ListDataModel(); + this.emailRecipientsDataModel.setWrappedData(this.emailRecipients); + } } diff --git a/source/java/org/alfresco/web/bean/actions/IHandler.java b/source/java/org/alfresco/web/bean/actions/IHandler.java index a5c7248286..022235fe9c 100644 --- a/source/java/org/alfresco/web/bean/actions/IHandler.java +++ b/source/java/org/alfresco/web/bean/actions/IHandler.java @@ -38,7 +38,7 @@ import org.alfresco.web.bean.wizard.IWizardBean; * * @author gavinc */ -public interface IHandler +public interface IHandler extends Serializable { /** * Adds any properties to the given map that need default values diff --git a/source/java/org/alfresco/web/bean/actions/RunActionWizard.java b/source/java/org/alfresco/web/bean/actions/RunActionWizard.java index 0ec2fa9253..71493e9ad4 100644 --- a/source/java/org/alfresco/web/bean/actions/RunActionWizard.java +++ b/source/java/org/alfresco/web/bean/actions/RunActionWizard.java @@ -48,10 +48,12 @@ import org.alfresco.web.ui.common.Utils; /** * Bean implementation for the "Run Action" wizard. * - * @author gavinc + * @author gavinc */ public class RunActionWizard extends BaseActionWizard { + private static final long serialVersionUID = 975435581009378899L; + protected boolean checkinActionPresent = false; // ------------------------------------------------------------------------------ @@ -91,12 +93,12 @@ public class RunActionWizard extends BaseActionWizard } // add the action to the rule - Action action = this.actionService.createAction(actionName); + Action action = this.getActionService().createAction(actionName); action.setParameterValues(repoActionParams); // execute the action on the current document node NodeRef nodeRef = new NodeRef(Repository.getStoreRef(), this.parameters.get("id")); - this.actionService.executeAction(action, nodeRef); + this.getActionService().executeAction(action, nodeRef); } return outcome; @@ -108,7 +110,7 @@ public class RunActionWizard extends BaseActionWizard if (this.actions == null) { NodeRef nodeRef = new NodeRef(Repository.getStoreRef(), this.parameters.get("id")); - List ruleActions = this.actionService.getActionDefinitions(nodeRef); + List ruleActions = this.getActionService().getActionDefinitions(nodeRef); this.actions = new ArrayList(); for (ActionDefinition ruleActionDef : ruleActions) { diff --git a/source/java/org/alfresco/web/bean/actions/handlers/AddFeaturesHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/AddFeaturesHandler.java index 2530f22f26..fb505863ec 100644 --- a/source/java/org/alfresco/web/bean/actions/handlers/AddFeaturesHandler.java +++ b/source/java/org/alfresco/web/bean/actions/handlers/AddFeaturesHandler.java @@ -45,6 +45,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class AddFeaturesHandler extends BaseActionHandler { + private static final long serialVersionUID = -2062128886273060606L; + protected static final String PROP_ASPECT = "aspect"; public String getJSPPath() diff --git a/source/java/org/alfresco/web/bean/actions/handlers/CheckInHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/CheckInHandler.java index ad33d324c0..893391925f 100644 --- a/source/java/org/alfresco/web/bean/actions/handlers/CheckInHandler.java +++ b/source/java/org/alfresco/web/bean/actions/handlers/CheckInHandler.java @@ -41,6 +41,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class CheckInHandler extends BaseActionHandler { + private static final long serialVersionUID = 9033071326749427779L; + protected static final String PROP_CHECKIN_DESC = "checkinDescription"; protected static final String PROP_CHECKIN_MINOR = "checkinMinorChange"; diff --git a/source/java/org/alfresco/web/bean/actions/handlers/CheckOutHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/CheckOutHandler.java index f9de5255c9..6ae9d4fe8a 100644 --- a/source/java/org/alfresco/web/bean/actions/handlers/CheckOutHandler.java +++ b/source/java/org/alfresco/web/bean/actions/handlers/CheckOutHandler.java @@ -46,6 +46,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class CheckOutHandler extends BaseActionHandler { + private static final long serialVersionUID = -7115284366068767316L; + public String getJSPPath() { return getJSPPath(CheckOutActionExecuter.NAME); diff --git a/source/java/org/alfresco/web/bean/actions/handlers/CopyHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/CopyHandler.java index 6ff8ce9205..d0693bb6dc 100644 --- a/source/java/org/alfresco/web/bean/actions/handlers/CopyHandler.java +++ b/source/java/org/alfresco/web/bean/actions/handlers/CopyHandler.java @@ -46,6 +46,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class CopyHandler extends BaseActionHandler { + private static final long serialVersionUID = -3570705279828902436L; + public String getJSPPath() { return getJSPPath(CopyActionExecuter.NAME); diff --git a/source/java/org/alfresco/web/bean/actions/handlers/CopyToWebProjectHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/CopyToWebProjectHandler.java index cc26a92606..92d9622535 100644 --- a/source/java/org/alfresco/web/bean/actions/handlers/CopyToWebProjectHandler.java +++ b/source/java/org/alfresco/web/bean/actions/handlers/CopyToWebProjectHandler.java @@ -48,6 +48,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class CopyToWebProjectHandler extends BaseActionHandler { + private static final long serialVersionUID = -6725139406646296868L; + public String getJSPPath() { return getJSPPath(CopyToWebProjectActionExecuter.NAME); diff --git a/source/java/org/alfresco/web/bean/actions/handlers/ImportHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/ImportHandler.java index 9d2f84dd74..3c6153a2c3 100644 --- a/source/java/org/alfresco/web/bean/actions/handlers/ImportHandler.java +++ b/source/java/org/alfresco/web/bean/actions/handlers/ImportHandler.java @@ -43,6 +43,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class ImportHandler extends BaseActionHandler { + private static final long serialVersionUID = -3011384175544764038L; + protected static final String IMPORT_ENCODING = "UTF-8"; public String getJSPPath() diff --git a/source/java/org/alfresco/web/bean/actions/handlers/LinkCategoryHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/LinkCategoryHandler.java index ea4122beca..6dabad3853 100644 --- a/source/java/org/alfresco/web/bean/actions/handlers/LinkCategoryHandler.java +++ b/source/java/org/alfresco/web/bean/actions/handlers/LinkCategoryHandler.java @@ -44,6 +44,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class LinkCategoryHandler extends BaseActionHandler { + private static final long serialVersionUID = -5956987738674149920L; + protected static final String PROP_CATEGORY = "category"; public String getJSPPath() diff --git a/source/java/org/alfresco/web/bean/actions/handlers/MailHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/MailHandler.java index ac2d1e86bf..b30f64decf 100644 --- a/source/java/org/alfresco/web/bean/actions/handlers/MailHandler.java +++ b/source/java/org/alfresco/web/bean/actions/handlers/MailHandler.java @@ -47,6 +47,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class MailHandler extends BaseActionHandler { + private static final long serialVersionUID = 622475325355334995L; + public static final String PROP_TO = "to"; public static final String PROP_FROM = "from"; public static final String PROP_MESSAGE = "message"; diff --git a/source/java/org/alfresco/web/bean/actions/handlers/MoveHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/MoveHandler.java index 5df3ef1375..a0d122afc9 100644 --- a/source/java/org/alfresco/web/bean/actions/handlers/MoveHandler.java +++ b/source/java/org/alfresco/web/bean/actions/handlers/MoveHandler.java @@ -46,6 +46,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class MoveHandler extends BaseActionHandler { + private static final long serialVersionUID = 2778547560606246126L; + public String getJSPPath() { return getJSPPath(MoveActionExecuter.NAME); diff --git a/source/java/org/alfresco/web/bean/actions/handlers/RemoveFeaturesHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/RemoveFeaturesHandler.java index 456843cf66..6e325dc60c 100644 --- a/source/java/org/alfresco/web/bean/actions/handlers/RemoveFeaturesHandler.java +++ b/source/java/org/alfresco/web/bean/actions/handlers/RemoveFeaturesHandler.java @@ -45,6 +45,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class RemoveFeaturesHandler extends BaseActionHandler { + private static final long serialVersionUID = 8725616196918341435L; + protected static final String PROP_ASPECT = "aspect"; public String getJSPPath() diff --git a/source/java/org/alfresco/web/bean/actions/handlers/ScriptHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/ScriptHandler.java index af77e2efcf..0e768a1935 100644 --- a/source/java/org/alfresco/web/bean/actions/handlers/ScriptHandler.java +++ b/source/java/org/alfresco/web/bean/actions/handlers/ScriptHandler.java @@ -33,8 +33,6 @@ import javax.faces.context.FacesContext; import org.alfresco.repo.action.executer.ScriptActionExecuter; import org.alfresco.service.cmr.repository.NodeRef; 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.wizard.IWizardBean; @@ -45,6 +43,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class ScriptHandler extends BaseActionHandler { + private static final long serialVersionUID = -8006002591602401584L; + protected static final String PROP_SCRIPT = "script"; public String getJSPPath() diff --git a/source/java/org/alfresco/web/bean/actions/handlers/SimpleWorkflowHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/SimpleWorkflowHandler.java index cf85b23057..3d3eff8167 100644 --- a/source/java/org/alfresco/web/bean/actions/handlers/SimpleWorkflowHandler.java +++ b/source/java/org/alfresco/web/bean/actions/handlers/SimpleWorkflowHandler.java @@ -44,6 +44,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class SimpleWorkflowHandler extends BaseActionHandler { + private static final long serialVersionUID = 2477573776900075171L; + public static final String PROP_APPROVE_STEP_NAME = "approveStepName"; public static final String PROP_APPROVE_ACTION = "approveAction"; public static final String PROP_APPROVE_FOLDER = "approveFolder"; diff --git a/source/java/org/alfresco/web/bean/actions/handlers/SpecialiseTypeHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/SpecialiseTypeHandler.java index dd3ec64687..c585b0d975 100644 --- a/source/java/org/alfresco/web/bean/actions/handlers/SpecialiseTypeHandler.java +++ b/source/java/org/alfresco/web/bean/actions/handlers/SpecialiseTypeHandler.java @@ -44,6 +44,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class SpecialiseTypeHandler extends BaseActionHandler { + private static final long serialVersionUID = 7404684895683515301L; + public static final String PROP_OBJECT_TYPE = "objecttype"; public String getJSPPath() diff --git a/source/java/org/alfresco/web/bean/actions/handlers/TransformHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/TransformHandler.java index 15d0899491..02156031a2 100644 --- a/source/java/org/alfresco/web/bean/actions/handlers/TransformHandler.java +++ b/source/java/org/alfresco/web/bean/actions/handlers/TransformHandler.java @@ -48,6 +48,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class TransformHandler extends BaseActionHandler { + private static final long serialVersionUID = -1224311673192351639L; + protected static final String PROP_TRANSFORMER = "transformer"; public String getJSPPath() diff --git a/source/java/org/alfresco/web/bean/actions/handlers/TransformImageHandler.java b/source/java/org/alfresco/web/bean/actions/handlers/TransformImageHandler.java index fcf30210c5..ce968929ca 100644 --- a/source/java/org/alfresco/web/bean/actions/handlers/TransformImageHandler.java +++ b/source/java/org/alfresco/web/bean/actions/handlers/TransformImageHandler.java @@ -49,6 +49,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class TransformImageHandler extends BaseActionHandler { + private static final long serialVersionUID = 7729555214101161605L; + protected static final String PROP_IMAGE_TRANSFORMER = "imageTransformer"; protected static final String PROP_TRANSFORM_OPTIONS = "transformOptions"; diff --git a/source/java/org/alfresco/web/bean/admin/AdminNodeBrowseBean.java b/source/java/org/alfresco/web/bean/admin/AdminNodeBrowseBean.java index 9dbdb9d13a..e38398bbee 100644 --- a/source/java/org/alfresco/web/bean/admin/AdminNodeBrowseBean.java +++ b/source/java/org/alfresco/web/bean/admin/AdminNodeBrowseBean.java @@ -23,7 +23,7 @@ * http://www.alfresco.com/legal/licensing" */ package org.alfresco.web.bean.admin; - + import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; @@ -56,6 +56,7 @@ import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.util.ISO9075; import org.alfresco.web.app.servlet.DownloadContentServlet; +import org.alfresco.web.bean.repository.Repository; // TODO: DownloadServlet - use of request parameter for property name? @@ -65,8 +66,10 @@ import org.alfresco.web.app.servlet.DownloadContentServlet; /** * Backing bean to support the Admin Node Browser */ -public class AdminNodeBrowseBean -{ +public class AdminNodeBrowseBean implements Serializable +{ + private static final long serialVersionUID = -8702324672426537379L; + /** selected query language */ private String queryLanguage = null; @@ -85,24 +88,24 @@ public class AdminNodeBrowseBean private SearchResults searchResults = new SearchResults((List)null); // stores and node - private DataModel stores = null; + transient private DataModel stores = null; private NodeRef nodeRef = null; private QName nodeType = null; private Path primaryPath = null; - private DataModel parents = null; - private DataModel aspects = null; - private DataModel properties = null; - private DataModel children = null; - private DataModel assocs = null; + transient private DataModel parents = null; + transient private DataModel aspects = null; + transient private DataModel properties = null; + transient private DataModel children = null; + transient private DataModel assocs = null; private Boolean inheritPermissions = null; - private DataModel permissions = null; + transient private DataModel permissions = null; // supporting repository services - private NodeService nodeService; - private DictionaryService dictionaryService; - private SearchService searchService; - private NamespaceService namespaceService; - private PermissionService permissionService; + transient private NodeService nodeService; + transient private DictionaryService dictionaryService; + transient private SearchService searchService; + transient private NamespaceService namespaceService; + transient private PermissionService permissionService; /** * @param nodeService node service @@ -110,6 +113,15 @@ public class AdminNodeBrowseBean public void setNodeService(NodeService nodeService) { this.nodeService = nodeService; + } + + private NodeService getNodeService() + { + if (nodeService == null) + { + nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + } + return nodeService; } /** @@ -118,6 +130,15 @@ public class AdminNodeBrowseBean public void setSearchService(SearchService searchService) { this.searchService = searchService; + } + + private SearchService getSearchService() + { + if (searchService == null) + { + searchService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSearchService(); + } + return searchService; } /** @@ -126,6 +147,15 @@ public class AdminNodeBrowseBean public void setDictionaryService(DictionaryService dictionaryService) { this.dictionaryService = dictionaryService; + } + + private DictionaryService getDictionaryService() + { + if (dictionaryService == null) + { + dictionaryService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService(); + } + return dictionaryService; } /** @@ -134,6 +164,15 @@ public class AdminNodeBrowseBean public void setNamespaceService(NamespaceService namespaceService) { this.namespaceService = namespaceService; + } + + private NamespaceService getNamespaceService() + { + if (namespaceService == null) + { + namespaceService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNamespaceService(); + } + return namespaceService; } /** @@ -142,6 +181,15 @@ public class AdminNodeBrowseBean public void setPermissionService(PermissionService permissionService) { this.permissionService = permissionService; + } + + private PermissionService getPermissionService() + { + if (permissionService == null) + { + permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService(); + } + return permissionService; } /** @@ -153,7 +201,7 @@ public class AdminNodeBrowseBean { if (stores == null) { - List storeRefs = nodeService.getStores(); + List storeRefs = getNodeService().getStores(); stores = new ListDataModel(storeRefs); } return stores; @@ -168,7 +216,7 @@ public class AdminNodeBrowseBean { if (nodeRef == null) { - nodeRef = nodeService.getRootNode(new StoreRef("system", "system")); + nodeRef = getNodeService().getRootNode(new StoreRef("system", "system")); } return nodeRef; } @@ -203,7 +251,7 @@ public class AdminNodeBrowseBean { if (nodeType == null) { - nodeType = nodeService.getType(getNodeRef()); + nodeType = getNodeService().getType(getNodeRef()); } return nodeType; } @@ -217,7 +265,7 @@ public class AdminNodeBrowseBean { if (primaryPath == null) { - primaryPath = nodeService.getPath(getNodeRef()); + primaryPath = getNodeService().getPath(getNodeRef()); } return ISO9075.decode(primaryPath.toString()); } @@ -244,7 +292,7 @@ public class AdminNodeBrowseBean { if (aspects == null) { - List aspectNames = new ArrayList(nodeService.getAspects(getNodeRef())); + List aspectNames = new ArrayList(getNodeService().getAspects(getNodeRef())); aspects = new ListDataModel(aspectNames); } return aspects; @@ -259,7 +307,7 @@ public class AdminNodeBrowseBean { if (parents == null) { - List parentRefs = nodeService.getParentAssocs(getNodeRef()); + List parentRefs = getNodeService().getParentAssocs(getNodeRef()); parents = new ListDataModel(parentRefs); } return parents; @@ -274,7 +322,7 @@ public class AdminNodeBrowseBean { if (properties == null) { - Map propertyValues = nodeService.getProperties(getNodeRef()); + Map propertyValues = getNodeService().getProperties(getNodeRef()); List nodeProperties = new ArrayList(propertyValues.size()); for (Map.Entry property : propertyValues.entrySet()) { @@ -294,7 +342,7 @@ public class AdminNodeBrowseBean { if (inheritPermissions == null) { - inheritPermissions = permissionService.getInheritParentPermissions(nodeRef); + inheritPermissions = this.getPermissionService().getInheritParentPermissions(nodeRef); } return inheritPermissions.booleanValue(); } @@ -308,10 +356,10 @@ public class AdminNodeBrowseBean { if (permissions == null) { - AccessStatus readPermissions = permissionService.hasPermission(nodeRef, PermissionService.READ_PERMISSIONS); + AccessStatus readPermissions = this.getPermissionService().hasPermission(nodeRef, PermissionService.READ_PERMISSIONS); if (readPermissions.equals(AccessStatus.ALLOWED)) { - List nodePermissions = new ArrayList(permissionService.getAllSetPermissions(nodeRef)); + List nodePermissions = new ArrayList(getPermissionService().getAllSetPermissions(nodeRef)); permissions = new ListDataModel(nodePermissions); } else @@ -333,7 +381,7 @@ public class AdminNodeBrowseBean { if (children == null) { - List assocRefs = nodeService.getChildAssocs(getNodeRef()); + List assocRefs = getNodeService().getChildAssocs(getNodeRef()); children = new ListDataModel(assocRefs); } return children; @@ -348,7 +396,7 @@ public class AdminNodeBrowseBean { if (assocs == null) { - List assocRefs = nodeService.getTargetAssocs(getNodeRef(), RegexQNamePattern.MATCH_ALL); + List assocRefs = getNodeService().getTargetAssocs(getNodeRef(), RegexQNamePattern.MATCH_ALL); assocs = new ListDataModel(assocRefs); } return assocs; @@ -421,8 +469,8 @@ public class AdminNodeBrowseBean */ public String selectStore() { - StoreRef storeRef = (StoreRef)stores.getRowData(); - NodeRef rootNode = nodeService.getRootNode(storeRef); + StoreRef storeRef = (StoreRef)getStores().getRowData(); + NodeRef rootNode = getNodeService().getRootNode(storeRef); setNodeRef(rootNode); return "success"; } @@ -468,7 +516,7 @@ public class AdminNodeBrowseBean */ public String selectParent() { - ChildAssociationRef assocRef = (ChildAssociationRef)parents.getRowData(); + ChildAssociationRef assocRef = (ChildAssociationRef)getParents().getRowData(); NodeRef parentRef = assocRef.getParentRef(); setNodeRef(parentRef); return "success"; @@ -481,7 +529,7 @@ public class AdminNodeBrowseBean */ public String selectToNode() { - AssociationRef assocRef = (AssociationRef)assocs.getRowData(); + AssociationRef assocRef = (AssociationRef)getAssocs().getRowData(); NodeRef targetRef = assocRef.getTargetRef(); setNodeRef(targetRef); return "success"; @@ -494,7 +542,7 @@ public class AdminNodeBrowseBean */ public String selectNodeProperty() { - Property property = (Property)properties.getRowData(); + Property property = (Property)getProperties().getRowData(); Property.Value value = (Property.Value)property.getValues().getRowData(); NodeRef nodeRef = (NodeRef)value.getValue(); setNodeRef(nodeRef); @@ -508,7 +556,7 @@ public class AdminNodeBrowseBean */ public String selectChild() { - ChildAssociationRef assocRef = (ChildAssociationRef)children.getRowData(); + ChildAssociationRef assocRef = (ChildAssociationRef)getChildren().getRowData(); NodeRef childRef = assocRef.getChildRef(); setNodeRef(childRef); return "success"; @@ -540,7 +588,7 @@ public class AdminNodeBrowseBean { // ensure node exists NodeRef nodeRef = new NodeRef(query); - boolean exists = nodeService.exists(nodeRef); + boolean exists = getNodeService().exists(nodeRef); if (!exists) { throw new AlfrescoRuntimeException("Node " + nodeRef + " does not exist."); @@ -550,13 +598,13 @@ public class AdminNodeBrowseBean } else if (queryLanguage.equals("selectnodes")) { - List nodes = searchService.selectNodes(getNodeRef(), query, null, namespaceService, false); + List nodes = getSearchService().selectNodes(getNodeRef(), query, null, namespaceService, false); searchResults = new SearchResults(nodes); return "search"; } // perform search - searchResults = new SearchResults(searchService.query(getNodeRef().getStoreRef(), queryLanguage, query)); + searchResults = new SearchResults(getSearchService().query(getNodeRef().getStoreRef(), queryLanguage, query)); return "search"; } catch(Throwable e) @@ -591,7 +639,7 @@ public class AdminNodeBrowseBean { this.name = name; - PropertyDefinition propDef = dictionaryService.getProperty(name); + PropertyDefinition propDef = getDictionaryService().getProperty(name); if (propDef != null) { datatype = propDef.getDataType().getName().toString(); @@ -720,10 +768,10 @@ public class AdminNodeBrowseBean { if (value != null) { - DataTypeDefinition dataTypeDefinition = dictionaryService.getDataType(value.getClass()); + DataTypeDefinition dataTypeDefinition = getDictionaryService().getDataType(value.getClass()); if (dataTypeDefinition != null) { - datatype = dictionaryService.getDataType(value.getClass()).getName().toString(); + datatype = getDictionaryService().getDataType(value.getClass()).getName().toString(); } } } @@ -780,8 +828,10 @@ public class AdminNodeBrowseBean /** * Permission representing the fact that "Read Permissions" has not been granted */ - public static class NoReadPermissionGranted - { + public static class NoReadPermissionGranted implements Serializable + { + private static final long serialVersionUID = -6256369557521402921L; + public String getPermission() { return PermissionService.READ_PERMISSIONS; @@ -801,10 +851,12 @@ public class AdminNodeBrowseBean /** * Wrapper class for Search Results */ - public class SearchResults - { + public class SearchResults implements Serializable + { + private static final long serialVersionUID = 7402906720039176001L; + private int length = 0; - private DataModel rows; + private SerialListDataModel rows; /** * Construct @@ -813,7 +865,7 @@ public class AdminNodeBrowseBean */ public SearchResults(ResultSet resultSet) { - rows = new ListDataModel(); + rows = new SerialListDataModel(); if (resultSet != null) { rows.setWrappedData(resultSet.getChildAssocRefs()); @@ -828,13 +880,13 @@ public class AdminNodeBrowseBean */ public SearchResults(List resultSet) { - rows = new ListDataModel(); + rows = new SerialListDataModel(); if (resultSet != null) { List assocRefs = new ArrayList(resultSet.size()); for (NodeRef nodeRef : resultSet) { - ChildAssociationRef childAssocRef = nodeService.getPrimaryParent(nodeRef); + ChildAssociationRef childAssocRef = getNodeService().getPrimaryParent(nodeRef); assocRefs.add(childAssocRef); } rows.setWrappedData(assocRefs); @@ -860,6 +912,11 @@ public class AdminNodeBrowseBean public DataModel getRows() { return rows; + } + + private class SerialListDataModel extends ListDataModel implements Serializable + { + private static final long serialVersionUID = 4154583769762846020L; } } diff --git a/source/java/org/alfresco/web/bean/admin/ExportDialog.java b/source/java/org/alfresco/web/bean/admin/ExportDialog.java index 325c32b6f8..4dd2a8b40c 100644 --- a/source/java/org/alfresco/web/bean/admin/ExportDialog.java +++ b/source/java/org/alfresco/web/bean/admin/ExportDialog.java @@ -35,7 +35,6 @@ import org.alfresco.repo.action.executer.RepositoryExporterActionExecuter; import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.ActionService; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.web.app.Application; import org.alfresco.web.bean.BrowseBean; import org.alfresco.web.bean.dialog.BaseDialogBean; @@ -50,6 +49,8 @@ import org.apache.commons.logging.LogFactory; */ public class ExportDialog extends BaseDialogBean { + private static final long serialVersionUID = -2592252768301728700L; + private static final Log logger = LogFactory.getLog(ExportDialog.class); private static final String ALL_SPACES = "all"; @@ -58,8 +59,7 @@ public class ExportDialog extends BaseDialogBean private static final String MSG_EXPORT = "export"; protected BrowseBean browseBean; - protected NodeService nodeService; - protected ActionService actionService; + transient private ActionService actionService; private String packageName; private String encoding = "UTF-8"; @@ -85,7 +85,7 @@ public class ExportDialog extends BaseDialogBean Map params = new HashMap(5); params.put(ExporterActionExecuter.PARAM_PACKAGE_NAME, this.packageName); params.put(ExporterActionExecuter.PARAM_DESTINATION_FOLDER, this.destination); - action = this.actionService.createAction(RepositoryExporterActionExecuter.NAME, params); + action = this.getActionService().createAction(RepositoryExporterActionExecuter.NAME, params); } else { @@ -96,12 +96,12 @@ public class ExportDialog extends BaseDialogBean params.put(ExporterActionExecuter.PARAM_DESTINATION_FOLDER, this.destination); params.put(ExporterActionExecuter.PARAM_INCLUDE_CHILDREN, Boolean.valueOf(includeChildren)); params.put(ExporterActionExecuter.PARAM_INCLUDE_SELF, new Boolean(includeSelf)); - action = this.actionService.createAction(ExporterActionExecuter.NAME, params); + action = this.getActionService().createAction(ExporterActionExecuter.NAME, params); } // execute action action.setExecuteAsynchronously(this.runInBackground); - this.actionService.executeAction(action, startNode); + this.getActionService().executeAction(action, startNode); if (logger.isDebugEnabled()) { @@ -306,13 +306,12 @@ public class ExportDialog extends BaseDialogBean this.actionService = actionService; } - /** - * Sets the node service - * - * @param nodeService the node service - */ - public void setNodeService(NodeService nodeService) + protected ActionService getActionService() { - this.nodeService = nodeService; + if (actionService == null) + { + actionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getActionService(); + } + return actionService; } } diff --git a/source/java/org/alfresco/web/bean/admin/ImportDialog.java b/source/java/org/alfresco/web/bean/admin/ImportDialog.java index fa53b22f25..d24bd9a72c 100644 --- a/source/java/org/alfresco/web/bean/admin/ImportDialog.java +++ b/source/java/org/alfresco/web/bean/admin/ImportDialog.java @@ -44,11 +44,9 @@ 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.repository.NodeService; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; import org.alfresco.web.app.Application; -import org.alfresco.web.bean.BrowseBean; import org.alfresco.web.bean.FileUploadBean; import org.alfresco.web.bean.dialog.BaseDialogBean; import org.alfresco.web.bean.repository.Repository; @@ -63,6 +61,8 @@ import org.apache.commons.logging.LogFactory; */ public class ImportDialog extends BaseDialogBean { + private static final long serialVersionUID = -8563911447832447065L; + private static final Log logger = LogFactory.getLog(ImportDialog.class); private static final String DEFAULT_OUTCOME = "dialog:close"; @@ -73,11 +73,9 @@ public class ImportDialog extends BaseDialogBean private static final String MSG_OK = "ok"; private static final String MSG_IMPORT = "import"; - protected BrowseBean browseBean; - protected NodeService nodeService; - protected ActionService actionService; - protected ContentService contentService; - protected MimetypeService mimetypeService; + transient private ActionService actionService; + transient private ContentService contentService; + transient private MimetypeService mimetypeService; private File file; private String fileName; @@ -118,11 +116,11 @@ public class ImportDialog extends BaseDialogBean params.put(ImporterActionExecuter.PARAM_ENCODING, encoding); // build the action to execute - Action action = actionService.createAction(ImporterActionExecuter.NAME, params); + Action action = getActionService().createAction(ImporterActionExecuter.NAME, params); action.setExecuteAsynchronously(runInBackground); // execute the action on the ACP file - actionService.executeAction(action, acpNodeRef); + getActionService().executeAction(action, acpNodeRef); if (logger.isDebugEnabled()) { @@ -257,16 +255,6 @@ public class ImportDialog extends BaseDialogBean { this.runInBackground = runInBackground; } - - /** - * Sets the BrowseBean instance to use to retrieve the current document - * - * @param browseBean BrowseBean instance - */ - public void setBrowseBean(BrowseBean browseBean) - { - this.browseBean = browseBean; - } /** * Sets the action service @@ -278,14 +266,13 @@ public class ImportDialog extends BaseDialogBean this.actionService = actionService; } - /** - * Sets the node service - * - * @param nodeService the node service - */ - public void setNodeService(NodeService nodeService) + protected ActionService getActionService() { - this.nodeService = nodeService; + if (actionService == null) + { + actionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getActionService(); + } + return actionService; } /** @@ -298,6 +285,15 @@ public class ImportDialog extends BaseDialogBean this.contentService = contentService; } + protected ContentService getContentService() + { + if (contentService == null) + { + contentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentService(); + } + return contentService; + } + /** * Sets the mimetype sevice * @@ -308,6 +304,15 @@ public class ImportDialog extends BaseDialogBean this.mimetypeService = mimetypeService; } + protected MimetypeService getMimetypeService() + { + if (mimetypeService == null) + { + mimetypeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMimetypeService(); + } + return mimetypeService; + } + /** * Adds the uploaded ACP/ZIP file to the repository * @@ -322,7 +327,7 @@ public class ImportDialog extends BaseDialogBean // create the node to represent the zip file String assocName = QName.createValidLocalName(this.fileName); - ChildAssociationRef assocRef = this.nodeService.createNode( + ChildAssociationRef assocRef = this.getNodeService().createNode( this.browseBean.getActionSpace().getNodeRef(), ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, assocName), ContentModel.TYPE_CONTENT, contentProps); @@ -330,17 +335,17 @@ public class ImportDialog extends BaseDialogBean NodeRef acpNodeRef = assocRef.getChildRef(); // apply the titled aspect to behave in the web client - String mimetype = this.mimetypeService.guessMimetype(this.fileName); + String mimetype = this.getMimetypeService().guessMimetype(this.fileName); Map titledProps = new HashMap(2, 1.0f); titledProps.put(ContentModel.PROP_TITLE, this.fileName); titledProps.put(ContentModel.PROP_DESCRIPTION, MimetypeMap.MIMETYPE_ACP.equals(mimetype) ? Application.getMessage(context, "import_acp_description") : Application.getMessage(context, "import_zip_description")); - this.nodeService.addAspect(acpNodeRef, ContentModel.ASPECT_TITLED, titledProps); + this.getNodeService().addAspect(acpNodeRef, ContentModel.ASPECT_TITLED, titledProps); // add the content to the node - ContentWriter writer = this.contentService.getWriter(acpNodeRef, ContentModel.PROP_CONTENT, true); + ContentWriter writer = this.getContentService().getWriter(acpNodeRef, ContentModel.PROP_CONTENT, true); writer.setEncoding(this.encoding); writer.setMimetype(mimetype); writer.putContent(this.file); diff --git a/source/java/org/alfresco/web/bean/ajax/ContentUpdateBean.java b/source/java/org/alfresco/web/bean/ajax/ContentUpdateBean.java index 62ff7313a1..b6ca1418b2 100644 --- a/source/java/org/alfresco/web/bean/ajax/ContentUpdateBean.java +++ b/source/java/org/alfresco/web/bean/ajax/ContentUpdateBean.java @@ -67,8 +67,10 @@ import org.w3c.dom.Node; * * @author Mike Hatfield */ -public class ContentUpdateBean +public class ContentUpdateBean implements Serializable { + private static final long serialVersionUID = -7209326198823950952L; + private static Log logger = LogFactory.getLog(ContentUpdateBean.class); /** diff --git a/source/java/org/alfresco/web/bean/ajax/FileUploadBean.java b/source/java/org/alfresco/web/bean/ajax/FileUploadBean.java index 3fe8390ff4..64a2ca0c3e 100644 --- a/source/java/org/alfresco/web/bean/ajax/FileUploadBean.java +++ b/source/java/org/alfresco/web/bean/ajax/FileUploadBean.java @@ -70,8 +70,10 @@ import org.w3c.dom.Node; * * @author Kevin Roast */ -public class FileUploadBean +public class FileUploadBean implements Serializable { + private static final long serialVersionUID = 4555828718375916674L; + private static Log logger = LogFactory.getLog(FileUploadBean.class); /** diff --git a/source/java/org/alfresco/web/bean/ajax/MySpacesBean.java b/source/java/org/alfresco/web/bean/ajax/MySpacesBean.java index 2dfb40ab6d..82971e78ad 100644 --- a/source/java/org/alfresco/web/bean/ajax/MySpacesBean.java +++ b/source/java/org/alfresco/web/bean/ajax/MySpacesBean.java @@ -51,8 +51,10 @@ import org.apache.commons.logging.LogFactory; * * @author Kevin Roast */ -public class MySpacesBean +public class MySpacesBean implements Serializable { + private static final long serialVersionUID = -5684182834188359483L; + private static Log logger = LogFactory.getLog(MySpacesBean.class); @InvokeCommand.ResponseMimetype(value=MimetypeMap.MIMETYPE_HTML) diff --git a/source/java/org/alfresco/web/bean/ajax/NavigatorPluginBean.java b/source/java/org/alfresco/web/bean/ajax/NavigatorPluginBean.java index bd1facb5bb..737bbe727c 100644 --- a/source/java/org/alfresco/web/bean/ajax/NavigatorPluginBean.java +++ b/source/java/org/alfresco/web/bean/ajax/NavigatorPluginBean.java @@ -25,6 +25,7 @@ package org.alfresco.web.bean.ajax; import java.io.IOException; +import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -62,8 +63,10 @@ import org.apache.commons.logging.LogFactory; * * @author gavinc */ -public class NavigatorPluginBean implements IContextListener +public class NavigatorPluginBean implements IContextListener,Serializable { + private static final long serialVersionUID = 5837326721916936115L; + public static final String BEAN_NAME = "NavigatorPluginBean"; protected List companyHomeRootNodes; @@ -74,9 +77,9 @@ public class NavigatorPluginBean implements IContextListener protected Map guestHomeNodes; protected NodeRef previouslySelectedNode; - private NodeService nodeService; - private NodeService internalNodeService; - private DictionaryService dictionaryService; + transient private NodeService nodeService; + transient private NodeService internalNodeService; + transient private DictionaryService dictionaryService; private static final Log logger = LogFactory.getLog(NavigatorPluginBean.class); @@ -128,7 +131,7 @@ public class NavigatorPluginBean implements IContextListener parentNode.removeChildren(); // get all the child folder objects for the parent - List childRefs = this.nodeService.getChildAssocs(parentNodeRef, + List childRefs = this.getNodeService().getChildAssocs(parentNodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); List sortedNodes = new ArrayList(); for (ChildAssociationRef ref: childRefs) @@ -328,7 +331,7 @@ public class NavigatorPluginBean implements IContextListener // query for the child nodes of company home NodeRef root = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId(fc)); - List childRefs = this.nodeService.getChildAssocs(root, + List childRefs = this.getNodeService().getChildAssocs(root, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef ref: childRefs) @@ -380,7 +383,7 @@ public class NavigatorPluginBean implements IContextListener // query for the child nodes of the user's home NodeRef root = new NodeRef(Repository.getStoreRef(), Application.getCurrentUser(FacesContext.getCurrentInstance()).getHomeSpaceId()); - List childRefs = this.nodeService.getChildAssocs(root, + List childRefs = this.getNodeService().getChildAssocs(root, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef ref: childRefs) @@ -434,7 +437,7 @@ public class NavigatorPluginBean implements IContextListener if (navBean != null) { NodeRef root = navBean.getGuestHomeNode().getNodeRef(); - List childRefs = this.nodeService.getChildAssocs(root, + List childRefs = this.getNodeService().getChildAssocs(root, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef ref: childRefs) @@ -470,6 +473,15 @@ public class NavigatorPluginBean implements IContextListener this.nodeService = nodeService; } + private NodeService getNodeService() + { + if (nodeService == null) + { + nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + } + return nodeService; + } + /** * @param internalNodeService The internalNodeService to set. */ @@ -477,6 +489,17 @@ public class NavigatorPluginBean implements IContextListener { this.internalNodeService = internalNodeService; } + + /** + * @return the internalNodeService + */ + private NodeService getInternalNodeService() + { + if (this.internalNodeService == null) { + this.internalNodeService = (NodeService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "nodeService"); + } + return this.internalNodeService; + } /** * @param dictionaryService The DictionaryService to set. @@ -486,6 +509,15 @@ public class NavigatorPluginBean implements IContextListener this.dictionaryService = dictionaryService; } + private DictionaryService getDictionaryService() + { + if (dictionaryService == null) + { + dictionaryService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService(); + } + return dictionaryService; + } + // ------------------------------------------------------------------------------ // Helper methods @@ -630,19 +662,19 @@ public class NavigatorPluginBean implements IContextListener { boolean addable = false; - if (this.nodeService.exists(nodeRef)) + 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.nodeService.getType(nodeRef); + QName type = this.getNodeService().getType(nodeRef); // make sure the type is defined in the data dictionary - TypeDefinition typeDef = this.dictionaryService.getType(type); + TypeDefinition typeDef = this.getDictionaryService().getType(type); if (typeDef != null) { // look for folder node types - if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_FOLDER) == true && - this.dictionaryService.isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false) + if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_FOLDER) == true && + this.getDictionaryService().isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false) { addable = true; } @@ -660,8 +692,8 @@ public class NavigatorPluginBean implements IContextListener protected TreeNode createTreeNode(NodeRef nodeRef) { TreeNode node = new TreeNode(nodeRef.toString(), - Repository.getNameForNode(this.internalNodeService, nodeRef), - (String)this.internalNodeService.getProperty(nodeRef, ApplicationModel.PROP_ICON)); + Repository.getNameForNode(this.getInternalNodeService(), nodeRef), + (String)this.getInternalNodeService().getProperty(nodeRef, ApplicationModel.PROP_ICON)); return node; } diff --git a/source/java/org/alfresco/web/bean/ajax/NodeInfoBean.java b/source/java/org/alfresco/web/bean/ajax/NodeInfoBean.java index 48b3bdc3e9..a25a233c76 100644 --- a/source/java/org/alfresco/web/bean/ajax/NodeInfoBean.java +++ b/source/java/org/alfresco/web/bean/ajax/NodeInfoBean.java @@ -25,6 +25,8 @@ package org.alfresco.web.bean.ajax; import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.Serializable; import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -50,9 +52,11 @@ import org.apache.commons.logging.LogFactory; * * @author gavinc */ -public class NodeInfoBean +public class NodeInfoBean implements Serializable { - private NodeService nodeService; + private static final long serialVersionUID = 137294178658919187L; + + transient private NodeService nodeService; private static final Log logger = LogFactory.getLog(NodeInfoBean.class); @@ -80,7 +84,7 @@ public class NodeInfoBean if (strNodeRef != null && strNodeRef.length() != 0) { nodeRef = new NodeRef(strNodeRef); - if (this.nodeService.exists(nodeRef) == false) + if (this.getNodeService().exists(nodeRef) == false) { out.write("Node could not be found in the repository!"); return; @@ -102,6 +106,15 @@ public class NodeInfoBean this.nodeService = nodeService; } + private NodeService getNodeService() + { + if (nodeService == null) + { + nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + } + return nodeService; + } + // ------------------------------------------------------------------------------ // Helper methods @@ -143,4 +156,5 @@ public class NodeInfoBean return Utils.getFileTypeImage(FacesContext.getCurrentInstance(), filename, size); } }; + } diff --git a/source/java/org/alfresco/web/bean/ajax/PortletActionsBean.java b/source/java/org/alfresco/web/bean/ajax/PortletActionsBean.java index 3fca56da68..9284b29f05 100644 --- a/source/java/org/alfresco/web/bean/ajax/PortletActionsBean.java +++ b/source/java/org/alfresco/web/bean/ajax/PortletActionsBean.java @@ -27,26 +27,17 @@ package org.alfresco.web.bean.ajax; import java.io.Serializable; import java.util.HashMap; import java.util.Map; -import java.util.StringTokenizer; import javax.faces.context.FacesContext; import javax.faces.context.ResponseWriter; -import org.alfresco.model.ApplicationModel; -import org.alfresco.model.ContentModel; import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.version.VersionModel; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.version.Version; import org.alfresco.service.cmr.version.VersionType; -import org.alfresco.service.namespace.QName; -import org.alfresco.web.app.servlet.BaseServlet; import org.alfresco.web.app.servlet.ajax.InvokeCommand; import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.spaces.CreateSpaceWizard; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -55,8 +46,10 @@ import org.apache.commons.logging.LogFactory; * * @author Mike Hatfield */ -public class PortletActionsBean +public class PortletActionsBean implements Serializable { + private static final long serialVersionUID = -8230154592621310289L; + private static Log logger = LogFactory.getLog(PortletActionsBean.class); @InvokeCommand.ResponseMimetype(value=MimetypeMap.MIMETYPE_HTML) diff --git a/source/java/org/alfresco/web/bean/ajax/TaskInfoBean.java b/source/java/org/alfresco/web/bean/ajax/TaskInfoBean.java index cd4e771dec..474a5356d7 100644 --- a/source/java/org/alfresco/web/bean/ajax/TaskInfoBean.java +++ b/source/java/org/alfresco/web/bean/ajax/TaskInfoBean.java @@ -25,6 +25,8 @@ package org.alfresco.web.bean.ajax; import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.Serializable; import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -46,9 +48,11 @@ import org.alfresco.web.ui.common.Utils; * * @author Kevin Roast */ -public class TaskInfoBean +public class TaskInfoBean implements Serializable { - private WorkflowService workflowService; + private static final long serialVersionUID = -6627537519541525897L; + + transient private WorkflowService workflowService; /** * Returns information for the workflow task identified by the 'taskId' @@ -67,7 +71,7 @@ public class TaskInfoBean throw new IllegalArgumentException("'taskId' parameter is missing"); } - WorkflowTask task = this.workflowService.getTaskById(taskId); + WorkflowTask task = this.getWorkflowService().getTaskById(taskId); if (task != null) { Repository.getServiceRegistry(context).getTemplateService().processTemplate( @@ -120,6 +124,15 @@ public class TaskInfoBean this.workflowService = workflowService; } + private WorkflowService getWorkflowService() + { + if (workflowService == null) + { + workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService(); + } + return workflowService; + } + // ------------------------------------------------------------------------------ // Helper methods diff --git a/source/java/org/alfresco/web/bean/categories/CategoriesDialog.java b/source/java/org/alfresco/web/bean/categories/CategoriesDialog.java index 91e49eaf61..e0bffe34a2 100644 --- a/source/java/org/alfresco/web/bean/categories/CategoriesDialog.java +++ b/source/java/org/alfresco/web/bean/categories/CategoriesDialog.java @@ -67,6 +67,8 @@ import org.apache.commons.logging.LogFactory; */ public class CategoriesDialog extends BaseDialogBean implements IContextListener, ChangeViewSupport { + private static final long serialVersionUID = -1254971127977205987L; + public static final String KEY_CATEGORY = "category"; public static final String PARAM_CATEGORY_REF = "categoryRef"; @@ -78,7 +80,7 @@ public class CategoriesDialog extends BaseDialogBean implements IContextListener private static final String LABEL_VIEW_DETAILS = "category_details"; private final static String MSG_CLOSE = "close"; - protected CategoryService categoryService; + transient private CategoryService categoryService; /** Members of the linked items of a category */ private Collection members = null; @@ -172,6 +174,11 @@ public class CategoriesDialog extends BaseDialogBean implements IContextListener public CategoryService getCategoryService() { + if (categoryService == null) + { + categoryService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getCategoryService(); + } + return categoryService; } @@ -444,7 +451,7 @@ public class CategoriesDialog extends BaseDialogBean implements IContextListener */ private void updateUILocation(NodeRef ref) { - String name = Repository.getNameForNode(this.nodeService, ref); + String name = Repository.getNameForNode(getNodeService(), ref); getLocation().add(new CategoryBreadcrumbHandler(ref, name)); this.setCurrentCategory(ref); } diff --git a/source/java/org/alfresco/web/bean/categories/CreateCategoryDialog.java b/source/java/org/alfresco/web/bean/categories/CreateCategoryDialog.java index 40a3a7242f..4b248050e9 100644 --- a/source/java/org/alfresco/web/bean/categories/CreateCategoryDialog.java +++ b/source/java/org/alfresco/web/bean/categories/CreateCategoryDialog.java @@ -157,7 +157,7 @@ public class CreateCategoryDialog extends BaseDialogBean // apply the titled aspect - for description Map titledProps = new HashMap(1, 1.0f); titledProps.put(ContentModel.PROP_DESCRIPTION, getDescription()); - nodeService.addAspect(ref, ContentModel.ASPECT_TITLED, titledProps); + getNodeService().addAspect(ref, ContentModel.ASPECT_TITLED, titledProps); return null; } }; diff --git a/source/java/org/alfresco/web/bean/categories/DeleteCategoryDialog.java b/source/java/org/alfresco/web/bean/categories/DeleteCategoryDialog.java index 4185700900..022275f24a 100644 --- a/source/java/org/alfresco/web/bean/categories/DeleteCategoryDialog.java +++ b/source/java/org/alfresco/web/bean/categories/DeleteCategoryDialog.java @@ -353,7 +353,7 @@ public class DeleteCategoryDialog extends BaseDialogBean List list = new ArrayList(getMembers().size()); NodeRef member = childRef.getChildRef(); - Collection categories = (Collection) nodeService.getProperty(member, ContentModel.PROP_CATEGORIES); + Collection categories = (Collection)getNodeService().getProperty(member, ContentModel.PROP_CATEGORIES); for (NodeRef category : categories) { @@ -364,7 +364,7 @@ public class DeleteCategoryDialog extends BaseDialogBean } // persist the list back to the repository - nodeService.setProperty(member, ContentModel.PROP_CATEGORIES, (Serializable) list); + getNodeService().setProperty(member, ContentModel.PROP_CATEGORIES, (Serializable) list); } } return categoryNodeRef; diff --git a/source/java/org/alfresco/web/bean/categories/EditCategoryDialog.java b/source/java/org/alfresco/web/bean/categories/EditCategoryDialog.java index c7ebd7aa15..75eccb160a 100644 --- a/source/java/org/alfresco/web/bean/categories/EditCategoryDialog.java +++ b/source/java/org/alfresco/web/bean/categories/EditCategoryDialog.java @@ -243,18 +243,18 @@ public class EditCategoryDialog extends BaseDialogBean // update the category node NodeRef nodeRef = getActionCategory().getNodeRef(); - nodeService.setProperty(nodeRef, ContentModel.PROP_NAME, getName()); + getNodeService().setProperty(nodeRef, ContentModel.PROP_NAME, getName()); // apply the titled aspect - for description - if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TITLED) == false) + if (getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_TITLED) == false) { Map titledProps = new HashMap(1, 1.0f); titledProps.put(ContentModel.PROP_DESCRIPTION, getDescription()); - nodeService.addAspect(nodeRef, ContentModel.ASPECT_TITLED, titledProps); + getNodeService().addAspect(nodeRef, ContentModel.ASPECT_TITLED, titledProps); } else { - nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, getDescription()); + getNodeService().setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, getDescription()); } // edit the node in the breadcrumb if required @@ -266,7 +266,7 @@ public class EditCategoryDialog extends BaseDialogBean { // and update with the modified node details CategoriesDialog categoriesDialog = new CategoriesDialog(); - IBreadcrumbHandler newHandler = categoriesDialog.new CategoryBreadcrumbHandler(nodeRef, Repository.getNameForNode(nodeService, nodeRef)); + IBreadcrumbHandler newHandler = categoriesDialog.new CategoryBreadcrumbHandler(nodeRef, Repository.getNameForNode(getNodeService(), nodeRef)); location.set(location.size() - 1, newHandler); } } diff --git a/source/java/org/alfresco/web/bean/categories/EditNodeCategoriesDialog.java b/source/java/org/alfresco/web/bean/categories/EditNodeCategoriesDialog.java index b48c9d0761..e6602ffb13 100644 --- a/source/java/org/alfresco/web/bean/categories/EditNodeCategoriesDialog.java +++ b/source/java/org/alfresco/web/bean/categories/EditNodeCategoriesDialog.java @@ -37,7 +37,6 @@ import org.alfresco.util.ParameterCheck; 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; /** * Implementation for the edit node categories dialog. @@ -77,7 +76,7 @@ public class EditNodeCategoriesDialog extends BaseDialogBean // determine description for dialog FacesContext context = FacesContext.getCurrentInstance(); - if (this.dictionaryService.isSubClass(this.node.getType(), ContentModel.TYPE_FOLDER)) + if (getDictionaryService().isSubClass(this.node.getType(), ContentModel.TYPE_FOLDER)) { this.description = Application.getMessage(context, "editcategory_space_description"); } @@ -91,13 +90,13 @@ public class EditNodeCategoriesDialog extends BaseDialogBean protected String finishImpl(FacesContext context, String outcome) throws Exception { // firstly retrieve all the properties for the current node - Map updateProps = this.nodeService.getProperties(this.node.getNodeRef()); + Map updateProps = getNodeService().getProperties(this.node.getNodeRef()); // create a node ref representation of the selected id and set the new properties updateProps.put(ContentModel.PROP_CATEGORIES, (Serializable) categories); // set the properties on the node - this.nodeService.setProperties(this.node.getNodeRef(), updateProps); + getNodeService().setProperties(this.node.getNodeRef(), updateProps); return outcome; } @@ -140,7 +139,7 @@ public class EditNodeCategoriesDialog extends BaseDialogBean if (this.categories == null) { // get the list of categories - this.categories = (List)this.nodeService.getProperty(this.node.getNodeRef(), + this.categories = (List)getNodeService().getProperty(this.node.getNodeRef(), ContentModel.PROP_CATEGORIES); } diff --git a/source/java/org/alfresco/web/bean/clipboard/AVMClipboardItem.java b/source/java/org/alfresco/web/bean/clipboard/AVMClipboardItem.java index 8eaed45c36..950ddcd5f3 100644 --- a/source/java/org/alfresco/web/bean/clipboard/AVMClipboardItem.java +++ b/source/java/org/alfresco/web/bean/clipboard/AVMClipboardItem.java @@ -47,6 +47,8 @@ import org.alfresco.web.bean.wcm.AVMBrowseBean; */ 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"; diff --git a/source/java/org/alfresco/web/bean/clipboard/AbstractClipboardItem.java b/source/java/org/alfresco/web/bean/clipboard/AbstractClipboardItem.java index ad58cb345e..0cce4c61d4 100644 --- a/source/java/org/alfresco/web/bean/clipboard/AbstractClipboardItem.java +++ b/source/java/org/alfresco/web/bean/clipboard/AbstractClipboardItem.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.bean.clipboard; +import java.io.IOException; +import java.io.ObjectInputStream; import java.util.List; import javax.faces.context.FacesContext; @@ -54,7 +56,7 @@ abstract class AbstractClipboardItem implements ClipboardItem /** Shallow search for nodes with a name pattern */ private static final String XPATH_QUERY_NODE_MATCH = "./*[like(@cm:name, $cm:name, false)]"; - private ServiceRegistry services = null; + transient private ServiceRegistry services = null; protected NodeRef ref; protected ClipboardStatus mode; @@ -172,4 +174,5 @@ abstract class AbstractClipboardItem implements ClipboardItem return (nodeRefs.size() != 0); } + } diff --git a/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java b/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java index 6180616987..e645dc6ec7 100644 --- a/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java +++ b/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.bean.clipboard; +import java.io.Serializable; import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; @@ -51,8 +52,10 @@ import org.apache.commons.logging.LogFactory; * * @author Kevin Roast */ -public class ClipboardBean +public class ClipboardBean implements Serializable { + private static final long serialVersionUID = -6299320341615099651L; + private static Log logger = LogFactory.getLog(ClipboardBean.class); /** I18N messages */ diff --git a/source/java/org/alfresco/web/bean/clipboard/ClipboardItem.java b/source/java/org/alfresco/web/bean/clipboard/ClipboardItem.java index b2b00b787b..56406a6a38 100644 --- a/source/java/org/alfresco/web/bean/clipboard/ClipboardItem.java +++ b/source/java/org/alfresco/web/bean/clipboard/ClipboardItem.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.bean.clipboard; +import java.io.Serializable; + import javax.faces.context.FacesContext; import org.alfresco.service.cmr.repository.NodeRef; @@ -34,7 +36,7 @@ import org.alfresco.service.namespace.QName; * * @author Kevin Roast */ -public interface ClipboardItem +public interface ClipboardItem extends Serializable { /** * @return the mode status of the clipboard item, the enum can be either Cut or Copy diff --git a/source/java/org/alfresco/web/bean/clipboard/WorkspaceClipboardItem.java b/source/java/org/alfresco/web/bean/clipboard/WorkspaceClipboardItem.java index 96c510b21d..ea247a95e2 100644 --- a/source/java/org/alfresco/web/bean/clipboard/WorkspaceClipboardItem.java +++ b/source/java/org/alfresco/web/bean/clipboard/WorkspaceClipboardItem.java @@ -58,6 +58,8 @@ import org.alfresco.web.ui.repo.component.shelf.UIClipboardShelfItem; */ public class WorkspaceClipboardItem extends AbstractClipboardItem { + private static final long serialVersionUID = -1686557602737846009L; + private static final String WORKSPACE_PASTE_VIEW_ID = "/jsp/browse/browse.jsp"; private static final String AVM_PASTE_VIEW_ID = "/jsp/wcm/browse-sandbox.jsp"; private static final String FORUMS_PASTE_VIEW_ID = "/jsp/forums/forums.jsp"; diff --git a/source/java/org/alfresco/web/bean/coci/CCCheckoutFileDialog.java b/source/java/org/alfresco/web/bean/coci/CCCheckoutFileDialog.java index ed80e9ca56..3aa787abde 100644 --- a/source/java/org/alfresco/web/bean/coci/CCCheckoutFileDialog.java +++ b/source/java/org/alfresco/web/bean/coci/CCCheckoutFileDialog.java @@ -99,7 +99,7 @@ public class CCCheckoutFileDialog extends CheckinCheckoutDialog // checkout to a arbituary parent Space NodeRef destRef = property.getSelectedSpaceId(); - ChildAssociationRef childAssocRef = nodeService.getPrimaryParent(destRef); + ChildAssociationRef childAssocRef = getNodeService().getPrimaryParent(destRef); workingCopyRef = property.getVersionOperationsService().checkout(node.getNodeRef(), destRef, ContentModel.ASSOC_CONTAINS, childAssocRef.getQName()); } else @@ -120,8 +120,8 @@ public class CCCheckoutFileDialog extends CheckinCheckoutDialog NodeRef workflowPackage = (NodeRef) task.properties.get(WorkflowModel.ASSOC_PACKAGE); if (workflowPackage != null) { - nodeService.addChild(workflowPackage, workingCopyRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName - .createValidLocalName((String) nodeService.getProperty(workingCopyRef, ContentModel.PROP_NAME)))); + getNodeService().addChild(workflowPackage, workingCopyRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName + .createValidLocalName((String) getNodeService().getProperty(workingCopyRef, ContentModel.PROP_NAME)))); if (logger.isDebugEnabled()) logger.debug("Added working copy to workflow package: " + workflowPackage); @@ -162,7 +162,7 @@ public class CCCheckoutFileDialog extends CheckinCheckoutDialog // If a check-in rule is present in the space // the document was checked out to the working copy would have // already disappeared! - if (this.nodeService.exists(property.getWorkingDocument().getNodeRef())) + if (getNodeService().exists(property.getWorkingDocument().getNodeRef())) { // go to the page that allows the user to download the content // for editing diff --git a/source/java/org/alfresco/web/bean/coci/CheckinCheckoutDialog.java b/source/java/org/alfresco/web/bean/coci/CheckinCheckoutDialog.java index 4429310ba7..b7f2a179eb 100644 --- a/source/java/org/alfresco/web/bean/coci/CheckinCheckoutDialog.java +++ b/source/java/org/alfresco/web/bean/coci/CheckinCheckoutDialog.java @@ -44,7 +44,6 @@ import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.InvalidNodeRefException; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.version.Version; import org.alfresco.service.cmr.version.VersionType; import org.alfresco.web.app.AlfrescoNavigationHandler; @@ -70,6 +69,8 @@ public class CheckinCheckoutDialog extends BaseDialogBean // ------------------------------------------------------------------------------ // Private data + private static final long serialVersionUID = -4898900470274506760L; + private static Log logger = LogFactory.getLog(CheckinCheckoutDialog.class); /* /** I18N messages */ @@ -117,22 +118,6 @@ public class CheckinCheckoutDialog extends BaseDialogBean this.browseBean = browseBean; } - /** - * @return Returns the NodeService. - */ - public NodeService getNodeService() - { - return this.nodeService; - } - - /** - * @param nodeService The NodeService to set. - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - public boolean getFinishButtonDisabled() { return false; diff --git a/source/java/org/alfresco/web/bean/content/AddContentDialog.java b/source/java/org/alfresco/web/bean/content/AddContentDialog.java index a0d10372c8..aaf4a10544 100644 --- a/source/java/org/alfresco/web/bean/content/AddContentDialog.java +++ b/source/java/org/alfresco/web/bean/content/AddContentDialog.java @@ -59,7 +59,8 @@ import org.alfresco.web.bean.repository.Repository; public class AddContentDialog extends BaseContentWizard { private final static String MSG_OK = "ok"; - + private static final long serialVersionUID = 3593557546118692687L; + protected List inlineEditableMimeTypes; protected File file; diff --git a/source/java/org/alfresco/web/bean/content/BaseContentWizard.java b/source/java/org/alfresco/web/bean/content/BaseContentWizard.java index 0ea7933063..55cbc30a5e 100644 --- a/source/java/org/alfresco/web/bean/content/BaseContentWizard.java +++ b/source/java/org/alfresco/web/bean/content/BaseContentWizard.java @@ -79,7 +79,7 @@ public abstract class BaseContentWizard extends BaseWizardBean // the NodeRef of the node created during finish protected NodeRef createdNode; protected List objectTypes; - protected ContentService contentService; + transient private ContentService contentService; protected static Log logger = LogFactory.getLog(BaseContentWizard.class); @@ -322,11 +322,11 @@ public abstract class BaseContentWizard extends BaseWizardBean QName idQName = Repository.resolveToQName(child.getAttribute("name")); if (idQName != null) { - TypeDefinition typeDef = this.dictionaryService.getType(idQName); + TypeDefinition typeDef = this.getDictionaryService().getType(idQName); if (typeDef != null) { - if (this.dictionaryService.isSubClass(typeDef.getName(), ContentModel.TYPE_CONTENT)) + if (this.getDictionaryService().isSubClass(typeDef.getName(), ContentModel.TYPE_CONTENT)) { // try and get the display label from config String label = Utils.getDisplayLabel(context, child); @@ -390,6 +390,15 @@ public abstract class BaseContentWizard extends BaseWizardBean this.contentService = contentService; } + protected ContentService getContentService() + { + if (contentService == null) + { + contentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentService(); + } + return contentService; + } + // ------------------------------------------------------------------------------ // Helper methods @@ -407,14 +416,14 @@ public abstract class BaseContentWizard extends BaseWizardBean String nodeId = this.navigator.getCurrentNodeId(); if (nodeId == null) { - containerNodeRef = this.nodeService.getRootNode(Repository.getStoreRef()); + containerNodeRef = this.getNodeService().getRootNode(Repository.getStoreRef()); } else { containerNodeRef = new NodeRef(Repository.getStoreRef(), nodeId); } - FileInfo fileInfo = this.fileFolderService.create( + FileInfo fileInfo = this.getFileFolderService().create( containerNodeRef, this.fileName, Repository.resolveToQName(this.objectType)); @@ -423,7 +432,7 @@ public abstract class BaseContentWizard extends BaseWizardBean // set the author aspect Map authorProps = new HashMap(1, 1.0f); authorProps.put(ContentModel.PROP_AUTHOR, this.author); - this.nodeService.addAspect(fileNodeRef, ContentModel.ASPECT_AUTHOR, authorProps); + this.getNodeService().addAspect(fileNodeRef, ContentModel.ASPECT_AUTHOR, authorProps); if (logger.isDebugEnabled()) logger.debug("Created file node for file: " + this.fileName); @@ -432,7 +441,7 @@ public abstract class BaseContentWizard extends BaseWizardBean Map titledProps = new HashMap(3, 1.0f); titledProps.put(ContentModel.PROP_TITLE, this.title); titledProps.put(ContentModel.PROP_DESCRIPTION, this.description); - this.nodeService.addAspect(fileNodeRef, ContentModel.ASPECT_TITLED, titledProps); + this.getNodeService().addAspect(fileNodeRef, ContentModel.ASPECT_TITLED, titledProps); if (logger.isDebugEnabled()) logger.debug("Added titled aspect with properties: " + titledProps); @@ -442,14 +451,14 @@ public abstract class BaseContentWizard extends BaseWizardBean { Map editProps = new HashMap(1, 1.0f); editProps.put(ApplicationModel.PROP_EDITINLINE, this.inlineEdit); - this.nodeService.addAspect(fileNodeRef, ApplicationModel.ASPECT_INLINEEDITABLE, editProps); + this.getNodeService().addAspect(fileNodeRef, ApplicationModel.ASPECT_INLINEEDITABLE, editProps); if (logger.isDebugEnabled()) logger.debug("Added inlineeditable aspect with properties: " + editProps); } // get a writer for the content and put the file - ContentWriter writer = contentService.getWriter(fileNodeRef, ContentModel.PROP_CONTENT, true); + ContentWriter writer = getContentService().getWriter(fileNodeRef, ContentModel.PROP_CONTENT, true); // set the mimetype and encoding writer.setMimetype(this.mimeType); writer.setEncoding(getEncoding()); diff --git a/source/java/org/alfresco/web/bean/content/CreateContentWizard.java b/source/java/org/alfresco/web/bean/content/CreateContentWizard.java index a005ca8a6b..e3393f0ad3 100644 --- a/source/java/org/alfresco/web/bean/content/CreateContentWizard.java +++ b/source/java/org/alfresco/web/bean/content/CreateContentWizard.java @@ -65,6 +65,8 @@ import org.w3c.dom.Document; */ public class CreateContentWizard extends BaseContentWizard { + private static final long serialVersionUID = -2740634368271194418L; + protected String content = null; protected List createMimeTypes; @@ -105,7 +107,7 @@ public class CreateContentWizard extends BaseContentWizard final Map props = new HashMap(1, 1.0f); props.put(WCMAppModel.PROP_PARENT_FORM_NAME, getFormName()); props.put(WCMAppModel.PROP_ORIGINAL_PARENT_PATH, ""); - this.nodeService.addAspect(super.createdNode, WCMAppModel.ASPECT_FORM_INSTANCE_DATA, props); + getNodeService().addAspect(super.createdNode, WCMAppModel.ASPECT_FORM_INSTANCE_DATA, props); } return result; diff --git a/source/java/org/alfresco/web/bean/content/DeleteContentDialog.java b/source/java/org/alfresco/web/bean/content/DeleteContentDialog.java index a5fd621630..a016a0c20e 100644 --- a/source/java/org/alfresco/web/bean/content/DeleteContentDialog.java +++ b/source/java/org/alfresco/web/bean/content/DeleteContentDialog.java @@ -34,6 +34,7 @@ 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; @@ -44,9 +45,9 @@ import org.apache.commons.logging.LogFactory; */ public class DeleteContentDialog extends BaseDialogBean { + private static final long serialVersionUID = 4199496011879649213L; - - protected MultilingualContentService multilingualContentService; + transient private MultilingualContentService multilingualContentService; private static final Log logger = LogFactory.getLog(DeleteContentDialog.class); @@ -67,7 +68,7 @@ public class DeleteContentDialog extends BaseDialogBean logger.debug("Trying to delete multilingual container: " + node.getId() + " and its translations" ); // delete the mlContainer and its translations - multilingualContentService.deleteTranslationContainer(node.getNodeRef()); + getMultilingualContentService().deleteTranslationContainer(node.getNodeRef()); } else { @@ -75,7 +76,7 @@ public class DeleteContentDialog extends BaseDialogBean logger.debug("Trying to delete content node: " + node.getId()); // delete the node - this.nodeService.deleteNode(node.getNodeRef()); + this.getNodeService().deleteNode(node.getNodeRef()); } } @@ -156,4 +157,14 @@ public class DeleteContentDialog extends BaseDialogBean { this.multilingualContentService = multilingualContentService; } + + protected MultilingualContentService getMultilingualContentService() + { + if (multilingualContentService == null) + { + multilingualContentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMultilingualContentService(); + } + return multilingualContentService; + } + } diff --git a/source/java/org/alfresco/web/bean/content/DocumentDetailsDialog.java b/source/java/org/alfresco/web/bean/content/DocumentDetailsDialog.java index 1487735a36..aef49b9afa 100644 --- a/source/java/org/alfresco/web/bean/content/DocumentDetailsDialog.java +++ b/source/java/org/alfresco/web/bean/content/DocumentDetailsDialog.java @@ -77,6 +77,8 @@ import org.alfresco.web.ui.common.component.UIActionLink; */ public class DocumentDetailsDialog extends BaseDetailsBean implements NavigationSupport { + private static final long serialVersionUID = -8579599071702546214L; + private static final String OUTCOME_RETURN = null; private static final String MSG_HAS_FOLLOWING_CATEGORIES = "has_following_categories"; @@ -93,12 +95,12 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio private static final String ML_VERSION_PANEL_ID = "ml-versions-panel"; - protected LockService lockService; - protected VersionService versionService; - protected CheckOutCheckInService cociService; - protected MultilingualContentService multilingualContentService; - protected ContentFilterLanguagesService contentFilterLanguagesService; - protected EditionService editionService; + transient protected LockService lockService; + transient protected VersionService versionService; + transient protected CheckOutCheckInService cociService; + transient protected MultilingualContentService multilingualContentService; + transient protected ContentFilterLanguagesService contentFilterLanguagesService; + transient protected EditionService editionService; private Node translationDocument; @@ -184,7 +186,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio if (ApplicationModel.TYPE_FILELINK.equals(document.getType())) { NodeRef destRef = (NodeRef)document.getProperties().get(ContentModel.PROP_LINK_DESTINATION); - if (nodeService.exists(destRef)) + if (getNodeService().exists(destRef)) { document = new Node(destRef); } @@ -252,7 +254,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio if (getDocument().hasAspect(ContentModel.ASPECT_VERSIONABLE)) { - VersionHistory history = this.versionService.getVersionHistory(getDocument().getNodeRef()); + VersionHistory history = this.getVersionService().getVersionHistory(getDocument().getNodeRef()); if (history != null) { @@ -333,7 +335,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio NodeRef mlContainer = getDocumentMlContainer().getNodeRef(); // get all editions and sort them ascending according their version label - List orderedEditionList = new ArrayList(editionService.getEditions(mlContainer).getAllVersions()); + List orderedEditionList = new ArrayList(getEditionService().getEditions(mlContainer).getAllVersions()); Collections.sort(orderedEditionList, new VersionLabelComparator()); // the list of Single Edition Bean to return @@ -369,16 +371,16 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio { // Get the translations because the current edition doesn't content link with its // translation in the version store. - Map translations = multilingualContentService.getTranslations(mlContainer); + Map translations = getMultilingualContentService().getTranslations(mlContainer); translationHistories = new ArrayList(translations.size()); for (NodeRef translation : translations.values()) { - translationHistories.add(versionService.getVersionHistory(translation)); + translationHistories.add(getVersionService().getVersionHistory(translation)); } } else { - translationHistories = editionService.getVersionedTranslations(edition); + translationHistories = getEditionService().getVersionedTranslations(edition); } // add each translation in the SingleEditionBean @@ -392,7 +394,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio Version lastVersion = orderedVersions.get(0); // get the properties of the lastVersion - Map lastVersionProperties = editionService.getVersionedMetadatas(lastVersion); + Map lastVersionProperties = getEditionService().getVersionedMetadatas(lastVersion); Locale language = (Locale) lastVersionProperties.get(ContentModel.PROP_LOCALE); // create a map node representation of the last version @@ -400,13 +402,13 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio clientLastVersion.put("versionName", lastVersionProperties.get(ContentModel.PROP_NAME)); // use the node service for the description to ensure that the returned value is a text and not a MLText - clientLastVersion.put("versionDescription", nodeService.getProperty(lastVersion.getFrozenStateNodeRef(), ContentModel.PROP_DESCRIPTION)); + clientLastVersion.put("versionDescription", getNodeService().getProperty(lastVersion.getFrozenStateNodeRef(), ContentModel.PROP_DESCRIPTION)); clientLastVersion.put("versionAuthor", lastVersionProperties.get(ContentModel.PROP_AUTHOR)); clientLastVersion.put("versionCreatedDate", lastVersionProperties.get(ContentModel.PROP_CREATED)); clientLastVersion.put("versionModifiedDate", lastVersionProperties.get(ContentModel.PROP_MODIFIED)); - clientLastVersion.put("versionLanguage", this.contentFilterLanguagesService.convertToNewISOCode(language.getLanguage()).toUpperCase()); + clientLastVersion.put("versionLanguage", this.getContentFilterLanguagesService().convertToNewISOCode(language.getLanguage()).toUpperCase()); - if(nodeService.hasAspect(lastVersion.getFrozenStateNodeRef(), ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION)) + if(getNodeService().hasAspect(lastVersion.getFrozenStateNodeRef(), ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION)) { clientLastVersion.put("versionUrl", null); } @@ -450,7 +452,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio { // we know for now that the general classifiable aspect only will be // applied so we can retrive the categories property direclty - Collection categories = (Collection)this.nodeService.getProperty( + Collection categories = (Collection)this.getNodeService().getProperty( getDocument().getNodeRef(), ContentModel.PROP_CATEGORIES); if (categories == null || categories.size() == 0) @@ -465,10 +467,10 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio builder.append("

    "); for (NodeRef ref : categories) { - if (this.nodeService.exists(ref)) + if (this.getNodeService().exists(ref)) { builder.append("
  • "); - builder.append(Repository.getNameForNode(this.nodeService, ref)); + builder.append(Repository.getNameForNode(this.getNodeService(), ref)); builder.append("
  • "); } } @@ -494,7 +496,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio public Object execute() throws Throwable { // add the general classifiable aspect to the node - nodeService.addAspect(getDocument().getNodeRef(), ContentModel.ASPECT_GEN_CLASSIFIABLE, null); + getNodeService().addAspect(getDocument().getNodeRef(), ContentModel.ASPECT_GEN_CLASSIFIABLE, null); return null; } }; @@ -524,7 +526,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio public Object execute() throws Throwable { // add the versionable aspect to the node - nodeService.addAspect(getDocument().getNodeRef(), ContentModel.ASPECT_VERSIONABLE, null); + getNodeService().addAspect(getDocument().getNodeRef(), ContentModel.ASPECT_VERSIONABLE, null); return null; } }; @@ -561,7 +563,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio { public Object execute() throws Throwable { - lockService.unlock(getNode().getNodeRef()); + getLockService().unlock(getNode().getNodeRef()); String msg = Application.getMessage(fc, MSG_SUCCESS_UNLOCK); FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg); @@ -613,7 +615,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio props.put(ApplicationModel.PROP_EDITINLINE, true); } } - nodeService.addAspect(getDocument().getNodeRef(), ApplicationModel.ASPECT_INLINEEDITABLE, props); + getNodeService().addAspect(getDocument().getNodeRef(), ApplicationModel.ASPECT_INLINEEDITABLE, props); return null; } @@ -768,7 +770,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio if (isLocked()) { - NodeRef workingCopyRef = this.cociService.getWorkingCopy(getDocument().getNodeRef()); + NodeRef workingCopyRef = this.getCheckOutCheckInService().getWorkingCopy(getDocument().getNodeRef()); if (workingCopyRef != null) { workingCopyNode = new Node(workingCopyRef); @@ -845,7 +847,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio { NodeRef nodeRef = getNode().getNodeRef(); - return new Node(multilingualContentService.getTranslationContainer(nodeRef)); + return new Node(getMultilingualContentService().getTranslationContainer(nodeRef)); } } /** @@ -857,6 +859,15 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio { this.lockService = lockService; } + + protected LockService getLockService() + { + if (lockService == null) + { + lockService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getLockService(); + } + return lockService; + } /** * Sets the version service instance the bean should use @@ -867,6 +878,15 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio { this.versionService = versionService; } + + protected VersionService getVersionService() + { + if (versionService == null) + { + versionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getVersionService(); + } + return versionService; + } /** * Sets the checkincheckout service instance the bean should use @@ -877,6 +897,15 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio { this.cociService = cociService; } + + protected CheckOutCheckInService getCheckOutCheckInService() + { + if (cociService == null) + { + cociService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getCheckOutCheckInService(); + } + return cociService; + } /** * @param multilingualContentService the multilingual ContentService to set @@ -885,6 +914,15 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio { this.multilingualContentService = multilingualContentService; } + + protected MultilingualContentService getMultilingualContentService() + { + if (multilingualContentService == null) + { + multilingualContentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMultilingualContentService(); + } + return multilingualContentService; + } /** * @param contentFilterLanguagesService The Content Filter Languages Service to set. @@ -893,6 +931,15 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio { this.contentFilterLanguagesService = contentFilterLanguagesService; } + + protected ContentFilterLanguagesService getContentFilterLanguagesService() + { + if (contentFilterLanguagesService == null) + { + contentFilterLanguagesService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentFilterLanguagesService(); + } + return contentFilterLanguagesService; + } /** * @param EditionService The Edition Service to set. @@ -901,6 +948,15 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio { this.editionService = editionService; } + + protected EditionService getEditionService() + { + if (editionService == null) + { + editionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getEditionService(); + } + return editionService; + } public String getCancelButtonLabel() { @@ -909,7 +965,8 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio public String getContainerSubTitle() { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + getDocument().getNodePath().toDisplayPath(nodeService, permissionService); + return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + + getDocument().getNodePath().toDisplayPath(getNodeService(), getPermissionService()); } public String getContainerTitle() diff --git a/source/java/org/alfresco/web/bean/content/DocumentLinkDetailsDialog.java b/source/java/org/alfresco/web/bean/content/DocumentLinkDetailsDialog.java index 0a4f1107bd..1586e9a251 100644 --- a/source/java/org/alfresco/web/bean/content/DocumentLinkDetailsDialog.java +++ b/source/java/org/alfresco/web/bean/content/DocumentLinkDetailsDialog.java @@ -66,7 +66,7 @@ public class DocumentLinkDetailsDialog extends BaseDetailsBean implements Naviga if (ApplicationModel.TYPE_FILELINK.equals(document.getType())) { NodeRef destRef = (NodeRef)document.getProperties().get(ContentModel.PROP_LINK_DESTINATION); - if (nodeService.exists(destRef)) + if (getNodeService().exists(destRef)) { document = new Node(destRef); } @@ -198,7 +198,8 @@ public class DocumentLinkDetailsDialog extends BaseDetailsBean implements Naviga public String getContainerSubTitle() { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + getDocument().getNodePath().toDisplayPath(nodeService, permissionService); + return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + + getDocument().getNodePath().toDisplayPath(getNodeService(), getPermissionService()); } public String getContainerTitle() diff --git a/source/java/org/alfresco/web/bean/content/DocumentPropertiesDialog.java b/source/java/org/alfresco/web/bean/content/DocumentPropertiesDialog.java index 3ed5fad8ff..7023fbbfda 100644 --- a/source/java/org/alfresco/web/bean/content/DocumentPropertiesDialog.java +++ b/source/java/org/alfresco/web/bean/content/DocumentPropertiesDialog.java @@ -68,14 +68,16 @@ import org.alfresco.web.ui.common.Utils; * * @author gavinc */ -public class DocumentPropertiesDialog +public class DocumentPropertiesDialog implements Serializable { + private static final long serialVersionUID = 3065164840163513872L; + private static final String TEMP_PROP_MIMETYPE = "mimetype"; private static final String TEMP_PROP_ENCODING = "encoding"; - protected NodeService nodeService; - protected FileFolderService fileFolderService; - protected DictionaryService dictionaryService; + transient private NodeService nodeService; + transient private FileFolderService fileFolderService; + transient private DictionaryService dictionaryService; protected BrowseBean browseBean; private List contentTypes; private Node editableNode; @@ -136,10 +138,10 @@ public class DocumentPropertiesDialog String name = (String) props.get(ContentModel.PROP_NAME); if (name != null) { - fileFolderService.rename(nodeRef, name); + getFileFolderService().rename(nodeRef, name); } - Map properties = this.nodeService.getProperties(nodeRef); + Map properties = getNodeService().getProperties(nodeRef); // we need to put all the properties from the editable bag back into // the format expected by the repository @@ -176,11 +178,11 @@ public class DocumentPropertiesDialog if (author != null && author.length() != 0) { // add aspect if required - if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == false) + if (getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == false) { Map authorProps = new HashMap(1, 1.0f); authorProps.put(ContentModel.PROP_AUTHOR, author); - this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_AUTHOR, authorProps); + getNodeService().addAspect(nodeRef, ContentModel.ASPECT_AUTHOR, authorProps); } // else it will get updated in the later setProperties() call } @@ -191,7 +193,7 @@ public class DocumentPropertiesDialog if (title != null || description != null) { // add the aspect to be sure it's present - nodeService.addAspect(nodeRef, ContentModel.ASPECT_TITLED, null); + getNodeService().addAspect(nodeRef, ContentModel.ASPECT_TITLED, null); // props will get added later in setProperties() } @@ -209,7 +211,7 @@ public class DocumentPropertiesDialog if ((propValue != null) && (propValue instanceof String) && (propValue.toString().length() == 0)) { - PropertyDefinition propDef = this.dictionaryService.getProperty(qname); + PropertyDefinition propDef = getDictionaryService().getProperty(qname); if (propDef != null) { if (propDef.getDataType().getName().equals(DataTypeDefinition.DOUBLE) || @@ -226,7 +228,7 @@ public class DocumentPropertiesDialog } // send the properties back to the repository - this.nodeService.setProperties(this.browseBean.getDocument().getNodeRef(), properties); + getNodeService().setProperties(this.browseBean.getDocument().getNodeRef(), properties); // we also need to persist any association changes that may have been made @@ -236,7 +238,7 @@ public class DocumentPropertiesDialog { for (AssociationRef assoc : typedAssoc.values()) { - this.nodeService.createAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName()); + getNodeService().createAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName()); } } @@ -246,7 +248,7 @@ public class DocumentPropertiesDialog { for (AssociationRef assoc : typedAssoc.values()) { - this.nodeService.removeAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName()); + getNodeService().removeAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName()); } } @@ -256,7 +258,7 @@ public class DocumentPropertiesDialog { for (ChildAssociationRef assoc : typedAssoc.values()) { - this.nodeService.addChild(assoc.getParentRef(), assoc.getChildRef(), assoc.getTypeQName(), assoc.getTypeQName()); + getNodeService().addChild(assoc.getParentRef(), assoc.getChildRef(), assoc.getTypeQName(), assoc.getTypeQName()); } } @@ -266,7 +268,7 @@ public class DocumentPropertiesDialog { for (ChildAssociationRef assoc : typedAssoc.values()) { - this.nodeService.removeChild(assoc.getParentRef(), assoc.getChildRef()); + getNodeService().removeChild(assoc.getParentRef(), assoc.getChildRef()); } } @@ -378,6 +380,11 @@ public class DocumentPropertiesDialog */ public NodeService getNodeService() { + if (nodeService == null) + { + nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + } + return this.nodeService; } @@ -396,6 +403,15 @@ public class DocumentPropertiesDialog { this.fileFolderService = fileFolderService; } + + protected FileFolderService getFileFolderService() + { + if (fileFolderService == null) + { + fileFolderService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getFileFolderService(); + } + return fileFolderService; + } /** * Sets the DictionaryService to use when persisting metadata @@ -406,6 +422,15 @@ public class DocumentPropertiesDialog { this.dictionaryService = dictionaryService; } + + protected DictionaryService getDictionaryService() + { + if (dictionaryService == null) + { + dictionaryService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService(); + } + return dictionaryService; + } /** * @return The BrowseBean diff --git a/source/java/org/alfresco/web/bean/content/EditContentPropertiesDialog.java b/source/java/org/alfresco/web/bean/content/EditContentPropertiesDialog.java index ff8bbc9b58..cd7f148415 100644 --- a/source/java/org/alfresco/web/bean/content/EditContentPropertiesDialog.java +++ b/source/java/org/alfresco/web/bean/content/EditContentPropertiesDialog.java @@ -54,6 +54,8 @@ import org.alfresco.web.bean.repository.Repository; */ public class EditContentPropertiesDialog extends BaseDialogBean { + private static final long serialVersionUID = -5681296528149487178L; + protected static final String TEMP_PROP_MIMETYPE = "mimetype"; protected static final String TEMP_PROP_ENCODING = "encoding"; @@ -100,12 +102,12 @@ public class EditContentPropertiesDialog extends BaseDialogBean String name = (String) editedProps.get(ContentModel.PROP_NAME); if (name != null) { - fileFolderService.rename(nodeRef, name); + getFileFolderService().rename(nodeRef, name); } // we need to put all the properties from the editable bag back into // the format expected by the repository - Map repoProps = this.nodeService.getProperties(nodeRef); + Map repoProps = this.getNodeService().getProperties(nodeRef); // Extract and deal with the special mimetype property for ContentData String mimetype = (String) editedProps.get(TEMP_PROP_MIMETYPE); @@ -135,15 +137,15 @@ public class EditContentPropertiesDialog extends BaseDialogBean } // add the "author" aspect if required, properties will get set below - if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == false) + if (this.getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == false) { - this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_AUTHOR, null); + this.getNodeService().addAspect(nodeRef, ContentModel.ASPECT_AUTHOR, null); } // add the "titled" aspect if required, properties will get set below - if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TITLED) == false) + if (this.getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_TITLED) == false) { - nodeService.addAspect(nodeRef, ContentModel.ASPECT_TITLED, null); + getNodeService().addAspect(nodeRef, ContentModel.ASPECT_TITLED, null); } // add the remaining properties @@ -159,7 +161,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean // check for empty strings when using number types, set to null in this case if (propValue instanceof String) { - PropertyDefinition propDef = this.dictionaryService.getProperty(qname); + PropertyDefinition propDef = this.getDictionaryService().getProperty(qname); if (((String)propValue).length() == 0) { if (propDef != null) @@ -184,7 +186,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean } // send the properties back to the repository - this.nodeService.setProperties(nodeRef, repoProps); + this.getNodeService().setProperties(nodeRef, repoProps); // we also need to persist any association changes that may have been made @@ -194,7 +196,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean { for (AssociationRef assoc : typedAssoc.values()) { - this.nodeService.createAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName()); + this.getNodeService().createAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName()); } } @@ -204,7 +206,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean { for (AssociationRef assoc : typedAssoc.values()) { - this.nodeService.removeAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName()); + this.getNodeService().removeAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName()); } } @@ -214,7 +216,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean { for (ChildAssociationRef assoc : typedAssoc.values()) { - this.nodeService.addChild(assoc.getParentRef(), assoc.getChildRef(), assoc.getTypeQName(), assoc.getTypeQName()); + this.getNodeService().addChild(assoc.getParentRef(), assoc.getChildRef(), assoc.getTypeQName(), assoc.getTypeQName()); } } @@ -224,7 +226,7 @@ public class EditContentPropertiesDialog extends BaseDialogBean { for (ChildAssociationRef assoc : typedAssoc.values()) { - this.nodeService.removeChild(assoc.getParentRef(), assoc.getChildRef()); + this.getNodeService().removeChild(assoc.getParentRef(), assoc.getChildRef()); } } diff --git a/source/java/org/alfresco/web/bean/content/EditContentWizard.java b/source/java/org/alfresco/web/bean/content/EditContentWizard.java index c17b3a79b2..56afb97b95 100644 --- a/source/java/org/alfresco/web/bean/content/EditContentWizard.java +++ b/source/java/org/alfresco/web/bean/content/EditContentWizard.java @@ -65,7 +65,7 @@ public class EditContentWizard extends CreateContentWizard this.nodeRef = node.getNodeRef(); try { - formName = (String)nodeService.getProperty(nodeRef, WCMAppModel.PROP_PARENT_FORM_NAME); // getFormName() ... + formName = (String)getNodeService().getProperty(nodeRef, WCMAppModel.PROP_PARENT_FORM_NAME); // getFormName() ... form = formsService.getForm(this.formName); } catch (FormNotFoundException fnfe) @@ -74,9 +74,9 @@ public class EditContentWizard extends CreateContentWizard throw new IllegalArgumentException(fnfe); } - this.content = this.contentService.getReader(nodeRef, ContentModel.PROP_CONTENT).getContentString(); + this.content = this.getContentService().getReader(nodeRef, ContentModel.PROP_CONTENT).getContentString(); - this.fileName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); // getName() ... + this.fileName = (String)getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME); // getName() ... this.mimeType = MimetypeMap.MIMETYPE_XML; } @@ -89,7 +89,7 @@ public class EditContentWizard extends CreateContentWizard @Override protected void saveContent(File fileContent, String strContent) throws Exception { - ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true); + ContentWriter writer = getContentService().getWriter(nodeRef, ContentModel.PROP_CONTENT, true); writer.putContent(strContent); } diff --git a/source/java/org/alfresco/web/bean/content/EditSimpleWorkflowDialog.java b/source/java/org/alfresco/web/bean/content/EditSimpleWorkflowDialog.java index 74b96373ab..c50a7f7a6e 100644 --- a/source/java/org/alfresco/web/bean/content/EditSimpleWorkflowDialog.java +++ b/source/java/org/alfresco/web/bean/content/EditSimpleWorkflowDialog.java @@ -75,7 +75,7 @@ public class EditSimpleWorkflowDialog extends BaseDialogBean try { - Map updateProps = nodeService.getProperties(getNode().getNodeRef()); + Map updateProps = getNodeService().getProperties(getNode().getNodeRef()); // update the simple workflow properties @@ -129,7 +129,7 @@ public class EditSimpleWorkflowDialog extends BaseDialogBean } // set the properties on the node - nodeService.setProperties(getNode().getNodeRef(), updateProps); + getNodeService().setProperties(getNode().getNodeRef(), updateProps); getNode().reset(); } catch (Throwable e) diff --git a/source/java/org/alfresco/web/bean/content/InviteContentUsersWizard.java b/source/java/org/alfresco/web/bean/content/InviteContentUsersWizard.java index 38f014ee93..b01618364a 100644 --- a/source/java/org/alfresco/web/bean/content/InviteContentUsersWizard.java +++ b/source/java/org/alfresco/web/bean/content/InviteContentUsersWizard.java @@ -37,6 +37,8 @@ import org.alfresco.web.bean.wizard.BaseInviteUsersWizard; */ public class InviteContentUsersWizard extends BaseInviteUsersWizard { + private static final long serialVersionUID = 9198783146031469545L; + /** Cache of available content permissions */ Set contentPermissions = null; @@ -45,7 +47,7 @@ public class InviteContentUsersWizard extends BaseInviteUsersWizard { if (this.contentPermissions == null) { - this.contentPermissions = this.permissionService.getSettablePermissions(ContentModel.TYPE_CONTENT); + this.contentPermissions = getPermissionService().getSettablePermissions(ContentModel.TYPE_CONTENT); } return this.contentPermissions; diff --git a/source/java/org/alfresco/web/bean/content/SetContentPropertiesDialog.java b/source/java/org/alfresco/web/bean/content/SetContentPropertiesDialog.java index 43c4fd7609..d3e9256345 100644 --- a/source/java/org/alfresco/web/bean/content/SetContentPropertiesDialog.java +++ b/source/java/org/alfresco/web/bean/content/SetContentPropertiesDialog.java @@ -33,6 +33,8 @@ import org.alfresco.web.app.AlfrescoNavigationHandler; */ public class SetContentPropertiesDialog extends EditContentPropertiesDialog { + private static final long serialVersionUID = -7705362669371767349L; + @Override protected String getDefaultCancelOutcome() { diff --git a/source/java/org/alfresco/web/bean/content/VersionedDocumentDetailsDialog.java b/source/java/org/alfresco/web/bean/content/VersionedDocumentDetailsDialog.java index e60427201a..70b2b01070 100644 --- a/source/java/org/alfresco/web/bean/content/VersionedDocumentDetailsDialog.java +++ b/source/java/org/alfresco/web/bean/content/VersionedDocumentDetailsDialog.java @@ -64,14 +64,16 @@ import org.alfresco.web.ui.common.component.UIActionLink; * * @author Yanick Pignot */ -public class VersionedDocumentDetailsDialog +public class VersionedDocumentDetailsDialog implements Serializable { - /** Dependencies */ - protected VersionService versionService; - protected EditionService editionService; - protected NodeService nodeService; - protected MultilingualContentService multilingualContentService; - protected ContentFilterLanguagesService contentFilterLanguagesService; + private static final long serialVersionUID = 1575175076564595262L; + + /** Dependencies */ + transient private VersionService versionService; + transient private EditionService editionService; + transient private NodeService nodeService; + transient private MultilingualContentService multilingualContentService; + transient private ContentFilterLanguagesService contentFilterLanguagesService; private static final Comparator VERSION_LABEL_COMPARATOR = new VersionLabelComparator(); @@ -130,7 +132,7 @@ public class VersionedDocumentDetailsDialog NodeRef currentNodeRef = new NodeRef(Repository.getStoreRef(), id); // the threatment is different if the node is a translation or a mlContainer - if(nodeService.getType(currentNodeRef).equals(ContentModel.TYPE_MULTILINGUAL_CONTAINER)) + if(getNodeService().getType(currentNodeRef).equals(ContentModel.TYPE_MULTILINGUAL_CONTAINER)) { // test if the lang parameter is valid ParameterCheck.mandatoryString("The lang of the node", lang); @@ -140,7 +142,7 @@ public class VersionedDocumentDetailsDialog versionLabel = cleanVersionLabel(versionLabel); // set the edition information of the mlContainer of the selected translation version - this.editionHistory = editionService.getEditions(currentNodeRef); + this.editionHistory = getEditionService().getEditions(currentNodeRef); this.documentEdition = editionHistory.getVersion(versionLabel); // set the version to display @@ -151,7 +153,7 @@ public class VersionedDocumentDetailsDialog fromPreviousEditon = false; // set the version history - this.versionHistory = versionService.getVersionHistory(currentNodeRef); + this.versionHistory = getVersionService().getVersionHistory(currentNodeRef); // set the version to display this.documentVersion = getBrowsingVersionForDocument(currentNodeRef, versionLabel); } @@ -242,7 +244,7 @@ public class VersionedDocumentDetailsDialog public List getTranslations() { // get the version of the mlContainer and its translations - List translationsList = editionService.getVersionedTranslations(this.documentEdition); + List translationsList = getEditionService().getVersionedTranslations(this.documentEdition); Map translationNodeRef; @@ -250,7 +252,7 @@ public class VersionedDocumentDetailsDialog if(translationsList.size() == 0) { // the selection edition is the current: use the multilingual content service - translationNodeRef = multilingualContentService.getTranslations(this.documentEdition.getVersionedNodeRef()); + translationNodeRef = getMultilingualContentService().getTranslations(this.documentEdition.getVersionedNodeRef()); } else { @@ -270,7 +272,7 @@ public class VersionedDocumentDetailsDialog if(lastVersion != null) { NodeRef versionNodeRef = lastVersion.getFrozenStateNodeRef(); - Locale locale = (Locale) nodeService.getProperty(versionNodeRef, ContentModel.PROP_LOCALE); + Locale locale = (Locale) getNodeService().getProperty(versionNodeRef, ContentModel.PROP_LOCALE); translationNodeRef.put(locale, versionNodeRef); } } @@ -289,14 +291,14 @@ public class VersionedDocumentDetailsDialog String lgge = (locale != null) ? // convert the locale into new ISO codes - contentFilterLanguagesService.convertToNewISOCode(locale.getLanguage()).toUpperCase() + getContentFilterLanguagesService().convertToNewISOCode(locale.getLanguage()).toUpperCase() : null; - mapNode.put("name", nodeService.getProperty(nodeRef, ContentModel.PROP_NAME)); + mapNode.put("name", getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME)); mapNode.put("language", lgge); mapNode.put("url", DownloadContentServlet.generateBrowserURL(nodeRef, mapNode.getName())); - mapNode.put("notEmpty", new Boolean(!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))); + mapNode.put("notEmpty", new Boolean(!getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))); // add the client side version to the list translations.add(mapNode); @@ -390,7 +392,7 @@ public class VersionedDocumentDetailsDialog */ public String getName() { - String name = (String) nodeService.getProperty(getFrozenStateNodeRef(), ContentModel.PROP_NAME); + String name = (String)getNodeService().getProperty(getFrozenStateNodeRef(), ContentModel.PROP_NAME); return name; } @@ -405,7 +407,7 @@ public class VersionedDocumentDetailsDialog public boolean isEmptyTranslation() { - return nodeService.hasAspect(getFrozenStateNodeRef(), ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION); + return getNodeService().hasAspect(getFrozenStateNodeRef(), ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION); } /** @@ -443,7 +445,7 @@ public class VersionedDocumentDetailsDialog */ private Version getBrowsingVersionForDocument(NodeRef document, String versionLabel) { - return this.versionService.getVersionHistory(document).getVersion(versionLabel); + return this.getVersionService().getVersionHistory(document).getVersion(versionLabel); } /** @@ -451,10 +453,10 @@ public class VersionedDocumentDetailsDialog */ private Version getBrowsingCurrentVersionForMLContainer(NodeRef document, String lang) { - NodeRef translation = multilingualContentService.getTranslationForLocale(document, I18NUtil.parseLocale(lang)); - this.versionHistory = versionService.getVersionHistory(translation); + NodeRef translation = getMultilingualContentService().getTranslationForLocale(document, I18NUtil.parseLocale(lang)); + this.versionHistory = getVersionService().getVersionHistory(translation); - return versionService.getCurrentVersion(translation); + return getVersionService().getCurrentVersion(translation); } /** @@ -464,7 +466,7 @@ public class VersionedDocumentDetailsDialog private Version getBrowsingVersionForMLContainer(NodeRef document, String editionLabel, String lang) { // get the list of translations of the given edition of the mlContainer - List translations = editionService.getVersionedTranslations(this.documentEdition); + List translations = getEditionService().getVersionedTranslations(this.documentEdition); // if translation size == 0, the edition is the current edition and the translations are not yet attached. if(translations.size() == 0) @@ -488,7 +490,7 @@ public class VersionedDocumentDetailsDialog if(lastVersion != null) { - Map properties = editionService.getVersionedMetadatas(lastVersion); + Map properties = getEditionService().getVersionedMetadatas(lastVersion); Locale locale = (Locale) properties.get(ContentModel.PROP_LOCALE); if(locale.getLanguage().equalsIgnoreCase(lang)) @@ -512,6 +514,15 @@ public class VersionedDocumentDetailsDialog { this.versionService = versionService; } + + protected VersionService getVersionService() + { + if (versionService == null) + { + versionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getVersionService(); + } + return versionService; + } /** * @param editionService the Edition Service to set @@ -520,6 +531,15 @@ public class VersionedDocumentDetailsDialog { this.editionService = editionService; } + + protected EditionService getEditionService() + { + if (editionService == null) + { + editionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getEditionService(); + } + return editionService; + } /** * @param nodeService the Node Service to set @@ -528,6 +548,15 @@ public class VersionedDocumentDetailsDialog { this.nodeService = nodeService; } + + protected NodeService getNodeService() + { + if (nodeService == null) + { + nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + } + return nodeService; + } /** * @param contentFilterLanguagesService the Content Filter Languages Service to set @@ -536,6 +565,15 @@ public class VersionedDocumentDetailsDialog { this.contentFilterLanguagesService = contentFilterLanguagesService; } + + protected ContentFilterLanguagesService getContentFilterLanguagesService() + { + if (contentFilterLanguagesService == null) + { + contentFilterLanguagesService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentFilterLanguagesService(); + } + return contentFilterLanguagesService; + } /** * @param Multilingual Content Service the Multilingual Content Service to set @@ -544,4 +582,13 @@ public class VersionedDocumentDetailsDialog { this.multilingualContentService = multilingualContentService; } + + protected MultilingualContentService getMultilingualContentService() + { + if (multilingualContentService == null) + { + multilingualContentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMultilingualContentService(); + } + return multilingualContentService; + } } \ No newline at end of file diff --git a/source/java/org/alfresco/web/bean/content/ViewContentPropertiesDialog.java b/source/java/org/alfresco/web/bean/content/ViewContentPropertiesDialog.java index 8a1e50b3b1..d20c21e11d 100644 --- a/source/java/org/alfresco/web/bean/content/ViewContentPropertiesDialog.java +++ b/source/java/org/alfresco/web/bean/content/ViewContentPropertiesDialog.java @@ -41,6 +41,8 @@ import org.alfresco.web.bean.repository.Node; */ public class ViewContentPropertiesDialog extends BaseDialogBean { + private static final long serialVersionUID = -867609607881256449L; + protected static final String TEMP_PROP_MIMETYPE = "mimetype"; protected static final String TEMP_PROP_ENCODING = "encoding"; diff --git a/source/java/org/alfresco/web/bean/dashboard/DashboardManager.java b/source/java/org/alfresco/web/bean/dashboard/DashboardManager.java index 3ebc353eee..f4ce27b1bf 100644 --- a/source/java/org/alfresco/web/bean/dashboard/DashboardManager.java +++ b/source/java/org/alfresco/web/bean/dashboard/DashboardManager.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.bean.dashboard; +import java.io.Serializable; import java.util.Collection; import java.util.Iterator; import java.util.List; @@ -45,8 +46,10 @@ import org.apache.commons.logging.LogFactory; * * @author Kevin Roast */ -public class DashboardManager +public class DashboardManager implements Serializable { + private static final long serialVersionUID = 6160628072764689380L; + public static final String BEAN_NAME = "DashboardManager"; private static Log logger = LogFactory.getLog(DashboardManager.class); @@ -59,8 +62,8 @@ public class DashboardManager private static final String JSP_DUMMY = "/jsp/dashboards/dummy.jsp"; private PageConfig pageConfig = null; - private DashletRenderingList renderingList = null; - private DashletTitleList titleList = null; + transient private DashletRenderingList renderingList = null; + transient private DashletTitleList titleList = null; /** * @return The layout JSP page for the current My Alfresco dashboard page @@ -251,6 +254,8 @@ public class DashboardManager */ private static class DashletRenderingList extends JSFHelperList { + private static final long serialVersionUID = -8611864902847833088L; + PageConfig config; public DashletRenderingList(PageConfig config) @@ -274,6 +279,8 @@ public class DashboardManager */ private static class DashletTitleList extends JSFHelperList { + private static final long serialVersionUID = 3522065600475233262L; + PageConfig config; public DashletTitleList(PageConfig config) @@ -308,7 +315,7 @@ public class DashboardManager /** * Helper class that implements a dummy List contract for use by JSF List getter methods */ - private static abstract class JSFHelperList implements List + private static abstract class JSFHelperList implements List, Serializable { // // Satisfy List interface contract diff --git a/source/java/org/alfresco/web/bean/dashboard/DashboardWizard.java b/source/java/org/alfresco/web/bean/dashboard/DashboardWizard.java index ad924e397f..b82d09e1ab 100644 --- a/source/java/org/alfresco/web/bean/dashboard/DashboardWizard.java +++ b/source/java/org/alfresco/web/bean/dashboard/DashboardWizard.java @@ -49,6 +49,8 @@ import org.alfresco.web.ui.common.component.description.UIDescription; */ public class DashboardWizard extends BaseWizardBean { + private static final long serialVersionUID = 2544040677742418309L; + private static final String COMPONENT_COLUMNDASHLETS = "column-dashlets"; private static final String COMPONENT_ALLDASHLETS = "all-dashlets"; diff --git a/source/java/org/alfresco/web/bean/dashboard/GettingStartedBean.java b/source/java/org/alfresco/web/bean/dashboard/GettingStartedBean.java index 2798ea9847..18fe828769 100644 --- a/source/java/org/alfresco/web/bean/dashboard/GettingStartedBean.java +++ b/source/java/org/alfresco/web/bean/dashboard/GettingStartedBean.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.bean.dashboard; +import java.io.Serializable; + import javax.faces.context.FacesContext; import org.alfresco.web.app.Application; @@ -34,8 +36,10 @@ import org.alfresco.web.bean.NavigationBean; * * @author Kevin Roast */ -public class GettingStartedBean +public class GettingStartedBean implements Serializable { + private static final long serialVersionUID = 5170536816906380802L; + private NavigationBean navigationBean; diff --git a/source/java/org/alfresco/web/bean/dashboard/PageConfig.java b/source/java/org/alfresco/web/bean/dashboard/PageConfig.java index 9e1726258c..1c22c6f573 100644 --- a/source/java/org/alfresco/web/bean/dashboard/PageConfig.java +++ b/source/java/org/alfresco/web/bean/dashboard/PageConfig.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.bean.dashboard; +import java.io.Serializable; import java.io.StringReader; import java.io.StringWriter; import java.util.ArrayList; @@ -50,8 +51,10 @@ import org.dom4j.io.XMLWriter; * * @author Kevin Roast */ -public final class PageConfig +public final class PageConfig implements Serializable { + private static final long serialVersionUID = 5464324390924278215L; + private static Log logger = LogFactory.getLog(DashboardManager.class); private static final String ELEMENT_DASHBOARD = "dashboard"; @@ -286,8 +289,10 @@ public final class PageConfig * Simple class to represent a Page in a Dashboard. * Each Page has a Layout associated with it, and a number of Column definitions. */ -final class Page +final class Page implements Serializable { + private static final long serialVersionUID = 8023042580316126423L; + private String id; private LayoutDefinition layoutDef; private List columns = new ArrayList(4); @@ -373,8 +378,10 @@ final class Page * Simple class representing a single Column in a dashboard Page. * Each column contains a list of Dashlet definitions. */ -final class Column +final class Column implements Serializable { + private static final long serialVersionUID = 6462844390234508010L; + private List dashlets = new ArrayList(4); /** diff --git a/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java b/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java index 9aee2c2c06..d336da58f1 100644 --- a/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java +++ b/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.bean.dialog; +import java.io.Serializable; import java.text.MessageFormat; import java.util.Collections; import java.util.List; @@ -53,7 +54,7 @@ import org.alfresco.web.ui.common.Utils; * * @author gavinc */ -public abstract class BaseDialogBean implements IDialogBean +public abstract class BaseDialogBean implements IDialogBean, Serializable { protected Map parameters; protected boolean isFinished = false; @@ -61,11 +62,12 @@ public abstract class BaseDialogBean implements IDialogBean // services common to most dialogs protected BrowseBean browseBean; protected NavigationBean navigator; - protected NodeService nodeService; - protected FileFolderService fileFolderService; - protected SearchService searchService; - protected DictionaryService dictionaryService; - protected NamespaceService namespaceService; + + transient private NodeService nodeService; + transient private FileFolderService fileFolderService; + transient private SearchService searchService; + transient private DictionaryService dictionaryService; + transient private NamespaceService namespaceService; public void init(Map parameters) { @@ -241,6 +243,15 @@ public abstract class BaseDialogBean implements IDialogBean this.nodeService = nodeService; } + protected NodeService getNodeService() + { + if (this.nodeService == null) + { + this.nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + } + return this.nodeService; + } + /** * @param fileFolderService used to manipulate folder/folder model nodes */ @@ -248,6 +259,15 @@ public abstract class BaseDialogBean implements IDialogBean { this.fileFolderService = fileFolderService; } + + protected FileFolderService getFileFolderService() + { + if (this.fileFolderService == null) + { + this.fileFolderService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getFileFolderService(); + } + return this.fileFolderService; + } /** * @param searchService the service used to find nodes @@ -257,6 +277,15 @@ public abstract class BaseDialogBean implements IDialogBean this.searchService = searchService; } + protected SearchService getSearchService() + { + if (this.searchService == null) + { + this.searchService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSearchService(); + } + return this.searchService; + } + /** * Sets the dictionary service * @@ -267,6 +296,15 @@ public abstract class BaseDialogBean implements IDialogBean this.dictionaryService = dictionaryService; } + protected DictionaryService getDictionaryService() + { + if (this.dictionaryService == null) + { + this.dictionaryService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService(); + } + return this.dictionaryService; + } + /** * @param namespaceService The NamespaceService */ @@ -275,6 +313,15 @@ public abstract class BaseDialogBean implements IDialogBean this.namespaceService = namespaceService; } + protected NamespaceService getNamespaceService() + { + if (this.namespaceService == null) + { + this.namespaceService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNamespaceService(); + } + return this.namespaceService; + } + /** * Returns the default cancel outcome * @@ -354,4 +401,5 @@ public abstract class BaseDialogBean implements IDialogBean FacesContext.getCurrentInstance(), getErrorMessageId()), exception.getMessage()); } + } diff --git a/source/java/org/alfresco/web/bean/dialog/DialogManager.java b/source/java/org/alfresco/web/bean/dialog/DialogManager.java index 896f8cc6d6..b0838d1087 100644 --- a/source/java/org/alfresco/web/bean/dialog/DialogManager.java +++ b/source/java/org/alfresco/web/bean/dialog/DialogManager.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.bean.dialog; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -44,8 +45,10 @@ import org.alfresco.web.ui.common.component.UIActionLink; * * @author gavinc */ -public final class DialogManager +public final class DialogManager implements Serializable { + private static final long serialVersionUID = -8690844273074627353L; + public final static String BEAN_NAME = "DialogManager"; private DialogState currentDialogState; diff --git a/source/java/org/alfresco/web/bean/dialog/DialogState.java b/source/java/org/alfresco/web/bean/dialog/DialogState.java index 757cae531e..fffc6cd834 100644 --- a/source/java/org/alfresco/web/bean/dialog/DialogState.java +++ b/source/java/org/alfresco/web/bean/dialog/DialogState.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.bean.dialog; +import java.io.Serializable; + import org.alfresco.web.app.AlfrescoNavigationHandler; import org.alfresco.web.config.DialogsConfigElement.DialogConfig; @@ -32,8 +34,10 @@ import org.alfresco.web.config.DialogsConfigElement.DialogConfig; * * @author gavinc */ -public final class DialogState +public final class DialogState implements Serializable { + private static final long serialVersionUID = -5007635589636930602L; + private DialogConfig config; private IDialogBean dialog; diff --git a/source/java/org/alfresco/web/bean/dialog/IDialogBean.java b/source/java/org/alfresco/web/bean/dialog/IDialogBean.java index d4b00361cd..22b755b570 100644 --- a/source/java/org/alfresco/web/bean/dialog/IDialogBean.java +++ b/source/java/org/alfresco/web/bean/dialog/IDialogBean.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.bean.dialog; +import java.io.Serializable; import java.util.List; import java.util.Map; @@ -34,7 +35,7 @@ import org.alfresco.web.config.DialogsConfigElement.DialogButtonConfig; * * @author gavinc */ -public interface IDialogBean +public interface IDialogBean extends Serializable { /** * Initialises the dialog bean diff --git a/source/java/org/alfresco/web/bean/forums/CreateDiscussionDialog.java b/source/java/org/alfresco/web/bean/forums/CreateDiscussionDialog.java index f63d0f64e2..8e94dd67a3 100644 --- a/source/java/org/alfresco/web/bean/forums/CreateDiscussionDialog.java +++ b/source/java/org/alfresco/web/bean/forums/CreateDiscussionDialog.java @@ -55,6 +55,8 @@ import org.apache.commons.logging.LogFactory; */ public class CreateDiscussionDialog extends CreateTopicDialog { + private static final long serialVersionUID = 3500493916528264014L; + protected NodeRef discussingNodeRef; private static final Log logger = LogFactory.getLog(CreateDiscussionDialog.class); @@ -114,24 +116,24 @@ public class CreateDiscussionDialog extends CreateTopicDialog this.discussingNodeRef = new NodeRef(Repository.getStoreRef(), id); - if (this.nodeService.hasAspect(this.discussingNodeRef, ForumModel.ASPECT_DISCUSSABLE)) + if (this.getNodeService().hasAspect(this.discussingNodeRef, ForumModel.ASPECT_DISCUSSABLE)) { throw new AlfrescoRuntimeException("createDiscussion called for an object that already has a discussion!"); } // add the discussable aspect - this.nodeService.addAspect(this.discussingNodeRef, ForumModel.ASPECT_DISCUSSABLE, null); + this.getNodeService().addAspect(this.discussingNodeRef, ForumModel.ASPECT_DISCUSSABLE, null); // create a child forum space using the child association just introduced by // adding the discussable aspect - String name = (String)this.nodeService.getProperty(this.discussingNodeRef, + String name = (String)this.getNodeService().getProperty(this.discussingNodeRef, ContentModel.PROP_NAME); String msg = Application.getMessage(FacesContext.getCurrentInstance(), "discussion_for"); String forumName = MessageFormat.format(msg, new Object[] {name}); Map forumProps = new HashMap(1); forumProps.put(ContentModel.PROP_NAME, forumName); - ChildAssociationRef childRef = this.nodeService.createNode(this.discussingNodeRef, + ChildAssociationRef childRef = this.getNodeService().createNode(this.discussingNodeRef, ForumModel.ASSOC_DISCUSSION, QName.createQName(NamespaceService.FORUMS_MODEL_1_0_URI, "discussion"), ForumModel.TYPE_FORUM, forumProps); @@ -141,7 +143,7 @@ public class CreateDiscussionDialog extends CreateTopicDialog // apply the uifacets aspect Map uiFacetsProps = new HashMap(5); uiFacetsProps.put(ApplicationModel.PROP_ICON, "forum"); - this.nodeService.addAspect(forumNodeRef, ApplicationModel.ASPECT_UIFACETS, uiFacetsProps); + this.getNodeService().addAspect(forumNodeRef, ApplicationModel.ASPECT_UIFACETS, uiFacetsProps); if (logger.isDebugEnabled()) logger.debug("created forum for content: " + this.discussingNodeRef.toString()); @@ -178,11 +180,11 @@ public class CreateDiscussionDialog extends CreateTopicDialog tx.begin(); // remove the discussable aspect from the node we were going to discuss! - this.nodeService.removeAspect(this.discussingNodeRef, ForumModel.ASPECT_DISCUSSABLE); + this.getNodeService().removeAspect(this.discussingNodeRef, ForumModel.ASPECT_DISCUSSABLE); // delete the forum space created when the wizard started Node forumNode = this.navigator.getCurrentNode(); - this.nodeService.deleteNode(forumNode.getNodeRef()); + this.getNodeService().deleteNode(forumNode.getNodeRef()); // commit the transaction tx.commit(); diff --git a/source/java/org/alfresco/web/bean/forums/CreateForumDialog.java b/source/java/org/alfresco/web/bean/forums/CreateForumDialog.java index 6289d53e50..a265d75d3e 100644 --- a/source/java/org/alfresco/web/bean/forums/CreateForumDialog.java +++ b/source/java/org/alfresco/web/bean/forums/CreateForumDialog.java @@ -42,6 +42,8 @@ public class CreateForumDialog extends CreateSpaceDialog // ------------------------------------------------------------------------------ // Wizard implementation + private static final long serialVersionUID = 277281993463789379L; + @Override public void init(Map parameters) { diff --git a/source/java/org/alfresco/web/bean/forums/CreateForumsDialog.java b/source/java/org/alfresco/web/bean/forums/CreateForumsDialog.java index dd82c7901f..26f20099a1 100644 --- a/source/java/org/alfresco/web/bean/forums/CreateForumsDialog.java +++ b/source/java/org/alfresco/web/bean/forums/CreateForumsDialog.java @@ -42,6 +42,8 @@ public class CreateForumsDialog extends CreateSpaceDialog // ------------------------------------------------------------------------------ // Wizard implementation + private static final long serialVersionUID = 4371868975654509241L; + @Override public void init(Map parameters) { diff --git a/source/java/org/alfresco/web/bean/forums/CreatePostDialog.java b/source/java/org/alfresco/web/bean/forums/CreatePostDialog.java index 9988d3e2a2..25df8aea13 100644 --- a/source/java/org/alfresco/web/bean/forums/CreatePostDialog.java +++ b/source/java/org/alfresco/web/bean/forums/CreatePostDialog.java @@ -44,6 +44,8 @@ public class CreatePostDialog extends CreateContentWizard // ------------------------------------------------------------------------------ // Wizard implementation + private static final long serialVersionUID = -2859329677883776068L; + @Override public void init(Map parameters) { diff --git a/source/java/org/alfresco/web/bean/forums/CreateReplyDialog.java b/source/java/org/alfresco/web/bean/forums/CreateReplyDialog.java index cb9225e101..4db5680e16 100644 --- a/source/java/org/alfresco/web/bean/forums/CreateReplyDialog.java +++ b/source/java/org/alfresco/web/bean/forums/CreateReplyDialog.java @@ -41,6 +41,8 @@ import org.apache.commons.logging.LogFactory; */ public class CreateReplyDialog extends CreatePostDialog { + private static final long serialVersionUID = 8036934269090933533L; + protected String replyContent = null; private static final Log logger = LogFactory.getLog(CreateReplyDialog.class); @@ -66,8 +68,8 @@ public class CreateReplyDialog extends CreatePostDialog // setup the referencing aspect with the references association // between the new post and the one being replied to - this.nodeService.addAspect(this.createdNode, ContentModel.ASPECT_REFERENCING, null); - this.nodeService.createAssociation(this.createdNode, this.browseBean.getDocument().getNodeRef(), + this.getNodeService().addAspect(this.createdNode, ContentModel.ASPECT_REFERENCING, null); + this.getNodeService().createAssociation(this.createdNode, this.browseBean.getDocument().getNodeRef(), ContentModel.ASSOC_REFERENCES); if (logger.isDebugEnabled()) diff --git a/source/java/org/alfresco/web/bean/forums/CreateTopicDialog.java b/source/java/org/alfresco/web/bean/forums/CreateTopicDialog.java index edfb4f5720..036f2f8da7 100644 --- a/source/java/org/alfresco/web/bean/forums/CreateTopicDialog.java +++ b/source/java/org/alfresco/web/bean/forums/CreateTopicDialog.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.bean.forums; +import java.io.IOException; +import java.io.ObjectInputStream; import java.io.Serializable; import java.util.HashMap; import java.util.Map; @@ -53,8 +55,10 @@ import org.apache.commons.logging.LogFactory; */ public class CreateTopicDialog extends CreateSpaceDialog { + private static final long serialVersionUID = -8672220556613430308L; + protected String message; - protected ContentService contentService; + transient private ContentService contentService; private static final Log logger = LogFactory.getLog(CreateTopicDialog.class); @@ -83,7 +87,7 @@ public class CreateTopicDialog extends CreateSpaceDialog // create a unique file name for the message content String fileName = ForumsBean.createPostFileName(); - FileInfo fileInfo = this.fileFolderService.create(containerNodeRef, + FileInfo fileInfo = this.getFileFolderService().create(containerNodeRef, fileName, ForumModel.TYPE_POST); NodeRef postNodeRef = fileInfo.getNodeRef(); @@ -93,20 +97,20 @@ public class CreateTopicDialog extends CreateSpaceDialog // apply the titled aspect - title and description Map titledProps = new HashMap(3, 1.0f); titledProps.put(ContentModel.PROP_TITLE, fileName); - this.nodeService.addAspect(postNodeRef, ContentModel.ASPECT_TITLED, titledProps); + this.getNodeService().addAspect(postNodeRef, ContentModel.ASPECT_TITLED, titledProps); if (logger.isDebugEnabled()) logger.debug("Added titled aspect with properties: " + titledProps); Map editProps = new HashMap(1, 1.0f); editProps.put(ApplicationModel.PROP_EDITINLINE, true); - this.nodeService.addAspect(postNodeRef, ApplicationModel.ASPECT_INLINEEDITABLE, editProps); + this.getNodeService().addAspect(postNodeRef, ApplicationModel.ASPECT_INLINEEDITABLE, editProps); if (logger.isDebugEnabled()) logger.debug("Added inlineeditable aspect with properties: " + editProps); // get a writer for the content and put the file - ContentWriter writer = contentService.getWriter(postNodeRef, ContentModel.PROP_CONTENT, true); + ContentWriter writer = getContentService().getWriter(postNodeRef, ContentModel.PROP_CONTENT, true); // set the mimetype and encoding writer.setMimetype(Repository.getMimeTypeForFileName(context, fileName)); writer.setEncoding("UTF-8"); @@ -165,4 +169,14 @@ public class CreateTopicDialog extends CreateSpaceDialog { this.contentService = contentService; } + + protected ContentService getContentService() + { + if (contentService == null) + { + contentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentService(); + } + return contentService; + } + } diff --git a/source/java/org/alfresco/web/bean/forums/DeleteForumDialog.java b/source/java/org/alfresco/web/bean/forums/DeleteForumDialog.java index a9a0db8590..36e6284baf 100644 --- a/source/java/org/alfresco/web/bean/forums/DeleteForumDialog.java +++ b/source/java/org/alfresco/web/bean/forums/DeleteForumDialog.java @@ -43,6 +43,8 @@ import org.alfresco.web.bean.spaces.DeleteSpaceDialog; */ public class DeleteForumDialog extends DeleteSpaceDialog { + private static final long serialVersionUID = -4246549059188399460L; + protected boolean reDisplayForums; // ------------------------------------------------------------------------------ @@ -62,7 +64,7 @@ public class DeleteForumDialog extends DeleteSpaceDialog { // find out what the parent type of the node being deleted Node node = this.browseBean.getActionSpace(); - ChildAssociationRef assoc = this.nodeService.getPrimaryParent(node.getNodeRef()); + ChildAssociationRef assoc = this.getNodeService().getPrimaryParent(node.getNodeRef()); if (assoc != null) { // get the parent node @@ -74,13 +76,13 @@ public class DeleteForumDialog extends DeleteSpaceDialog { // if the association type is the 'discussion' association we // need to remove the discussable aspect from the parent node - this.nodeService.removeAspect(parent, ForumModel.ASPECT_DISCUSSABLE); + this.getNodeService().removeAspect(parent, ForumModel.ASPECT_DISCUSSABLE); } // if the parent type is a forum space then we need the dialog to go // back to the forums view otherwise it will use the default of 'browse', // this happens when a forum being used to discuss a node is deleted. - QName parentType = this.nodeService.getType(parent); + QName parentType = this.getNodeService().getType(parent); if (parentType.equals(ForumModel.TYPE_FORUMS)) { this.reDisplayForums = true; diff --git a/source/java/org/alfresco/web/bean/forums/DeleteForumsDialog.java b/source/java/org/alfresco/web/bean/forums/DeleteForumsDialog.java index ebb087ce31..7c539a6154 100644 --- a/source/java/org/alfresco/web/bean/forums/DeleteForumsDialog.java +++ b/source/java/org/alfresco/web/bean/forums/DeleteForumsDialog.java @@ -43,6 +43,8 @@ import org.alfresco.web.bean.spaces.DeleteSpaceDialog; */ public class DeleteForumsDialog extends DeleteSpaceDialog { + private static final long serialVersionUID = -1673691210425371041L; + protected boolean reDisplayForums; // ------------------------------------------------------------------------------ @@ -62,11 +64,11 @@ public class DeleteForumsDialog extends DeleteSpaceDialog { // find out what the parent type of the node being deleted Node node = this.browseBean.getActionSpace(); - ChildAssociationRef assoc = this.nodeService.getPrimaryParent(node.getNodeRef()); + ChildAssociationRef assoc = this.getNodeService().getPrimaryParent(node.getNodeRef()); if (assoc != null) { NodeRef parent = assoc.getParentRef(); - QName parentType = this.nodeService.getType(parent); + QName parentType = this.getNodeService().getType(parent); if (parentType.equals(ForumModel.TYPE_FORUMS)) { this.reDisplayForums = true; diff --git a/source/java/org/alfresco/web/bean/forums/DeletePostDialog.java b/source/java/org/alfresco/web/bean/forums/DeletePostDialog.java index 7196bf8ec5..2d2f754ccc 100644 --- a/source/java/org/alfresco/web/bean/forums/DeletePostDialog.java +++ b/source/java/org/alfresco/web/bean/forums/DeletePostDialog.java @@ -41,6 +41,8 @@ public class DeletePostDialog extends DeleteContentDialog // ------------------------------------------------------------------------------ // Dialog implementation + private static final long serialVersionUID = 6804626884508461423L; + @Override protected String doPostCommitProcessing(FacesContext context, String outcome) { diff --git a/source/java/org/alfresco/web/bean/forums/DeleteTopicDialog.java b/source/java/org/alfresco/web/bean/forums/DeleteTopicDialog.java index 6d1f917a9c..d51ddceea6 100644 --- a/source/java/org/alfresco/web/bean/forums/DeleteTopicDialog.java +++ b/source/java/org/alfresco/web/bean/forums/DeleteTopicDialog.java @@ -43,6 +43,8 @@ import org.alfresco.web.bean.spaces.DeleteSpaceDialog; */ public class DeleteTopicDialog extends DeleteSpaceDialog { + private static final long serialVersionUID = 548182341698381545L; + protected boolean reDisplayTopics; // ------------------------------------------------------------------------------ @@ -62,11 +64,11 @@ public class DeleteTopicDialog extends DeleteSpaceDialog { // find out what the parent type of the node being deleted Node node = this.browseBean.getActionSpace(); - ChildAssociationRef assoc = this.nodeService.getPrimaryParent(node.getNodeRef()); + ChildAssociationRef assoc = this.getNodeService().getPrimaryParent(node.getNodeRef()); if (assoc != null) { NodeRef parent = assoc.getParentRef(); - QName parentType = this.nodeService.getType(parent); + QName parentType = this.getNodeService().getType(parent); if (parentType.equals(ForumModel.TYPE_FORUM)) { this.reDisplayTopics = true; diff --git a/source/java/org/alfresco/web/bean/forums/EditPostDialog.java b/source/java/org/alfresco/web/bean/forums/EditPostDialog.java index dba1976390..ac62cba8c1 100644 --- a/source/java/org/alfresco/web/bean/forums/EditPostDialog.java +++ b/source/java/org/alfresco/web/bean/forums/EditPostDialog.java @@ -47,6 +47,8 @@ public class EditPostDialog extends CreatePostDialog // ------------------------------------------------------------------------------ // Wizard implementation + private static final long serialVersionUID = 7925794441178897699L; + @Override public void init(Map parameters) { @@ -55,7 +57,7 @@ public class EditPostDialog extends CreatePostDialog // we need to remove the
    tags and replace with carriage returns // and then setup the content member variable Node currentDocument = this.browseBean.getDocument(); - ContentReader reader = this.contentService.getReader(currentDocument.getNodeRef(), + ContentReader reader = this.getContentService().getReader(currentDocument.getNodeRef(), ContentModel.PROP_CONTENT); if (reader != null) @@ -80,15 +82,15 @@ public class EditPostDialog extends CreatePostDialog // check that the name of this post does not contain the : // character (used in previous versions), if it does rename // the post. - String name = (String)this.nodeService.getProperty( + String name = (String)this.getNodeService().getProperty( postNode, ContentModel.PROP_NAME); if (name.indexOf(":") != -1) { String newName = name.replace(':', '-'); - this.fileFolderService.rename(postNode, newName); + this.getFileFolderService().rename(postNode, newName); } - ContentWriter writer = this.contentService.getWriter(postNode, + ContentWriter writer = this.getContentService().getWriter(postNode, ContentModel.PROP_CONTENT, true); if (writer != null) { diff --git a/source/java/org/alfresco/web/bean/forums/ForumDetailsDialog.java b/source/java/org/alfresco/web/bean/forums/ForumDetailsDialog.java index 0cf8897024..49e4ec17cc 100644 --- a/source/java/org/alfresco/web/bean/forums/ForumDetailsDialog.java +++ b/source/java/org/alfresco/web/bean/forums/ForumDetailsDialog.java @@ -66,7 +66,7 @@ public class ForumDetailsDialog extends BaseDetailsBean implements NavigationSup if (ApplicationModel.TYPE_FOLDERLINK.equals(space.getType())) { NodeRef destRef = (NodeRef) space.getProperties().get(ContentModel.PROP_LINK_DESTINATION); - if (nodeService.exists(destRef)) + if (getNodeService().exists(destRef)) { space = new Node(destRef); } @@ -234,7 +234,8 @@ public class ForumDetailsDialog extends BaseDetailsBean implements NavigationSup @Override public String getContainerSubTitle() { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + getSpace().getNodePath().toDisplayPath(nodeService, permissionService); + return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + + getSpace().getNodePath().toDisplayPath(getNodeService(), getPermissionService()); } public String getContainerTitle() diff --git a/source/java/org/alfresco/web/bean/forums/ForumsBean.java b/source/java/org/alfresco/web/bean/forums/ForumsBean.java index 521d3a55df..ef701628bd 100644 --- a/source/java/org/alfresco/web/bean/forums/ForumsBean.java +++ b/source/java/org/alfresco/web/bean/forums/ForumsBean.java @@ -85,25 +85,27 @@ import org.apache.commons.logging.LogFactory; */ public class ForumsBean implements IContextListener { + private static final long serialVersionUID = 7066410060288061436L; + private static Log logger = LogFactory.getLog(ForumsBean.class); private static final String PAGE_NAME_FORUMS = "forums"; private static final String PAGE_NAME_FORUM = "forum"; private static final String PAGE_NAME_TOPIC = "topic"; /** The NodeService to be used by the bean */ - protected NodeService nodeService; + transient private NodeService nodeService; /** The ContentService to be used by the bean */ - protected ContentService contentService; + transient private ContentService contentService; /** The DictionaryService bean reference */ - protected DictionaryService dictionaryService; + transient private DictionaryService dictionaryService; /** The SearchService bean reference. */ - protected SearchService searchService; + transient private SearchService searchService; /** The NamespaceService bean reference. */ - protected NamespaceService namespaceService; + transient private NamespaceService namespaceService; /** The browse bean */ protected BrowseBean browseBean; @@ -168,6 +170,15 @@ public class ForumsBean implements IContextListener this.nodeService = nodeService; } + protected NodeService getNodeService() + { + if (nodeService == null) + { + nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + } + return nodeService; + } + /** * Sets the content service to use * @@ -177,6 +188,15 @@ public class ForumsBean implements IContextListener { this.contentService = contentService; } + + protected ContentService getContentService() + { + if (contentService == null) + { + contentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentService(); + } + return contentService; + } /** * @param dictionaryService The DictionaryService to set. @@ -186,6 +206,15 @@ public class ForumsBean implements IContextListener this.dictionaryService = dictionaryService; } + protected DictionaryService getDictionaryService() + { + if (dictionaryService == null) + { + dictionaryService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService(); + } + return dictionaryService; + } + /** * @param searchService The SearchService to set. */ @@ -193,6 +222,15 @@ public class ForumsBean implements IContextListener { this.searchService = searchService; } + + protected SearchService getSearchService() + { + if (searchService == null) + { + searchService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSearchService(); + } + return searchService; + } /** * @param namespaceService The NamespaceService to set. @@ -201,6 +239,15 @@ public class ForumsBean implements IContextListener { this.namespaceService = namespaceService; } + + protected NamespaceService getNamespaceService() + { + if (namespaceService == null) + { + namespaceService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNamespaceService(); + } + return namespaceService; + } /** * Sets the BrowseBean instance to use to retrieve the current document @@ -440,7 +487,7 @@ public class ForumsBean implements IContextListener if (parentNodeId == null) { // no specific parent node specified - use the root node - parentRef = this.nodeService.getRootNode(Repository.getStoreRef()); + parentRef = this.getNodeService().getRootNode(Repository.getStoreRef()); } else { @@ -448,7 +495,7 @@ public class ForumsBean implements IContextListener parentRef = new NodeRef(Repository.getStoreRef(), parentNodeId); } - List childRefs = this.nodeService.getChildAssocs(parentRef, + List childRefs = this.getNodeService().getChildAssocs(parentRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); this.forums = new ArrayList(childRefs.size()); this.topics = new ArrayList(childRefs.size()); @@ -459,44 +506,44 @@ public class ForumsBean implements IContextListener // create our Node representation from the NodeRef NodeRef nodeRef = ref.getChildRef(); - if (this.nodeService.exists(nodeRef)) + 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.nodeService.getType(nodeRef); + QName type = this.getNodeService().getType(nodeRef); // make sure the type is defined in the data dictionary - TypeDefinition typeDef = this.dictionaryService.getType(type); + TypeDefinition typeDef = this.getDictionaryService().getType(type); if (typeDef != null) { // extract forums, forum, topic and post types - if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false) + if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false) { - if (this.dictionaryService.isSubClass(type, ForumModel.TYPE_FORUMS) || - this.dictionaryService.isSubClass(type, ForumModel.TYPE_FORUM)) + if (this.getDictionaryService().isSubClass(type, ForumModel.TYPE_FORUMS) || + this.getDictionaryService().isSubClass(type, ForumModel.TYPE_FORUM)) { // create our Node representation - MapNode node = new MapNode(nodeRef, this.nodeService, true); + MapNode node = new MapNode(nodeRef, this.getNodeService(), true); node.addPropertyResolver("icon", this.browseBean.resolverSpaceIcon); node.addPropertyResolver("smallIcon", this.browseBean.resolverSmallIcon); this.forums.add(node); } - if (this.dictionaryService.isSubClass(type, ForumModel.TYPE_TOPIC)) + if (this.getDictionaryService().isSubClass(type, ForumModel.TYPE_TOPIC)) { // create our Node representation - MapNode node = new MapNode(nodeRef, this.nodeService, true); + MapNode node = new MapNode(nodeRef, this.getNodeService(), true); node.addPropertyResolver("icon", this.browseBean.resolverSpaceIcon); node.addPropertyResolver("smallIcon", this.browseBean.resolverSmallIcon); node.addPropertyResolver("replies", this.resolverReplies); this.topics.add(node); } - else if (this.dictionaryService.isSubClass(type, ForumModel.TYPE_POST)) + else if (this.getDictionaryService().isSubClass(type, ForumModel.TYPE_POST)) { // create our Node representation - MapNode node = new MapNode(nodeRef, this.nodeService, true); + MapNode node = new MapNode(nodeRef, this.getNodeService(), true); this.browseBean.setupCommonBindingProperties(node); node.addPropertyResolver("smallIcon", this.browseBean.resolverSmallIcon); @@ -561,7 +608,7 @@ public class ForumsBean implements IContextListener FacesContext context = FacesContext.getCurrentInstance(); Node replyToNode = this.browseBean.getDocument(); - boolean isReplyPost = this.nodeService.hasAspect(replyToNode.getNodeRef(), + boolean isReplyPost = this.getNodeService().hasAspect(replyToNode.getNodeRef(), ContentModel.ASPECT_REFERENCING); String contextPath = context.getExternalContext().getRequestContextPath(); String colour = isReplyPost ? "yellow" : "orange"; @@ -765,13 +812,13 @@ public class ForumsBean implements IContextListener NodeRef nodeRef = new NodeRef(Repository.getStoreRef(), id); - if (this.nodeService.hasAspect(nodeRef, ForumModel.ASPECT_DISCUSSABLE) == false) + if (this.getNodeService().hasAspect(nodeRef, ForumModel.ASPECT_DISCUSSABLE) == false) { throw new AlfrescoRuntimeException("discuss called for an object that does not have a discussion!"); } // as the node has the discussable aspect there must be a discussions child assoc - List children = this.nodeService.getChildAssocs(nodeRef, + List children = this.getNodeService().getChildAssocs(nodeRef, ForumModel.ASSOC_DISCUSSION, RegexQNamePattern.MATCH_ALL); // there should only be one child, retrieve it if there is @@ -795,15 +842,17 @@ public class ForumsBean implements IContextListener // Property Resolvers public NodePropertyResolver resolverReplies = new NodePropertyResolver() { + private static final long serialVersionUID = -4800772273246202885L; + public Object get(Node node) { // query for the number of posts within the given node String repliesXPath = "./*[(subtypeOf('" + ForumModel.TYPE_POST + "'))]"; - List replies = searchService.selectNodes( + List replies = getSearchService().selectNodes( node.getNodeRef(), repliesXPath, new QueryParameterDefinition[] {}, - namespaceService, + getNamespaceService(), false); // reduce the count by 1 as one of the posts will be the initial post @@ -819,6 +868,8 @@ public class ForumsBean implements IContextListener }; public NodePropertyResolver resolverContent = new NodePropertyResolver() { + private static final long serialVersionUID = -2575377410105460440L; + public Object get(Node node) { String content = null; @@ -826,7 +877,7 @@ public class ForumsBean implements IContextListener // get the content property from the node and retrieve the // full content as a string (obviously should only be used // for small amounts of content) - ContentReader reader = contentService.getReader(node.getNodeRef(), + ContentReader reader = getContentService().getReader(node.getNodeRef(), ContentModel.PROP_CONTENT); if (reader != null) @@ -839,13 +890,15 @@ public class ForumsBean implements IContextListener }; public NodePropertyResolver resolverReplyTo = new NodePropertyResolver() { + private static final long serialVersionUID = 2614901755220899360L; + public Object get(Node node) { // determine if this node is a reply to another post, if so find // the creator of the original poster String replyTo = null; - List assocs = nodeService.getTargetAssocs(node.getNodeRef(), + List assocs = getNodeService().getTargetAssocs(node.getNodeRef(), ContentModel.ASSOC_REFERENCES); // there should only be one association, if there is more than one @@ -928,7 +981,7 @@ public class ForumsBean implements IContextListener { // get the content of the article being replied to String replyContent = ""; - ContentReader reader = this.contentService.getReader(replyToNode.getNodeRef(), + ContentReader reader = this.getContentService().getReader(replyToNode.getNodeRef(), ContentModel.PROP_CONTENT); if (reader != null) { @@ -959,6 +1012,8 @@ public class ForumsBean implements IContextListener */ public static class TopicBubbleViewRenderer implements IRichListRenderer { + private static final long serialVersionUID = -6641033880549363822L; + public static final String VIEWMODEID = "bubble"; public String getViewModeID() diff --git a/source/java/org/alfresco/web/bean/forums/ForumsDetailsDialog.java b/source/java/org/alfresco/web/bean/forums/ForumsDetailsDialog.java index c91b4049f8..3b48170ec2 100644 --- a/source/java/org/alfresco/web/bean/forums/ForumsDetailsDialog.java +++ b/source/java/org/alfresco/web/bean/forums/ForumsDetailsDialog.java @@ -66,7 +66,7 @@ public class ForumsDetailsDialog extends BaseDetailsBean implements NavigationSu if (ApplicationModel.TYPE_FOLDERLINK.equals(space.getType())) { NodeRef destRef = (NodeRef) space.getProperties().get(ContentModel.PROP_LINK_DESTINATION); - if (nodeService.exists(destRef)) + if (getNodeService().exists(destRef)) { space = new Node(destRef); } @@ -234,7 +234,8 @@ public class ForumsDetailsDialog extends BaseDetailsBean implements NavigationSu @Override public String getContainerSubTitle() { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + getSpace().getNodePath().toDisplayPath(nodeService, permissionService); + return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + + getSpace().getNodePath().toDisplayPath(getNodeService(), getPermissionService()); } public String getContainerTitle() diff --git a/source/java/org/alfresco/web/bean/forums/TopicDetailsDialog.java b/source/java/org/alfresco/web/bean/forums/TopicDetailsDialog.java index 4fdba43ead..ccf6844484 100644 --- a/source/java/org/alfresco/web/bean/forums/TopicDetailsDialog.java +++ b/source/java/org/alfresco/web/bean/forums/TopicDetailsDialog.java @@ -66,7 +66,7 @@ public class TopicDetailsDialog extends BaseDetailsBean implements NavigationSup if (ApplicationModel.TYPE_FOLDERLINK.equals(space.getType())) { NodeRef destRef = (NodeRef) space.getProperties().get(ContentModel.PROP_LINK_DESTINATION); - if (nodeService.exists(destRef)) + if (getNodeService().exists(destRef)) { space = new Node(destRef); } @@ -234,7 +234,8 @@ public class TopicDetailsDialog extends BaseDetailsBean implements NavigationSup @Override public String getContainerSubTitle() { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + getSpace().getNodePath().toDisplayPath(nodeService, permissionService); + return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + + getSpace().getNodePath().toDisplayPath(getNodeService(), getPermissionService()); } public String getContainerTitle() diff --git a/source/java/org/alfresco/web/bean/groups/AddUsersDialog.java b/source/java/org/alfresco/web/bean/groups/AddUsersDialog.java index 59aaf151fa..fb2010ddd0 100644 --- a/source/java/org/alfresco/web/bean/groups/AddUsersDialog.java +++ b/source/java/org/alfresco/web/bean/groups/AddUsersDialog.java @@ -187,11 +187,11 @@ public class AddUsersDialog extends BaseDialogBean ArrayList itemList = new ArrayList(nodes.size()); for (NodeRef personRef : nodes) { - String username = (String) nodeService.getProperty(personRef, ContentModel.PROP_USERNAME); + String username = (String)getNodeService().getProperty(personRef, ContentModel.PROP_USERNAME); if (PermissionService.GUEST_AUTHORITY.equals(username) == false) { - String firstName = (String) nodeService.getProperty(personRef, ContentModel.PROP_FIRSTNAME); - String lastName = (String) nodeService.getProperty(personRef, ContentModel.PROP_LASTNAME); + String firstName = (String)getNodeService().getProperty(personRef, ContentModel.PROP_FIRSTNAME); + String lastName = (String)getNodeService().getProperty(personRef, ContentModel.PROP_LASTNAME); SelectItem item = new SortableSelectItem(username, firstName + " " + lastName, lastName); itemList.add(item); @@ -258,8 +258,8 @@ public class AddUsersDialog extends BaseDialogBean { // found a Person with a User authority NodeRef ref = this.personService.getPerson(authority); - String firstName = (String) this.nodeService.getProperty(ref, ContentModel.PROP_FIRSTNAME); - String lastName = (String) this.nodeService.getProperty(ref, ContentModel.PROP_LASTNAME); + String firstName = (String)getNodeService().getProperty(ref, ContentModel.PROP_FIRSTNAME); + String lastName = (String)getNodeService().getProperty(ref, ContentModel.PROP_LASTNAME); // build a sensible label for display label.append(firstName).append(' ').append(lastName); diff --git a/source/java/org/alfresco/web/bean/groups/GroupsDialog.java b/source/java/org/alfresco/web/bean/groups/GroupsDialog.java index 33a2fa1d48..f0b5a9fe21 100644 --- a/source/java/org/alfresco/web/bean/groups/GroupsDialog.java +++ b/source/java/org/alfresco/web/bean/groups/GroupsDialog.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.bean.groups; +import java.io.Serializable; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collections; @@ -66,15 +67,17 @@ import org.apache.commons.logging.LogFactory; public class GroupsDialog extends BaseDialogBean implements IContextListener, FilterViewSupport, ChangeViewSupport { + private static final long serialVersionUID = -624617545796275734L; + public static final String KEY_GROUP = "group"; public static final String PARAM_GROUP = "group"; public static final String PARAM_GROUP_NAME = "groupName"; /** The AuthorityService to be used by the bean */ - protected AuthorityService authService; + transient private AuthorityService authService; /** personService bean reference */ - protected PersonService personService; + transient private PersonService personService; /** Component references */ protected UIRichList groupsRichList; @@ -269,11 +272,29 @@ public class GroupsDialog extends BaseDialogBean { this.authService = authService; } + + private AuthorityService getAuthorityService() + { + if (authService == null) + { + authService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAuthorityService(); + } + return authService; + } public void setPersonService(PersonService personService) { this.personService = personService; } + + private PersonService getPersonService() + { + if (personService == null) + { + personService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPersonService(); + } + return personService; + } public UIRichList getGroupsRichList() { @@ -334,24 +355,24 @@ public class GroupsDialog extends BaseDialogBean // root groups if (immediate == true) { - authorities = this.authService.getAllRootAuthorities(AuthorityType.GROUP); + authorities = this.getAuthorityService().getAllRootAuthorities(AuthorityType.GROUP); } else { - authorities = this.authService.getAllAuthorities(AuthorityType.GROUP); + authorities = this.getAuthorityService().getAllAuthorities(AuthorityType.GROUP); } } else { // sub-group of an existing group - authorities = this.authService.getContainedAuthorities(AuthorityType.GROUP, this.group, immediate); + authorities = this.getAuthorityService().getContainedAuthorities(AuthorityType.GROUP, this.group, immediate); } groups = new ArrayList(authorities.size()); for (String authority : authorities) { Map authMap = new HashMap(3, 1.0f); - String name = this.authService.getShortName(authority); + String name = this.getAuthorityService().getShortName(authority); authMap.put("name", name); authMap.put("id", authority); authMap.put("group", authority); @@ -397,21 +418,21 @@ public class GroupsDialog extends BaseDialogBean { // users of an existing group boolean immediate = (this.filterMode.equals(FILTER_CHILDREN)); - authorities = this.authService.getContainedAuthorities(AuthorityType.USER, this.group, immediate); + authorities = this.getAuthorityService().getContainedAuthorities(AuthorityType.USER, this.group, immediate); } users = new ArrayList(authorities.size()); for (String authority : authorities) { Map authMap = new HashMap(3, 1.0f); - String userName = this.authService.getShortName(authority); + String userName = this.getAuthorityService().getShortName(authority); authMap.put("userName", userName); authMap.put("id", authority); // get Person details for this Authority - NodeRef ref = this.personService.getPerson(authority); - String firstName = (String)this.nodeService.getProperty(ref, ContentModel.PROP_FIRSTNAME); - String lastName = (String)this.nodeService.getProperty(ref, ContentModel.PROP_LASTNAME); + NodeRef ref = this.getPersonService().getPerson(authority); + String firstName = (String)this.getNodeService().getProperty(ref, ContentModel.PROP_FIRSTNAME); + String lastName = (String)this.getNodeService().getProperty(ref, ContentModel.PROP_LASTNAME); // build a sensible label for display StringBuilder label = new StringBuilder(48); @@ -493,7 +514,7 @@ public class GroupsDialog extends BaseDialogBean tx = Repository.getUserTransaction(context); tx.begin(); - this.authService.removeAuthority(this.group, authority); + this.getAuthorityService().removeAuthority(this.group, authority); // commit the transaction tx.commit(); @@ -518,7 +539,7 @@ public class GroupsDialog extends BaseDialogBean */ protected void updateUILocation(String group) { - String groupName = this.authService.getShortName(group); + String groupName = this.getAuthorityService().getShortName(group); this.location.add(new GroupBreadcrumbHandler(group, groupName)); this.setCurrentGroup(group, groupName); } @@ -632,8 +653,10 @@ public class GroupsDialog extends BaseDialogBean /** * Simple wrapper bean exposing user authority and person details for JSF results list */ - public static class UserAuthorityDetails + public static class UserAuthorityDetails implements Serializable { + private static final long serialVersionUID = 1056255933962068348L; + public UserAuthorityDetails(String name, String authority) { this.name = name; diff --git a/source/java/org/alfresco/web/bean/ml/AddTranslationDialog.java b/source/java/org/alfresco/web/bean/ml/AddTranslationDialog.java index ae84c3e7c6..e5c779fa26 100644 --- a/source/java/org/alfresco/web/bean/ml/AddTranslationDialog.java +++ b/source/java/org/alfresco/web/bean/ml/AddTranslationDialog.java @@ -1,169 +1,174 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.web.bean.ml; - -import java.util.Map; - -import javax.faces.context.FacesContext; -import javax.faces.model.SelectItem; - -import org.alfresco.i18n.I18NUtil; -import org.alfresco.service.cmr.ml.MultilingualContentService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.users.UserPreferencesBean; -import org.alfresco.web.bean.content.AddContentDialog; - -/** - * Dialog bean to upload a new document and to add it to an existing MLContainer. - * - * @author yanipig - */ -public class AddTranslationDialog extends AddContentDialog -{ - private static final String MSG_OK = "ok"; - - private MultilingualContentService multilingualContentService; - private UserPreferencesBean userPreferencesBean; - - // the multilingual container where to add this translation - protected NodeRef mlTranslation; - - // Locale of the new translation - private String language; - - // languages available in the ML container yet - private SelectItem[] unusedLanguages; - - - /* (non-Javadoc) - * @see org.alfresco.web.bean.content.AddContentDialog#init(java.util.Map) - */ - @Override - public void init(Map parameters) - { - super.init(parameters); - - this.language = null; - this.mlTranslation = this.browseBean.getDocument().getNodeRef(); - setFileName(null); - unusedLanguages = null; - } - - /* (non-Javadoc) - * @see org.alfresco.web.bean.content.AddContentDialog#finishImpl(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - // add the new file to the repository - outcome = super.finishImpl(context, outcome); - - // add a new translation - multilingualContentService.addTranslation(this.createdNode, this.mlTranslation, I18NUtil.parseLocale(this.language)); - - return "dialog:close:browse"; - } - - @Override - public String cancel() - { - super.cancel(); - - return getDefaultFinishOutcome(); - } - - public boolean getFinishButtonDisabled() - { - return author == null || author.length() < 1 || language == null; - } - - /** - * @return the locale of this new translation - */ - public String getLanguage() - { - return language; - } - - /** - * @param language the locale of this new translation - */ - public void setLanguage(String language) - { - this.language = language; - } - - /** - * @param unusedLanguages - */ - public void setUnusedLanguages(SelectItem[] unusedLanguages) - { - this.unusedLanguages = unusedLanguages; - } - - /** - * Method calls by the dialog to limit the list of languages. - * - * @return the list of availables translation in the MLContainer - */ - - public SelectItem[] getUnusedLanguages() - { - if(unusedLanguages == null) - { - unusedLanguages = userPreferencesBean.getAvailablesContentFilterLanguages(this.mlTranslation, false); - } - - return unusedLanguages; - } - - public MultilingualContentService getMultilingualContentService() - { - return multilingualContentService; - } - - public void setMultilingualContentService(MultilingualContentService multilingualContentService) - { - this.multilingualContentService = multilingualContentService; - } - - public UserPreferencesBean getUserPreferencesBean() - { - return userPreferencesBean; - } - - public void setUserPreferencesBean(UserPreferencesBean userPreferencesBean) - { - this.userPreferencesBean = userPreferencesBean; - } - - @Override - public String getFinishButtonLabel() - { - - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_OK); - } -} +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean.ml; + +import java.util.Map; + +import javax.faces.context.FacesContext; +import javax.faces.model.SelectItem; + +import org.alfresco.i18n.I18NUtil; +import org.alfresco.service.cmr.ml.MultilingualContentService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.web.app.Application; +import org.alfresco.web.bean.users.UserPreferencesBean; +import org.alfresco.web.bean.content.AddContentDialog; +import org.alfresco.web.bean.repository.Repository; + +/** + * Dialog bean to upload a new document and to add it to an existing MLContainer. + * + * @author yanipig + */ +public class AddTranslationDialog extends AddContentDialog +{ + private static final long serialVersionUID = 5588241907778464543L; + private static final String MSG_OK = "ok"; + + transient private MultilingualContentService multilingualContentService; + private UserPreferencesBean userPreferencesBean; + + // the multilingual container where to add this translation + protected NodeRef mlTranslation; + + // Locale of the new translation + private String language; + + // languages available in the ML container yet + private SelectItem[] unusedLanguages; + + + /* (non-Javadoc) + * @see org.alfresco.web.bean.content.AddContentDialog#init(java.util.Map) + */ + @Override + public void init(Map parameters) + { + super.init(parameters); + + this.language = null; + this.mlTranslation = this.browseBean.getDocument().getNodeRef(); + setFileName(null); + unusedLanguages = null; + } + + /* (non-Javadoc) + * @see org.alfresco.web.bean.content.AddContentDialog#finishImpl(javax.faces.context.FacesContext, java.lang.String) + */ + @Override + protected String finishImpl(FacesContext context, String outcome) throws Exception + { + // add the new file to the repository + outcome = super.finishImpl(context, outcome); + + // add a new translation + getMultilingualContentService().addTranslation(this.createdNode, this.mlTranslation, I18NUtil.parseLocale(this.language)); + + return "dialog:close:browse"; + } + + @Override + public String cancel() + { + super.cancel(); + + return getDefaultFinishOutcome(); + } + + public boolean getFinishButtonDisabled() + { + return author == null || author.length() < 1 || language == null; + } + + /** + * @return the locale of this new translation + */ + public String getLanguage() + { + return language; + } + + /** + * @param language the locale of this new translation + */ + public void setLanguage(String language) + { + this.language = language; + } + + /** + * @param unusedLanguages + */ + public void setUnusedLanguages(SelectItem[] unusedLanguages) + { + this.unusedLanguages = unusedLanguages; + } + + /** + * Method calls by the dialog to limit the list of languages. + * + * @return the list of availables translation in the MLContainer + */ + + public SelectItem[] getUnusedLanguages() + { + if(unusedLanguages == null) + { + unusedLanguages = userPreferencesBean.getAvailablesContentFilterLanguages(this.mlTranslation, false); + } + + return unusedLanguages; + } + + public MultilingualContentService getMultilingualContentService() + { + if (multilingualContentService == null) + { + multilingualContentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMultilingualContentService(); + } + return multilingualContentService; + } + + public void setMultilingualContentService(MultilingualContentService multilingualContentService) + { + this.multilingualContentService = multilingualContentService; + } + + public UserPreferencesBean getUserPreferencesBean() + { + return userPreferencesBean; + } + + public void setUserPreferencesBean(UserPreferencesBean userPreferencesBean) + { + this.userPreferencesBean = userPreferencesBean; + } + + @Override + public String getFinishButtonLabel() + { + return Application.getMessage(FacesContext.getCurrentInstance(), MSG_OK); + } +} diff --git a/source/java/org/alfresco/web/bean/ml/AddTranslationWithoutContentDialog.java b/source/java/org/alfresco/web/bean/ml/AddTranslationWithoutContentDialog.java index 5b44871efb..44d1b1b084 100644 --- a/source/java/org/alfresco/web/bean/ml/AddTranslationWithoutContentDialog.java +++ b/source/java/org/alfresco/web/bean/ml/AddTranslationWithoutContentDialog.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.bean.ml; +import java.io.IOException; +import java.io.ObjectInputStream; import java.util.Locale; import java.util.Map; @@ -37,6 +39,7 @@ import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.web.bean.users.UserPreferencesBean; import org.alfresco.web.bean.dialog.BaseDialogBean; import org.alfresco.web.bean.repository.Node; +import org.alfresco.web.bean.repository.Repository; /** * Dialog bean to add a new translation without content. I means, a new node is created @@ -46,7 +49,9 @@ import org.alfresco.web.bean.repository.Node; */ public class AddTranslationWithoutContentDialog extends BaseDialogBean { - private MultilingualContentService multilingualContentService; + private static final long serialVersionUID = -1252453783397533792L; + + transient private MultilingualContentService multilingualContentService; private UserPreferencesBean userPreferencesBean; // the translation being to be created @@ -80,12 +85,12 @@ public class AddTranslationWithoutContentDialog extends BaseDialogBean Locale locale = I18NUtil.parseLocale(language); // add the empty translation - newTranslation = multilingualContentService.addEmptyTranslation(refNode, null, locale); + newTranslation = getMultilingualContentService().addEmptyTranslation(refNode, null, locale); // set the properties - nodeService.setProperty(newTranslation, ContentModel.PROP_DESCRIPTION, description); - nodeService.setProperty(newTranslation, ContentModel.PROP_AUTHOR, author); - nodeService.setProperty(newTranslation, ContentModel.PROP_TITLE, title); + getNodeService().setProperty(newTranslation, ContentModel.PROP_DESCRIPTION, description); + getNodeService().setProperty(newTranslation, ContentModel.PROP_AUTHOR, author); + getNodeService().setProperty(newTranslation, ContentModel.PROP_TITLE, title); // redirect the user according the value of (show other properties) if(showOtherProperties) @@ -114,6 +119,16 @@ public class AddTranslationWithoutContentDialog extends BaseDialogBean { this.multilingualContentService = multilingualContentService; } + + private MultilingualContentService getMultilingualContentService() + { + if (multilingualContentService == null) + { + multilingualContentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMultilingualContentService(); + } + return multilingualContentService; + + } /** * @return the author @@ -202,4 +217,5 @@ public class AddTranslationWithoutContentDialog extends BaseDialogBean { this.showOtherProperties = showOtherProperties; } + } diff --git a/source/java/org/alfresco/web/bean/ml/EditMLContainerDialog.java b/source/java/org/alfresco/web/bean/ml/EditMLContainerDialog.java index 98af031ffa..6d86dd933e 100644 --- a/source/java/org/alfresco/web/bean/ml/EditMLContainerDialog.java +++ b/source/java/org/alfresco/web/bean/ml/EditMLContainerDialog.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.bean.ml; +import java.io.IOException; +import java.io.ObjectInputStream; import java.io.Serializable; import java.util.Map; @@ -36,6 +38,7 @@ 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; /** * Dialog bean to edit an existing multilingual container. @@ -44,7 +47,9 @@ import org.alfresco.web.bean.repository.Node; */ public class EditMLContainerDialog extends BaseDialogBean { - MultilingualContentService multilingualContentService; + private static final long serialVersionUID = -6340255019962646300L; + + transient private MultilingualContentService multilingualContentService; private Node editableNode; @@ -82,7 +87,7 @@ public class EditMLContainerDialog extends BaseDialogBean { QName qname = QName.createQName(entry.getKey()); - nodeService.setProperty(container, qname, (Serializable) entry.getValue()); + getNodeService().setProperty(container, qname, (Serializable) entry.getValue()); } return outcome; @@ -102,7 +107,7 @@ public class EditMLContainerDialog extends BaseDialogBean else { return new Node( - multilingualContentService.getTranslationContainer( + getMultilingualContentService().getTranslationContainer( currentNode.getNodeRef()) ); } @@ -132,7 +137,12 @@ public class EditMLContainerDialog extends BaseDialogBean /** * @return the multilingualContentService */ - public MultilingualContentService getMultilingualContentService() { + public MultilingualContentService getMultilingualContentService() + { + if (multilingualContentService == null) + { + multilingualContentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMultilingualContentService(); + } return multilingualContentService; } @@ -143,4 +153,5 @@ public class EditMLContainerDialog extends BaseDialogBean MultilingualContentService multilingualContentService) { this.multilingualContentService = multilingualContentService; } + } diff --git a/source/java/org/alfresco/web/bean/ml/MakeMultilingualDialog.java b/source/java/org/alfresco/web/bean/ml/MakeMultilingualDialog.java index 5300784ca5..cf99d1daee 100644 --- a/source/java/org/alfresco/web/bean/ml/MakeMultilingualDialog.java +++ b/source/java/org/alfresco/web/bean/ml/MakeMultilingualDialog.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.bean.ml; +import java.io.IOException; +import java.io.ObjectInputStream; import java.util.Locale; import java.util.Map; @@ -38,6 +40,7 @@ import org.alfresco.web.app.servlet.FacesHelper; import org.alfresco.web.bean.users.UserPreferencesBean; import org.alfresco.web.bean.dialog.BaseDialogBean; import org.alfresco.web.bean.repository.Node; +import org.alfresco.web.bean.repository.Repository; /** * Dialog bean to make a node multilingual @@ -46,7 +49,9 @@ import org.alfresco.web.bean.repository.Node; */ public class MakeMultilingualDialog extends BaseDialogBean { - private MultilingualContentService multilingualContentService; + private static final long serialVersionUID = -2862474360129631088L; + + transient private MultilingualContentService multilingualContentService; private UserPreferencesBean userPreferencesBean; @@ -82,20 +87,20 @@ public class MakeMultilingualDialog extends BaseDialogBean NodeRef nodeRef = this.editableNode.getNodeRef(); // propose the author and the language of the content for the properties of the MLContainer - if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == true - && this.nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHOR) != null) + if (this.getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == true + && this.getNodeService().getProperty(nodeRef, ContentModel.PROP_AUTHOR) != null) { - setAuthor((String) this.nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHOR)); + setAuthor((String) this.getNodeService().getProperty(nodeRef, ContentModel.PROP_AUTHOR)); } else { setAuthor(""); } - if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_LOCALIZED) == true - && this.nodeService.getProperty(nodeRef, ContentModel.PROP_LOCALE) != null) + if (this.getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_LOCALIZED) == true + && this.getNodeService().getProperty(nodeRef, ContentModel.PROP_LOCALE) != null) { - setLanguage(((Locale) this.nodeService.getProperty(nodeRef, ContentModel.PROP_LOCALE)).toString()); + setLanguage(((Locale) this.getNodeService().getProperty(nodeRef, ContentModel.PROP_LOCALE)).toString()); } else { @@ -125,17 +130,17 @@ public class MakeMultilingualDialog extends BaseDialogBean NodeRef nodeRef = this.editableNode.getNodeRef(); // make this node multilingual - multilingualContentService.makeTranslation(nodeRef, locale); - NodeRef mlContainer = multilingualContentService.getTranslationContainer(nodeRef); + getMultilingualContentService().makeTranslation(nodeRef, locale); + NodeRef mlContainer = getMultilingualContentService().getTranslationContainer(nodeRef); // if the author of the node is not set, set it with the default author name of // the new ML Container - String nodeAuthor = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHOR); + String nodeAuthor = (String) getNodeService().getProperty(nodeRef, ContentModel.PROP_AUTHOR); if (nodeAuthor == null || nodeAuthor.length() < 1) - nodeService.setProperty(nodeRef, ContentModel.PROP_AUTHOR, getAuthor()); + getNodeService().setProperty(nodeRef, ContentModel.PROP_AUTHOR, getAuthor()); // set properties of the ml container - nodeService.setProperty(mlContainer, ContentModel.PROP_AUTHOR, getAuthor()); + getNodeService().setProperty(mlContainer, ContentModel.PROP_AUTHOR, getAuthor()); return outcome; } @@ -277,9 +282,19 @@ public class MakeMultilingualDialog extends BaseDialogBean { this.multilingualContentService = multilingualContentService; } + + private MultilingualContentService getMultilingualContentService() + { + if (multilingualContentService == null) + { + multilingualContentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMultilingualContentService(); + } + return multilingualContentService; + } public void setUserPreferencesBean(UserPreferencesBean userPreferencesBean) { this.userPreferencesBean = userPreferencesBean; } + } diff --git a/source/java/org/alfresco/web/bean/ml/MultilingualManageDialog.java b/source/java/org/alfresco/web/bean/ml/MultilingualManageDialog.java index 210e762f8b..a76c94a255 100644 --- a/source/java/org/alfresco/web/bean/ml/MultilingualManageDialog.java +++ b/source/java/org/alfresco/web/bean/ml/MultilingualManageDialog.java @@ -197,18 +197,18 @@ public class MultilingualManageDialog extends BaseDialogBean // create a map node representation of the translation MapNode mapNode = new MapNode(nodeRef); - Locale locale = (Locale) nodeService.getProperty(nodeRef, ContentModel.PROP_LOCALE); + Locale locale = (Locale) getNodeService().getProperty(nodeRef, ContentModel.PROP_LOCALE); String lgge = (locale != null) ? // convert the locale into new ISO codes contentFilterLanguagesService.convertToNewISOCode(locale.getLanguage()).toUpperCase() : null; - mapNode.put("name", nodeService.getProperty(nodeRef, ContentModel.PROP_NAME)); + mapNode.put("name", getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME)); mapNode.put("language", lgge); mapNode.put("url", DownloadContentServlet.generateBrowserURL(nodeRef, mapNode.getName())); - mapNode.put("notEmpty", new Boolean(!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))); + mapNode.put("notEmpty", new Boolean(!getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))); mapNode.put("userHasRight", new Boolean(canNewEdtion)); // add the client side version to the list translations.add(mapNode); @@ -310,8 +310,8 @@ public class MultilingualManageDialog extends BaseDialogBean try { // clear template property - this.nodeService.setProperty(getNode().getNodeRef(), ContentModel.PROP_TEMPLATE, null); - this.nodeService.removeAspect(getNode().getNodeRef(), ContentModel.ASPECT_TEMPLATABLE); + this.getNodeService().setProperty(getNode().getNodeRef(), ContentModel.PROP_TEMPLATE, null); + this.getNodeService().removeAspect(getNode().getNodeRef(), ContentModel.ASPECT_TEMPLATABLE); // reset node details for next refresh of details page getNode().reset(); @@ -449,13 +449,13 @@ public class MultilingualManageDialog extends BaseDialogBean clientLastVersion.put("versionName", lastVersionProperties.get(ContentModel.PROP_NAME)); // use the node service for the description to ensure that the returned value is a text and not a MLText - clientLastVersion.put("versionDescription", nodeService.getProperty(lastVersion.getFrozenStateNodeRef(), ContentModel.PROP_DESCRIPTION)); + clientLastVersion.put("versionDescription", getNodeService().getProperty(lastVersion.getFrozenStateNodeRef(), ContentModel.PROP_DESCRIPTION)); clientLastVersion.put("versionAuthor", lastVersionProperties.get(ContentModel.PROP_AUTHOR)); clientLastVersion.put("versionCreatedDate", lastVersionProperties.get(ContentModel.PROP_CREATED)); clientLastVersion.put("versionModifiedDate", lastVersionProperties.get(ContentModel.PROP_MODIFIED)); clientLastVersion.put("versionLanguage", this.contentFilterLanguagesService.convertToNewISOCode(language.getLanguage()).toUpperCase()); - if(nodeService.hasAspect(lastVersion.getFrozenStateNodeRef(), ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION)) + if(getNodeService().hasAspect(lastVersion.getFrozenStateNodeRef(), ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION)) { clientLastVersion.put("versionUrl", null); } diff --git a/source/java/org/alfresco/web/bean/ml/MultilingualUtils.java b/source/java/org/alfresco/web/bean/ml/MultilingualUtils.java index a7e273be22..c8f7a0efc5 100644 --- a/source/java/org/alfresco/web/bean/ml/MultilingualUtils.java +++ b/source/java/org/alfresco/web/bean/ml/MultilingualUtils.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.bean.ml; +import java.io.Serializable; import java.util.Locale; import java.util.Map; @@ -42,10 +43,12 @@ import org.alfresco.web.bean.repository.Node; * * @author yanipig */ -public class MultilingualUtils +public class MultilingualUtils implements Serializable { - /** + private static final long serialVersionUID = 2218309432064312000L; + + /** * Returns true if the current user has enough right to add a content to the space * where the pivot translation is located in. * diff --git a/source/java/org/alfresco/web/bean/ml/NewEditionWizard.java b/source/java/org/alfresco/web/bean/ml/NewEditionWizard.java index 86bfb02979..c38c11a396 100644 --- a/source/java/org/alfresco/web/bean/ml/NewEditionWizard.java +++ b/source/java/org/alfresco/web/bean/ml/NewEditionWizard.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.bean.ml; +import java.io.IOException; +import java.io.ObjectInputStream; import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; @@ -45,7 +47,6 @@ import org.alfresco.service.cmr.ml.ContentFilterLanguagesService; import org.alfresco.service.cmr.ml.EditionService; import org.alfresco.service.cmr.ml.MultilingualContentService; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.version.Version; import org.alfresco.service.cmr.version.VersionService; import org.alfresco.service.cmr.version.VersionType; @@ -53,6 +54,7 @@ import org.alfresco.util.ParameterCheck; import org.alfresco.web.app.AlfrescoNavigationHandler; 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.BaseWizardBean; import org.alfresco.web.ui.common.component.UIActionLink; @@ -63,14 +65,16 @@ import org.alfresco.web.ui.common.component.UIActionLink; */ public class NewEditionWizard extends BaseWizardBean { + private static final long serialVersionUID = 2078582486053536124L; + public static final String ID_MESSAGE_MINOR_CHANGE = "minor_change"; public static final String ID_MESSAGE_MAJOR_CHANGE = "major_change"; - protected EditionService editionService; - protected MultilingualContentService multilingualContentService; - protected ContentFilterLanguagesService contentFilterLanguagesService; - protected LockService lockService; - protected VersionService versionService; + transient private EditionService editionService; + transient private MultilingualContentService multilingualContentService; + transient private ContentFilterLanguagesService contentFilterLanguagesService; + transient private LockService lockService; + transient private VersionService versionService; protected NodeRef mlContainerToVersion; @@ -157,7 +161,7 @@ public class NewEditionWizard extends BaseWizardBean } // create the edition and get the reference of the new starting translation - NodeRef newPivot = editionService.createEdition(startingElement, versionProperties); + NodeRef newPivot = getEditionService().createEdition(startingElement, versionProperties); // redirect the user at the 'modify translation properties' page if desire. if (otherProperties == true) @@ -223,12 +227,12 @@ public class NewEditionWizard extends BaseWizardBean private void setStartingItem(String language) { // get the starting point translation with its locale - startingElement = multilingualContentService.getTranslationForLocale(mlContainerToVersion, I18NUtil.parseLocale(language)); + startingElement = getMultilingualContentService().getTranslationForLocale(mlContainerToVersion, I18NUtil.parseLocale(language)); // set the futur properties of the new starting element (only usefull for the summary step) setLanguage(language); - setTitle((String) nodeService.getProperty(startingElement, ContentModel.PROP_TITLE)); - setAuthor((String) nodeService.getProperty(startingElement, ContentModel.PROP_AUTHOR)); + setTitle((String) getNodeService().getProperty(startingElement, ContentModel.PROP_TITLE)); + setAuthor((String) getNodeService().getProperty(startingElement, ContentModel.PROP_AUTHOR)); } /** @@ -252,30 +256,30 @@ public class NewEditionWizard extends BaseWizardBean this.selectableTranslations = new ArrayList(); // get all translations of the mlContainer - Map translations = multilingualContentService.getTranslations(mlContainerToVersion); + Map translations = getMultilingualContentService().getTranslations(mlContainerToVersion); // fill the data table rows list for(Map.Entry entry : translations.entrySet()) { NodeRef nodeRef = entry.getValue(); - String name = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); - String langCode = ((Locale) nodeService.getProperty(nodeRef, ContentModel.PROP_LOCALE)).getLanguage(); - String langText = contentFilterLanguagesService.getLabelByCode(langCode); - String lockOwner = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_LOCK_OWNER); + String name = (String) getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME); + String langCode = ((Locale) getNodeService().getProperty(nodeRef, ContentModel.PROP_LOCALE)).getLanguage(); + String langText = getContentFilterLanguagesService().getLabelByCode(langCode); + String lockOwner = (String) getNodeService().getProperty(nodeRef, ContentModel.PROP_LOCK_OWNER); // create the row with the current translation TranslationWrapper wrapper = new TranslationWrapper(name, langCode, lockOwner, langText); - if(!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION)) + if(!getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION)) { // add it to the selectable list if it is not empty this.selectableTranslations.add(wrapper); } - if(nodeService.hasAspect(nodeRef, ContentModel.ASPECT_LOCKABLE)) + if(getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_LOCKABLE)) { - LockStatus lockStatus = lockService.getLockStatus(nodeRef); + LockStatus lockStatus = getLockService().getLockStatus(nodeRef); if (lockStatus != LockStatus.NO_LOCK) { // if the node is locked, add it to the locked translation list @@ -291,19 +295,19 @@ public class NewEditionWizard extends BaseWizardBean // set the mlContainer to version NodeRef currentNodeRef = this.browseBean.getDocument().getNodeRef(); - if(ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(nodeService.getType(currentNodeRef))) + if(ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(getNodeService().getType(currentNodeRef))) { mlContainerToVersion = currentNodeRef; } else { - mlContainerToVersion = multilingualContentService.getTranslationContainer(currentNodeRef); + mlContainerToVersion = getMultilingualContentService().getTranslationContainer(currentNodeRef); } if(!skipFirstStep) { // init the pivot language (it will be selected by default) - selectedLanguage = ((Locale) nodeService.getProperty(mlContainerToVersion, ContentModel.PROP_LOCALE)).getLanguage(); + selectedLanguage = ((Locale) getNodeService().getProperty(mlContainerToVersion, ContentModel.PROP_LOCALE)).getLanguage(); } } @@ -369,7 +373,7 @@ public class NewEditionWizard extends BaseWizardBean */ public String getLanguage() { - return contentFilterLanguagesService.getLabelByCode(language); + return getContentFilterLanguagesService().getLabelByCode(language); } @@ -420,7 +424,7 @@ public class NewEditionWizard extends BaseWizardBean */ public String getVersionLabel() { - String label = versionService.getCurrentVersion(mlContainerToVersion).getVersionLabel(); + String label = getVersionService().getCurrentVersion(mlContainerToVersion).getVersionLabel(); String nextLabel = null; @@ -490,15 +494,15 @@ public class NewEditionWizard extends BaseWizardBean { this.multilingualContentService = multilingualContentService; } - - - /** - * @param nodeService the Node Service to set - */ - public void setNodeService(NodeService nodeService) + + protected MultilingualContentService getMultilingualContentService() { - this.nodeService = nodeService; - } + if (multilingualContentService == null) + { + multilingualContentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMultilingualContentService(); + } + return multilingualContentService; + } /** * @param contentFilterLanguagesService the Content Filter Languages Service to set @@ -507,6 +511,15 @@ public class NewEditionWizard extends BaseWizardBean { this.contentFilterLanguagesService = contentFilterLanguagesService; } + + protected ContentFilterLanguagesService getContentFilterLanguagesService() + { + if (contentFilterLanguagesService == null) + { + contentFilterLanguagesService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentFilterLanguagesService(); + } + return contentFilterLanguagesService; + } /** @@ -516,6 +529,15 @@ public class NewEditionWizard extends BaseWizardBean { this.lockService = lockService; } + + protected LockService getLockService() + { + if (lockService == null) + { + lockService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getLockService(); + } + return lockService; + } /** * @param editionService the Edition Service to set @@ -524,6 +546,15 @@ public class NewEditionWizard extends BaseWizardBean { this.editionService = editionService; } + + protected EditionService getEditionService() + { + if (editionService == null) + { + editionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getEditionService(); + } + return editionService; + } /** * @param versionService the version Service to set @@ -532,13 +563,24 @@ public class NewEditionWizard extends BaseWizardBean { this.versionService = versionService; } + + protected VersionService getVersionService() + { + if (versionService == null) + { + versionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getVersionService(); + } + return versionService; + } /** * Simple wrapper class to represent a translation in the data table */ - public static class TranslationWrapper + public static class TranslationWrapper implements Serializable { + private static final long serialVersionUID = 5517785385414245587L; + private String language; private String name; private String checkedOutBy; diff --git a/source/java/org/alfresco/web/bean/ml/SingleEditionBean.java b/source/java/org/alfresco/web/bean/ml/SingleEditionBean.java index 3272196d20..6cddb35c39 100644 --- a/source/java/org/alfresco/web/bean/ml/SingleEditionBean.java +++ b/source/java/org/alfresco/web/bean/ml/SingleEditionBean.java @@ -1,5 +1,6 @@ package org.alfresco.web.bean.ml; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; import org.alfresco.web.bean.repository.MapNode; @@ -10,10 +11,11 @@ import org.alfresco.web.bean.repository.MapNode; * * @author pignoya */ -public class SingleEditionBean +public class SingleEditionBean implements Serializable { + private static final long serialVersionUID = 9145202732094403340L; - /** The edition in a list */ + /** The edition in a list */ private List edition = null; /** The translation list of the edition */ diff --git a/source/java/org/alfresco/web/bean/preview/BasePreviewBean.java b/source/java/org/alfresco/web/bean/preview/BasePreviewBean.java index 84ef8a702a..3369355fa4 100644 --- a/source/java/org/alfresco/web/bean/preview/BasePreviewBean.java +++ b/source/java/org/alfresco/web/bean/preview/BasePreviewBean.java @@ -1,202 +1,195 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.web.bean.preview; - -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.ContentModel; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.dictionary.DictionaryService; -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.TemplateImageResolver; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.BrowseBean; -import org.alfresco.web.bean.NavigationBean; -import org.alfresco.web.bean.TemplateSupportBean; -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.data.IDataContainer; -import org.alfresco.web.data.QuickSort; -import org.alfresco.web.ui.common.Utils; - -/** - * Backing bean for the Preview Document in Template action page - * - * @author Kevin Roast - */ -public abstract class BasePreviewBean extends BaseDialogBean -{ - /** BrowseBean instance */ - protected BrowseBean browseBean; - - /** The NavigationBean bean reference */ - protected NavigationBean navigator; - - /** The selected Template Id */ - protected NodeRef template; - - - /** - * @param browseBean The BrowseBean to set. - */ - public void setBrowseBean(BrowseBean browseBean) - { - this.browseBean = browseBean; - } - - /** - * @param navigator The NavigationBean to set. - */ - public void setNavigator(NavigationBean navigator) - { - this.navigator = navigator; - } - - /** - * Returns the node this bean is currently working with - * - * @return The current Node - */ - public abstract Node getNode(); - - /** - * Returns the id of the current node - * - * @return The id - */ - public String getId() - { - return getNode().getId(); - } - - /** - * Returns the name of the current node - * - * @return Name of the current node - */ - public String getName() - { - return getNode().getName(); - } - - /** - * Returns a model for use by the template on the Preview page. - * - * @return model containing current document/space info. - */ - public abstract Map getTemplateModel(); - - /** Template Image resolver helper */ - protected TemplateImageResolver imageResolver = new TemplateImageResolver() - { - public String resolveImagePathForName(String filename, FileTypeImageSize size) - { - return Utils.getFileTypeImage(FacesContext.getCurrentInstance(), filename, size); - } - }; - - /** - * @return the current template as a full NodeRef - */ - public NodeRef getTemplateRef() - { - return this.template; - } - - /** - * @return Returns the template Id. - */ - public String getTemplate() - { - return (this.template != null ? this.template.getId() : null); - } - - /** - * @param template The template Id to set. - */ - public void setTemplate(String template) - { - if (template != null && template.equals(TemplateSupportBean.NO_SELECTION) == false) - { - this.template = new NodeRef(Repository.getStoreRef(), template); - } - } - - private int findNextPreviewNode(List nodes, int start) - { - // search from start to end of list - for (int i=start; i nodes, int start) - { - // search from start to beginning of list - for (int i=start; i>=0; i--) - { - Node next = nodes.get(i); - if (next.hasAspect(ContentModel.ASPECT_TEMPLATABLE)) - { - return i; - } - } - // end of list to start + 1 (to skip original node) - for (int i=nodes.size() - 1; i>start; i--) - { - Node next = nodes.get(i); - if (next.hasAspect(ContentModel.ASPECT_TEMPLATABLE)) - { - return i; - } - } - return -1; - } -} +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean.preview; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import javax.faces.context.FacesContext; + +import org.alfresco.model.ContentModel; +import org.alfresco.repo.security.permissions.AccessDeniedException; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.FileTypeImageSize; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.TemplateImageResolver; +import org.alfresco.web.bean.BrowseBean; +import org.alfresco.web.bean.NavigationBean; +import org.alfresco.web.bean.TemplateSupportBean; +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.ui.common.Utils; + +/** + * Backing bean for the Preview Document in Template action page + * + * @author Kevin Roast + */ +public abstract class BasePreviewBean extends BaseDialogBean +{ + /** BrowseBean instance */ + protected BrowseBean browseBean; + + /** The NavigationBean bean reference */ + protected NavigationBean navigator; + + /** The selected Template Id */ + protected NodeRef template; + + + /** + * @param browseBean The BrowseBean to set. + */ + public void setBrowseBean(BrowseBean browseBean) + { + this.browseBean = browseBean; + } + + /** + * @param navigator The NavigationBean to set. + */ + public void setNavigator(NavigationBean navigator) + { + this.navigator = navigator; + } + + /** + * Returns the node this bean is currently working with + * + * @return The current Node + */ + public abstract Node getNode(); + + /** + * Returns the id of the current node + * + * @return The id + */ + public String getId() + { + return getNode().getId(); + } + + /** + * Returns the name of the current node + * + * @return Name of the current node + */ + public String getName() + { + return getNode().getName(); + } + + /** + * Returns a model for use by the template on the Preview page. + * + * @return model containing current document/space info. + */ + public abstract Map getTemplateModel(); + + /** Template Image resolver helper */ + protected TemplateImageResolver imageResolver = new TemplateImageResolver() + { + public String resolveImagePathForName(String filename, FileTypeImageSize size) + { + return Utils.getFileTypeImage(FacesContext.getCurrentInstance(), filename, size); + } + }; + + /** + * @return the current template as a full NodeRef + */ + public NodeRef getTemplateRef() + { + return this.template; + } + + /** + * @return Returns the template Id. + */ + public String getTemplate() + { + return (this.template != null ? this.template.getId() : null); + } + + /** + * @param template The template Id to set. + */ + public void setTemplate(String template) + { + if (template != null && template.equals(TemplateSupportBean.NO_SELECTION) == false) + { + this.template = new NodeRef(Repository.getStoreRef(), template); + } + } + + private int findNextPreviewNode(List nodes, int start) + { + // search from start to end of list + for (int i=start; i nodes, int start) + { + // search from start to beginning of list + for (int i=start; i>=0; i--) + { + Node next = nodes.get(i); + if (next.hasAspect(ContentModel.ASPECT_TEMPLATABLE)) + { + return i; + } + } + // end of list to start + 1 (to skip original node) + for (int i=nodes.size() - 1; i>start; i--) + { + Node next = nodes.get(i); + if (next.hasAspect(ContentModel.ASPECT_TEMPLATABLE)) + { + return i; + } + } + return -1; + } +} diff --git a/source/java/org/alfresco/web/bean/preview/DocumentPreviewBean.java b/source/java/org/alfresco/web/bean/preview/DocumentPreviewBean.java index 4fa179cc95..50216dec0b 100644 --- a/source/java/org/alfresco/web/bean/preview/DocumentPreviewBean.java +++ b/source/java/org/alfresco/web/bean/preview/DocumentPreviewBean.java @@ -1,179 +1,181 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.web.bean.preview; - -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.repository.NodeRef; -import org.alfresco.service.cmr.repository.TemplateService; -import org.alfresco.web.app.Application; -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.component.UIActionLink; - -/** - * Backing bean for the Preview Document in Template action page - * - * @author Kevin Roast - */ -public class DocumentPreviewBean extends BasePreviewBean implements NavigationSupport -{ - private final static String MSG_PREVIEW_OF = "preview_of"; - private final static String MSG_CLOSE = "close"; - - /** - * Returns the document this bean is currently representing - * - * @return The document Node - */ - public Node getNode() - { - return this.browseBean.getDocument(); - } - - /** - * Returns a model for use by a template on the Document Details page. - * - * @return model containing current document and current space info. - */ - @SuppressWarnings("unchecked") - public Map getTemplateModel() - { - HashMap model = new HashMap(3, 1.0f); - - model.put("document", getNode().getNodeRef()); - model.put("space", this.navigator.getCurrentNode().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:previewContent"; - } - - 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) - { - List nodes = this.browseBean.getContent(); - if (nodes.size() > 1) - { - // perform a linear search - this is slow but stateless - // otherwise we would have to manage state of last selected node - // this gets very tricky as this bean is instantiated once and never - // reset - it does not know when the document has changed etc. - for (int i = 0; i < nodes.size(); i++) - { - if (id.equals(nodes.get(i).getId()) == true) - { - Node next; - // found our item - navigate to next - if (i != nodes.size() - 1) - { - next = nodes.get(i + 1); - } - else - { - // handle wrapping case - next = nodes.get(0); - } - - // prepare for showing details for this node - this.browseBean.setupContentAction(next.getId(), false); - break; - } - } - } - } - } - - 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) - { - List nodes = this.browseBean.getContent(); - if (nodes.size() > 1) - { - // see above - for (int i = 0; i < nodes.size(); i++) - { - if (id.equals(nodes.get(i).getId()) == true) - { - Node previous; - // found our item - navigate to previous - if (i != 0) - { - previous = nodes.get(i - 1); - } - else - { - // handle wrapping case - previous = nodes.get(nodes.size() - 1); - } - - // prepare for showing details for this node - this.browseBean.setupContentAction(previous.getId(), false); - break; - } - } - } - } - } - - public String getContainerTitle() - { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_PREVIEW_OF) + " '" + getName() + "'"; - } - - public String getCancelButtonLabel() - { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE); - } -} +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean.preview; + +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.repository.NodeRef; +import org.alfresco.service.cmr.repository.TemplateService; +import org.alfresco.web.app.Application; +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.component.UIActionLink; + +/** + * Backing bean for the Preview Document in Template action page + * + * @author Kevin Roast + */ +public class DocumentPreviewBean extends BasePreviewBean implements NavigationSupport +{ + private static final long serialVersionUID = 2476545866710371333L; + + private final static String MSG_PREVIEW_OF = "preview_of"; + private final static String MSG_CLOSE = "close"; + + /** + * Returns the document this bean is currently representing + * + * @return The document Node + */ + public Node getNode() + { + return this.browseBean.getDocument(); + } + + /** + * Returns a model for use by a template on the Document Details page. + * + * @return model containing current document and current space info. + */ + @SuppressWarnings("unchecked") + public Map getTemplateModel() + { + HashMap model = new HashMap(3, 1.0f); + + model.put("document", getNode().getNodeRef()); + model.put("space", this.navigator.getCurrentNode().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:previewContent"; + } + + 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) + { + List nodes = this.browseBean.getContent(); + if (nodes.size() > 1) + { + // perform a linear search - this is slow but stateless + // otherwise we would have to manage state of last selected node + // this gets very tricky as this bean is instantiated once and never + // reset - it does not know when the document has changed etc. + for (int i = 0; i < nodes.size(); i++) + { + if (id.equals(nodes.get(i).getId()) == true) + { + Node next; + // found our item - navigate to next + if (i != nodes.size() - 1) + { + next = nodes.get(i + 1); + } + else + { + // handle wrapping case + next = nodes.get(0); + } + + // prepare for showing details for this node + this.browseBean.setupContentAction(next.getId(), false); + break; + } + } + } + } + } + + 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) + { + List nodes = this.browseBean.getContent(); + if (nodes.size() > 1) + { + // see above + for (int i = 0; i < nodes.size(); i++) + { + if (id.equals(nodes.get(i).getId()) == true) + { + Node previous; + // found our item - navigate to previous + if (i != 0) + { + previous = nodes.get(i - 1); + } + else + { + // handle wrapping case + previous = nodes.get(nodes.size() - 1); + } + + // prepare for showing details for this node + this.browseBean.setupContentAction(previous.getId(), false); + break; + } + } + } + } + } + + public String getContainerTitle() + { + return Application.getMessage(FacesContext.getCurrentInstance(), MSG_PREVIEW_OF) + " '" + getName() + "'"; + } + + public String getCancelButtonLabel() + { + return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE); + } +} diff --git a/source/java/org/alfresco/web/bean/preview/SpacePreviewBean.java b/source/java/org/alfresco/web/bean/preview/SpacePreviewBean.java index 16e32d3b5f..13c5e47550 100644 --- a/source/java/org/alfresco/web/bean/preview/SpacePreviewBean.java +++ b/source/java/org/alfresco/web/bean/preview/SpacePreviewBean.java @@ -1,205 +1,207 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.web.bean.preview; - -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.repository.NodeRef; -import org.alfresco.service.cmr.repository.TemplateService; -import org.alfresco.web.app.Application; -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.component.UIActionLink; - -/** - * Backing bean for the Preview Space in Template action page - * - * @author Kevin Roast - */ -public class SpacePreviewBean extends BasePreviewBean implements NavigationSupport -{ - private final static String MSG_PREVIEW_OF = "preview_of"; - private final static String MSG_CLOSE = "close"; - /** - * Returns the Space this bean is currently representing - * - * @return The Space Node - */ - public Node getNode() - { - return this.browseBean.getActionSpace(); - } - - /** - * Returns a model for use by a template on the Document Details page. - * - * @return model containing current document and current space info. - */ - @SuppressWarnings("unchecked") - public Map getTemplateModel() - { - HashMap model = new HashMap(3, 1.0f); - - model.put("space", getNode().getNodeRef()); - model.put(TemplateService.KEY_IMAGE_RESOLVER, imageResolver); - - return model; - } - - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - return null; - } - - public String getCurrentItemId() - { - return getId(); - } - - public String getOutcome() - { - return "dialog:close:dialog:previewSpace"; - } - - public void nextItem(ActionEvent event) - { - boolean foundNextItem = false; - 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); - if (nodes.size() > 1) - { - // perform a linear search - this is slow but stateless - // otherwise we would have to manage state of last selected node - // this gets very tricky as this bean is instantiated once and never - // reset - it does not know when the document has changed etc. - for (int i = 0; i < nodes.size(); i++) - { - if (id.equals(nodes.get(i).getId()) == true) - { - Node next; - // found our item - navigate to next - if (i != nodes.size() - 1) - { - next = nodes.get(i + 1); - } - else - { - // handle wrapping case - next = nodes.get(0); - } - - // prepare for showing details for this node - this.browseBean.setupSpaceAction(next.getId(), false); - - // we found a next item - foundNextItem = true; - } - } - } - - // if we did not find a next item make sure the current node is - // in the dispatch context otherwise the details screen will go back - // to the default one. - if (foundNextItem == false) - { - Node currNode = new Node(currNodeRef); - this.navigator.setupDispatchContext(currNode); - } - } - - } - - public void previousItem(ActionEvent event) - { - boolean foundPreviousItem = false; - 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); - if (nodes.size() > 1) - { - // see above - for (int i = 0; i < nodes.size(); i++) - { - if (id.equals(nodes.get(i).getId()) == true) - { - Node previous; - // found our item - navigate to previous - if (i != 0) - { - previous = nodes.get(i - 1); - } - else - { - // handle wrapping case - previous = nodes.get(nodes.size() - 1); - } - - // show details for this node - this.browseBean.setupSpaceAction(previous.getId(), false); - - // we found a next item - foundPreviousItem = true; - } - } - } - - // if we did not find a previous item make sure the current node is - // in the dispatch context otherwise the details screen will go back - // to the default one. - if (foundPreviousItem == false) - { - Node currNode = new Node(currNodeRef); - this.navigator.setupDispatchContext(currNode); - } - } - - } - - public String getContainerTitle() - { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_PREVIEW_OF) + " '" + getName() + "'"; - } - - public String getCancelButtonLabel() - { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE); - } - -} +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean.preview; + +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.repository.NodeRef; +import org.alfresco.service.cmr.repository.TemplateService; +import org.alfresco.web.app.Application; +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.component.UIActionLink; + +/** + * Backing bean for the Preview Space in Template action page + * + * @author Kevin Roast + */ +public class SpacePreviewBean extends BasePreviewBean implements NavigationSupport +{ + private static final long serialVersionUID = -4766291793031654901L; + private final static String MSG_PREVIEW_OF = "preview_of"; + private final static String MSG_CLOSE = "close"; + + /** + * Returns the Space this bean is currently representing + * + * @return The Space Node + */ + public Node getNode() + { + return this.browseBean.getActionSpace(); + } + + /** + * Returns a model for use by a template on the Document Details page. + * + * @return model containing current document and current space info. + */ + @SuppressWarnings("unchecked") + public Map getTemplateModel() + { + HashMap model = new HashMap(3, 1.0f); + + model.put("space", getNode().getNodeRef()); + model.put(TemplateService.KEY_IMAGE_RESOLVER, imageResolver); + + return model; + } + + protected String finishImpl(FacesContext context, String outcome) throws Exception + { + return null; + } + + public String getCurrentItemId() + { + return getId(); + } + + public String getOutcome() + { + return "dialog:close:dialog:previewSpace"; + } + + public void nextItem(ActionEvent event) + { + boolean foundNextItem = false; + 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); + if (nodes.size() > 1) + { + // perform a linear search - this is slow but stateless + // otherwise we would have to manage state of last selected node + // this gets very tricky as this bean is instantiated once and never + // reset - it does not know when the document has changed etc. + for (int i = 0; i < nodes.size(); i++) + { + if (id.equals(nodes.get(i).getId()) == true) + { + Node next; + // found our item - navigate to next + if (i != nodes.size() - 1) + { + next = nodes.get(i + 1); + } + else + { + // handle wrapping case + next = nodes.get(0); + } + + // prepare for showing details for this node + this.browseBean.setupSpaceAction(next.getId(), false); + + // we found a next item + foundNextItem = true; + } + } + } + + // if we did not find a next item make sure the current node is + // in the dispatch context otherwise the details screen will go back + // to the default one. + if (foundNextItem == false) + { + Node currNode = new Node(currNodeRef); + this.navigator.setupDispatchContext(currNode); + } + } + + } + + public void previousItem(ActionEvent event) + { + boolean foundPreviousItem = false; + 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); + if (nodes.size() > 1) + { + // see above + for (int i = 0; i < nodes.size(); i++) + { + if (id.equals(nodes.get(i).getId()) == true) + { + Node previous; + // found our item - navigate to previous + if (i != 0) + { + previous = nodes.get(i - 1); + } + else + { + // handle wrapping case + previous = nodes.get(nodes.size() - 1); + } + + // show details for this node + this.browseBean.setupSpaceAction(previous.getId(), false); + + // we found a next item + foundPreviousItem = true; + } + } + } + + // if we did not find a previous item make sure the current node is + // in the dispatch context otherwise the details screen will go back + // to the default one. + if (foundPreviousItem == false) + { + Node currNode = new Node(currNodeRef); + this.navigator.setupDispatchContext(currNode); + } + } + + } + + public String getContainerTitle() + { + return Application.getMessage(FacesContext.getCurrentInstance(), MSG_PREVIEW_OF) + " '" + getName() + "'"; + } + + public String getCancelButtonLabel() + { + return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE); + } + +} diff --git a/source/java/org/alfresco/web/bean/repository/Node.java b/source/java/org/alfresco/web/bean/repository/Node.java index f613fe9ec0..88db1d3551 100644 --- a/source/java/org/alfresco/web/bean/repository/Node.java +++ b/source/java/org/alfresco/web/bean/repository/Node.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.bean.repository; +import java.io.IOException; +import java.io.ObjectInputStream; import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; @@ -66,7 +68,7 @@ public class Node implements Serializable protected Boolean workingCopyOwner = null; protected QNameNodeMap properties; protected boolean propsRetrieved = false; - protected ServiceRegistry services = null; + protected transient ServiceRegistry services = null; protected boolean childAssocsRetrieved = false; protected QNameNodeMap childAssociations; protected boolean assocsRetrieved = false; diff --git a/source/java/org/alfresco/web/bean/repository/NodePropertyResolver.java b/source/java/org/alfresco/web/bean/repository/NodePropertyResolver.java index a5365f2aff..c17bd434da 100644 --- a/source/java/org/alfresco/web/bean/repository/NodePropertyResolver.java +++ b/source/java/org/alfresco/web/bean/repository/NodePropertyResolver.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.bean.repository; +import java.io.Serializable; + /** * Simple interface used to implement small classes capable of calculating dynamic property values * for Nodes at runtime. This allows bean responsible for building large lists of Nodes to @@ -35,7 +37,7 @@ package org.alfresco.web.bean.repository; * * @author Kevin Roast */ -public interface NodePropertyResolver +public interface NodePropertyResolver extends Serializable { /** * Get the property value for this resolver diff --git a/source/java/org/alfresco/web/bean/repository/Preferences.java b/source/java/org/alfresco/web/bean/repository/Preferences.java index 69c831672a..f5f258a0ef 100644 --- a/source/java/org/alfresco/web/bean/repository/Preferences.java +++ b/source/java/org/alfresco/web/bean/repository/Preferences.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.bean.repository; +import java.io.IOException; +import java.io.ObjectInputStream; import java.io.Serializable; import java.util.HashMap; import java.util.Map; @@ -41,10 +43,12 @@ import org.alfresco.service.namespace.QName; * * @author Kevin Roast */ -public final class Preferences +public final class Preferences implements Serializable { + private static final long serialVersionUID = 722840612660970723L; + private NodeRef preferencesRef; - private NodeService nodeService; + private transient NodeService nodeService; private Map cache = new HashMap(16, 1.0f); /** diff --git a/source/java/org/alfresco/web/bean/repository/QNameNodeMap.java b/source/java/org/alfresco/web/bean/repository/QNameNodeMap.java index eab600866e..e8bf6e73f8 100644 --- a/source/java/org/alfresco/web/bean/repository/QNameNodeMap.java +++ b/source/java/org/alfresco/web/bean/repository/QNameNodeMap.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.bean.repository; +import java.io.Serializable; import java.util.HashMap; import java.util.Map; @@ -35,8 +36,10 @@ import org.alfresco.service.namespace.QNameMap; * * @author Kevin Roast */ -public final class QNameNodeMap extends QNameMap implements Map, Cloneable +public final class QNameNodeMap extends QNameMap implements Map, Cloneable, Serializable { + + private static final long serialVersionUID = -1760755862411509262L; private Node parent = null; private Map resolvers = new HashMap(8, 1.0f); @@ -55,6 +58,16 @@ public final class QNameNodeMap extends QNameMap implements Map, Cloneable this.parent = parent; } + + /** + * + */ + protected QNameNodeMap() + { + super(); + } + + /** * Register a property resolver for the named property. * diff --git a/source/java/org/alfresco/web/bean/repository/User.java b/source/java/org/alfresco/web/bean/repository/User.java index 4a07883850..ff14f7e3e8 100644 --- a/source/java/org/alfresco/web/bean/repository/User.java +++ b/source/java/org/alfresco/web/bean/repository/User.java @@ -1,261 +1,263 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.web.bean.repository; - -import java.io.Serializable; -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.configuration.ConfigurableService; -import org.alfresco.service.ServiceRegistry; -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.cmr.search.SearchService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.web.app.Application; - -/** - * Bean that represents the currently logged in user - * - * @author gavinc - */ -public final class User -{ - private String companyRootId; - private String homeSpaceId; - private String userName; - private String ticket; - private NodeRef person; - private String fullName = null; - private Boolean administrator = null; - - private Preferences preferences = null; - - /** - * Constructor - * - * @param userName constructor for the user - */ - public User(String userName, String ticket, NodeRef person) - { - if (userName == null || ticket == null || person == null) - { - throw new IllegalArgumentException("All user details are mandatory!"); - } - - this.userName = userName; - this.ticket = ticket; - this.person = person; - } - - /** - * Forces a clear of any cached or calcluated values - */ - public void reset() - { - this.fullName = null; - this.administrator = null; - this.preferences = null; - } - - /** - * @return The user name - */ - public String getUserName() - { - return this.userName; - } - - /** - * Return the full name of the Person this User represents - * - * @param service NodeService to use - * - * @return The full name - */ - public String getFullName(NodeService service) - { - if (this.fullName == null) - { - String lastName = (String)service.getProperty(this.person, ContentModel.PROP_LASTNAME); - this.fullName = service.getProperty(this.person, ContentModel.PROP_FIRSTNAME) + - (lastName != null ? (" " + lastName) : ""); - } - - return this.fullName; - } - - /** - * @return Retrieves the user's home space (this may be the id of the company home space) - */ - public String getHomeSpaceId() - { - return this.homeSpaceId; - } - - /** - * @param homeSpaceId Sets the id of the users home space - */ - public void setHomeSpaceId(String homeSpaceId) - { - this.homeSpaceId = homeSpaceId; - } - - /** - * @return Retrieves the company home space - */ - public String getCompanyRootId() - { - return this.companyRootId; - } - - /** - * @param companyRootId Sets the id of the company home space - */ - public void setCompanyRootId(String companyRootId) - { - this.companyRootId = companyRootId; - } - - /** - * @return Returns the ticket. - */ - public String getTicket() - { - return this.ticket; - } - - /** - * @return Returns the person NodeRef - */ - public NodeRef getPerson() - { - return this.person; - } - - /** - * @return If the current user has Admin Authority - */ - public boolean isAdmin() - { - if (administrator == null) - { - administrator = Repository.getServiceRegistry(FacesContext.getCurrentInstance()) - .getAuthorityService().hasAdminAuthority(); - } - - return administrator; - } - - /** - * @return The Preferences for the User - */ - Preferences getPreferences() - { - if (this.preferences == null) - { - this.preferences = new Preferences(getUserPreferencesRef()); - } - return this.preferences; - } - - /** - * Get or create the node used to store user preferences. - * Utilises the 'configurable' aspect on the Person linked to this user. - */ - synchronized NodeRef getUserPreferencesRef() - { - FacesContext fc = FacesContext.getCurrentInstance(); - ServiceRegistry registry = Repository.getServiceRegistry(fc); - NodeService nodeService = registry.getNodeService(); - SearchService searchService = registry.getSearchService(); - NamespaceService namespaceService = registry.getNamespaceService(); - ConfigurableService configurableService = Repository.getConfigurableService(fc); - - NodeRef person = getPerson(); - if (nodeService.hasAspect(person, ApplicationModel.ASPECT_CONFIGURABLE) == false) - { - // create the configuration folder for this Person node - configurableService.makeConfigurable(person); - } - - // target of the assoc is the configurations folder ref - NodeRef configRef = configurableService.getConfigurationFolder(person); - if (configRef == null) - { - throw new IllegalStateException("Unable to find associated 'configurations' folder for node: " + person); - } - - String xpath = NamespaceService.APP_MODEL_PREFIX + ":" + "preferences"; - List nodes = searchService.selectNodes( - configRef, - xpath, - null, - namespaceService, - false); - - NodeRef prefRef; - if (nodes.size() == 1) - { - prefRef = nodes.get(0); - } - else - { - // create the preferences Node for this user - ChildAssociationRef childRef = nodeService.createNode( - configRef, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "preferences"), - ContentModel.TYPE_CMOBJECT); - - prefRef = childRef.getChildRef(); - } - - return prefRef; - } - - /** - * Returns the full name of the user represented by the given NodeRef - * - * @param nodeService The node service instance - * @param user The user to get the full name for - * @return The full name - */ - public static String getFullName(NodeService nodeService, NodeRef user) - { - Map props = nodeService.getProperties(user); - String firstName = (String)props.get(ContentModel.PROP_FIRSTNAME); - String lastName = (String)props.get(ContentModel.PROP_LASTNAME); - String fullName = firstName + ((lastName != null && lastName.length() > 0) ? " " + lastName : ""); - - return fullName; - } -} +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean.repository; + +import java.io.Serializable; +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.configuration.ConfigurableService; +import org.alfresco.service.ServiceRegistry; +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.cmr.search.SearchService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.web.app.Application; + +/** + * Bean that represents the currently logged in user + * + * @author gavinc + */ +public final class User implements Serializable +{ + private static final long serialVersionUID = -90577901805847829L; + + private String companyRootId; + private String homeSpaceId; + private String userName; + private String ticket; + private NodeRef person; + private String fullName = null; + private Boolean administrator = null; + + private Preferences preferences = null; + + /** + * Constructor + * + * @param userName constructor for the user + */ + public User(String userName, String ticket, NodeRef person) + { + if (userName == null || ticket == null || person == null) + { + throw new IllegalArgumentException("All user details are mandatory!"); + } + + this.userName = userName; + this.ticket = ticket; + this.person = person; + } + + /** + * Forces a clear of any cached or calcluated values + */ + public void reset() + { + this.fullName = null; + this.administrator = null; + this.preferences = null; + } + + /** + * @return The user name + */ + public String getUserName() + { + return this.userName; + } + + /** + * Return the full name of the Person this User represents + * + * @param service NodeService to use + * + * @return The full name + */ + public String getFullName(NodeService service) + { + if (this.fullName == null) + { + String lastName = (String)service.getProperty(this.person, ContentModel.PROP_LASTNAME); + this.fullName = service.getProperty(this.person, ContentModel.PROP_FIRSTNAME) + + (lastName != null ? (" " + lastName) : ""); + } + + return this.fullName; + } + + /** + * @return Retrieves the user's home space (this may be the id of the company home space) + */ + public String getHomeSpaceId() + { + return this.homeSpaceId; + } + + /** + * @param homeSpaceId Sets the id of the users home space + */ + public void setHomeSpaceId(String homeSpaceId) + { + this.homeSpaceId = homeSpaceId; + } + + /** + * @return Retrieves the company home space + */ + public String getCompanyRootId() + { + return this.companyRootId; + } + + /** + * @param companyRootId Sets the id of the company home space + */ + public void setCompanyRootId(String companyRootId) + { + this.companyRootId = companyRootId; + } + + /** + * @return Returns the ticket. + */ + public String getTicket() + { + return this.ticket; + } + + /** + * @return Returns the person NodeRef + */ + public NodeRef getPerson() + { + return this.person; + } + + /** + * @return If the current user has Admin Authority + */ + public boolean isAdmin() + { + if (administrator == null) + { + administrator = Repository.getServiceRegistry(FacesContext.getCurrentInstance()) + .getAuthorityService().hasAdminAuthority(); + } + + return administrator; + } + + /** + * @return The Preferences for the User + */ + Preferences getPreferences() + { + if (this.preferences == null) + { + this.preferences = new Preferences(getUserPreferencesRef()); + } + return this.preferences; + } + + /** + * Get or create the node used to store user preferences. + * Utilises the 'configurable' aspect on the Person linked to this user. + */ + synchronized NodeRef getUserPreferencesRef() + { + FacesContext fc = FacesContext.getCurrentInstance(); + ServiceRegistry registry = Repository.getServiceRegistry(fc); + NodeService nodeService = registry.getNodeService(); + SearchService searchService = registry.getSearchService(); + NamespaceService namespaceService = registry.getNamespaceService(); + ConfigurableService configurableService = Repository.getConfigurableService(fc); + + NodeRef person = getPerson(); + if (nodeService.hasAspect(person, ApplicationModel.ASPECT_CONFIGURABLE) == false) + { + // create the configuration folder for this Person node + configurableService.makeConfigurable(person); + } + + // target of the assoc is the configurations folder ref + NodeRef configRef = configurableService.getConfigurationFolder(person); + if (configRef == null) + { + throw new IllegalStateException("Unable to find associated 'configurations' folder for node: " + person); + } + + String xpath = NamespaceService.APP_MODEL_PREFIX + ":" + "preferences"; + List nodes = searchService.selectNodes( + configRef, + xpath, + null, + namespaceService, + false); + + NodeRef prefRef; + if (nodes.size() == 1) + { + prefRef = nodes.get(0); + } + else + { + // create the preferences Node for this user + ChildAssociationRef childRef = nodeService.createNode( + configRef, + ContentModel.ASSOC_CONTAINS, + QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "preferences"), + ContentModel.TYPE_CMOBJECT); + + prefRef = childRef.getChildRef(); + } + + return prefRef; + } + + /** + * Returns the full name of the user represented by the given NodeRef + * + * @param nodeService The node service instance + * @param user The user to get the full name for + * @return The full name + */ + public static String getFullName(NodeService nodeService, NodeRef user) + { + Map props = nodeService.getProperties(user); + String firstName = (String)props.get(ContentModel.PROP_FIRSTNAME); + String lastName = (String)props.get(ContentModel.PROP_LASTNAME); + String fullName = firstName + ((lastName != null && lastName.length() > 0) ? " " + lastName : ""); + + return fullName; + } +} diff --git a/source/java/org/alfresco/web/bean/rules/CreateRuleWizard.java b/source/java/org/alfresco/web/bean/rules/CreateRuleWizard.java index aea6d45782..194e5df4ea 100644 --- a/source/java/org/alfresco/web/bean/rules/CreateRuleWizard.java +++ b/source/java/org/alfresco/web/bean/rules/CreateRuleWizard.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.bean.rules; +import java.io.IOException; +import java.io.ObjectInputStream; import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; @@ -68,10 +70,12 @@ import org.apache.commons.logging.LogFactory; */ public class CreateRuleWizard extends BaseActionWizard { + private static final long serialVersionUID = 6197875728665281192L; + protected static final String PROP_CONDITION_NAME = "conditionName"; protected static final String PROP_CONDITION_SUMMARY = "conditionSummary"; - protected RuleService ruleService; + transient private RuleService ruleService; protected RulesDialog rulesDialog; private List modelTypes; @@ -83,7 +87,7 @@ public class CreateRuleWizard extends BaseActionWizard protected Map currentConditionProperties; protected List> allConditionsProperties; - protected DataModel allConditionsDataModel; + transient protected DataModel allConditionsDataModel; protected String title; protected String description; @@ -135,7 +139,7 @@ public class CreateRuleWizard extends BaseActionWizard outcome = setupRule(context, rule, outcome); // Save the rule - this.ruleService.saveRule(currentSpace.getNodeRef(), rule); + this.getRuleService().saveRule(currentSpace.getNodeRef(), rule); if (logger.isDebugEnabled()) logger.debug("Added rule '" + this.title + "'"); @@ -308,7 +312,7 @@ public class CreateRuleWizard extends BaseActionWizard // if there wasn't a client based label try and get it from the dictionary if (label == null) { - TypeDefinition typeDef = this.dictionaryService.getType(idQName); + TypeDefinition typeDef = this.getDictionaryService().getType(idQName); if (typeDef != null) { label = typeDef.getTitle(); @@ -351,7 +355,7 @@ public class CreateRuleWizard extends BaseActionWizard { this.mimeTypes = new ArrayList(50); - Map mimeTypes = mimetypeService.getDisplaysByMimetype(); + Map mimeTypes = getMimetypeService().getDisplaysByMimetype(); for (String mimeType : mimeTypes.keySet()) { this.mimeTypes.add(new SelectItem(mimeType, mimeTypes.get(mimeType))); @@ -372,7 +376,7 @@ public class CreateRuleWizard extends BaseActionWizard { if (this.conditions == null) { - List ruleConditions = this.actionService.getActionConditionDefinitions(); + List ruleConditions = this.getActionService().getActionConditionDefinitions(); this.conditions = new ArrayList(ruleConditions.size()); for (ActionConditionDefinition ruleConditionDef : ruleConditions) { @@ -400,7 +404,7 @@ public class CreateRuleWizard extends BaseActionWizard { if (this.types == null) { - List ruleTypes = this.ruleService.getRuleTypes(); + List ruleTypes = this.getRuleService().getRuleTypes(); this.types = new ArrayList(ruleTypes.size()); for (RuleType ruleType : ruleTypes) { @@ -564,7 +568,7 @@ public class CreateRuleWizard extends BaseActionWizard else { // just add the action to the list and use the title as the summary - ActionConditionDefinition conditionDef = this.actionService. + ActionConditionDefinition conditionDef = this.getActionService(). getActionConditionDefinition(this.condition); condProps.put(PROP_CONDITION_SUMMARY, conditionDef.getTitle()); condProps.put(BaseConditionHandler.PROP_CONDITION_NOT, Boolean.FALSE); @@ -683,6 +687,15 @@ public class CreateRuleWizard extends BaseActionWizard this.ruleService = ruleService; } + protected RuleService getRuleService() + { + if (ruleService == null) + { + ruleService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getRuleService(); + } + return ruleService; + } + /** * Sets the rulesDialog instance to be used by the wizard in edit mode * @@ -714,7 +727,7 @@ public class CreateRuleWizard extends BaseActionWizard rule.setExecuteAsynchronously(this.runInBackground); rule.setRuleDisabled(this.ruleDisabled); - CompositeAction compositeAction = this.actionService.createCompositeAction(); + CompositeAction compositeAction = this.getActionService().createCompositeAction(); rule.setAction(compositeAction); // add all the conditions to the rule @@ -732,7 +745,7 @@ public class CreateRuleWizard extends BaseActionWizard } // add the condition to the rule - ActionCondition condition = this.actionService. + ActionCondition condition = this.getActionService(). createActionCondition(conditionName); condition.setParameterValues(repoCondParams); @@ -760,7 +773,7 @@ public class CreateRuleWizard extends BaseActionWizard } // add the action to the rule - Action action = this.actionService.createAction(actionName); + Action action = this.getActionService().createAction(actionName); action.setParameterValues(repoActionParams); compositeAction.addAction(action); } @@ -818,4 +831,13 @@ public class CreateRuleWizard extends BaseActionWizard } } } + + private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException + { + in.defaultReadObject(); + + this.allConditionsDataModel = new ListDataModel(); + this.allConditionsDataModel.setWrappedData(this.allConditionsProperties); + } + } diff --git a/source/java/org/alfresco/web/bean/rules/EditRuleWizard.java b/source/java/org/alfresco/web/bean/rules/EditRuleWizard.java index 603f19bfe1..e1fc8e4f02 100644 --- a/source/java/org/alfresco/web/bean/rules/EditRuleWizard.java +++ b/source/java/org/alfresco/web/bean/rules/EditRuleWizard.java @@ -52,6 +52,8 @@ import org.apache.commons.logging.LogFactory; */ public class EditRuleWizard extends CreateRuleWizard { + private static final long serialVersionUID = -7222762769396254445L; + private static final Log logger = LogFactory.getLog(EditRuleWizard.class); // ------------------------------------------------------------------------------ @@ -106,7 +108,7 @@ public class EditRuleWizard extends CreateRuleWizard { // there's no handler, so we presume it is a no-paramter // condition, use the condition title as the summary - ActionConditionDefinition conditionDef = this.actionService. + ActionConditionDefinition conditionDef = this.getActionService(). getActionConditionDefinition(this.condition); this.currentConditionProperties.put(PROP_CONDITION_SUMMARY, conditionDef.getTitle()); @@ -138,7 +140,7 @@ public class EditRuleWizard extends CreateRuleWizard { // there's no handler, so we presume it is a no-paramter // action, use the action title as the summary - ActionDefinition actionDef = this.actionService.getActionDefinition(this.action); + ActionDefinition actionDef = this.getActionService().getActionDefinition(this.action); this.currentActionProperties.put(PROP_ACTION_SUMMARY, actionDef.getTitle()); // add the no params marker so we can disable the edit action this.currentActionProperties.put(NO_PARAMS_MARKER, "no-params"); @@ -176,7 +178,7 @@ public class EditRuleWizard extends CreateRuleWizard outcome = setupRule(context, rule, outcome); // Save the rule - this.ruleService.saveRule(currentSpace.getNodeRef(), rule); + this.getRuleService().saveRule(currentSpace.getNodeRef(), rule); if (logger.isDebugEnabled()) logger.debug("Updated rule '" + this.title + "'"); diff --git a/source/java/org/alfresco/web/bean/rules/RulesDialog.java b/source/java/org/alfresco/web/bean/rules/RulesDialog.java index 5b7ac9c808..022c49cad4 100644 --- a/source/java/org/alfresco/web/bean/rules/RulesDialog.java +++ b/source/java/org/alfresco/web/bean/rules/RulesDialog.java @@ -41,13 +41,11 @@ import org.alfresco.repo.rule.RuleModel; import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.ActionService; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.rule.Rule; import org.alfresco.service.cmr.rule.RuleService; import org.alfresco.web.app.Application; import org.alfresco.web.app.context.IContextListener; import org.alfresco.web.app.context.UIContextService; -import org.alfresco.web.bean.BrowseBean; import org.alfresco.web.bean.dialog.BaseDialogBean; import org.alfresco.web.bean.dialog.FilterViewSupport; import org.alfresco.web.bean.repository.Node; @@ -67,6 +65,8 @@ import org.apache.commons.logging.LogFactory; */ public class RulesDialog extends BaseDialogBean implements IContextListener, FilterViewSupport { + private static final long serialVersionUID = -1255494344597331464L; + private static final String MSG_REAPPLY_RULES_SUCCESS = "reapply_rules_success"; private static final String MSG_IGNORE_INHERTIED_RULES = "ignore_inherited_rules"; private static final String MSG_INCLUDE_INHERITED_RULES = "include_inherited_rules"; @@ -80,11 +80,11 @@ public class RulesDialog extends BaseDialogBean implements IContextListener, Fil private String filterModeMode = INHERITED; - protected RuleService ruleService; + transient private RuleService ruleService; private List rules; private Rule currentRule; private UIRichList richList; - private ActionService actionService; + transient private ActionService actionService; /** @@ -130,15 +130,15 @@ public class RulesDialog extends BaseDialogBean implements IContextListener, Fil } // get the rules from the repository - List repoRules = this.ruleService.getRules(getSpace().getNodeRef(), includeInherited); + List repoRules = this.getRuleService().getRules(getSpace().getNodeRef(), includeInherited); this.rules = new ArrayList(repoRules.size()); // wrap them all passing the current space for (Rule rule : repoRules) { - Date createdDate = (Date)this.nodeService.getProperty(rule.getNodeRef(), ContentModel.PROP_CREATED); - Date modifiedDate = (Date)this.nodeService.getProperty(rule.getNodeRef(), ContentModel.PROP_MODIFIED); - boolean isLocal = getSpace().getNodeRef().equals(this.ruleService.getOwningNodeRef(rule)); + Date createdDate = (Date)this.getNodeService().getProperty(rule.getNodeRef(), ContentModel.PROP_CREATED); + Date modifiedDate = (Date)this.getNodeService().getProperty(rule.getNodeRef(), ContentModel.PROP_MODIFIED); + boolean isLocal = getSpace().getNodeRef().equals(this.getRuleService().getOwningNodeRef(rule)); WrappedRule wrapped = new WrappedRule(rule, isLocal, createdDate, modifiedDate); this.rules.add(wrapped); @@ -162,7 +162,7 @@ public class RulesDialog extends BaseDialogBean implements IContextListener, Fil if (logger.isDebugEnabled()) logger.debug("Rule clicked, it's id is: " + id); - this.currentRule = this.ruleService.getRule(new NodeRef(id)); + this.currentRule = this.getRuleService().getRule(new NodeRef(id)); // refresh list contextUpdated(); @@ -185,7 +185,7 @@ public class RulesDialog extends BaseDialogBean implements IContextListener, Fil tx.begin(); // Create the the apply rules action - Action action = this.actionService.createAction(ExecuteAllRulesActionExecuter.NAME); + Action action = this.getActionService().createAction(ExecuteAllRulesActionExecuter.NAME); // Set the include inherited parameter to match the current filter value boolean executeInherited = true; @@ -196,7 +196,7 @@ public class RulesDialog extends BaseDialogBean implements IContextListener, Fil action.setParameterValue(ExecuteAllRulesActionExecuter.PARAM_EXECUTE_INHERITED_RULES, executeInherited); // Execute the action - this.actionService.executeAction(action, this.getSpace().getNodeRef()); + this.getActionService().executeAction(action, this.getSpace().getNodeRef()); // TODO how do I get the message here ... String msg = Application.getMessage(fc, MSG_REAPPLY_RULES_SUCCESS); @@ -226,7 +226,7 @@ public class RulesDialog extends BaseDialogBean implements IContextListener, Fil FacesContext fc = FacesContext.getCurrentInstance(); String result = Application.getMessage(fc, MSG_IGNORE_INHERTIED_RULES); - if (this.nodeService.hasAspect(this.getSpace().getNodeRef(), RuleModel.ASPECT_IGNORE_INHERITED_RULES) == true) + if (this.getNodeService().hasAspect(this.getSpace().getNodeRef(), RuleModel.ASPECT_IGNORE_INHERITED_RULES) == true) { result = Application.getMessage(fc, MSG_INCLUDE_INHERITED_RULES); } @@ -235,7 +235,7 @@ public class RulesDialog extends BaseDialogBean implements IContextListener, Fil public boolean getIgnoreInheritedRules() { - return this.nodeService.hasAspect(this.getSpace().getNodeRef(), RuleModel.ASPECT_IGNORE_INHERITED_RULES); + return this.getNodeService().hasAspect(this.getSpace().getNodeRef(), RuleModel.ASPECT_IGNORE_INHERITED_RULES); } /** @@ -246,13 +246,13 @@ public class RulesDialog extends BaseDialogBean implements IContextListener, Fil public void ignoreInheritedRules(ActionEvent event) { NodeRef nodeRef = this.getSpace().getNodeRef(); - if (this.nodeService.hasAspect(nodeRef, RuleModel.ASPECT_IGNORE_INHERITED_RULES) == true) + if (this.getNodeService().hasAspect(nodeRef, RuleModel.ASPECT_IGNORE_INHERITED_RULES) == true) { - this.nodeService.removeAspect(nodeRef, RuleModel.ASPECT_IGNORE_INHERITED_RULES); + this.getNodeService().removeAspect(nodeRef, RuleModel.ASPECT_IGNORE_INHERITED_RULES); } else { - this.nodeService.addAspect(nodeRef, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); + this.getNodeService().addAspect(nodeRef, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); } // force the list to be re-queried when the page is refreshed @@ -311,6 +311,15 @@ public class RulesDialog extends BaseDialogBean implements IContextListener, Fil this.ruleService = ruleService; } + protected RuleService getRuleService() + { + if (ruleService == null) + { + ruleService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getRuleService(); + } + return ruleService; + } + /** * Set the action service to use * @@ -321,7 +330,14 @@ public class RulesDialog extends BaseDialogBean implements IContextListener, Fil this.actionService = actionService; } - + private ActionService getActionService() + { + if (actionService == null) + { + actionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getActionService(); + } + return actionService; + } // ------------------------------------------------------------------------------ // IContextListener implementation diff --git a/source/java/org/alfresco/web/bean/rules/handlers/CompareMimeTypeHandler.java b/source/java/org/alfresco/web/bean/rules/handlers/CompareMimeTypeHandler.java index 1e7a05af24..30cb74f642 100644 --- a/source/java/org/alfresco/web/bean/rules/handlers/CompareMimeTypeHandler.java +++ b/source/java/org/alfresco/web/bean/rules/handlers/CompareMimeTypeHandler.java @@ -43,6 +43,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class CompareMimeTypeHandler extends BaseConditionHandler { + private static final long serialVersionUID = 6421611697032505073L; + protected static final String PROP_MIMETYPE = "mimetype"; public String getJSPPath() diff --git a/source/java/org/alfresco/web/bean/rules/handlers/HasAspectHandler.java b/source/java/org/alfresco/web/bean/rules/handlers/HasAspectHandler.java index 3b5e508f01..ab55861129 100644 --- a/source/java/org/alfresco/web/bean/rules/handlers/HasAspectHandler.java +++ b/source/java/org/alfresco/web/bean/rules/handlers/HasAspectHandler.java @@ -44,6 +44,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class HasAspectHandler extends BaseConditionHandler { + private static final long serialVersionUID = 7365950247553882237L; + protected static final String PROP_ASPECT = "aspect"; public String getJSPPath() diff --git a/source/java/org/alfresco/web/bean/rules/handlers/InCategoryHandler.java b/source/java/org/alfresco/web/bean/rules/handlers/InCategoryHandler.java index ac6ab9c834..eef846e513 100644 --- a/source/java/org/alfresco/web/bean/rules/handlers/InCategoryHandler.java +++ b/source/java/org/alfresco/web/bean/rules/handlers/InCategoryHandler.java @@ -44,6 +44,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class InCategoryHandler extends BaseConditionHandler { + private static final long serialVersionUID = -7312917724514125469L; + protected static final String PROP_CATEGORY = "category"; public String getJSPPath() diff --git a/source/java/org/alfresco/web/bean/rules/handlers/IsSubTypeHandler.java b/source/java/org/alfresco/web/bean/rules/handlers/IsSubTypeHandler.java index 8a22a7a06b..cbe0e8371e 100644 --- a/source/java/org/alfresco/web/bean/rules/handlers/IsSubTypeHandler.java +++ b/source/java/org/alfresco/web/bean/rules/handlers/IsSubTypeHandler.java @@ -44,6 +44,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class IsSubTypeHandler extends BaseConditionHandler { + private static final long serialVersionUID = 906340104511402964L; + protected static final String PROP_MODEL_TYPE = "modeltype"; public String getJSPPath() diff --git a/source/java/org/alfresco/web/bean/rules/handlers/PropertyValueHandler.java b/source/java/org/alfresco/web/bean/rules/handlers/PropertyValueHandler.java index ca7b704f59..5c68841bc9 100644 --- a/source/java/org/alfresco/web/bean/rules/handlers/PropertyValueHandler.java +++ b/source/java/org/alfresco/web/bean/rules/handlers/PropertyValueHandler.java @@ -41,6 +41,8 @@ import org.alfresco.web.bean.wizard.IWizardBean; */ public class PropertyValueHandler extends BaseConditionHandler { + private static final long serialVersionUID = 6718858865738420012L; + public static final String PROP_CONTAINS_TEXT = "containstext"; public String getJSPPath() diff --git a/source/java/org/alfresco/web/bean/search/AdvancedSearchDialog.java b/source/java/org/alfresco/web/bean/search/AdvancedSearchDialog.java index a9144d8637..57f8737552 100644 --- a/source/java/org/alfresco/web/bean/search/AdvancedSearchDialog.java +++ b/source/java/org/alfresco/web/bean/search/AdvancedSearchDialog.java @@ -86,8 +86,10 @@ import org.alfresco.web.ui.repo.component.UISearchCustomProperties; */ public class AdvancedSearchDialog extends BaseDialogBean { + private static final long serialVersionUID = 3658148969240122732L; + /** PermissionService */ - protected PermissionService permissionService; + transient private PermissionService permissionService; /** * Default constructor @@ -109,6 +111,15 @@ public class AdvancedSearchDialog extends BaseDialogBean this.permissionService = permissionService; } + protected PermissionService getPermissionService() + { + if (permissionService == null) + { + permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService(); + } + return permissionService; + } + public void setProperties(SearchProperties properties) { this.properties = properties; @@ -123,7 +134,7 @@ public class AdvancedSearchDialog extends BaseDialogBean if (allow) { NodeRef savedSearchRef = new NodeRef(Repository.getStoreRef(), properties.getSavedSearch()); - allow = (this.permissionService.hasPermission(savedSearchRef, + allow = (getPermissionService().hasPermission(savedSearchRef, PermissionService.WRITE) == AccessStatus.ALLOWED); } return allow; @@ -510,7 +521,7 @@ public class AdvancedSearchDialog extends BaseDialogBean { NodeRef searchRef = new NodeRef(Repository.getStoreRef(), properties.getSavedSearch()); Node searchNode = new Node(searchRef); - if (this.nodeService.exists(searchRef) && searchNode.hasPermission(PermissionService.WRITE)) + if (getNodeService().exists(searchRef) && searchNode.hasPermission(PermissionService.WRITE)) { Node node = new Node(searchRef); properties.setSearchName(node.getName()); @@ -559,7 +570,7 @@ public class AdvancedSearchDialog extends BaseDialogBean { DictionaryService dd = services.getDictionaryService(); - List childRefs = nodeService.getChildAssocs( + List childRefs = getNodeService().getChildAssocs( searchesRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); @@ -822,11 +833,11 @@ public class AdvancedSearchDialog extends BaseDialogBean List results = null; try { - results = searchService.selectNodes( + results = getSearchService().selectNodes( rootRef, xpath, null, - namespaceService, + getNamespaceService(), false); } catch (AccessDeniedException err) @@ -855,11 +866,11 @@ public class AdvancedSearchDialog extends BaseDialogBean List results = null; try { - results = searchService.selectNodes( + results = getSearchService().selectNodes( globalRef, xpath, null, - namespaceService, + getNamespaceService(), false); } catch (AccessDeniedException err) @@ -879,7 +890,7 @@ public class AdvancedSearchDialog extends BaseDialogBean // create the preferences Node for this user Map props = new HashMap(2, 1.0f); props.put(ContentModel.PROP_NAME, user.getUserName()); - ChildAssociationRef childRef = nodeService.createNode( + ChildAssociationRef childRef = getNodeService().createNode( globalRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.APP_MODEL_1_0_URI, QName.createValidLocalName(user.getUserName())), @@ -910,11 +921,11 @@ public class AdvancedSearchDialog extends BaseDialogBean List results = null; try { - results = searchService.selectNodes( - nodeService.getRootNode(Repository.getStoreRef()), + results = getSearchService().selectNodes( + getNodeService().getRootNode(Repository.getStoreRef()), xpath, null, - namespaceService, + getNamespaceService(), false); } catch (AccessDeniedException err) @@ -934,6 +945,7 @@ public class AdvancedSearchDialog extends BaseDialogBean /** * Action handler called when the Add button is pressed to add the current Category selection */ + @SuppressWarnings("unchecked") public void addCategory(ActionEvent event) { UIAjaxCategoryPicker selector = (UIAjaxCategoryPicker)event.getComponent().findComponent("catSelector"); diff --git a/source/java/org/alfresco/web/bean/search/EditSearchDialog.java b/source/java/org/alfresco/web/bean/search/EditSearchDialog.java index c471c8d3ff..a688d38e43 100644 --- a/source/java/org/alfresco/web/bean/search/EditSearchDialog.java +++ b/source/java/org/alfresco/web/bean/search/EditSearchDialog.java @@ -76,12 +76,12 @@ public class EditSearchDialog extends AdvancedSearchDialog // detect if was previously selected saved search (e.g. // NodeRef not null) NodeRef searchRef = new NodeRef(Repository.getStoreRef(), properties.getSavedSearch()); - if (nodeService.exists(searchRef)) + if (getNodeService().exists(searchRef)) { - Map props = nodeService.getProperties(searchRef); + Map props = getNodeService().getProperties(searchRef); props.put(ContentModel.PROP_NAME, properties.getSearchName()); props.put(ContentModel.PROP_DESCRIPTION, properties.getSearchDescription()); - nodeService.setProperties(searchRef, props); + getNodeService().setProperties(searchRef, props); ContentService contentService = Repository.getServiceRegistry(context).getContentService(); ContentWriter writer = contentService.getWriter(searchRef, ContentModel.PROP_CONTENT, true); diff --git a/source/java/org/alfresco/web/bean/search/SaveSearchDialog.java b/source/java/org/alfresco/web/bean/search/SaveSearchDialog.java index c987b34fb2..40e7758f99 100644 --- a/source/java/org/alfresco/web/bean/search/SaveSearchDialog.java +++ b/source/java/org/alfresco/web/bean/search/SaveSearchDialog.java @@ -92,7 +92,7 @@ public class SaveSearchDialog extends AdvancedSearchDialog Map props = new HashMap(2, 1.0f); props.put(ContentModel.PROP_NAME, properties.getSearchName()); props.put(ContentModel.PROP_DESCRIPTION, properties.getSearchDescription()); - ChildAssociationRef childRef = nodeService.createNode(searchesRefFinal, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.ALFRESCO_URI, QName + ChildAssociationRef childRef = getNodeService().createNode(searchesRefFinal, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.ALFRESCO_URI, QName .createValidLocalName(properties.getSearchName())), ContentModel.TYPE_CONTENT, props); ContentService contentService = Repository.getServiceRegistry(context).getContentService(); diff --git a/source/java/org/alfresco/web/bean/spaces/ApplyDocTemplateDialog.java b/source/java/org/alfresco/web/bean/spaces/ApplyDocTemplateDialog.java index 9526e5a8c5..450a189326 100644 --- a/source/java/org/alfresco/web/bean/spaces/ApplyDocTemplateDialog.java +++ b/source/java/org/alfresco/web/bean/spaces/ApplyDocTemplateDialog.java @@ -56,14 +56,14 @@ public class ApplyDocTemplateDialog extends BaseDialogBean // apply the templatable aspect if required if (getNode().hasAspect(ContentModel.ASPECT_TEMPLATABLE) == false) { - this.nodeService.addAspect(getNode().getNodeRef(), ContentModel.ASPECT_TEMPLATABLE, null); + this.getNodeService().addAspect(getNode().getNodeRef(), ContentModel.ASPECT_TEMPLATABLE, null); } // get the selected template from the Template Picker NodeRef templateRef = new NodeRef(Repository.getStoreRef(), this.template); // set the template NodeRef into the templatable aspect property - this.nodeService.setProperty(getNode().getNodeRef(), ContentModel.PROP_TEMPLATE, templateRef); + this.getNodeService().setProperty(getNode().getNodeRef(), ContentModel.PROP_TEMPLATE, templateRef); // reset node details for next refresh of details page getNode().reset(); diff --git a/source/java/org/alfresco/web/bean/spaces/ApplyRssTemplateDialog.java b/source/java/org/alfresco/web/bean/spaces/ApplyRssTemplateDialog.java index dcad73a9e4..e0f53c7377 100644 --- a/source/java/org/alfresco/web/bean/spaces/ApplyRssTemplateDialog.java +++ b/source/java/org/alfresco/web/bean/spaces/ApplyRssTemplateDialog.java @@ -87,14 +87,14 @@ public class ApplyRssTemplateDialog extends BaseDialogBean // apply the feedsource aspect if required if (getNode().hasAspect(ApplicationModel.ASPECT_FEEDSOURCE) == false) { - this.nodeService.addAspect(getNode().getNodeRef(), ApplicationModel.ASPECT_FEEDSOURCE, null); + this.getNodeService().addAspect(getNode().getNodeRef(), ApplicationModel.ASPECT_FEEDSOURCE, null); } // get the selected template Id from the Template Picker NodeRef templateRef = new NodeRef(Repository.getStoreRef(), this.rssTemplate); // set the template NodeRef into the templatable aspect property - this.nodeService.setProperty(getNode().getNodeRef(), ApplicationModel.PROP_FEEDTEMPLATE, templateRef); + this.getNodeService().setProperty(getNode().getNodeRef(), ApplicationModel.PROP_FEEDTEMPLATE, templateRef); // reset node details for next refresh of details page getNode().reset(); diff --git a/source/java/org/alfresco/web/bean/spaces/ApplySpaceTemplateDialog.java b/source/java/org/alfresco/web/bean/spaces/ApplySpaceTemplateDialog.java index 6f71604b38..6f43450d3e 100644 --- a/source/java/org/alfresco/web/bean/spaces/ApplySpaceTemplateDialog.java +++ b/source/java/org/alfresco/web/bean/spaces/ApplySpaceTemplateDialog.java @@ -73,14 +73,14 @@ public class ApplySpaceTemplateDialog extends BaseDialogBean // apply the templatable aspect if required if (getNode().hasAspect(ContentModel.ASPECT_TEMPLATABLE) == false) { - this.nodeService.addAspect(getNode().getNodeRef(), ContentModel.ASPECT_TEMPLATABLE, null); + this.getNodeService().addAspect(getNode().getNodeRef(), ContentModel.ASPECT_TEMPLATABLE, null); } // get the selected template from the Template Picker NodeRef templateRef = new NodeRef(Repository.getStoreRef(), this.template); // set the template NodeRef into the templatable aspect property - this.nodeService.setProperty(getNode().getNodeRef(), ContentModel.PROP_TEMPLATE, templateRef); + this.getNodeService().setProperty(getNode().getNodeRef(), ContentModel.PROP_TEMPLATE, templateRef); // reset node details for next refresh of details page getNode().reset(); diff --git a/source/java/org/alfresco/web/bean/spaces/CreateSpaceDialog.java b/source/java/org/alfresco/web/bean/spaces/CreateSpaceDialog.java index 989df3c406..b26a8df77c 100644 --- a/source/java/org/alfresco/web/bean/spaces/CreateSpaceDialog.java +++ b/source/java/org/alfresco/web/bean/spaces/CreateSpaceDialog.java @@ -38,9 +38,12 @@ import org.alfresco.web.app.Application; */ public class CreateSpaceDialog extends CreateSpaceWizard { + private static final long serialVersionUID = 4659583264588102372L; // ------------------------------------------------------------------------------ // Wizard implementation + + @Override public String getFinishButtonLabel() { diff --git a/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java b/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java index 1f7c80624b..f81e0986ac 100644 --- a/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java +++ b/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java @@ -1,760 +1,762 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.web.bean.spaces; - -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 java.util.ResourceBundle; - -import javax.faces.context.FacesContext; -import javax.faces.model.SelectItem; - -import org.alfresco.config.Config; -import org.alfresco.config.ConfigElement; -import org.alfresco.model.ApplicationModel; -import org.alfresco.model.ContentModel; -import org.alfresco.service.cmr.dictionary.TypeDefinition; -import org.alfresco.service.cmr.model.FileExistsException; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.DynamicNamespacePrefixResolver; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -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.BaseWizardBean; -import org.alfresco.web.data.IDataContainer; -import org.alfresco.web.data.QuickSort; -import org.alfresco.web.ui.common.Utils; -import org.alfresco.web.ui.common.component.UIListItem; -import org.alfresco.web.ui.common.component.description.UIDescription; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Bean responsible for the create space wizard - * - * @author gavinc - */ -public class CreateSpaceWizard extends BaseWizardBean -{ - public static final String DEFAULT_SPACE_ICON_NAME = "space-icon-default"; - public static final String DEFAULT_SPACE_ICON_PATH = ""; - public static final String DEFAULT_SPACE_TYPE_ICON_PATH = "/images/icons/space.gif"; - - private static Log logger = LogFactory.getLog(CreateSpaceWizard.class); - - protected static final String CREATEFROM_TEMPLATE = "template"; - protected static final String CREATEFROM_EXISTING = "existing"; - protected static final String CREATEFROM_SCRATCH = "scratch"; - - protected String spaceType; - protected String icon; - protected String createFrom; - protected NodeRef existingSpaceId; - protected String templateSpaceId; - protected String copyPolicy; - protected String name; - protected String title; - protected String description; - protected String templateName; - protected boolean saveAsTemplate; - protected List templates; - protected List folderTypes; - protected List folderTypeDescriptions; - - // the NodeRef of the node created during finish - protected NodeRef createdNode; - - // ------------------------------------------------------------------------------ - // Wizard implementation - - /** - * Initialises the wizard - */ - public void init(Map parameters) - { - super.init(parameters); - - // clear the cached query results - if (this.templates != null) - { - this.templates.clear(); - this.templates = null; - } - - // reset all variables - this.createFrom = CREATEFROM_SCRATCH; - this.spaceType = ContentModel.TYPE_FOLDER.toString(); - this.icon = null; - this.copyPolicy = "contents"; - this.existingSpaceId = null; - this.templateSpaceId = null; - this.name = null; - this.title = null; - this.description = null; - this.templateName = null; - this.saveAsTemplate = false; - } - - public String next() - { - // if the user has chosen to create the space from an existing - // space or from a template we need to find it's type to show - // the current set of icons. - if (this.createFrom.equals(CREATEFROM_EXISTING) && this.existingSpaceId != null) - { - this.spaceType = this.nodeService.getType(this.existingSpaceId).toString(); - } - else if (this.createFrom.equals(CREATEFROM_TEMPLATE) && this.templateSpaceId != null) - { - NodeRef templateNode = new NodeRef(Repository.getStoreRef(), this.templateSpaceId); - this.spaceType = this.nodeService.getType(templateNode).toString(); - } - - return null; - } - - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - String newSpaceId = null; - - if (this.createFrom.equals(CREATEFROM_SCRATCH)) - { - // create the space (just create a folder for now) - NodeRef parentNodeRef; - String nodeId = this.navigator.getCurrentNodeId(); - if (nodeId == null) - { - parentNodeRef = this.nodeService.getRootNode(Repository.getStoreRef()); - } - else - { - parentNodeRef = new NodeRef(Repository.getStoreRef(), nodeId); - } - - FileInfo fileInfo = fileFolderService.create( - parentNodeRef, - this.name, - Repository.resolveToQName(this.spaceType)); - NodeRef nodeRef = fileInfo.getNodeRef(); - newSpaceId = nodeRef.getId(); - - if (logger.isDebugEnabled()) - logger.debug("Created folder node with name: " + this.name); - - // apply the uifacets aspect - icon, title and description props - Map uiFacetsProps = new HashMap(5); - uiFacetsProps.put(ApplicationModel.PROP_ICON, this.icon); - uiFacetsProps.put(ContentModel.PROP_TITLE, this.title); - uiFacetsProps.put(ContentModel.PROP_DESCRIPTION, this.description); - this.nodeService.addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, uiFacetsProps); - - if (logger.isDebugEnabled()) - logger.debug("Added uifacets aspect with properties: " + uiFacetsProps); - - // remember the created node - this.createdNode = nodeRef; - } - else if (this.createFrom.equals(CREATEFROM_EXISTING)) - { - // copy the selected space and update the name, description and icon - NodeRef sourceNode = this.existingSpaceId; - NodeRef parentSpace = new NodeRef(Repository.getStoreRef(), this.navigator.getCurrentNodeId()); - - // copy from existing - NodeRef copiedNode = this.fileFolderService.copy(sourceNode, parentSpace, this.name).getNodeRef(); - - // also need to set the new title, description and icon properties - this.nodeService.setProperty(copiedNode, ContentModel.PROP_TITLE, this.title); - this.nodeService.setProperty(copiedNode, ContentModel.PROP_DESCRIPTION, this.description); - this.nodeService.setProperty(copiedNode, ApplicationModel.PROP_ICON, this.icon); - - newSpaceId = copiedNode.getId(); - - if (logger.isDebugEnabled()) - logger.debug("Copied space with id of " + sourceNode.getId() + " to " + this.name); - - // remember the created node - this.createdNode = copiedNode; - } - else if (this.createFrom.equals(CREATEFROM_TEMPLATE)) - { - // copy the selected space and update the name, description and icon - NodeRef sourceNode = new NodeRef(Repository.getStoreRef(), this.templateSpaceId); - NodeRef parentSpace = new NodeRef(Repository.getStoreRef(), this.navigator.getCurrentNodeId()); - // copy from the template - NodeRef copiedNode = this.fileFolderService.copy(sourceNode, parentSpace, this.name).getNodeRef(); - // also need to set the new title, description and icon properties - this.nodeService.setProperty(copiedNode, ContentModel.PROP_TITLE, this.title); - this.nodeService.setProperty(copiedNode, ContentModel.PROP_DESCRIPTION, this.description); - this.nodeService.setProperty(copiedNode, ApplicationModel.PROP_ICON, this.icon); - - newSpaceId = copiedNode.getId(); - - if (logger.isDebugEnabled()) - logger.debug("Copied template space with id of " + sourceNode.getId() + " to " + this.name); - - // remember the created node - this.createdNode = copiedNode; - } - - // if the user selected to save the space as a template space copy the new - // space to the templates folder - if (this.saveAsTemplate) - { - // get hold of the Templates node - DynamicNamespacePrefixResolver namespacePrefixResolver = new DynamicNamespacePrefixResolver(null); - namespacePrefixResolver.registerNamespace(NamespaceService.APP_MODEL_PREFIX, NamespaceService.APP_MODEL_1_0_URI); - - String xpath = Application.getRootPath(FacesContext.getCurrentInstance()) + "/" + - Application.getGlossaryFolderName(FacesContext.getCurrentInstance()) + "/" + - Application.getSpaceTemplatesFolderName(FacesContext.getCurrentInstance()); - - NodeRef rootNodeRef = this.nodeService.getRootNode(Repository.getStoreRef()); - List templateNodeList = this.searchService.selectNodes( - rootNodeRef, - xpath, null, namespacePrefixResolver, false); - if (templateNodeList.size() == 1) - { - // get the first item in the list as we from test above there is only one! - NodeRef templateNode = templateNodeList.get(0); - NodeRef sourceNode = new NodeRef(Repository.getStoreRef(), newSpaceId); - // copy this to the template location - fileFolderService.copy(sourceNode, templateNode, this.templateName); - } - } - - setTitle(""); - setDescription(""); - - return outcome; - } - - // ------------------------------------------------------------------------------ - // Bean Getters and Setters - - /** - * @return Returns the copyPolicy. - */ - public String getCopyPolicy() - { - return copyPolicy; - } - - /** - * @param copyPolicy The copyPolicy to set. - */ - public void setCopyPolicy(String copyPolicy) - { - this.copyPolicy = copyPolicy; - } - - /** - * @return Returns the createFrom. - */ - public String getCreateFrom() - { - return createFrom; - } - - /** - * @param createFrom The createFrom to set. - */ - public void setCreateFrom(String createFrom) - { - this.createFrom = createFrom; - } - - /** - * @return Returns the description. - */ - public String getDescription() - { - return description; - } - - /** - * @param description The description to set. - */ - public void setDescription(String description) - { - this.description = description; - } - - /** - * @return Returns the existingSpaceId. - */ - public NodeRef getExistingSpaceId() - { - return existingSpaceId; - } - - /** - * @param existingSpaceId The existingSpaceId to set. - */ - public void setExistingSpaceId(NodeRef existingSpaceId) - { - this.existingSpaceId = existingSpaceId; - } - - /** - * @return Returns the icon. - */ - public String getIcon() - { - return icon; - } - - /** - * @param icon The icon to set. - */ - public void setIcon(String icon) - { - this.icon = icon; - } - - /** - * @return Returns the name. - */ - public String getName() - { - return name; - } - - /** - * @param name The name to set. - */ - public void setName(String name) - { - this.name = name.trim(); - } - - /** - * @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 saveAsTemplate. - */ - public boolean isSaveAsTemplate() - { - return saveAsTemplate; - } - - /** - * @param saveAsTemplate The saveAsTemplate to set. - */ - public void setSaveAsTemplate(boolean saveAsTemplate) - { - this.saveAsTemplate = saveAsTemplate; - } - - /** - * @return Returns the spaceType. - */ - public String getSpaceType() - { - return spaceType; - } - - /** - * @param spaceType The spaceType to set. - */ - public void setSpaceType(String spaceType) - { - this.spaceType = spaceType; - } - - /** - * @return Returns the templateName. - */ - public String getTemplateName() - { - return templateName; - } - - /** - * @param templateName The templateName to set. - */ - public void setTemplateName(String templateName) - { - this.templateName = templateName; - } - - /** - * @return Returns the templateSpaceId. - */ - public String getTemplateSpaceId() - { - return templateSpaceId; - } - - /** - * @param templateSpaceId The templateSpaceId to set. - */ - public void setTemplateSpaceId(String templateSpaceId) - { - this.templateSpaceId = templateSpaceId; - } - - /** - * @return Returns the summary data for the wizard. - */ - public String getSummary() - { - String summaryCreateType = null; - ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); - - if (this.createFrom.equals(CREATEFROM_SCRATCH)) - { - summaryCreateType = bundle.getString(CREATEFROM_SCRATCH); - } - else if (this.createFrom.equals(CREATEFROM_EXISTING)) - { - summaryCreateType = bundle.getString("an_existing_space"); - } - else if (this.createFrom.equals(CREATEFROM_TEMPLATE)) - { - summaryCreateType = bundle.getString("a_template"); - } - -// String summarySaveAsTemplate = this.saveAsTemplate ? bundle.getString("yes") : bundle.getString("no"); -// bundle.getString("save_as_template"), bundle.getString("template_name")}, -// summarySaveAsTemplate, this.templateName - - String spaceTypeLabel = null; - for (UIListItem item : this.getFolderTypes()) - { - if (item.getValue().equals(this.spaceType)) - { - spaceTypeLabel = item.getLabel(); - break; - } - } - - return buildSummary( - new String[] {bundle.getString("space_type"), bundle.getString("name"), - bundle.getString("description"), bundle.getString("creating_from")}, - new String[] {spaceTypeLabel, this.name, Utils.encode(this.description), summaryCreateType}); - } - - /** - * @return Returns a list of template spaces currently in the system - */ - public List getTemplateSpaces() - { - if (this.templates == null) - { - this.templates = new ArrayList(); - - FacesContext context = FacesContext.getCurrentInstance(); - String xpath = Application.getRootPath(context) + "/" + Application.getGlossaryFolderName(context) + - "/" + Application.getSpaceTemplatesFolderName(context) + "/*"; - NodeRef rootNodeRef = this.nodeService.getRootNode(Repository.getStoreRef()); - List results = this.searchService.selectNodes(rootNodeRef, xpath, null, this.namespaceService, false); - - if (results.size() != 0) - { - // show templates of the type relating to the space we are creating - QName spaceType = QName.createQName(this.spaceType); - for (NodeRef assocRef : results) - { - Node childNode = new Node(assocRef); - if (this.dictionaryService.isSubClass(childNode.getType(), spaceType)) - { - this.templates.add(new SelectItem(childNode.getId(), childNode.getName())); - } - } - - // make sure the list is sorted by the label - QuickSort sorter = new QuickSort(this.templates, "label", true, IDataContainer.SORT_CASEINSENSITIVE); - sorter.sort(); - } - - // add an entry (at the start) to instruct the user to select a template - this.templates.add(0, new SelectItem("none", Application.getMessage(FacesContext.getCurrentInstance(), "select_a_template"))); - } - - return this.templates; - } - - /** - * Returns a list of UIListItem objects representing the folder types - * and also constructs the list of descriptions for each type - * - * @return List of UIListItem components - */ - @SuppressWarnings("unchecked") - public List getFolderTypes() - { - if ((this.folderTypes == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) - { - FacesContext context = FacesContext.getCurrentInstance(); - this.folderTypes = new ArrayList(2); - this.folderTypeDescriptions = new ArrayList(2); - - // add the well known 'container space' type to start with - UIListItem defaultItem = new UIListItem(); - String defaultLabel = Application.getMessage(context, "container"); - defaultItem.setValue(ContentModel.TYPE_FOLDER.toString()); - defaultItem.setLabel(defaultLabel); - defaultItem.setTooltip(defaultLabel); - defaultItem.setImage(DEFAULT_SPACE_TYPE_ICON_PATH); - this.folderTypes.add(defaultItem); - - UIDescription defaultDesc = new UIDescription(); - defaultDesc.setControlValue(ContentModel.TYPE_FOLDER.toString()); - defaultDesc.setText(Application.getMessage(context, "container_desc")); - this.folderTypeDescriptions.add(defaultDesc); - - // add any configured content sub-types to the list - Config wizardCfg = Application.getConfigService(FacesContext.getCurrentInstance()). - getConfig("Space Wizards"); - if (wizardCfg != null) - { - ConfigElement typesCfg = wizardCfg.getConfigElement("folder-types"); - if (typesCfg != null) - { - for (ConfigElement child : typesCfg.getChildren()) - { - QName idQName = Repository.resolveToQName(child.getAttribute("name")); - TypeDefinition typeDef = this.dictionaryService.getType(idQName); - - if (typeDef != null) - { - if (this.dictionaryService.isSubClass(typeDef.getName(), ContentModel.TYPE_FOLDER)) - { - // try and get the label from config - String label = Utils.getDisplayLabel(context, child); - - // if there wasn't a client based label try and get it from the dictionary - if (label == null) - { - label = typeDef.getTitle(); - } - - // finally use the localname if we still haven't found a label - if (label == null) - { - label = idQName.getLocalName(); - } - - // resolve a description string for the type - String description = Utils.getDescription(context, child); - - // if we don't have a local description just use the label - if (description == null) - { - description = label; - } - - // extract the icon to use from the config - String icon = child.getAttribute("icon"); - if (icon == null || icon.length() == 0) - { - icon = DEFAULT_SPACE_TYPE_ICON_PATH; - } - - UIListItem item = new UIListItem(); - item.setValue(idQName.toString()); - item.setLabel(label); - item.setTooltip(label); - item.setImage(icon); - this.folderTypes.add(item); - - UIDescription desc = new UIDescription(); - desc.setControlValue(idQName.toString()); - desc.setText(description); - this.folderTypeDescriptions.add(desc); - } - else - { - logger.warn("Failed to add '" + child.getAttribute("name") + - "' to the list of folder types as the type is not a subtype of cm:folder"); - } - } - else - { - logger.warn("Failed to add '" + child.getAttribute("name") + - "' to the list of folder types as the type is not recognised"); - } - } - } - else - { - logger.warn("Could not find 'folder-types' configuration element"); - } - } - else - { - logger.warn("Could not find 'Space Wizards' configuration section"); - } - - } - - return this.folderTypes; - } - - /** - * Returns a list of UIDescription objects for the folder types - * - * @return A list of UIDescription objects - */ - public List getFolderTypeDescriptions() - { - if ((this.folderTypeDescriptions == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) - { - // call the getFolderType method to construct the list - getFolderTypes(); - } - - return this.folderTypeDescriptions; - } - - /** - * Returns a list of icons to allow the user to select from. - * The list can change according to the type of space being created. - * - * @return A list of icons - */ - @SuppressWarnings("unchecked") - public List getIcons() - { - // NOTE: we can't cache this list as it depends on the space type - // which the user can change during the advanced space wizard - - List icons = null; - List iconNames = new ArrayList(8); - - QName type = QName.createQName(this.spaceType); - String typePrefixForm = type.toPrefixString(this.namespaceService); - - Config config = Application.getConfigService(FacesContext.getCurrentInstance()). - getConfig(typePrefixForm + " icons"); - if (config != null) - { - ConfigElement iconsCfg = config.getConfigElement("icons"); - if (iconsCfg != null) - { - boolean first = true; - for (ConfigElement icon : iconsCfg.getChildren()) - { - String iconName = icon.getAttribute("name"); - String iconPath = icon.getAttribute("path"); - - if (iconName != null && iconPath != null) - { - if (first) - { - // if this is the first icon create the list and make - // the first icon in the list the default - - icons = new ArrayList(iconsCfg.getChildCount()); - if (this.icon == null) - { - // set the default if it is not already - this.icon = iconName; - } - first = false; - } - - UIListItem item = new UIListItem(); - item.setValue(iconName); - item.setImage(iconPath); - icons.add(item); - iconNames.add(iconName); - } - } - } - } - - // if we didn't find any icons display one default choice - if (icons == null) - { - icons = new ArrayList(1); - this.icon = DEFAULT_SPACE_ICON_NAME; - - UIListItem item = new UIListItem(); - item.setValue(DEFAULT_SPACE_ICON_NAME); - item.setImage("/images/icons/space-icon-default.gif"); - icons.add(item); - iconNames.add(DEFAULT_SPACE_ICON_NAME); - } - - // make sure the current value for the icon is valid for the - // current list of icons about to be displayed - if (iconNames.contains(this.icon) == false) - { - this.icon = iconNames.get(0); - } - - return icons; - } - - // ------------------------------------------------------------------------------ - // Helper methods - - /** - * 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 - { - return MessageFormat.format(Application.getMessage( - FacesContext.getCurrentInstance(), "error_space"), - exception.getMessage()); - } - } -} +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean.spaces; + +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 java.util.ResourceBundle; + +import javax.faces.context.FacesContext; +import javax.faces.model.SelectItem; + +import org.alfresco.config.Config; +import org.alfresco.config.ConfigElement; +import org.alfresco.model.ApplicationModel; +import org.alfresco.model.ContentModel; +import org.alfresco.service.cmr.dictionary.TypeDefinition; +import org.alfresco.service.cmr.model.FileExistsException; +import org.alfresco.service.cmr.model.FileInfo; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.DynamicNamespacePrefixResolver; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +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.BaseWizardBean; +import org.alfresco.web.data.IDataContainer; +import org.alfresco.web.data.QuickSort; +import org.alfresco.web.ui.common.Utils; +import org.alfresco.web.ui.common.component.UIListItem; +import org.alfresco.web.ui.common.component.description.UIDescription; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Bean responsible for the create space wizard + * + * @author gavinc + */ +public class CreateSpaceWizard extends BaseWizardBean +{ + private static final long serialVersionUID = 2917623558917193097L; + + public static final String DEFAULT_SPACE_ICON_NAME = "space-icon-default"; + public static final String DEFAULT_SPACE_ICON_PATH = ""; + public static final String DEFAULT_SPACE_TYPE_ICON_PATH = "/images/icons/space.gif"; + + private static Log logger = LogFactory.getLog(CreateSpaceWizard.class); + + protected static final String CREATEFROM_TEMPLATE = "template"; + protected static final String CREATEFROM_EXISTING = "existing"; + protected static final String CREATEFROM_SCRATCH = "scratch"; + + protected String spaceType; + protected String icon; + protected String createFrom; + protected NodeRef existingSpaceId; + protected String templateSpaceId; + protected String copyPolicy; + protected String name; + protected String title; + protected String description; + protected String templateName; + protected boolean saveAsTemplate; + protected List templates; + protected List folderTypes; + protected List folderTypeDescriptions; + + // the NodeRef of the node created during finish + protected NodeRef createdNode; + + // ------------------------------------------------------------------------------ + // Wizard implementation + + /** + * Initialises the wizard + */ + public void init(Map parameters) + { + super.init(parameters); + + // clear the cached query results + if (this.templates != null) + { + this.templates.clear(); + this.templates = null; + } + + // reset all variables + this.createFrom = CREATEFROM_SCRATCH; + this.spaceType = ContentModel.TYPE_FOLDER.toString(); + this.icon = null; + this.copyPolicy = "contents"; + this.existingSpaceId = null; + this.templateSpaceId = null; + this.name = null; + this.title = null; + this.description = null; + this.templateName = null; + this.saveAsTemplate = false; + } + + public String next() + { + // if the user has chosen to create the space from an existing + // space or from a template we need to find it's type to show + // the current set of icons. + if (this.createFrom.equals(CREATEFROM_EXISTING) && this.existingSpaceId != null) + { + this.spaceType = this.getNodeService().getType(this.existingSpaceId).toString(); + } + else if (this.createFrom.equals(CREATEFROM_TEMPLATE) && this.templateSpaceId != null) + { + NodeRef templateNode = new NodeRef(Repository.getStoreRef(), this.templateSpaceId); + this.spaceType = this.getNodeService().getType(templateNode).toString(); + } + + return null; + } + + @Override + protected String finishImpl(FacesContext context, String outcome) throws Exception + { + String newSpaceId = null; + + if (this.createFrom.equals(CREATEFROM_SCRATCH)) + { + // create the space (just create a folder for now) + NodeRef parentNodeRef; + String nodeId = this.navigator.getCurrentNodeId(); + if (nodeId == null) + { + parentNodeRef = this.getNodeService().getRootNode(Repository.getStoreRef()); + } + else + { + parentNodeRef = new NodeRef(Repository.getStoreRef(), nodeId); + } + + FileInfo fileInfo = getFileFolderService().create( + parentNodeRef, + this.name, + Repository.resolveToQName(this.spaceType)); + NodeRef nodeRef = fileInfo.getNodeRef(); + newSpaceId = nodeRef.getId(); + + if (logger.isDebugEnabled()) + logger.debug("Created folder node with name: " + this.name); + + // apply the uifacets aspect - icon, title and description props + Map uiFacetsProps = new HashMap(5); + uiFacetsProps.put(ApplicationModel.PROP_ICON, this.icon); + uiFacetsProps.put(ContentModel.PROP_TITLE, this.title); + uiFacetsProps.put(ContentModel.PROP_DESCRIPTION, this.description); + this.getNodeService().addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, uiFacetsProps); + + if (logger.isDebugEnabled()) + logger.debug("Added uifacets aspect with properties: " + uiFacetsProps); + + // remember the created node + this.createdNode = nodeRef; + } + else if (this.createFrom.equals(CREATEFROM_EXISTING)) + { + // copy the selected space and update the name, description and icon + NodeRef sourceNode = this.existingSpaceId; + NodeRef parentSpace = new NodeRef(Repository.getStoreRef(), this.navigator.getCurrentNodeId()); + + // copy from existing + NodeRef copiedNode = this.getFileFolderService().copy(sourceNode, parentSpace, this.name).getNodeRef(); + + // also need to set the new title, description and icon properties + this.getNodeService().setProperty(copiedNode, ContentModel.PROP_TITLE, this.title); + this.getNodeService().setProperty(copiedNode, ContentModel.PROP_DESCRIPTION, this.description); + this.getNodeService().setProperty(copiedNode, ApplicationModel.PROP_ICON, this.icon); + + newSpaceId = copiedNode.getId(); + + if (logger.isDebugEnabled()) + logger.debug("Copied space with id of " + sourceNode.getId() + " to " + this.name); + + // remember the created node + this.createdNode = copiedNode; + } + else if (this.createFrom.equals(CREATEFROM_TEMPLATE)) + { + // copy the selected space and update the name, description and icon + NodeRef sourceNode = new NodeRef(Repository.getStoreRef(), this.templateSpaceId); + NodeRef parentSpace = new NodeRef(Repository.getStoreRef(), this.navigator.getCurrentNodeId()); + // copy from the template + NodeRef copiedNode = this.getFileFolderService().copy(sourceNode, parentSpace, this.name).getNodeRef(); + // also need to set the new title, description and icon properties + this.getNodeService().setProperty(copiedNode, ContentModel.PROP_TITLE, this.title); + this.getNodeService().setProperty(copiedNode, ContentModel.PROP_DESCRIPTION, this.description); + this.getNodeService().setProperty(copiedNode, ApplicationModel.PROP_ICON, this.icon); + + newSpaceId = copiedNode.getId(); + + if (logger.isDebugEnabled()) + logger.debug("Copied template space with id of " + sourceNode.getId() + " to " + this.name); + + // remember the created node + this.createdNode = copiedNode; + } + + // if the user selected to save the space as a template space copy the new + // space to the templates folder + if (this.saveAsTemplate) + { + // get hold of the Templates node + DynamicNamespacePrefixResolver namespacePrefixResolver = new DynamicNamespacePrefixResolver(null); + namespacePrefixResolver.registerNamespace(NamespaceService.APP_MODEL_PREFIX, NamespaceService.APP_MODEL_1_0_URI); + + String xpath = Application.getRootPath(FacesContext.getCurrentInstance()) + "/" + + Application.getGlossaryFolderName(FacesContext.getCurrentInstance()) + "/" + + Application.getSpaceTemplatesFolderName(FacesContext.getCurrentInstance()); + + NodeRef rootNodeRef = this.getNodeService().getRootNode(Repository.getStoreRef()); + List templateNodeList = this.getSearchService().selectNodes( + rootNodeRef, + xpath, null, namespacePrefixResolver, false); + if (templateNodeList.size() == 1) + { + // get the first item in the list as we from test above there is only one! + NodeRef templateNode = templateNodeList.get(0); + NodeRef sourceNode = new NodeRef(Repository.getStoreRef(), newSpaceId); + // copy this to the template location + getFileFolderService().copy(sourceNode, templateNode, this.templateName); + } + } + + setTitle(""); + setDescription(""); + + return outcome; + } + + // ------------------------------------------------------------------------------ + // Bean Getters and Setters + + /** + * @return Returns the copyPolicy. + */ + public String getCopyPolicy() + { + return copyPolicy; + } + + /** + * @param copyPolicy The copyPolicy to set. + */ + public void setCopyPolicy(String copyPolicy) + { + this.copyPolicy = copyPolicy; + } + + /** + * @return Returns the createFrom. + */ + public String getCreateFrom() + { + return createFrom; + } + + /** + * @param createFrom The createFrom to set. + */ + public void setCreateFrom(String createFrom) + { + this.createFrom = createFrom; + } + + /** + * @return Returns the description. + */ + public String getDescription() + { + return description; + } + + /** + * @param description The description to set. + */ + public void setDescription(String description) + { + this.description = description; + } + + /** + * @return Returns the existingSpaceId. + */ + public NodeRef getExistingSpaceId() + { + return existingSpaceId; + } + + /** + * @param existingSpaceId The existingSpaceId to set. + */ + public void setExistingSpaceId(NodeRef existingSpaceId) + { + this.existingSpaceId = existingSpaceId; + } + + /** + * @return Returns the icon. + */ + public String getIcon() + { + return icon; + } + + /** + * @param icon The icon to set. + */ + public void setIcon(String icon) + { + this.icon = icon; + } + + /** + * @return Returns the name. + */ + public String getName() + { + return name; + } + + /** + * @param name The name to set. + */ + public void setName(String name) + { + this.name = name.trim(); + } + + /** + * @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 saveAsTemplate. + */ + public boolean isSaveAsTemplate() + { + return saveAsTemplate; + } + + /** + * @param saveAsTemplate The saveAsTemplate to set. + */ + public void setSaveAsTemplate(boolean saveAsTemplate) + { + this.saveAsTemplate = saveAsTemplate; + } + + /** + * @return Returns the spaceType. + */ + public String getSpaceType() + { + return spaceType; + } + + /** + * @param spaceType The spaceType to set. + */ + public void setSpaceType(String spaceType) + { + this.spaceType = spaceType; + } + + /** + * @return Returns the templateName. + */ + public String getTemplateName() + { + return templateName; + } + + /** + * @param templateName The templateName to set. + */ + public void setTemplateName(String templateName) + { + this.templateName = templateName; + } + + /** + * @return Returns the templateSpaceId. + */ + public String getTemplateSpaceId() + { + return templateSpaceId; + } + + /** + * @param templateSpaceId The templateSpaceId to set. + */ + public void setTemplateSpaceId(String templateSpaceId) + { + this.templateSpaceId = templateSpaceId; + } + + /** + * @return Returns the summary data for the wizard. + */ + public String getSummary() + { + String summaryCreateType = null; + ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); + + if (this.createFrom.equals(CREATEFROM_SCRATCH)) + { + summaryCreateType = bundle.getString(CREATEFROM_SCRATCH); + } + else if (this.createFrom.equals(CREATEFROM_EXISTING)) + { + summaryCreateType = bundle.getString("an_existing_space"); + } + else if (this.createFrom.equals(CREATEFROM_TEMPLATE)) + { + summaryCreateType = bundle.getString("a_template"); + } + +// String summarySaveAsTemplate = this.saveAsTemplate ? bundle.getString("yes") : bundle.getString("no"); +// bundle.getString("save_as_template"), bundle.getString("template_name")}, +// summarySaveAsTemplate, this.templateName + + String spaceTypeLabel = null; + for (UIListItem item : this.getFolderTypes()) + { + if (item.getValue().equals(this.spaceType)) + { + spaceTypeLabel = item.getLabel(); + break; + } + } + + return buildSummary( + new String[] {bundle.getString("space_type"), bundle.getString("name"), + bundle.getString("description"), bundle.getString("creating_from")}, + new String[] {spaceTypeLabel, this.name, Utils.encode(this.description), summaryCreateType}); + } + + /** + * @return Returns a list of template spaces currently in the system + */ + public List getTemplateSpaces() + { + if (this.templates == null) + { + this.templates = new ArrayList(); + + FacesContext context = FacesContext.getCurrentInstance(); + String xpath = Application.getRootPath(context) + "/" + Application.getGlossaryFolderName(context) + + "/" + Application.getSpaceTemplatesFolderName(context) + "/*"; + NodeRef rootNodeRef = this.getNodeService().getRootNode(Repository.getStoreRef()); + List results = this.getSearchService().selectNodes(rootNodeRef, xpath, null, this.getNamespaceService(), false); + + if (results.size() != 0) + { + // show templates of the type relating to the space we are creating + QName spaceType = QName.createQName(this.spaceType); + for (NodeRef assocRef : results) + { + Node childNode = new Node(assocRef); + if (this.getDictionaryService().isSubClass(childNode.getType(), spaceType)) + { + this.templates.add(new SelectItem(childNode.getId(), childNode.getName())); + } + } + + // make sure the list is sorted by the label + QuickSort sorter = new QuickSort(this.templates, "label", true, IDataContainer.SORT_CASEINSENSITIVE); + sorter.sort(); + } + + // add an entry (at the start) to instruct the user to select a template + this.templates.add(0, new SelectItem("none", Application.getMessage(FacesContext.getCurrentInstance(), "select_a_template"))); + } + + return this.templates; + } + + /** + * Returns a list of UIListItem objects representing the folder types + * and also constructs the list of descriptions for each type + * + * @return List of UIListItem components + */ + @SuppressWarnings("unchecked") + public List getFolderTypes() + { + if ((this.folderTypes == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) + { + FacesContext context = FacesContext.getCurrentInstance(); + this.folderTypes = new ArrayList(2); + this.folderTypeDescriptions = new ArrayList(2); + + // add the well known 'container space' type to start with + UIListItem defaultItem = new UIListItem(); + String defaultLabel = Application.getMessage(context, "container"); + defaultItem.setValue(ContentModel.TYPE_FOLDER.toString()); + defaultItem.setLabel(defaultLabel); + defaultItem.setTooltip(defaultLabel); + defaultItem.setImage(DEFAULT_SPACE_TYPE_ICON_PATH); + this.folderTypes.add(defaultItem); + + UIDescription defaultDesc = new UIDescription(); + defaultDesc.setControlValue(ContentModel.TYPE_FOLDER.toString()); + defaultDesc.setText(Application.getMessage(context, "container_desc")); + this.folderTypeDescriptions.add(defaultDesc); + + // add any configured content sub-types to the list + Config wizardCfg = Application.getConfigService(FacesContext.getCurrentInstance()). + getConfig("Space Wizards"); + if (wizardCfg != null) + { + ConfigElement typesCfg = wizardCfg.getConfigElement("folder-types"); + if (typesCfg != null) + { + for (ConfigElement child : typesCfg.getChildren()) + { + QName idQName = Repository.resolveToQName(child.getAttribute("name")); + TypeDefinition typeDef = this.getDictionaryService().getType(idQName); + + if (typeDef != null) + { + if (this.getDictionaryService().isSubClass(typeDef.getName(), ContentModel.TYPE_FOLDER)) + { + // try and get the label from config + String label = Utils.getDisplayLabel(context, child); + + // if there wasn't a client based label try and get it from the dictionary + if (label == null) + { + label = typeDef.getTitle(); + } + + // finally use the localname if we still haven't found a label + if (label == null) + { + label = idQName.getLocalName(); + } + + // resolve a description string for the type + String description = Utils.getDescription(context, child); + + // if we don't have a local description just use the label + if (description == null) + { + description = label; + } + + // extract the icon to use from the config + String icon = child.getAttribute("icon"); + if (icon == null || icon.length() == 0) + { + icon = DEFAULT_SPACE_TYPE_ICON_PATH; + } + + UIListItem item = new UIListItem(); + item.setValue(idQName.toString()); + item.setLabel(label); + item.setTooltip(label); + item.setImage(icon); + this.folderTypes.add(item); + + UIDescription desc = new UIDescription(); + desc.setControlValue(idQName.toString()); + desc.setText(description); + this.folderTypeDescriptions.add(desc); + } + else + { + logger.warn("Failed to add '" + child.getAttribute("name") + + "' to the list of folder types as the type is not a subtype of cm:folder"); + } + } + else + { + logger.warn("Failed to add '" + child.getAttribute("name") + + "' to the list of folder types as the type is not recognised"); + } + } + } + else + { + logger.warn("Could not find 'folder-types' configuration element"); + } + } + else + { + logger.warn("Could not find 'Space Wizards' configuration section"); + } + + } + + return this.folderTypes; + } + + /** + * Returns a list of UIDescription objects for the folder types + * + * @return A list of UIDescription objects + */ + public List getFolderTypeDescriptions() + { + if ((this.folderTypeDescriptions == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) + { + // call the getFolderType method to construct the list + getFolderTypes(); + } + + return this.folderTypeDescriptions; + } + + /** + * Returns a list of icons to allow the user to select from. + * The list can change according to the type of space being created. + * + * @return A list of icons + */ + @SuppressWarnings("unchecked") + public List getIcons() + { + // NOTE: we can't cache this list as it depends on the space type + // which the user can change during the advanced space wizard + + List icons = null; + List iconNames = new ArrayList(8); + + QName type = QName.createQName(this.spaceType); + String typePrefixForm = type.toPrefixString(this.getNamespaceService()); + + Config config = Application.getConfigService(FacesContext.getCurrentInstance()). + getConfig(typePrefixForm + " icons"); + if (config != null) + { + ConfigElement iconsCfg = config.getConfigElement("icons"); + if (iconsCfg != null) + { + boolean first = true; + for (ConfigElement icon : iconsCfg.getChildren()) + { + String iconName = icon.getAttribute("name"); + String iconPath = icon.getAttribute("path"); + + if (iconName != null && iconPath != null) + { + if (first) + { + // if this is the first icon create the list and make + // the first icon in the list the default + + icons = new ArrayList(iconsCfg.getChildCount()); + if (this.icon == null) + { + // set the default if it is not already + this.icon = iconName; + } + first = false; + } + + UIListItem item = new UIListItem(); + item.setValue(iconName); + item.setImage(iconPath); + icons.add(item); + iconNames.add(iconName); + } + } + } + } + + // if we didn't find any icons display one default choice + if (icons == null) + { + icons = new ArrayList(1); + this.icon = DEFAULT_SPACE_ICON_NAME; + + UIListItem item = new UIListItem(); + item.setValue(DEFAULT_SPACE_ICON_NAME); + item.setImage("/images/icons/space-icon-default.gif"); + icons.add(item); + iconNames.add(DEFAULT_SPACE_ICON_NAME); + } + + // make sure the current value for the icon is valid for the + // current list of icons about to be displayed + if (iconNames.contains(this.icon) == false) + { + this.icon = iconNames.get(0); + } + + return icons; + } + + // ------------------------------------------------------------------------------ + // Helper methods + + /** + * 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 + { + return MessageFormat.format(Application.getMessage( + FacesContext.getCurrentInstance(), "error_space"), + exception.getMessage()); + } + } +} diff --git a/source/java/org/alfresco/web/bean/spaces/DeleteSpaceDialog.java b/source/java/org/alfresco/web/bean/spaces/DeleteSpaceDialog.java index 0dc95e5e2b..47883bebb4 100644 --- a/source/java/org/alfresco/web/bean/spaces/DeleteSpaceDialog.java +++ b/source/java/org/alfresco/web/bean/spaces/DeleteSpaceDialog.java @@ -54,6 +54,8 @@ import org.apache.commons.logging.LogFactory; */ public class DeleteSpaceDialog extends BaseDialogBean { + private static final long serialVersionUID = 5960844637376808571L; + private static final Log logger = LogFactory.getLog(DeleteContentDialog.class); private static final String DELETE_ALL = "all"; @@ -84,22 +86,22 @@ public class DeleteSpaceDialog extends BaseDialogBean if (DELETE_ALL.equals(this.deleteMode)) { NodeRef nodeRef = node.getNodeRef(); - if (this.nodeService.exists(nodeRef)) + if (this.getNodeService().exists(nodeRef)) { // The node still exists - this.nodeService.deleteNode(node.getNodeRef()); + this.getNodeService().deleteNode(node.getNodeRef()); } } else { - List childRefs = this.nodeService.getChildAssocs(node.getNodeRef(), + List childRefs = this.getNodeService().getChildAssocs(node.getNodeRef(), ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); List deleteRefs = new ArrayList(childRefs.size()); for (ChildAssociationRef ref : childRefs) { NodeRef nodeRef = ref.getChildRef(); - if (this.nodeService.exists(nodeRef)) + if (this.getNodeService().exists(nodeRef)) { if (DELETE_CONTENTS.equals(this.deleteMode)) { @@ -108,18 +110,18 @@ public class DeleteSpaceDialog extends BaseDialogBean else { // find it's type so we can see if it's a node we are interested in - QName type = this.nodeService.getType(nodeRef); + QName type = this.getNodeService().getType(nodeRef); // make sure the type is defined in the data dictionary - TypeDefinition typeDef = this.dictionaryService.getType(type); + TypeDefinition typeDef = this.getDictionaryService().getType(type); if (typeDef != null) { if (DELETE_FOLDERS.equals(this.deleteMode)) { // look for folder type - if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_FOLDER) == true && - this.dictionaryService.isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false) + if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_FOLDER) == true && + this.getDictionaryService().isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false) { deleteRefs.add(nodeRef); } @@ -127,7 +129,7 @@ public class DeleteSpaceDialog extends BaseDialogBean else if (DELETE_FILES.equals(this.deleteMode)) { // look for content file type - if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT)) + if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_CONTENT)) { deleteRefs.add(nodeRef); } @@ -148,7 +150,7 @@ public class DeleteSpaceDialog extends BaseDialogBean tx = txService.getNonPropagatingUserTransaction(); tx.begin(); - this.nodeService.deleteNode(nodeRef); + this.getNodeService().deleteNode(nodeRef); tx.commit(); } @@ -172,7 +174,7 @@ public class DeleteSpaceDialog extends BaseDialogBean { Node node = this.browseBean.getActionSpace(); - if (node != null && this.nodeService.exists(node.getNodeRef()) == false) + if (node != null && this.getNodeService().exists(node.getNodeRef()) == false) { // remove this node from the breadcrumb if required this.browseBean.removeSpaceFromBreadcrumb(node); diff --git a/source/java/org/alfresco/web/bean/spaces/EditSimpleWorkflowDialog.java b/source/java/org/alfresco/web/bean/spaces/EditSimpleWorkflowDialog.java index 4aef3ccfa8..0c0c9c0560 100644 --- a/source/java/org/alfresco/web/bean/spaces/EditSimpleWorkflowDialog.java +++ b/source/java/org/alfresco/web/bean/spaces/EditSimpleWorkflowDialog.java @@ -73,7 +73,7 @@ public class EditSimpleWorkflowDialog extends BaseDialogBean public Object execute() throws Throwable { // firstly retrieve all the properties for the current node - Map updateProps = nodeService.getProperties(getNode().getNodeRef()); + Map updateProps = getNodeService().getProperties(getNode().getNodeRef()); // update the simple workflow properties @@ -127,7 +127,7 @@ public class EditSimpleWorkflowDialog extends BaseDialogBean } // set the properties on the node - nodeService.setProperties(getNode().getNodeRef(), updateProps); + getNodeService().setProperties(getNode().getNodeRef(), updateProps); return null; } }; diff --git a/source/java/org/alfresco/web/bean/spaces/EditSpaceDialog.java b/source/java/org/alfresco/web/bean/spaces/EditSpaceDialog.java index ddf68ee0da..342bba5f84 100644 --- a/source/java/org/alfresco/web/bean/spaces/EditSpaceDialog.java +++ b/source/java/org/alfresco/web/bean/spaces/EditSpaceDialog.java @@ -49,6 +49,8 @@ import org.alfresco.web.bean.repository.Node; */ public class EditSpaceDialog extends CreateSpaceDialog { + private static final long serialVersionUID = 6090397957979372269L; + protected Node editableNode; @Override @@ -92,16 +94,16 @@ public class EditSpaceDialog extends CreateSpaceDialog String name = (String)editedProps.get(ContentModel.PROP_NAME); if (name != null) { - this.fileFolderService.rename(nodeRef, name); + this.getFileFolderService().rename(nodeRef, name); } // get the current set of properties from the repository - Map repoProps = this.nodeService.getProperties(nodeRef); + Map repoProps = this.getNodeService().getProperties(nodeRef); // add the "uifacets" aspect if required, properties will get set below - if (this.nodeService.hasAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS) == false) + if (this.getNodeService().hasAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS) == false) { - this.nodeService.addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, null); + this.getNodeService().addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, null); } // overwrite the current properties with the edited ones @@ -118,7 +120,7 @@ public class EditSpaceDialog extends CreateSpaceDialog if ((propValue != null) && (propValue instanceof String) && (propValue.toString().length() == 0)) { - PropertyDefinition propDef = this.dictionaryService.getProperty(qname); + PropertyDefinition propDef = this.getDictionaryService().getProperty(qname); if (propDef != null) { if (propDef.getDataType().getName().equals(DataTypeDefinition.DOUBLE) || @@ -135,7 +137,7 @@ public class EditSpaceDialog extends CreateSpaceDialog } // send the properties back to the repository - this.nodeService.setProperties(nodeRef, repoProps); + this.getNodeService().setProperties(nodeRef, repoProps); // we also need to persist any association changes that may have been made @@ -145,7 +147,7 @@ public class EditSpaceDialog extends CreateSpaceDialog { for (AssociationRef assoc : typedAssoc.values()) { - this.nodeService.createAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName()); + this.getNodeService().createAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName()); } } @@ -155,7 +157,7 @@ public class EditSpaceDialog extends CreateSpaceDialog { for (AssociationRef assoc : typedAssoc.values()) { - this.nodeService.removeAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName()); + this.getNodeService().removeAssociation(assoc.getSourceRef(), assoc.getTargetRef(), assoc.getTypeQName()); } } @@ -165,7 +167,7 @@ public class EditSpaceDialog extends CreateSpaceDialog { for (ChildAssociationRef assoc : typedAssoc.values()) { - this.nodeService.addChild(assoc.getParentRef(), assoc.getChildRef(), assoc.getTypeQName(), assoc.getTypeQName()); + this.getNodeService().addChild(assoc.getParentRef(), assoc.getChildRef(), assoc.getTypeQName(), assoc.getTypeQName()); } } @@ -175,7 +177,7 @@ public class EditSpaceDialog extends CreateSpaceDialog { for (ChildAssociationRef assoc : typedAssoc.values()) { - this.nodeService.removeChild(assoc.getParentRef(), assoc.getChildRef()); + this.getNodeService().removeChild(assoc.getParentRef(), assoc.getChildRef()); } } diff --git a/source/java/org/alfresco/web/bean/spaces/InviteSpaceUsersWizard.java b/source/java/org/alfresco/web/bean/spaces/InviteSpaceUsersWizard.java index d6aebb9ce5..0b4187251f 100644 --- a/source/java/org/alfresco/web/bean/spaces/InviteSpaceUsersWizard.java +++ b/source/java/org/alfresco/web/bean/spaces/InviteSpaceUsersWizard.java @@ -37,6 +37,8 @@ import org.alfresco.web.bean.wizard.BaseInviteUsersWizard; */ public class InviteSpaceUsersWizard extends BaseInviteUsersWizard { + private static final long serialVersionUID = -1584891656721183347L; + /** Cache of available folder permissions */ Set folderPermissions = null; @@ -45,7 +47,7 @@ public class InviteSpaceUsersWizard extends BaseInviteUsersWizard { if (this.folderPermissions == null) { - this.folderPermissions = this.permissionService.getSettablePermissions(ContentModel.TYPE_FOLDER); + this.folderPermissions = getPermissionService().getSettablePermissions(ContentModel.TYPE_FOLDER); } return this.folderPermissions; diff --git a/source/java/org/alfresco/web/bean/spaces/RecentSpacesBean.java b/source/java/org/alfresco/web/bean/spaces/RecentSpacesBean.java index 83f8a92c5b..c7918ef243 100644 --- a/source/java/org/alfresco/web/bean/spaces/RecentSpacesBean.java +++ b/source/java/org/alfresco/web/bean/spaces/RecentSpacesBean.java @@ -56,6 +56,8 @@ import org.apache.commons.logging.LogFactory; */ public class RecentSpacesBean implements IContextListener { + private static final long serialVersionUID = -6405913558933664909L; + private static Log logger = LogFactory.getLog(RecentSpacesBean.class); /** The NavigationBean reference */ diff --git a/source/java/org/alfresco/web/bean/spaces/SpaceDetailsDialog.java b/source/java/org/alfresco/web/bean/spaces/SpaceDetailsDialog.java index ca7d64af54..d723d36887 100644 --- a/source/java/org/alfresco/web/bean/spaces/SpaceDetailsDialog.java +++ b/source/java/org/alfresco/web/bean/spaces/SpaceDetailsDialog.java @@ -56,6 +56,8 @@ import org.alfresco.web.ui.common.component.UIActionLink; */ public class SpaceDetailsDialog extends BaseDetailsBean implements NavigationSupport { + private static final long serialVersionUID = -6066782024875635443L; + private static final String MSG_HAS_FOLLOWING_CATEGORIES = "has_following_categories_space"; private static final String MSG_NO_CATEGORIES_APPLIED = "no_categories_applied_space"; private static final String MSG_ERROR_ASPECT_CLASSIFY = "error_aspect_classify_space"; @@ -126,7 +128,7 @@ public class SpaceDetailsDialog extends BaseDetailsBean implements NavigationSup if (ApplicationModel.TYPE_FOLDERLINK.equals(space.getType())) { NodeRef destRef = (NodeRef)space.getProperties().get(ContentModel.PROP_LINK_DESTINATION); - if (nodeService.exists(destRef)) + if (getNodeService().exists(destRef)) { space = new Node(destRef); } @@ -306,7 +308,7 @@ public class SpaceDetailsDialog extends BaseDetailsBean implements NavigationSup { // we know for now that the general classifiable aspect only will be // applied so we can retrive the categories property direclty - Collection categories = (Collection)this.nodeService.getProperty( + Collection categories = (Collection)getNodeService().getProperty( getSpace().getNodeRef(), ContentModel.PROP_CATEGORIES); if (categories == null || categories.size() == 0) @@ -321,10 +323,10 @@ public class SpaceDetailsDialog extends BaseDetailsBean implements NavigationSup builder.append("
      "); for (NodeRef ref : categories) { - if (this.nodeService.exists(ref)) + if (getNodeService().exists(ref)) { builder.append("
    • "); - builder.append(Repository.getNameForNode(this.nodeService, ref)); + builder.append(Repository.getNameForNode(getNodeService(), ref)); builder.append("
    • "); } } @@ -350,7 +352,7 @@ public class SpaceDetailsDialog extends BaseDetailsBean implements NavigationSup tx.begin(); // add the general classifiable aspect to the node - this.nodeService.addAspect(getSpace().getNodeRef(), ContentModel.ASPECT_GEN_CLASSIFIABLE, null); + getNodeService().addAspect(getSpace().getNodeRef(), ContentModel.ASPECT_GEN_CLASSIFIABLE, null); // commit the transaction tx.commit(); @@ -449,14 +451,14 @@ public class SpaceDetailsDialog extends BaseDetailsBean implements NavigationSup // apply the feedsource aspect if required if (getNode().hasAspect(ApplicationModel.ASPECT_FEEDSOURCE) == false) { - this.nodeService.addAspect(getNode().getNodeRef(), ApplicationModel.ASPECT_FEEDSOURCE, null); + getNodeService().addAspect(getNode().getNodeRef(), ApplicationModel.ASPECT_FEEDSOURCE, null); } // get the selected template Id from the Template Picker NodeRef templateRef = new NodeRef(Repository.getStoreRef(), this.rssTemplate); // set the template NodeRef into the templatable aspect property - this.nodeService.setProperty(getNode().getNodeRef(), ApplicationModel.PROP_FEEDTEMPLATE, templateRef); + getNodeService().setProperty(getNode().getNodeRef(), ApplicationModel.PROP_FEEDTEMPLATE, templateRef); // reset node details for next refresh of details page getNode().reset(); @@ -477,8 +479,8 @@ public class SpaceDetailsDialog extends BaseDetailsBean implements NavigationSup try { // clear template property - this.nodeService.setProperty(getNode().getNodeRef(), ApplicationModel.PROP_FEEDTEMPLATE, null); - this.nodeService.removeAspect(getNode().getNodeRef(), ApplicationModel.ASPECT_FEEDSOURCE); + getNodeService().setProperty(getNode().getNodeRef(), ApplicationModel.PROP_FEEDTEMPLATE, null); + getNodeService().removeAspect(getNode().getNodeRef(), ApplicationModel.ASPECT_FEEDSOURCE); // reset node details for next refresh of details page getNode().reset(); @@ -510,7 +512,8 @@ public class SpaceDetailsDialog extends BaseDetailsBean implements NavigationSup @Override public String getContainerSubTitle() { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + getSpace().getNodePath().toDisplayPath(nodeService, permissionService); + return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + + getSpace().getNodePath().toDisplayPath(getNodeService(), getPermissionService()); } public String getContainerTitle() diff --git a/source/java/org/alfresco/web/bean/trashcan/TrashcanDialog.java b/source/java/org/alfresco/web/bean/trashcan/TrashcanDialog.java index 5c18e0197e..478bfd79d5 100644 --- a/source/java/org/alfresco/web/bean/trashcan/TrashcanDialog.java +++ b/source/java/org/alfresco/web/bean/trashcan/TrashcanDialog.java @@ -73,6 +73,8 @@ import org.alfresco.web.ui.common.component.UIModeList; */ public class TrashcanDialog extends BaseDialogBean implements IContextListener { + private static final long serialVersionUID = -7783683979079046969L; + protected TrashcanDialogProperty property; private static final String MSG_DELETED_ITEMS_FOR = "deleted_items_for"; @@ -211,7 +213,7 @@ public class TrashcanDialog extends BaseDialogBean implements IContextListener sp.setQuery(query); sp.addStore(getArchiveRootRef().getStoreRef()); // the Archived Node store - results = searchService.query(sp); + results = getSearchService().query(sp); itemNodes = new ArrayList(results.length()); } @@ -221,11 +223,11 @@ public class TrashcanDialog extends BaseDialogBean implements IContextListener { NodeRef nodeRef = row.getNodeRef(); - if (nodeService.exists(nodeRef)) + if (getNodeService().exists(nodeRef)) { - QName type = nodeService.getType(nodeRef); + QName type = getNodeService().getType(nodeRef); - MapNode node = new MapNode(nodeRef, nodeService, false); + MapNode node = new MapNode(nodeRef, getNodeService(), false); node.addPropertyResolver("locationPath", resolverLocationPath); node.addPropertyResolver("displayPath", resolverDisplayPath); @@ -233,8 +235,8 @@ public class TrashcanDialog extends BaseDialogBean implements IContextListener node.addPropertyResolver("deletedBy", resolverDeletedBy); node.addPropertyResolver("isFolder", resolverIsFolder); - if (dictionaryService.isSubClass(type, ContentModel.TYPE_FOLDER) == true && - dictionaryService.isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false) + if (getDictionaryService().isSubClass(type, ContentModel.TYPE_FOLDER) == true && + getDictionaryService().isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false) { node.addPropertyResolver("typeIcon", this.resolverSmallIcon); } @@ -270,12 +272,14 @@ public class TrashcanDialog extends BaseDialogBean implements IContextListener private NodePropertyResolver resolverLocationPath = new NodePropertyResolver() { + private static final long serialVersionUID = -2501720368642759082L; + public Object get(Node node) { ChildAssociationRef childRef = (ChildAssociationRef)node.getProperties().get(ContentModel.PROP_ARCHIVED_ORIGINAL_PARENT_ASSOC); - if (nodeService.exists(childRef.getParentRef())) + if (getNodeService().exists(childRef.getParentRef())) { - return nodeService.getPath(childRef.getParentRef()); + return getNodeService().getPath(childRef.getParentRef()); } else { @@ -286,12 +290,14 @@ public class TrashcanDialog extends BaseDialogBean implements IContextListener private NodePropertyResolver resolverDisplayPath = new NodePropertyResolver() { + private static final long serialVersionUID = 9178556770343499694L; + public Object get(Node node) { ChildAssociationRef childRef = (ChildAssociationRef)node.getProperties().get(ContentModel.PROP_ARCHIVED_ORIGINAL_PARENT_ASSOC); - if (nodeService.exists(childRef.getParentRef())) + if (getNodeService().exists(childRef.getParentRef())) { - return Repository.getDisplayPath(nodeService.getPath(childRef.getParentRef()), true); + return Repository.getDisplayPath(getNodeService().getPath(childRef.getParentRef()), true); } else { @@ -302,6 +308,8 @@ public class TrashcanDialog extends BaseDialogBean implements IContextListener private NodePropertyResolver resolverFileType16 = new NodePropertyResolver() { + private static final long serialVersionUID = 7462526266770371703L; + public Object get(Node node) { return Utils.getFileTypeImage(node.getName(), true); @@ -310,6 +318,8 @@ public class TrashcanDialog extends BaseDialogBean implements IContextListener private NodePropertyResolver resolverSmallIcon = new NodePropertyResolver() { + private static final long serialVersionUID = 5528945140207247127L; + @SuppressWarnings("unchecked") public Object get(Node node) { @@ -321,6 +331,8 @@ public class TrashcanDialog extends BaseDialogBean implements IContextListener private NodePropertyResolver resolverFileType32 = new NodePropertyResolver() { + private static final long serialVersionUID = -5681639025578263060L; + public Object get(Node node) { return Utils.getFileTypeImage(node.getName(), false); @@ -329,6 +341,8 @@ public class TrashcanDialog extends BaseDialogBean implements IContextListener private NodePropertyResolver resolverLargeIcon = new NodePropertyResolver() { + private static final long serialVersionUID = -8334570770580388654L; + @SuppressWarnings("unchecked") public Object get(Node node) { @@ -340,6 +354,8 @@ public class TrashcanDialog extends BaseDialogBean implements IContextListener private NodePropertyResolver resolverMimetype = new NodePropertyResolver() { + private static final long serialVersionUID = -5892550146037635522L; + public Object get(Node node) { ContentData content = (ContentData)node.getProperties().get(ContentModel.PROP_CONTENT); @@ -349,6 +365,8 @@ public class TrashcanDialog extends BaseDialogBean implements IContextListener private NodePropertyResolver resolverSize = new NodePropertyResolver() { + private static final long serialVersionUID = -191591211947393578L; + public Object get(Node node) { ContentData content = (ContentData)node.getProperties().get(ContentModel.PROP_CONTENT); @@ -358,6 +376,8 @@ public class TrashcanDialog extends BaseDialogBean implements IContextListener private NodePropertyResolver resolverEncoding = new NodePropertyResolver() { + private static final long serialVersionUID = -1594354572323978873L; + public Object get(Node node) { ContentData content = (ContentData)node.getProperties().get(ContentModel.PROP_CONTENT); @@ -367,6 +387,8 @@ public class TrashcanDialog extends BaseDialogBean implements IContextListener private NodePropertyResolver resolverDeletedDate = new NodePropertyResolver() { + private static final long serialVersionUID = 3240286507786251191L; + public Object get(Node node) { return node.getProperties().get(ContentModel.PROP_ARCHIVED_DATE); @@ -375,6 +397,8 @@ public class TrashcanDialog extends BaseDialogBean implements IContextListener private NodePropertyResolver resolverDeletedBy = new NodePropertyResolver() { + private static final long serialVersionUID = -8678755146743606599L; + public Object get(Node node) { return node.getProperties().get(ContentModel.PROP_ARCHIVED_BY); @@ -383,9 +407,11 @@ public class TrashcanDialog extends BaseDialogBean implements IContextListener private NodePropertyResolver resolverIsFolder = new NodePropertyResolver() { + private static final long serialVersionUID = -9181535522349485509L; + public Object get(Node node) { - return dictionaryService.isSubClass(node.getType(), ContentModel.TYPE_FOLDER); + return getDictionaryService().isSubClass(node.getType(), ContentModel.TYPE_FOLDER); } }; @@ -457,8 +483,8 @@ public class TrashcanDialog extends BaseDialogBean implements IContextListener node.addPropertyResolver("size", resolverSize); node.addPropertyResolver("encoding", resolverEncoding); - if (dictionaryService.isSubClass(node.getType(), ContentModel.TYPE_FOLDER) == true && - dictionaryService.isSubClass(node.getType(), ContentModel.TYPE_SYSTEM_FOLDER) == false) + if (getDictionaryService().isSubClass(node.getType(), ContentModel.TYPE_FOLDER) == true && + getDictionaryService().isSubClass(node.getType(), ContentModel.TYPE_SYSTEM_FOLDER) == false) { node.addPropertyResolver("icon", this.resolverLargeIcon); } @@ -716,7 +742,7 @@ public class TrashcanDialog extends BaseDialogBean implements IContextListener // listed item rows buf.append(""); String img; - if (dictionaryService.isSubClass(node.getType(), ContentModel.TYPE_FOLDER)) + if (getDictionaryService().isSubClass(node.getType(), ContentModel.TYPE_FOLDER)) { String icon = (String)node.getProperties().get("app:icon"); img = "/images/icons/" + (icon != null ? icon + "-16.gif" : BrowseBean.SPACE_SMALL_DEFAULT + ".gif"); @@ -761,14 +787,14 @@ public class TrashcanDialog extends BaseDialogBean implements IContextListener if (archivedPath) { ChildAssociationRef childRef = (ChildAssociationRef)node.getProperties().get(ContentModel.PROP_ARCHIVED_ORIGINAL_PARENT_ASSOC); - if (nodeService.exists(childRef.getParentRef())) + if (getNodeService().exists(childRef.getParentRef())) { - buf.append(Repository.getNamePath(nodeService, nodeService.getPath(childRef.getParentRef()), null, "/", null)); + buf.append(Repository.getNamePath(getNodeService(), getNodeService().getPath(childRef.getParentRef()), null, "/", null)); } } else { - buf.append(Repository.getNamePath(nodeService, nodeService.getPath(node.getNodeRef()), null, "/", null)); + buf.append(Repository.getNamePath(getNodeService(), getNodeService().getPath(node.getNodeRef()), null, "/", null)); } buf.append(""); } diff --git a/source/java/org/alfresco/web/bean/users/ContentUsersBean.java b/source/java/org/alfresco/web/bean/users/ContentUsersBean.java index a9cdbce7fa..29698520d6 100644 --- a/source/java/org/alfresco/web/bean/users/ContentUsersBean.java +++ b/source/java/org/alfresco/web/bean/users/ContentUsersBean.java @@ -38,6 +38,8 @@ import org.alfresco.web.bean.repository.Node; */ public class ContentUsersBean extends UserMembersBean { + private static final long serialVersionUID = 5206400236997654181L; + private final static String MSG_MANAGE_CONTENT_USERS = "manage_content_users"; private final static String MSG_CONTENT_OWNER = "content_owner"; private final static String MSG_CLOSE= "close"; diff --git a/source/java/org/alfresco/web/bean/users/CreateUserWizard.java b/source/java/org/alfresco/web/bean/users/CreateUserWizard.java index 5d5e8b4553..8b4c92c630 100644 --- a/source/java/org/alfresco/web/bean/users/CreateUserWizard.java +++ b/source/java/org/alfresco/web/bean/users/CreateUserWizard.java @@ -215,7 +215,7 @@ public class CreateUserWizard extends BaseWizardBean String homeSpaceLabel = this.homeSpaceName; if (this.homeSpaceName.length() == 0 && this.homeSpaceLocation != null) { - homeSpaceLabel = Repository.getNameForNode(this.nodeService, this.homeSpaceLocation); + homeSpaceLabel = Repository.getNameForNode(this.getNodeService(), this.homeSpaceLocation); } String quotaLabel = ""; @@ -560,8 +560,8 @@ public class CreateUserWizard extends BaseWizardBean { String companyXPath = Application.getRootPath(FacesContext.getCurrentInstance()); - NodeRef rootNodeRef = this.nodeService.getRootNode(Repository.getStoreRef()); - List nodes = this.searchService.selectNodes(rootNodeRef, companyXPath, null, this.namespaceService, false); + NodeRef rootNodeRef = this.getNodeService().getRootNode(Repository.getStoreRef()); + List nodes = this.getSearchService().selectNodes(rootNodeRef, companyXPath, null, this.getNamespaceService(), false); if (nodes.size() == 0) { @@ -576,12 +576,12 @@ public class CreateUserWizard extends BaseWizardBean protected NodeRef getDefaultHomeSpace() { - if ((this.defaultHomeSpaceRef == null) || !nodeService.exists(this.defaultHomeSpaceRef)) + if ((this.defaultHomeSpaceRef == null) || !getNodeService().exists(this.defaultHomeSpaceRef)) { String defaultHomeSpacePath = Application.getClientConfig(FacesContext.getCurrentInstance()).getDefaultHomeSpacePath(); - NodeRef rootNodeRef = this.nodeService.getRootNode(Repository.getStoreRef()); - List nodes = this.searchService.selectNodes(rootNodeRef, defaultHomeSpacePath, null, this.namespaceService, false); + NodeRef rootNodeRef = this.getNodeService().getRootNode(Repository.getStoreRef()); + List nodes = this.getSearchService().selectNodes(rootNodeRef, defaultHomeSpacePath, null, this.getNamespaceService(), false); if (nodes.size() == 0) { @@ -612,10 +612,10 @@ public class CreateUserWizard extends BaseWizardBean // check for existance of home space with same name - return immediately // if it exists or throw an exception an give user chance to enter another name // TODO: this might be better replaced with an XPath query! - List children = this.nodeService.getChildAssocs(parentRef); + List children = this.getNodeService().getChildAssocs(parentRef); for (ChildAssociationRef ref : children) { - String childNodeName = (String) this.nodeService.getProperty(ref.getChildRef(), ContentModel.PROP_NAME); + String childNodeName = (String) this.getNodeService().getProperty(ref.getChildRef(), ContentModel.PROP_NAME); if (spaceName.equals(childNodeName)) { if (error) @@ -632,13 +632,13 @@ public class CreateUserWizard extends BaseWizardBean // space does not exist already, create a new Space under it with // the specified name String qname = QName.createValidLocalName(spaceName); - ChildAssociationRef assocRef = this.nodeService.createNode(parentRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, qname), + ChildAssociationRef assocRef = this.getNodeService().createNode(parentRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, qname), ContentModel.TYPE_FOLDER); NodeRef nodeRef = assocRef.getChildRef(); // set the name property on the node - this.nodeService.setProperty(nodeRef, ContentModel.PROP_NAME, spaceName); + this.getNodeService().setProperty(nodeRef, ContentModel.PROP_NAME, spaceName); if (logger.isDebugEnabled()) logger.debug("Created Home Space for with name: " + spaceName); @@ -647,7 +647,7 @@ public class CreateUserWizard extends BaseWizardBean Map uiFacetsProps = new HashMap(3); uiFacetsProps.put(ApplicationModel.PROP_ICON, CreateSpaceWizard.DEFAULT_SPACE_ICON_NAME); uiFacetsProps.put(ContentModel.PROP_TITLE, spaceName); - this.nodeService.addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, uiFacetsProps); + this.getNodeService().addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, uiFacetsProps); setupHomeSpacePermissions(nodeRef); diff --git a/source/java/org/alfresco/web/bean/users/DeleteUserDialog.java b/source/java/org/alfresco/web/bean/users/DeleteUserDialog.java index 58a8f743cd..ba5dcbb656 100644 --- a/source/java/org/alfresco/web/bean/users/DeleteUserDialog.java +++ b/source/java/org/alfresco/web/bean/users/DeleteUserDialog.java @@ -139,7 +139,7 @@ public class DeleteUserDialog extends BaseDialogBean { params.addStore(Repository.getStoreRef()); params.setQuery(query); - List people = this.searchService.query(params).getNodeRefs(); + List people = this.getSearchService().query(params).getNodeRefs(); if (logger.isDebugEnabled()) logger.debug("Found " + people.size() + " users"); diff --git a/source/java/org/alfresco/web/bean/users/EditUserDetailsDialog.java b/source/java/org/alfresco/web/bean/users/EditUserDetailsDialog.java index 958d850ba8..6f83d39e77 100644 --- a/source/java/org/alfresco/web/bean/users/EditUserDetailsDialog.java +++ b/source/java/org/alfresco/web/bean/users/EditUserDetailsDialog.java @@ -83,7 +83,7 @@ public class EditUserDetailsDialog extends BaseDialogBean { ServiceRegistry services = Repository.getServiceRegistry(FacesContext.getCurrentInstance()); DictionaryService dd = services.getDictionaryService(); - Map props = this.nodeService.getProperties(getPerson().getNodeRef()); + Map props = getNodeService().getProperties(getPerson().getNodeRef()); for (String key : getPerson().getProperties().keySet()) { QName propQName = QName.createQName(key); @@ -95,7 +95,7 @@ public class EditUserDetailsDialog extends BaseDialogBean // persist all property changes NodeRef personRef = getPerson().getNodeRef(); - this.nodeService.setProperties(personRef, props); + this.getNodeService().setProperties(personRef, props); // save person description content field if (this.personDescription != null) @@ -109,16 +109,16 @@ public class EditUserDetailsDialog extends BaseDialogBean // setup user avatar association if (this.photoRef != null) { - List refs = this.nodeService.getTargetAssocs(personRef, ContentModel.ASSOC_AVATAR); + List refs = this.getNodeService().getTargetAssocs(personRef, ContentModel.ASSOC_AVATAR); // remove old association if it exists if (refs.size() == 1) { NodeRef existingRef = refs.get(0).getTargetRef(); - this.nodeService.removeAssociation( + this.getNodeService().removeAssociation( personRef, existingRef, ContentModel.ASSOC_AVATAR); } // setup new association - this.nodeService.createAssociation(personRef, this.photoRef, ContentModel.ASSOC_AVATAR); + this.getNodeService().createAssociation(personRef, this.photoRef, ContentModel.ASSOC_AVATAR); } // if the above calls were successful, then reset Person Node in the session @@ -195,7 +195,7 @@ public class EditUserDetailsDialog extends BaseDialogBean { if (this.photoRef == null) { - List refs = this.nodeService.getTargetAssocs(person.getNodeRef(), ContentModel.ASSOC_AVATAR); + List refs = this.getNodeService().getTargetAssocs(person.getNodeRef(), ContentModel.ASSOC_AVATAR); if (refs.size() == 1) { this.photoRef = refs.get(0).getTargetRef(); diff --git a/source/java/org/alfresco/web/bean/users/EditUserWizard.java b/source/java/org/alfresco/web/bean/users/EditUserWizard.java index 6c20e67bc5..827d9297d2 100644 --- a/source/java/org/alfresco/web/bean/users/EditUserWizard.java +++ b/source/java/org/alfresco/web/bean/users/EditUserWizard.java @@ -92,14 +92,14 @@ public class EditUserWizard extends CreateUserWizard // calculate home space name and parent space Id from homeFolderId this.homeSpaceLocation = null; // default to Company root space NodeRef homeFolderRef = (NodeRef) props.get("homeFolder"); - if (this.nodeService.exists(homeFolderRef) == true) + if (this.getNodeService().exists(homeFolderRef) == true) { - ChildAssociationRef childAssocRef = this.nodeService.getPrimaryParent(homeFolderRef); + ChildAssociationRef childAssocRef = this.getNodeService().getPrimaryParent(homeFolderRef); NodeRef parentRef = childAssocRef.getParentRef(); - if (this.nodeService.getRootNode(Repository.getStoreRef()).equals(parentRef) == false) + if (this.getNodeService().getRootNode(Repository.getStoreRef()).equals(parentRef) == false) { this.homeSpaceLocation = parentRef; - this.homeSpaceName = Repository.getNameForNode(nodeService, homeFolderRef); + this.homeSpaceName = Repository.getNameForNode(getNodeService(), homeFolderRef); } else { @@ -120,20 +120,20 @@ public class EditUserWizard extends CreateUserWizard // update the existing node in the repository NodeRef nodeRef = properties.getPerson().getNodeRef(); - Map props = this.nodeService.getProperties(nodeRef); + Map props = this.getNodeService().getProperties(nodeRef); props.put(ContentModel.PROP_USERNAME, this.userName); props.put(ContentModel.PROP_FIRSTNAME, this.firstName); props.put(ContentModel.PROP_LASTNAME, this.lastName); // calculate whether we need to move the old home space or create new NodeRef newHomeFolderRef; - NodeRef oldHomeFolderRef = (NodeRef) this.nodeService.getProperty(nodeRef, ContentModel.PROP_HOMEFOLDER); + NodeRef oldHomeFolderRef = (NodeRef) this.getNodeService().getProperty(nodeRef, ContentModel.PROP_HOMEFOLDER); boolean moveHomeSpace = false; boolean renameHomeSpace = false; - if (oldHomeFolderRef != null && this.nodeService.exists(oldHomeFolderRef) == true) + if (oldHomeFolderRef != null && this.getNodeService().exists(oldHomeFolderRef) == true) { // the original home folder ref exists so may need moving if it has been changed - ChildAssociationRef childAssocRef = this.nodeService.getPrimaryParent(oldHomeFolderRef); + ChildAssociationRef childAssocRef = this.getNodeService().getPrimaryParent(oldHomeFolderRef); NodeRef currentHomeSpaceLocation = childAssocRef.getParentRef(); if (this.homeSpaceName.length() != 0) { @@ -143,7 +143,7 @@ public class EditUserWizard extends CreateUserWizard moveHomeSpace = true; } - String oldHomeSpaceName = Repository.getNameForNode(nodeService, oldHomeFolderRef); + String oldHomeSpaceName = Repository.getNameForNode(getNodeService(), oldHomeFolderRef); if (oldHomeSpaceName.equals(this.homeSpaceName) == false && oldHomeFolderRef.equals(this.homeSpaceLocation) == false) { renameHomeSpace = true; @@ -180,15 +180,15 @@ public class EditUserWizard extends CreateUserWizard // either move, rename or both required if (moveHomeSpace == true) { - this.nodeService - .moveNode(oldHomeFolderRef, this.homeSpaceLocation, ContentModel.ASSOC_CONTAINS, this.nodeService.getPrimaryParent(oldHomeFolderRef).getQName()); + this.getNodeService() + .moveNode(oldHomeFolderRef, this.homeSpaceLocation, ContentModel.ASSOC_CONTAINS, this.getNodeService().getPrimaryParent(oldHomeFolderRef).getQName()); } newHomeFolderRef = oldHomeFolderRef; // ref ID doesn't change if (renameHomeSpace == true) { // change HomeSpace node name - this.nodeService.setProperty(newHomeFolderRef, ContentModel.PROP_NAME, this.homeSpaceName); + this.getNodeService().setProperty(newHomeFolderRef, ContentModel.PROP_NAME, this.homeSpaceName); } } @@ -200,7 +200,7 @@ public class EditUserWizard extends CreateUserWizard props.put(ContentModel.PROP_LOCATION, this.location); props.put(ContentModel.PROP_PRESENCEPROVIDER, this.presenceProvider); props.put(ContentModel.PROP_PRESENCEUSERNAME, this.presenceUsername); - this.nodeService.setProperties(nodeRef, props); + this.getNodeService().setProperties(nodeRef, props); // TODO: RESET HomeSpace Ref found in top-level navigation bar! // NOTE: not need cos only admin can do this? diff --git a/source/java/org/alfresco/web/bean/users/EmailSpaceUsersDialog.java b/source/java/org/alfresco/web/bean/users/EmailSpaceUsersDialog.java index 38b2b7bdea..cfc6ca0450 100644 --- a/source/java/org/alfresco/web/bean/users/EmailSpaceUsersDialog.java +++ b/source/java/org/alfresco/web/bean/users/EmailSpaceUsersDialog.java @@ -50,6 +50,7 @@ import org.alfresco.service.cmr.security.PersonService; 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.FacesHelper; import org.alfresco.web.bean.TemplateMailHelperBean; import org.alfresco.web.bean.dialog.BaseDialogBean; import org.alfresco.web.bean.repository.MapNode; @@ -71,6 +72,8 @@ import org.springframework.mail.javamail.JavaMailSender; */ public class EmailSpaceUsersDialog extends BaseDialogBean implements IContextListener { + private static final long serialVersionUID = 7925542142116904285L; + private static final String PROP_DUPLICATE = "duplicate"; private static final String PROP_PARENT = "parent"; private static final String PROP_ID = "id"; @@ -83,10 +86,10 @@ public class EmailSpaceUsersDialog extends BaseDialogBean implements IContextLis private static final String PROP_USERNAME = "userName"; /** Injected Bean references */ - protected PermissionService permissionService; - protected PersonService personService; - protected AuthorityService authorityService; - protected JavaMailSender mailSender; + transient private PermissionService permissionService; + transient private PersonService personService; + transient private AuthorityService authorityService; + transient private JavaMailSender mailSender; /** Helper providing template based mailing facilities */ protected TemplateMailHelperBean mailHelper; @@ -114,8 +117,8 @@ public class EmailSpaceUsersDialog extends BaseDialogBean implements IContextLis super.init(parameters); mailHelper = new TemplateMailHelperBean(); - mailHelper.setMailSender(mailSender); - mailHelper.setNodeService(nodeService); + mailHelper.setMailSender(getMailSender()); + mailHelper.setNodeService(getNodeService()); } /** @@ -129,7 +132,7 @@ public class EmailSpaceUsersDialog extends BaseDialogBean implements IContextLis // calculate the 'from' email address User user = Application.getCurrentUser(context); - String from = (String)this.nodeService.getProperty(user.getPerson(), ContentModel.PROP_EMAIL); + String from = (String)this.getNodeService().getProperty(user.getPerson(), ContentModel.PROP_EMAIL); if (from == null || from.length() == 0) { // if the user does not have an email address get the default one from the config service @@ -148,12 +151,12 @@ public class EmailSpaceUsersDialog extends BaseDialogBean implements IContextLis AuthorityType authType = AuthorityType.getAuthorityType(authority); if (authType.equals(AuthorityType.USER)) { - if (selected == true && this.personService.personExists(authority)) + if (selected == true && this.getPersonService().personExists(authority)) { if (mailedAuthorities.contains(authority) == false) { this.mailHelper.notifyUser( - this.personService.getPerson(authority), spaceRef, from, (String)node.get(PROP_ROLES)); + this.getPersonService().getPerson(authority), spaceRef, from, (String)node.get(PROP_ROLES)); mailedAuthorities.add(authority); } } @@ -165,15 +168,15 @@ public class EmailSpaceUsersDialog extends BaseDialogBean implements IContextLis if (expanded == false && selected == true) { // notify all members of the group - Set users = this.authorityService.getContainedAuthorities(AuthorityType.USER, authority, false); + Set users = this.getAuthorityService().getContainedAuthorities(AuthorityType.USER, authority, false); for (String userAuth : users) { - if (this.personService.personExists(userAuth) == true) + if (this.getPersonService().personExists(userAuth) == true) { if (mailedAuthorities.contains(userAuth) == false) { this.mailHelper.notifyUser( - this.personService.getPerson(userAuth), spaceRef, from, (String)node.get(PROP_ROLES)); + this.getPersonService().getPerson(userAuth), spaceRef, from, (String)node.get(PROP_ROLES)); mailedAuthorities.add(userAuth); } } @@ -225,6 +228,15 @@ public class EmailSpaceUsersDialog extends BaseDialogBean implements IContextLis this.permissionService = permissionService; } + protected PermissionService getPermissionService() + { + if (permissionService == null) + { + permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService(); + } + return permissionService; + } + /** * @param personService The PersonService to set */ @@ -233,6 +245,15 @@ public class EmailSpaceUsersDialog extends BaseDialogBean implements IContextLis this.personService = personService; } + protected PersonService getPersonService() + { + if (personService == null) + { + personService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPersonService(); + } + return personService; + } + /** * @param mailSender The JavaMailSender to set. */ @@ -241,6 +262,15 @@ public class EmailSpaceUsersDialog extends BaseDialogBean implements IContextLis this.mailSender = mailSender; } + protected JavaMailSender getMailSender() + { + if (mailSender == null) + { + mailSender = (JavaMailSender) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "mailService"); + } + return mailSender; + } + /** * @param authorityService The AuthorityService to set. */ @@ -249,6 +279,15 @@ public class EmailSpaceUsersDialog extends BaseDialogBean implements IContextLis this.authorityService = authorityService; } + protected AuthorityService getAuthorityService() + { + if (authorityService == null) + { + authorityService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAuthorityService(); + } + return authorityService; + } + /** * @return The space to email users for */ @@ -285,7 +324,7 @@ public class EmailSpaceUsersDialog extends BaseDialogBean implements IContextLis NodeRef spaceRef = getSpace().getNodeRef(); while (spaceRef != null) { - Set permissions = permissionService.getAllSetPermissions(spaceRef); + Set permissions = getPermissionService().getAllSetPermissions(spaceRef); for (AccessPermission permission : permissions) { // we are only interested in Allow and not Guest/Everyone/owner @@ -311,9 +350,9 @@ public class EmailSpaceUsersDialog extends BaseDialogBean implements IContextLis } // walk parent inheritance chain until root or no longer inherits - if (permissionService.getInheritParentPermissions(spaceRef)) + if (getPermissionService().getInheritParentPermissions(spaceRef)) { - spaceRef = nodeService.getPrimaryParent(spaceRef).getParentRef(); + spaceRef = getNodeService().getPrimaryParent(spaceRef).getParentRef(); } else { @@ -426,7 +465,7 @@ public class EmailSpaceUsersDialog extends BaseDialogBean implements IContextLis boolean selected = (Boolean)userGroup.get(PROP_SELECTED); String currentAuthority = Application.getCurrentUser(FacesContext.getCurrentInstance()).getUserName(); - Set authorities = authorityService.getContainedAuthorities( + Set authorities = getAuthorityService().getContainedAuthorities( null, pickerEvent.Authority, true); for (String authority : authorities) { @@ -511,9 +550,9 @@ public class EmailSpaceUsersDialog extends BaseDialogBean implements IContextLis Map node = null; if (AuthorityType.getAuthorityType(authority) == AuthorityType.GUEST || - this.personService.personExists(authority)) + this.getPersonService().personExists(authority)) { - NodeRef nodeRef = this.personService.getPerson(authority); + NodeRef nodeRef = this.getPersonService().getPerson(authority); if (nodeRef != null) { // create our Node representation @@ -569,4 +608,5 @@ public class EmailSpaceUsersDialog extends BaseDialogBean implements IContextLis return node; } + } diff --git a/source/java/org/alfresco/web/bean/users/SpaceUsersBean.java b/source/java/org/alfresco/web/bean/users/SpaceUsersBean.java index ca2637e2da..fa9d70f2f7 100644 --- a/source/java/org/alfresco/web/bean/users/SpaceUsersBean.java +++ b/source/java/org/alfresco/web/bean/users/SpaceUsersBean.java @@ -38,6 +38,8 @@ import org.alfresco.web.bean.repository.Node; */ public class SpaceUsersBean extends UserMembersBean { + private static final long serialVersionUID = -4847219834289259559L; + private final static String MSG_MANAGE_INVITED_USERS = "manage_invited_users"; private final static String MSG_SPACE_OWNER = "space_owner"; private final static String MSG_CLOSE= "close"; diff --git a/source/java/org/alfresco/web/bean/users/UserMembersBean.java b/source/java/org/alfresco/web/bean/users/UserMembersBean.java index d777a498d5..a25c30af18 100644 --- a/source/java/org/alfresco/web/bean/users/UserMembersBean.java +++ b/source/java/org/alfresco/web/bean/users/UserMembersBean.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.bean.users; +import java.io.Serializable; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collections; @@ -42,7 +43,6 @@ import javax.faces.model.ListDataModel; import javax.transaction.UserTransaction; import org.alfresco.model.ContentModel; -import org.alfresco.repo.transaction.AlfrescoTransactionSupport; import org.alfresco.service.cmr.repository.InvalidNodeRefException; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; @@ -81,22 +81,22 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext private static final String OUTCOME_FINISH = "finish"; /** NodeService bean reference */ - protected NodeService nodeService; + transient private NodeService nodeService; /** SearchService bean reference */ - protected SearchService searchService; + transient private SearchService searchService; /** PermissionService bean reference */ - protected PermissionService permissionService; + transient private PermissionService permissionService; /** PersonService bean reference */ - protected PersonService personService; + transient private PersonService personService; /** BrowseBean bean refernce */ protected BrowseBean browseBean; /** OwnableService bean reference */ - protected OwnableService ownableService; + transient private OwnableService ownableService; /** Component reference for Users RichList control */ private UIRichList usersRichList; @@ -108,7 +108,7 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext private String personName = null; /** datamodel for table of roles for current person */ - private DataModel personRolesDataModel = null; + private transient DataModel personRolesDataModel = null; /** roles for current person */ private List personRoles = null; @@ -144,6 +144,15 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext { this.nodeService = nodeService; } + + protected NodeService getNodeService() + { + if (nodeService == null) + { + nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + } + return nodeService; + } /** * @param searchService The search service @@ -153,6 +162,15 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext this.searchService = searchService; } + protected SearchService getSearchService() + { + if (searchService == null) + { + searchService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSearchService(); + } + return searchService; + } + /** * @param permissionService The PermissionService to set. */ @@ -161,6 +179,15 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext this.permissionService = permissionService; } + protected PermissionService getPermissionService() + { + if (permissionService == null) + { + permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService(); + } + return permissionService; + } + /** * @param ownableService The ownableService to set. */ @@ -169,6 +196,15 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext this.ownableService = ownableService; } + protected OwnableService getOwnableService() + { + if (ownableService == null) + { + ownableService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getOwnableService(); + } + return ownableService; + } + /** * @param personService The personService to set. */ @@ -177,6 +213,15 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext this.personService = personService; } + protected PersonService getPersonService() + { + if (personService == null) + { + personService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPersonService(); + } + return personService; + } + /** * @param browseBean The BrowseBean to set. */ @@ -263,7 +308,7 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext */ public boolean isInheritPermissions() { - return this.permissionService.getInheritParentPermissions(getNode().getNodeRef()); + return this.getPermissionService().getInheritParentPermissions(getNode().getNodeRef()); } /** @@ -279,7 +324,7 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext */ public String getOwner() { - return this.ownableService.getOwner(getNode().getNodeRef()); + return this.getOwnableService().getOwner(getNode().getNodeRef()); } /** @@ -301,7 +346,7 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext // for any authentication instance (user/group). // Then combine them into a single list for each authentication found. Map> permissionMap = new HashMap>(8, 1.0f); - Set permissions = permissionService.getAllSetPermissions(getNode().getNodeRef()); + Set permissions = getPermissionService().getAllSetPermissions(getNode().getNodeRef()); for (AccessPermission permission : permissions) { // we are only interested in Allow and not groups/owner etc. @@ -332,9 +377,9 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext { // check if we are dealing with a person (User Authority) if (AuthorityType.getAuthorityType(authority) == AuthorityType.GUEST || - personService.personExists(authority)) + getPersonService().personExists(authority)) { - NodeRef nodeRef = personService.getPerson(authority); + NodeRef nodeRef = getPersonService().getPerson(authority); if (nodeRef != null) { // create our Node representation @@ -482,10 +527,10 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext { try { - if (this.personService.personExists(authority)) + if (this.getPersonService().personExists(authority)) { // create the node ref, then our node representation - NodeRef ref = personService.getPerson(authority); + NodeRef ref = getPersonService().getPerson(authority); Node node = new Node(ref); // setup convience function for current user full name @@ -499,7 +544,7 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext // setup roles for this Authority List userPermissions = new ArrayList(4); - Set permissions = permissionService.getAllSetPermissions(getNode().getNodeRef()); + Set permissions = getPermissionService().getAllSetPermissions(getNode().getNodeRef()); if (permissions != null) { for (AccessPermission permission : permissions) @@ -546,7 +591,7 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext { // change the value to the new selected value boolean inheritPermissions = (Boolean)event.getNewValue(); - this.permissionService.setInheritParentPermissions(getNode().getNodeRef(), inheritPermissions); + this.getPermissionService().setInheritParentPermissions(getNode().getNodeRef(), inheritPermissions); // inform the user that the change occured FacesContext context = FacesContext.getCurrentInstance(); @@ -563,7 +608,7 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext // see if the user still has permissions to the node, if not, we need // to go back to the root of the current "area" by simulating the user // pressing the top level navigation button i.e. My Home - if (this.permissionService.hasPermission(getNode().getNodeRef(), + if (this.getPermissionService().hasPermission(getNode().getNodeRef(), PermissionService.CHANGE_PERMISSIONS) == AccessStatus.ALLOWED) { FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg); @@ -625,7 +670,7 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext */ public void removeRole(ActionEvent event) { - PermissionWrapper wrapper = (PermissionWrapper)this.personRolesDataModel.getRowData(); + PermissionWrapper wrapper = (PermissionWrapper)getPersonRolesDataModel().getRowData(); if (wrapper != null) { this.personRoles.remove(wrapper); @@ -656,10 +701,10 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext // clear the currently set permissions for this user // and add each of the new permissions in turn NodeRef nodeRef = getNode().getNodeRef(); - this.permissionService.clearPermission(nodeRef, getPersonAuthority()); + this.getPermissionService().clearPermission(nodeRef, getPersonAuthority()); for (PermissionWrapper wrapper : personRoles) { - this.permissionService.setPermission( + this.getPermissionService().setPermission( nodeRef, getPersonAuthority(), wrapper.getPermission(), @@ -699,7 +744,7 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext if (getPersonAuthority() != null) { // clear permissions for the specified Authority - this.permissionService.clearPermission(getNode().getNodeRef(), getPersonAuthority()); + this.getPermissionService().clearPermission(getNode().getNodeRef(), getPersonAuthority()); } // commit the transaction @@ -716,7 +761,7 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext // see if the user still has permissions to the node, if not, we need // to go back to the root of the current "area" by simulating the user // pressing the top level navigation button i.e. My Home - if (this.permissionService.hasPermission(getNode().getNodeRef(), + if (this.getPermissionService().hasPermission(getNode().getNodeRef(), PermissionService.CHANGE_PERMISSIONS) == AccessStatus.DENIED) { NavigationBean nb = (NavigationBean)FacesHelper.getManagedBean( @@ -753,8 +798,10 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext /** * Wrapper class for list data model to display current roles for user */ - public static class PermissionWrapper + public static class PermissionWrapper implements Serializable { + private static final long serialVersionUID = 953727068432918977L; + public PermissionWrapper(String permission, String label) { this.permission = permission; @@ -774,4 +821,5 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext private String label; private String permission; } + } diff --git a/source/java/org/alfresco/web/bean/users/UserPreferencesBean.java b/source/java/org/alfresco/web/bean/users/UserPreferencesBean.java index c79f57c34d..e498cfbd7e 100644 --- a/source/java/org/alfresco/web/bean/users/UserPreferencesBean.java +++ b/source/java/org/alfresco/web/bean/users/UserPreferencesBean.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.bean.users; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -44,6 +45,7 @@ import org.alfresco.web.app.context.UIContextService; import org.alfresco.web.app.servlet.FacesHelper; import org.alfresco.web.bean.NavigationBean; import org.alfresco.web.bean.repository.PreferencesService; +import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.config.LanguagesConfigElement; /** @@ -51,8 +53,10 @@ import org.alfresco.web.config.LanguagesConfigElement; * * @author Kevin Roast */ -public class UserPreferencesBean +public class UserPreferencesBean implements Serializable { + private static final long serialVersionUID = -1262481849503163054L; + private static final String PREF_STARTLOCATION = "start-location"; private static final String PREF_CONTENTFILTERLANGUAGE = "content-filter-language"; @@ -70,13 +74,13 @@ public class UserPreferencesBean private String contentFilterLanguage = null; /** the injected MultilingualContentService */ - MultilingualContentService multilingualContentService; + transient private MultilingualContentService multilingualContentService; /** the injected ContentFilterLanguagesService */ - ContentFilterLanguagesService contentFilterLanguagesService; + transient private ContentFilterLanguagesService contentFilterLanguagesService; /** the injected NodeService */ - NodeService nodeService; + transient private NodeService nodeService; /** * @return the list of available languages @@ -197,7 +201,7 @@ public class UserPreferencesBean ResourceBundle msg = Application.getBundle(fc); // get the list of filter languages - List languages = contentFilterLanguagesService.getFilterLanguages(); + List languages = getContentFilterLanguagesService().getFilterLanguages(); // set the item selection list SelectItem[] items = new SelectItem[(includeAllLanguages) ? languages.size() + 1 : languages.size()]; @@ -213,7 +217,7 @@ public class UserPreferencesBean for (String lang : languages) { - String label = contentFilterLanguagesService.getLabelByCode(lang); + String label = getContentFilterLanguagesService().getLabelByCode(lang); items[idx] = new SelectItem(lang, label); idx++; } @@ -231,7 +235,7 @@ public class UserPreferencesBean public SelectItem[] getAvailablesContentFilterLanguages(NodeRef translation, boolean returnTranslationLanguage) { // get the list of missing translation of this node - List missingLocales = multilingualContentService.getMissingTranslations(translation, returnTranslationLanguage); + List missingLocales = getMultilingualContentService().getMissingTranslations(translation, returnTranslationLanguage); // set the item selection list SelectItem[] items = new SelectItem[missingLocales.size()]; @@ -239,7 +243,7 @@ public class UserPreferencesBean for(Locale locale : missingLocales) { - String label = contentFilterLanguagesService.getLabelByCode(locale.getLanguage()); + String label = getContentFilterLanguagesService().getLabelByCode(locale.getLanguage()); items[idx] = new SelectItem( locale.toString(), @@ -347,6 +351,11 @@ public class UserPreferencesBean */ public MultilingualContentService getMultilingualContentService() { + if (multilingualContentService == null) + { + multilingualContentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMultilingualContentService(); + } + return multilingualContentService; } @@ -364,6 +373,11 @@ public class UserPreferencesBean */ public NodeService getNodeService() { + if (nodeService == null) + { + nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + } + return nodeService; } @@ -383,4 +397,16 @@ public class UserPreferencesBean { this.contentFilterLanguagesService = contentFilterLanguagesService; } + + /** + * @return the contentFilterLanguagesService + */ + ContentFilterLanguagesService getContentFilterLanguagesService() + { + if (contentFilterLanguagesService == null) + { + contentFilterLanguagesService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentFilterLanguagesService(); + } + return contentFilterLanguagesService; + } } diff --git a/source/java/org/alfresco/web/bean/users/UserShortcutsBean.java b/source/java/org/alfresco/web/bean/users/UserShortcutsBean.java index af80bf149e..d84e3bca72 100644 --- a/source/java/org/alfresco/web/bean/users/UserShortcutsBean.java +++ b/source/java/org/alfresco/web/bean/users/UserShortcutsBean.java @@ -58,18 +58,20 @@ import org.apache.commons.logging.LogFactory; * * @author Kevin Roast */ -public class UserShortcutsBean +public class UserShortcutsBean implements Serializable { + private static final long serialVersionUID = -2264529845476479897L; + private static Log logger = LogFactory.getLog(UserShortcutsBean.class); /** The NodeService to be used by the bean */ - protected NodeService nodeService; + transient protected NodeService nodeService; /** The BrowseBean reference */ protected BrowseBean browseBean; /** The PermissionService reference */ - protected PermissionService permissionService; + transient private PermissionService permissionService; /** List of shortcut nodes */ private List shortcuts = null; @@ -87,6 +89,15 @@ public class UserShortcutsBean { this.nodeService = nodeService; } + + protected NodeService getNodeService() + { + if (nodeService == null) + { + nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + } + return nodeService; + } /** * @param browseBean The BrowseBean to set. @@ -104,6 +115,15 @@ public class UserShortcutsBean this.permissionService = permissionService; } + protected PermissionService getPermissionService() + { + if (permissionService == null) + { + permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService(); + } + return permissionService; + } + /** * @return the List of shortcut Nodes */ @@ -132,7 +152,7 @@ public class UserShortcutsBean NodeRef ref = new NodeRef(Repository.getStoreRef(), shortcuts.get(i)); try { - if (this.nodeService.exists(ref) == true) + if (this.getNodeService().exists(ref) == true) { Node node = new Node(ref); @@ -338,9 +358,9 @@ public class UserShortcutsBean try { - if (permissionService.hasPermission(selectedNode.getNodeRef(), PermissionService.READ) == AccessStatus.ALLOWED) + if (getPermissionService().hasPermission(selectedNode.getNodeRef(), PermissionService.READ) == AccessStatus.ALLOWED) { - if (nodeService.exists(selectedNode.getNodeRef()) == false) + if (getNodeService().exists(selectedNode.getNodeRef()) == false) { throw new InvalidNodeRefException(selectedNode.getNodeRef()); } diff --git a/source/java/org/alfresco/web/bean/users/UsersDialog.java b/source/java/org/alfresco/web/bean/users/UsersDialog.java index baeb34734d..40369814fc 100644 --- a/source/java/org/alfresco/web/bean/users/UsersDialog.java +++ b/source/java/org/alfresco/web/bean/users/UsersDialog.java @@ -66,6 +66,8 @@ import org.apache.commons.logging.LogFactory; */ public class UsersDialog extends BaseDialogBean implements IContextListener, ChangeViewSupport { + private static final long serialVersionUID = 7613786955971599967L; + private static Log logger = LogFactory.getLog(UsersDialog.class); public static String BEAN_NAME = "UsersDialog"; diff --git a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java index 6d9a8c7dc2..904119b5e3 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java @@ -76,6 +76,7 @@ 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; @@ -106,6 +107,8 @@ import org.apache.commons.logging.LogFactory; */ 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); @@ -198,25 +201,25 @@ public class AVMBrowseBean implements IContextListener private SearchContext searchContext = null; /** The NodeService to be used by the bean */ - protected NodeService nodeService; + transient private NodeService nodeService; /** The WorkflowService bean reference. */ - protected WorkflowService workflowService; + transient private WorkflowService workflowService; /** The NavigationBean bean reference */ protected NavigationBean navigator; /** AVM service bean reference */ - protected AVMService avmService; + transient private AVMService avmService; /** AVM sync service bean reference */ - protected AVMSyncService avmSyncService; + transient private AVMSyncService avmSyncService; /** Action service bean reference */ - protected ActionService actionService; + transient private ActionService actionService; /** The FormsService reference */ - protected FormsService formsService; + transient private FormsService formsService; /** The SearchService reference */ protected SearchService searchService; @@ -243,6 +246,15 @@ public class AVMBrowseBean implements IContextListener { this.avmService = avmService; } + + protected AVMService getAvmService() + { + if (avmService == null) + { + avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); + } + return avmService; + } /** * @param avmSyncService The AVMSyncService to set. @@ -252,6 +264,15 @@ public class AVMBrowseBean implements IContextListener this.avmSyncService = avmSyncService; } + protected AVMSyncService getAvmSyncService() + { + if (avmSyncService == null) + { + avmSyncService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMSyncService(); + } + return avmSyncService; + } + /** * @param nodeService The NodeService to set. */ @@ -269,6 +290,15 @@ public class AVMBrowseBean implements IContextListener workflowService = service; } + protected WorkflowService getWorkflowService() + { + if (workflowService == null) + { + workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService(); + } + return workflowService; + } + /** * @param searchService The Searcher to set. */ @@ -284,7 +314,11 @@ public class AVMBrowseBean implements IContextListener */ public NodeService getNodeService() { - return this.nodeService; + if (nodeService == null) + { + nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + } + return nodeService; } /** @@ -303,6 +337,15 @@ public class AVMBrowseBean implements IContextListener this.actionService = actionService; } + protected ActionService getActionService() + { + if (actionService == null) + { + actionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getActionService(); + } + return actionService; + } + /** * @param formsService The FormsService to set. */ @@ -311,6 +354,15 @@ public class AVMBrowseBean implements IContextListener this.formsService = formsService; } + protected FormsService getFormsService() + { + if (formsService == null) + { + formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); + } + return formsService; + } + public int getPageSizeFiles() { return this.pageSizeFiles; @@ -367,7 +419,7 @@ public class AVMBrowseBean implements IContextListener final FacesContext fc = FacesContext.getCurrentInstance(); final ResourceBundle msg = Application.getBundle(fc); final String stagingStore = this.getStagingStore(); - final AVMStoreDescriptor store = this.avmService.getStore(stagingStore); + final AVMStoreDescriptor store = getAvmService().getStore(stagingStore); final String storeId = (String)this.getWebProject().getStoreId(); if (store != null) { @@ -397,13 +449,13 @@ public class AVMBrowseBean implements IContextListener { QName qn = QName.createQName(null, SandboxConstants.PROP_SANDBOX_STORE_PREFIX + storeId + "%"); final Map> relatedSandboxes = - avmService.queryStoresPropertyKeys(qn); + getAvmService().queryStoresPropertyKeys(qn); final List result = new LinkedList(); for (String storeName : relatedSandboxes.keySet()) { for (final QName type : types) { - if (this.avmService.getStoreProperty(storeName, type) != null) + if (getAvmService().getStoreProperty(storeName, type) != null) { result.add(storeName); break; @@ -604,7 +656,7 @@ public class AVMBrowseBean implements IContextListener if (this.webapps == null) { String path = AVMUtil.buildSandboxRootPath(getStagingStore()); - Map folders = this.avmService.getDirectoryListing(-1, path); + Map folders = getAvmService().getDirectoryListing(-1, path); List webapps = new ArrayList(folders.size()); for (AVMNodeDescriptor node : folders.values()) { @@ -795,7 +847,7 @@ public class AVMBrowseBean implements IContextListener { if (this.currentPathNode == null) { - AVMNodeDescriptor node = this.avmService.lookup(-1, getCurrentPath(), true); + AVMNodeDescriptor node = getAvmService().lookup(-1, getCurrentPath(), true); this.currentPathNode = new AVMNode(node); } return this.currentPathNode; @@ -851,7 +903,7 @@ public class AVMBrowseBean implements IContextListener { // see if there are any deployment attempts for the site NodeRef webProjectRef = this.getWebsite().getNodeRef(); - deployAttempts = this.nodeService.getChildAssocs(webProjectRef, + deployAttempts = getNodeService().getChildAssocs(webProjectRef, WCMAppModel.ASSOC_DEPLOYMENTATTEMPT, RegexQNamePattern.MATCH_ALL); // add a placeholder object in the request so we don't evaluate this again for this request @@ -924,7 +976,7 @@ public class AVMBrowseBean implements IContextListener tx = Repository.getUserTransaction(context, true); tx.begin(); - Map nodes = this.avmService.getDirectoryListing(-1, getCurrentPath()); + Map nodes = getAvmService().getDirectoryListing(-1, getCurrentPath()); this.files = new ArrayList(nodes.size()); this.folders = new ArrayList(nodes.size()); for (String name : nodes.keySet()) @@ -1234,7 +1286,7 @@ public class AVMBrowseBean implements IContextListener } // setup the action node - this.setAVMActionNodeDescriptor(avmService.lookup(-1, path, true)); + this.setAVMActionNodeDescriptor(getAvmService().lookup(-1, path, true)); } // update UI state ready for return after dialog close @@ -1265,25 +1317,25 @@ public class AVMBrowseBean implements IContextListener // retrieve the content reader for this node String avmPath = this.getAvmActionNode().getPath(); - if (this.avmService.hasAspect(-1, avmPath, WCMAppModel.ASPECT_RENDITION)) + 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.formsService.getRendition(-1, avmPath).getPrimaryFormInstanceData(); + 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(this.avmService.lookup(-1, avmPath))); + this.setAvmActionNode(new AVMNode(getAvmService().lookup(-1, avmPath))); } catch (FileNotFoundException fnfe) { - this.avmService.removeAspect(avmPath, WCMAppModel.ASPECT_RENDITION); - this.avmService.removeAspect(avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA); + getAvmService().removeAspect(avmPath, WCMAppModel.ASPECT_RENDITION); + getAvmService().removeAspect(avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA); Utils.addErrorMessage(fnfe.getMessage(), fnfe); } } @@ -1292,14 +1344,14 @@ public class AVMBrowseBean implements IContextListener logger.debug("Editing AVM node: " + avmPath); String outcome = null; // calculate which editor screen to display - if (this.avmService.hasAspect(-1, avmPath, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) + 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.formsService.getFormInstanceData(-1, avmPath).getForm(); + this.getFormsService().getFormInstanceData(-1, avmPath).getForm(); // navigate to appropriate screen outcome = "wizard:editWebContent"; } @@ -1368,17 +1420,17 @@ public class AVMBrowseBean implements IContextListener tx = Repository.getUserTransaction(context, false); tx.begin(); - AVMNodeDescriptor node = this.avmService.lookup(-1, path, true); + AVMNodeDescriptor node = getAvmService().lookup(-1, path, true); if (node != null) { FormInstanceData fid = null; - if (this.avmService.hasAspect(-1, path, WCMAppModel.ASPECT_RENDITION)) + if (getAvmService().hasAspect(-1, path, WCMAppModel.ASPECT_RENDITION)) { - fid = this.formsService.getRendition(-1, path).getPrimaryFormInstanceData(); + fid = this.getFormsService().getRendition(-1, path).getPrimaryFormInstanceData(); } - else if (this.avmService.hasAspect(-1, path, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) + else if (getAvmService().hasAspect(-1, path, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) { - fid = this.formsService.getFormInstanceData(-1, path); + fid = this.getFormsService().getFormInstanceData(-1, path); } List> versionPaths = new ArrayList>(); if (fid != null) @@ -1398,8 +1450,8 @@ public class AVMBrowseBean implements IContextListener } final Map args = new HashMap(1, 1.0f); args.put(AVMUndoSandboxListAction.PARAM_NODE_LIST, (Serializable)versionPaths); - Action action = this.actionService.createAction(AVMUndoSandboxListAction.NAME, args); - this.actionService.executeAction(action, null); // dummy action ref + Action action = this.getActionService().createAction(AVMUndoSandboxListAction.NAME, args); + this.getActionService().executeAction(action, null); // dummy action ref } // commit the transaction @@ -1449,13 +1501,13 @@ public class AVMBrowseBean implements IContextListener String sandboxPath = AVMUtil.buildSandboxRootPath( sandbox ); List diffs = - this.avmSyncService.compare( + this.getAvmSyncService().compare( -1,sandboxPath,Integer.valueOf(strVersion),sandboxPath,null); Map args = new HashMap(1, 1.0f); args.put(AVMRevertStoreAction.PARAM_VERSION, Integer.valueOf(strVersion)); - Action action = this.actionService.createAction(AVMRevertStoreAction.NAME, args); - this.actionService.executeAction(action, AVMNodeConverter.ToNodeRef(-1, sandbox + ":/")); + Action action = this.getActionService().createAction(AVMRevertStoreAction.NAME, args); + this.getActionService().executeAction(action, AVMNodeConverter.ToNodeRef(-1, sandbox + ":/")); // commit the transaction tx.commit(); @@ -1547,7 +1599,7 @@ public class AVMBrowseBean implements IContextListener tx.begin(); // transition the task - this.workflowService.endTask(taskId, "launch"); + this.getWorkflowService().endTask(taskId, "launch"); // commit the transaction tx.commit(); @@ -1579,7 +1631,7 @@ public class AVMBrowseBean implements IContextListener tx.begin(); // cancel the workflow - this.workflowService.cancelWorkflow(workflowId); + this.getWorkflowService().cancelWorkflow(workflowId); // commit the transaction tx.commit(); diff --git a/source/java/org/alfresco/web/bean/wcm/AVMDetailsBean.java b/source/java/org/alfresco/web/bean/wcm/AVMDetailsBean.java index 2076e1444e..7af5694929 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMDetailsBean.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMDetailsBean.java @@ -24,29 +24,18 @@ */ 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.application.FacesMessage; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; -import javax.transaction.UserTransaction; -import org.alfresco.model.ContentModel; import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.TemplateImageResolver; -import org.alfresco.service.cmr.security.OwnableService; -import org.alfresco.web.app.Application; 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.Utils; -import org.alfresco.web.ui.common.Utils.URLMode; import org.alfresco.web.ui.common.component.UIActionLink; import org.alfresco.web.ui.common.component.UIPanel.ExpandedEvent; @@ -57,11 +46,13 @@ import org.alfresco.web.ui.common.component.UIPanel.ExpandedEvent; */ public abstract class AVMDetailsBean extends BaseDialogBean implements NavigationSupport { + private static final long serialVersionUID = -4895328117656471680L; + /** NodeService bean reference */ - protected NodeService nodeService; + transient private NodeService nodeService; /** AVM service bean reference */ - protected AVMService avmService; + transient private AVMService avmService; /** AVMBrowseBean bean reference */ protected AVMBrowseBean avmBrowseBean; @@ -80,6 +71,15 @@ public abstract class AVMDetailsBean extends BaseDialogBean implements Navigatio this.nodeService = nodeService; } + protected NodeService getNodeService() + { + if (nodeService == null) + { + nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + } + return nodeService; + } + /** * @param avmService The AVMService to set. */ @@ -88,6 +88,15 @@ public abstract class AVMDetailsBean extends BaseDialogBean implements Navigatio this.avmService = avmService; } + protected AVMService getAvmService() + { + if (avmService == null) + { + avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); + } + return avmService; + } + /** * @param avmBrowseBean The AVMBrowseBean to set. */ diff --git a/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java b/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java index 65315745f7..aec22a30cd 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java @@ -18,45 +18,28 @@ package org.alfresco.web.bean.wcm; import java.io.File; -import java.io.FileNotFoundException; +import java.io.Serializable; import java.text.MessageFormat; -import java.util.HashSet; 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.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.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.avmsync.AVMSyncService; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.ContentReader; 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.DownloadContentServlet; +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.Form; import org.alfresco.web.forms.FormInstanceData; import org.alfresco.web.forms.FormNotFoundException; -import org.alfresco.web.forms.FormProcessor; import org.alfresco.web.forms.FormsService; -import org.alfresco.web.forms.RenderingEngineTemplate; -import org.alfresco.web.forms.Rendition; -import org.alfresco.web.forms.XMLUtil; import org.alfresco.web.ui.common.Utils; -import org.alfresco.web.ui.common.component.UIActionLink; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; /** * Bean backing the edit pages for a AVM node content. @@ -66,6 +49,8 @@ import org.w3c.dom.Document; */ 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"; @@ -75,9 +60,9 @@ public class AVMEditBean extends BaseDialogBean private File file = null; private String fileName = null; - protected AVMService avmService; + transient private AVMService avmService; protected AVMBrowseBean avmBrowseBean; - protected FormsService formsService; + transient private FormsService formsService; // ------------------------------------------------------------------------------ // Bean property getters and setters @@ -89,6 +74,15 @@ public class AVMEditBean extends BaseDialogBean { this.avmService = avmService; } + + protected AVMService getAvmService() + { + if (avmService == null) + { + avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); + } + return avmService; + } /** * @param avmBrowseBean The AVMBrowseBean to set. @@ -105,6 +99,16 @@ public class AVMEditBean extends BaseDialogBean { 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. @@ -180,7 +184,7 @@ public class AVMEditBean extends BaseDialogBean tx.begin(); // get an updating writer that we can use to modify the content on the current node - final ContentWriter writer = this.avmService.getContentWriter(node.getPath()); + final ContentWriter writer = this.getAvmService().getContentWriter(node.getPath()); // also update the mime type in case a different type of file is uploaded String mimeType = Repository.getMimeTypeForFileName(context, this.fileName); @@ -189,7 +193,7 @@ public class AVMEditBean extends BaseDialogBean // commit the transaction tx.commit(); - if (this.avmService.hasAspect(-1, node.getPath(), WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) + if (this.getAvmService().hasAspect(-1, node.getPath(), WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) { this.regenerateRenditions(); } @@ -253,7 +257,7 @@ public class AVMEditBean extends BaseDialogBean throws FormNotFoundException { final String avmPath = this.getAvmNode().getPath(); - final FormInstanceData fid = this.formsService.getFormInstanceData(-1, avmPath); + final FormInstanceData fid = this.getFormsService().getFormInstanceData(-1, avmPath); final List result = fid.regenerateRenditions(); for (FormInstanceData.RegenerateResult rr : result) { diff --git a/source/java/org/alfresco/web/bean/wcm/AVMNode.java b/source/java/org/alfresco/web/bean/wcm/AVMNode.java index 3d31dbf1d1..9846951b9a 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMNode.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMNode.java @@ -57,10 +57,14 @@ import org.alfresco.web.ui.common.Utils; */ public class AVMNode extends Node implements Map { + private static final long serialVersionUID = 2200295347489543757L; + public final static NodePropertyResolver RESOLVER_PREVIEW_URL = new NodePropertyResolver() { - public Object get(final Node node) + private static final long serialVersionUID = -8437274476137672895L; + + public Object get(final Node node) { if (! (node instanceof AVMNode)) { @@ -80,7 +84,9 @@ public class AVMNode extends Node implements Map public final static NodePropertyResolver RESOLVER_SANDBOX_RELATIVE_PATH = new NodePropertyResolver() { - public Object get(final Node node) + private static final long serialVersionUID = -2367701285830581225L; + + public Object get(final Node node) { if (! (node instanceof AVMNode)) { @@ -108,7 +114,9 @@ public class AVMNode extends Node implements Map public final static NodePropertyResolver RESOLVER_FILE_TYPE_16 = new NodePropertyResolver() { - public Object get(final Node node) + private static final long serialVersionUID = 4300079423348609858L; + + public Object get(final Node node) { if (! (node instanceof AVMNode)) { diff --git a/source/java/org/alfresco/web/bean/wcm/AddAvmContentDialog.java b/source/java/org/alfresco/web/bean/wcm/AddAvmContentDialog.java index 5ee42cff07..9f2533b347 100644 --- a/source/java/org/alfresco/web/bean/wcm/AddAvmContentDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/AddAvmContentDialog.java @@ -39,6 +39,7 @@ 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. @@ -47,10 +48,12 @@ import org.alfresco.web.bean.content.AddContentDialog; */ public class AddAvmContentDialog extends AddContentDialog { + private static final long serialVersionUID = 4019639621892035132L; + private static final String MSG_OK = "ok"; - + /** The AVMService bean reference */ - protected AVMService avmService; + transient private AVMService avmService; /** AVM Browse Bean reference */ protected AVMBrowseBean avmBrowseBean; @@ -67,6 +70,15 @@ public class AddAvmContentDialog extends AddContentDialog this.avmService = avmService; } + protected AVMService getAvmService() + { + if (avmService == null) + { + avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMLockingAwareService(); + } + return avmService; + } + /** * @param avmBrowseBean The AVMBrowseBean to set. */ @@ -87,7 +99,7 @@ public class AddAvmContentDialog extends AddContentDialog String parent = this.avmBrowseBean.getCurrentPath(); // create the file - this.avmService.createFile(parent, this.fileName); + this.getAvmService().createFile(parent, this.fileName); this.path = parent + '/' + this.fileName; NodeRef fileNodeRef = AVMNodeConverter.ToNodeRef(-1, this.path); @@ -98,10 +110,10 @@ public class AddAvmContentDialog extends AddContentDialog Map titledProps = new HashMap(2, 1.0f); titledProps.put(ContentModel.PROP_TITLE, this.title); titledProps.put(ContentModel.PROP_DESCRIPTION, this.description); - this.nodeService.addAspect(fileNodeRef, ContentModel.ASPECT_TITLED, titledProps); + this.getNodeService().addAspect(fileNodeRef, ContentModel.ASPECT_TITLED, titledProps); // get a writer for the content and put the file - ContentWriter writer = contentService.getWriter(fileNodeRef, ContentModel.PROP_CONTENT, true); + ContentWriter writer = getContentService().getWriter(fileNodeRef, ContentModel.PROP_CONTENT, true); writer.setMimetype(this.mimeType); writer.setEncoding(this.encoding); if (fileContent != null) diff --git a/source/java/org/alfresco/web/bean/wcm/ChangeExpirationDateDialog.java b/source/java/org/alfresco/web/bean/wcm/ChangeExpirationDateDialog.java index 0158308cb3..68250e265c 100644 --- a/source/java/org/alfresco/web/bean/wcm/ChangeExpirationDateDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/ChangeExpirationDateDialog.java @@ -40,6 +40,8 @@ import org.alfresco.web.bean.dialog.IDialogBean; */ public class ChangeExpirationDateDialog extends BaseDialogBean { + private static final long serialVersionUID = 7052061252811577796L; + private String path; private Date expirationDate; private Map expirationDates; diff --git a/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java b/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java index 4079f46b46..27cc6d35b8 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java @@ -37,6 +37,7 @@ import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; 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; @@ -47,9 +48,11 @@ import org.apache.commons.logging.LogFactory; */ public class CreateFolderDialog extends BaseDialogBean { + private static final long serialVersionUID = 5501238017264037644L; + private static final Log logger = LogFactory.getLog(CreateFolderDialog.class); - protected AVMService avmService; + transient private AVMService avmService; protected AVMBrowseBean avmBrowseBean; protected String name; @@ -83,6 +86,15 @@ public class CreateFolderDialog extends BaseDialogBean this.avmService = avmService; } + protected AVMService getAvmService() + { + if (avmService == null) + { + avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); + } + return avmService; + } + /** * @return Returns the description. */ @@ -126,14 +138,14 @@ public class CreateFolderDialog extends BaseDialogBean protected String finishImpl(FacesContext context, String outcome) throws Exception { String parent = this.avmBrowseBean.getCurrentPath(); - this.avmService.createDirectory(parent, this.name); + this.getAvmService().createDirectory(parent, this.name); String path = parent + '/' + this.name; NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, path); - this.nodeService.addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, null); + this.getNodeService().addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, null); if (this.description != null && this.description.length() != 0) { - this.avmService.setNodeProperty(path, ContentModel.PROP_DESCRIPTION, new PropertyValue(DataTypeDefinition.TEXT, this.description)); + this.getAvmService().setNodeProperty(path, ContentModel.PROP_DESCRIPTION, new PropertyValue(DataTypeDefinition.TEXT, this.description)); // this.nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, this.description); } diff --git a/source/java/org/alfresco/web/bean/wcm/CreateFormWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateFormWizard.java index cdf146d677..561136c23b 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateFormWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateFormWizard.java @@ -54,7 +54,9 @@ 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; @@ -82,8 +84,7 @@ import org.w3c.dom.Document; * * @author arielb */ -public class CreateFormWizard - extends BaseWizardBean +public class CreateFormWizard extends BaseWizardBean { ///////////////////////////////////////////////////////////////////////////// @@ -94,6 +95,8 @@ public class CreateFormWizard public class RenderingEngineTemplateData implements Serializable { + private static final long serialVersionUID = -7786031074741795036L; + private final NodeRef nodeRef; private final File file; private final String name; @@ -200,10 +203,10 @@ public class CreateFormWizard protected List renderingEngineTemplates = null; protected transient XSModel schema; protected String schemaFileName; - protected ContentService contentService; - protected MimetypeService mimetypeService; - protected WorkflowService workflowService; - protected FormsService formsService; + protected transient ContentService contentService; + protected transient MimetypeService mimetypeService; + protected transient WorkflowService workflowService; + protected transient FormsService formsService; private String schemaRootElementName = null; private String formName = null; @@ -239,25 +242,25 @@ public class CreateFormWizard NodeRef contentFormsNodeRef = null; if (getIsWebForm() == true) { - contentFormsNodeRef = this.formsService.getWebContentFormsNodeRef(); + contentFormsNodeRef = this.getFormsService().getWebContentFormsNodeRef(); } else { - contentFormsNodeRef = this.formsService.getContentFormsNodeRef(); + contentFormsNodeRef = this.getFormsService().getContentFormsNodeRef(); } final FileInfo folderInfo = - this.fileFolderService.create(contentFormsNodeRef, + this.getFileFolderService().create(contentFormsNodeRef, this.getFormName(), WCMAppModel.TYPE_FORMFOLDER); final FileInfo fileInfo = - this.fileFolderService.create(folderInfo.getNodeRef(), + getFileFolderService().create(folderInfo.getNodeRef(), this.getSchemaFileName(), ContentModel.TYPE_CONTENT); // get a writer for the content and put the file - final ContentWriter writer = this.contentService.getWriter(fileInfo.getNodeRef(), + final ContentWriter writer = this.getContentService().getWriter(fileInfo.getNodeRef(), ContentModel.PROP_CONTENT, true); // set the mimetype and encoding @@ -269,18 +272,18 @@ public class CreateFormWizard final Map props = new HashMap(2, 1.0f); props.put(ContentModel.PROP_TITLE, this.getFormTitle()); props.put(ContentModel.PROP_DESCRIPTION, this.getFormDescription()); - this.nodeService.addAspect(folderInfo.getNodeRef(), ContentModel.ASPECT_TITLED, props); + 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.nodeService.addAspect(folderInfo.getNodeRef(), WCMAppModel.ASPECT_FORM, props); + this.getNodeService().addAspect(folderInfo.getNodeRef(), WCMAppModel.ASPECT_FORM, props); if (this.applyDefaultWorkflow) { props.clear(); props.put(WCMAppModel.PROP_WORKFLOW_NAME, this.getDefaultWorkflowName()[0]); - this.nodeService.createNode(folderInfo.getNodeRef(), + this.getNodeService().createNode(folderInfo.getNodeRef(), WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS, WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS, WCMAppModel.TYPE_WORKFLOW_DEFAULTS, @@ -290,7 +293,7 @@ public class CreateFormWizard props.clear(); props.put(WCMAppModel.PROP_OUTPUT_PATH_PATTERN, this.getOutputPathPatternForFormInstanceData()); - this.nodeService.addAspect(folderInfo.getNodeRef(), + this.getNodeService().addAspect(folderInfo.getNodeRef(), WCMAppModel.ASPECT_OUTPUT_PATH_PATTERN, props); for (RenderingEngineTemplateData retd : this.renderingEngineTemplates) { @@ -308,13 +311,13 @@ public class CreateFormWizard " to form " + this.getFormName()); NodeRef renderingEngineTemplateNodeRef = - this.fileFolderService.searchSimple(formNodeRef, retd.getName()); + this.getFileFolderService().searchSimple(formNodeRef, retd.getName()); final HashMap props = new HashMap(); if (renderingEngineTemplateNodeRef == null) { try { - final FileInfo fileInfo = this.fileFolderService.create(formNodeRef, + final FileInfo fileInfo = this.getFileFolderService().create(formNodeRef, retd.getName(), ContentModel.TYPE_CONTENT); if (LOGGER.isDebugEnabled()) @@ -329,7 +332,7 @@ public class CreateFormWizard } // get a writer for the content and put the file - final ContentWriter writer = this.contentService.getWriter(renderingEngineTemplateNodeRef, + final ContentWriter writer = this.getContentService().getWriter(renderingEngineTemplateNodeRef, ContentModel.PROP_CONTENT, true); // set the mimetype and encoding @@ -338,14 +341,14 @@ public class CreateFormWizard writer.setEncoding("UTF-8"); writer.putContent(retd.getFile()); - this.nodeService.createAssociation(formNodeRef, + 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.nodeService.addAspect(renderingEngineTemplateNodeRef, + this.getNodeService().addAspect(renderingEngineTemplateNodeRef, WCMAppModel.ASPECT_RENDERING_ENGINE_TEMPLATE, props); @@ -353,7 +356,7 @@ public class CreateFormWizard props.clear(); props.put(ContentModel.PROP_TITLE, retd.getTitle()); props.put(ContentModel.PROP_DESCRIPTION, retd.getDescription()); - this.nodeService.addAspect(renderingEngineTemplateNodeRef, + this.getNodeService().addAspect(renderingEngineTemplateNodeRef, ContentModel.ASPECT_TITLED, props); } @@ -364,7 +367,7 @@ public class CreateFormWizard props.put(WCMAppModel.PROP_MIMETYPE_FOR_RENDITION, retd.getMimetypeForRendition()); - final NodeRef rpNodeRef = this.nodeService.createNode(renderingEngineTemplateNodeRef, + final NodeRef rpNodeRef = this.getNodeService().createNode(renderingEngineTemplateNodeRef, WCMAppModel.ASSOC_RENDITION_PROPERTIES, WCMAppModel.ASSOC_RENDITION_PROPERTIES, WCMAppModel.TYPE_RENDITION_PROPERTIES, @@ -372,7 +375,7 @@ public class CreateFormWizard props.clear(); props.put(WCMAppModel.PROP_OUTPUT_PATH_PATTERN, retd.getOutputPathPatternForRendition()); - this.nodeService.addAspect(rpNodeRef, WCMAppModel.ASPECT_OUTPUT_PATH_PATTERN, props); + this.getNodeService().addAspect(rpNodeRef, WCMAppModel.ASPECT_OUTPUT_PATH_PATTERN, props); } @Override @@ -519,7 +522,7 @@ public class CreateFormWizard if (this.outputPathPatternForRendition != null && !this.outputPathPatternForRendition.endsWith(DEFAULT_EXTENSION_PATTERN)) { - result = this.mimetypeService.guessMimetype(this.outputPathPatternForRendition); + result = this.getMimetypeService().guessMimetype(this.outputPathPatternForRendition); } if (result == null) { @@ -598,7 +601,7 @@ public class CreateFormWizard public void removeSelectedRenderingEngineTemplate(final ActionEvent event) { final RenderingEngineTemplateData wrapper = (RenderingEngineTemplateData) - this.renderingEngineTemplatesDataModel.getRowData(); + this.getRenderingEngineTemplatesDataModel().getRowData(); if (wrapper != null) { this.renderingEngineTemplates.remove(wrapper); @@ -750,7 +753,7 @@ public class CreateFormWizard this.getRenderingEngineTemplateFileName() != null) { this.renderingEngine = - this.formsService.guessRenderingEngine(this.getRenderingEngineTemplateFileName()); + this.getFormsService().guessRenderingEngine(this.getRenderingEngineTemplateFileName()); } return (this.renderingEngine == null ? null @@ -764,7 +767,7 @@ public class CreateFormWizard { this.renderingEngine = (renderingEngineName == null ? null - : this.formsService.getRenderingEngine(renderingEngineName)); + : this.getFormsService().getRenderingEngine(renderingEngineName)); } /** @@ -773,7 +776,7 @@ public class CreateFormWizard public List getRenderingEngineChoices() { final List result = new LinkedList(); - for (RenderingEngine re : this.formsService.getRenderingEngines()) + for (RenderingEngine re : this.getFormsService().getRenderingEngines()) { result.add(new SelectItem(re.getName(), re.getName())); } @@ -791,7 +794,7 @@ public class CreateFormWizard { this.mimetypeChoices = new ArrayList(50); - final Map mimetypes = this.mimetypeService.getDisplaysByMimetype(); + final Map mimetypes = this.getMimetypeService().getDisplaysByMimetype(); for (String mimetype : mimetypes.keySet()) { this.mimetypeChoices.add(new SelectItem(mimetype, @@ -1042,7 +1045,7 @@ public class CreateFormWizard { return (this.defaultWorkflowName == null || !this.applyDefaultWorkflow ? null - : this.workflowService.getDefinitionByName(this.defaultWorkflowName)); + : this.getWorkflowService().getDefinitionByName(this.defaultWorkflowName)); } /** @@ -1128,6 +1131,16 @@ public class CreateFormWizard { this.contentService = contentService; } + + protected ContentService getContentService() + { + if (contentService == null) + { + contentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentService(); + } + + return contentService; + } /** * @param mimetypeService The mimetypeService to set. @@ -1136,6 +1149,15 @@ public class CreateFormWizard { this.mimetypeService = mimetypeService; } + + protected MimetypeService getMimetypeService() + { + if (mimetypeService == null) + { + mimetypeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMimetypeService(); + } + return mimetypeService; + } /** * @param workflowService The workflowService to set. @@ -1144,6 +1166,15 @@ public class CreateFormWizard { this.workflowService = workflowService; } + + protected WorkflowService getWorkflowService() + { + if (workflowService == null) + { + workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService(); + } + return workflowService; + } /** * @param formsService The FormsService to set. @@ -1153,6 +1184,15 @@ public class CreateFormWizard this.formsService = formsService; } + protected FormsService getFormsService() + { + if (formsService == null) + { + formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); + } + return formsService; + } + // ------------------------------------------------------------------------------ // Helper Methods diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java index 4cdb43874d..4c1bdfaa87 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java @@ -61,6 +61,7 @@ import org.alfresco.service.cmr.repository.NodeRef; 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.content.CreateContentWizard; import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.data.IDataContainer; @@ -68,6 +69,8 @@ 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.FormProcessor; +import org.alfresco.web.forms.FormsService; import org.alfresco.web.forms.RenderingEngineTemplate; import org.alfresco.web.forms.Rendition; import org.alfresco.web.forms.XMLUtil; @@ -84,31 +87,45 @@ import org.w3c.dom.Document; */ public class CreateWebContentWizard extends CreateContentWizard { + private static final long serialVersionUID = -4090370304405270047L; + private static final Log LOGGER = LogFactory.getLog(CreateWebContentWizard.class); - + protected String content = null; - protected transient List createMimeTypes; - protected transient List formChoices; + transient private List createMimeTypes; + transient private List formChoices; protected String createdPath = null; protected List renditions = null; protected FormInstanceData formInstanceData = null; + protected FormProcessor.Session formProcessorSession = null; + transient private Document instanceDataDocument = null; protected boolean formSelectDisabled = false; protected boolean startWorkflow = false; - protected AVMLockingService avmLockingService; - protected AVMService avmService; - protected AVMSyncService avmSyncService; + transient private AVMLockingService avmLockingService; + transient private AVMService avmService; + transient private AVMSyncService avmSyncService; protected AVMBrowseBean avmBrowseBean; protected FilePickerBean filePickerBean; + transient private FormsService formsService; /** - * @param avmService The AVMService to set. + * @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. */ @@ -117,16 +134,34 @@ public class CreateWebContentWizard extends CreateContentWizard this.avmLockingService = avmLockingService; } + protected AVMLockingService getAvmLockingService() + { + if (avmLockingService == null) + { + avmLockingService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMLockingService(); + } + return avmLockingService; + } + /** - * @param avmSyncService The AVMSyncService to set. + * @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. + * @param avmBrowseBean The AVMBrowseBean to set. */ public void setAvmBrowseBean(final AVMBrowseBean avmBrowseBean) { @@ -134,21 +169,38 @@ public class CreateWebContentWizard extends CreateContentWizard } /** - * @param filePickerBean The FilePickerBean to set. + * @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; @@ -181,7 +233,7 @@ public class CreateWebContentWizard extends CreateContentWizard Utils.addErrorMessage(fnfe.getMessage(), fnfe); } } - + // reset the preview layer String storeName = AVMUtil.getStoreName(this.avmBrowseBean.getCurrentPath()); storeName = AVMUtil.getCorrespondingPreviewStoreName(storeName); @@ -197,7 +249,7 @@ public class CreateWebContentWizard extends CreateContentWizard LOGGER.debug("reseting layer " + path); // call the actual implementation - avmSyncService.resetLayer(path); + getAvmSyncService().resetLayer(path); return null; } }; @@ -264,14 +316,14 @@ public class CreateWebContentWizard extends CreateContentWizard if (LOGGER.isDebugEnabled()) LOGGER.debug("clearing form instance data: " + formInstanceData.getPath()); - avmService.removeNode(formInstanceData.getPath()); + getAvmService().removeNode(formInstanceData.getPath()); } if (renditions != null) { for (Rendition r : renditions) { - avmService.removeNode(r.getPath()); + getAvmService().removeNode(r.getPath()); } } @@ -303,27 +355,20 @@ public class CreateWebContentWizard extends CreateContentWizard { 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)); + 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)); + 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)); + diffList.add(new AVMDifference(-1, path, -1, AVMUtil.getCorrespondingPathInMainStore(path), AVMDifference.NEWER)); } if (LOGGER.isDebugEnabled()) @@ -333,50 +378,36 @@ public class CreateWebContentWizard extends CreateContentWizard LOGGER.debug("updating main store with " + diff.getSourcePath()); } } - this.avmSyncService.update(diffList, null, true, true, true, true, null, null); + this.getAvmSyncService().update(diffList, null, true, true, true, true, null, null); for (final AVMDifference diff : diffList) { final String path = diff.getDestinationPath(); if (LOGGER.isDebugEnabled()) { - LOGGER.debug("modifying lock on " + path + - ". chaging store from " + - this.avmLockingService.getLock(AVMUtil.getStoreId(path), - AVMUtil.getStoreRelativePath(path)).getStore() + - " to " + AVMUtil.getStoreName(path)); + LOGGER.debug("modifying lock on " + path + ". chaging store from " + + this.getAvmLockingService().getLock(AVMUtil.getStoreId(path), AVMUtil.getStoreRelativePath(path)).getStore() + " to " + AVMUtil.getStoreName(path)); } - this.avmLockingService.modifyLock(AVMUtil.getStoreId(path), - AVMUtil.getStoreRelativePath(path), - null, - AVMUtil.getStoreName(path), - null, - null); + this.getAvmLockingService().modifyLock(AVMUtil.getStoreId(path), AVMUtil.getStoreRelativePath(path), null, AVMUtil.getStoreName(path), null, null); } if (this.startWorkflow) { - final List submitNodes = - new ArrayList(1 + - this.getUploadedFiles().size() + - this.getRenditions().size()); + final List submitNodes = new ArrayList(1 + this.getUploadedFiles().size() + this.getRenditions().size()); for (final AVMDifference d : diffList) { - submitNodes.add(this.avmService.lookup(-1, d.getDestinationPath())); + 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()); + 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"); + 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; } @@ -391,38 +422,36 @@ public class CreateWebContentWizard extends CreateContentWizard if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null) { - this.formInstanceData = this.formsService.getFormInstanceData(-1, this.createdPath); + 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() + " to main store"); + LOGGER.debug("reset form instance data " + this.formInstanceData.getName() + " and " + this.renditions.size() + " to main store"); } 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 - + // 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 + protected void saveContent() throws Exception { // get the parent path of the location to save the content String fileName = this.getFileName(); @@ -430,17 +459,12 @@ public class CreateWebContentWizard extends CreateContentWizard 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); + final Form form = (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) ? this.getForm() : null); String path = cwd; if (form != null) { - path = form.getOutputPathForFormInstanceData(this.instanceDataDocument, - fileName, - cwd, - this.avmBrowseBean.getWebapp()); - this.content = XMLUtil.toString(this.instanceDataDocument, false); + 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]; @@ -457,9 +481,7 @@ public class CreateWebContentWizard extends CreateContentWizard // put the content of the file into the AVM store try { - avmService.createFile(path, - fileName, - new ByteArrayInputStream((this.content == null ? "" : this.content).getBytes("UTF-8"))); + getAvmService().createFile(path, fileName, new ByteArrayInputStream((this.content == null ? "" : this.content).getBytes("UTF-8"))); } catch (AVMExistsException avmee) { @@ -467,24 +489,24 @@ public class CreateWebContentWizard extends CreateContentWizard msg = MessageFormat.format(msg, fileName); throw new AlfrescoRuntimeException(msg, avmee); } - + // remember the created path this.createdPath = AVMNodeConverter.ExtendAVMPath(path, fileName); - + // add titled aspect for the read/edit properties screens final NodeRef formInstanceDataNodeRef = AVMNodeConverter.ToNodeRef(-1, this.createdPath); final Map props = new HashMap(1, 1.0f); props.put(ContentModel.PROP_TITLE, fileName); - this.nodeService.addAspect(formInstanceDataNodeRef, ContentModel.ASPECT_TITLED, props); + this.getNodeService().addAspect(formInstanceDataNodeRef, ContentModel.ASPECT_TITLED, props); if (form != null) { props.clear(); props.put(WCMAppModel.PROP_PARENT_FORM_NAME, form.getName()); props.put(WCMAppModel.PROP_ORIGINAL_PARENT_PATH, cwd); - this.nodeService.addAspect(formInstanceDataNodeRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA, props); + this.getNodeService().addAspect(formInstanceDataNodeRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA, props); - this.formInstanceData = this.formsService.getFormInstanceData(formInstanceDataNodeRef); + this.formInstanceData = getFormsService().getFormInstanceData(formInstanceDataNodeRef); this.renditions = new LinkedList(); for (RenderingEngineTemplate ret : form.getRenderingEngineTemplates()) { @@ -518,22 +540,18 @@ public class CreateWebContentWizard extends CreateContentWizard 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 (result != null && MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.getFormName() != null && "xml".equals(FilenameUtils.getExtension(result).toLowerCase()) ? FilenameUtils + .removeExtension(result) + : result); } /** @@ -543,7 +561,7 @@ public class CreateWebContentWizard extends CreateContentWizard { return this.content; } - + /** * @param content The content to edit (should be clear initially) */ @@ -565,14 +583,14 @@ public class CreateWebContentWizard extends CreateContentWizard { 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 */ @@ -581,10 +599,10 @@ public class CreateWebContentWizard extends CreateContentWizard 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"); @@ -604,9 +622,7 @@ public class CreateWebContentWizard extends CreateContentWizard for (ConfigElement child : typesCfg.getChildren()) { final String currentMimeType = child.getAttribute("name"); - if (currentMimeType == null || - (MimetypeMap.MIMETYPE_XML.equals(currentMimeType) && - this.getFormChoices().size() == 0)) + if (currentMimeType == null || (MimetypeMap.MIMETYPE_XML.equals(currentMimeType) && this.getFormChoices().size() == 0)) { continue; } @@ -614,28 +630,40 @@ public class CreateWebContentWizard extends CreateContentWizard 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; } - public Form getForm() - throws FormNotFoundException - { - return (this.getFormName() != null - ? this.avmBrowseBean.getWebProject().getForm(this.getFormName()) - : null); - } - /** - * @return Returns the wrapper instance data for feeding the xml - * content to the form processor. + * @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() { @@ -644,9 +672,7 @@ public class CreateWebContentWizard extends CreateContentWizard final String content = this.getContent(); try { - this.instanceDataDocument = (content != null - ? XMLUtil.parse(content) - : XMLUtil.newDocument()); + this.instanceDataDocument = (content != null ? XMLUtil.parse(content) : XMLUtil.newDocument()); } catch (Exception e) { @@ -671,7 +697,7 @@ public class CreateWebContentWizard extends CreateContentWizard } return items; } - + /** * Returns the generated form instance data. */ @@ -679,7 +705,7 @@ public class CreateWebContentWizard extends CreateContentWizard { return this.formInstanceData; } - + /** * Returns the generated renditions */ @@ -687,7 +713,7 @@ public class CreateWebContentWizard extends CreateContentWizard { return this.renditions; } - + /** * Returns the files uploaded using the form */ @@ -700,17 +726,15 @@ public class CreateWebContentWizard extends CreateContentWizard } final NodeRef[] uploadedFiles = this.filePickerBean.getUploadedFiles(); - final List result = - new ArrayList(uploadedFiles.length); + final List result = new ArrayList(uploadedFiles.length); for (NodeRef nodeRef : uploadedFiles) { final UIListItem item = new UIListItem(); - final String name = (String) - this.nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); + final String name = (String) this.getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME); item.setValue(name); - item.setLabel((String)this.nodeService.getProperty(nodeRef, ContentModel.PROP_TITLE)); - item.setDescription((String)this.nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION)); + item.setLabel((String) this.getNodeService().getProperty(nodeRef, ContentModel.PROP_TITLE)); + item.setDescription((String) this.getNodeService().getProperty(nodeRef, ContentModel.PROP_DESCRIPTION)); item.setImage(Utils.getFileTypeImage(name, false)); result.add(item); } @@ -718,8 +742,7 @@ public class CreateWebContentWizard extends CreateContentWizard } /** - * Returns the number of submittable files which is the total number of - * uploaded files, renditions, and the form instance data. + * Returns the number of submittable files which is the total number of uploaded files, renditions, and the form instance data. */ public int getNumberOfSubmittableFiles() { @@ -752,43 +775,30 @@ public class CreateWebContentWizard extends CreateContentWizard } /** - * Provides the url to the preview sandbox containing the asset currently - * being edited. + * Provides the url to the preview sandbox containing the asset currently being edited. */ public String getPreviewSandboxUrl() { - return AVMUtil.buildWebappUrl(AVMUtil.getCorrespondingPreviewStoreName(this.avmBrowseBean.getSandbox()), - this.avmBrowseBean.getWebapp()); + return AVMUtil.buildWebappUrl(AVMUtil.getCorrespondingPreviewStoreName(this.avmBrowseBean.getSandbox()), 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[] - { - this.getFileName(), - this.getSummaryObjectType(), - this.getSummaryMimeType(this.mimeType) - }); + return this.buildSummary(new String[] { bundle.getString("file_name"), bundle.getString("type"), bundle.getString("content_type") }, new String[] { this.getFileName(), + this.getSummaryObjectType(), this.getSummaryMimeType(this.mimeType) }); } public boolean getEditMode() { return false; } - + // ------------------------------------------------------------------------------ // Action event handlers - + /** * Create content type value changed by the user */ diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebappDialog.java b/source/java/org/alfresco/web/bean/wcm/CreateWebappDialog.java index aae8640a8c..35772fc17c 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebappDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebappDialog.java @@ -43,6 +43,8 @@ public class CreateWebappDialog extends CreateFolderDialog // ------------------------------------------------------------------------------ // Dialog implementation + private static final long serialVersionUID = -3883601909422422829L; + protected String path; /** @@ -53,21 +55,21 @@ public class CreateWebappDialog extends CreateFolderDialog { final String stagingStore = this.avmBrowseBean.getStagingStore(); final String parent = AVMUtil.buildSandboxRootPath( stagingStore ); - this.avmService.createDirectory(parent, this.name); + this.getAvmService().createDirectory(parent, this.name); this.path = AVMNodeConverter.ExtendAVMPath(parent, this.name); - this.avmService.addAspect(this.path, ApplicationModel.ASPECT_UIFACETS); - this.avmService.addAspect(this.path, WCMAppModel.ASPECT_WEBAPP); + this.getAvmService().addAspect(this.path, ApplicationModel.ASPECT_UIFACETS); + this.getAvmService().addAspect(this.path, WCMAppModel.ASPECT_WEBAPP); if (this.description != null && this.description.length() != 0) { - this.avmService.setNodeProperty(path, + this.getAvmService().setNodeProperty(path, ContentModel.PROP_DESCRIPTION, new PropertyValue(DataTypeDefinition.TEXT, this.description)); } // Snapshot the store with the empty webapp - this.avmService.createSnapshot(stagingStore, null, null); + this.getAvmService().createSnapshot(stagingStore, null, null); return outcome; } diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java index 0973837019..a32002cccc 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java @@ -84,6 +84,8 @@ import org.apache.commons.logging.LogFactory; */ 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 COMPONENT_FORMLIST = "form-list"; @@ -116,18 +118,18 @@ public class CreateWebsiteWizard extends BaseWizardBean protected boolean isSource; protected boolean showAllSourceProjects; - protected AVMService avmService; - protected WorkflowService workflowService; - protected PersonService personService; - protected AVMLockingService avmLockingService; - protected FormsService formsService; + transient private AVMService avmService; + transient private WorkflowService workflowService; + transient private PersonService personService; + transient private AVMLockingService avmLockingService; + transient private FormsService formsService; /** 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 */ - protected DataModel formsDataModel = null; + transient private DataModel formsDataModel = null; /** transient list of form UIListItem objects */ protected List formsList = null; @@ -139,10 +141,10 @@ public class CreateWebsiteWizard extends BaseWizardBean protected FormWrapper actionForm = null; /** datamodel for table of selected workflows */ - protected DataModel workflowsDataModel = null; + transient private DataModel workflowsDataModel = null; /** transient list of workflow UIListItem objects */ - protected List workflowsList = null; + transient private List workflowsList = null; /** list of workflow wrapper objects */ protected List workflows = null; @@ -202,7 +204,7 @@ public class CreateWebsiteWizard extends BaseWizardBean // create the website space in the correct parent folder final NodeRef websiteParent = WebProject.getWebsitesFolder(); - FileInfo fileInfo = this.fileFolderService.create( + FileInfo fileInfo = this.getFileFolderService().create( websiteParent, this.name, WCMAppModel.TYPE_AVMWEBFOLDER); @@ -219,14 +221,14 @@ public class CreateWebsiteWizard extends BaseWizardBean uiFacetsProps.put(ApplicationModel.PROP_ICON, AVMUtil.SPACE_ICON_WEBSITE); uiFacetsProps.put(ContentModel.PROP_TITLE, this.title); uiFacetsProps.put(ContentModel.PROP_DESCRIPTION, this.description); - this.nodeService.addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, uiFacetsProps); + getNodeService().addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, uiFacetsProps); // use as template source flag - this.nodeService.setProperty(nodeRef, WCMAppModel.PROP_ISSOURCE, this.isSource); + getNodeService().setProperty(nodeRef, WCMAppModel.PROP_ISSOURCE, this.isSource); // set the default webapp name for the project String webapp = (this.webapp != null && this.webapp.length() != 0) ? this.webapp : WEBAPP_DEFAULT; - this.nodeService.setProperty(nodeRef, WCMAppModel.PROP_DEFAULTWEBAPP, webapp); + getNodeService().setProperty(nodeRef, WCMAppModel.PROP_DEFAULTWEBAPP, webapp); // call a delegate wizard bean to provide invite user functionality InviteWebsiteUsersWizard wiz = getInviteUsersWizard(); @@ -245,7 +247,7 @@ public class CreateWebsiteWizard extends BaseWizardBean (this.sourceWebProject != null && this.sourceWebProject.length != 0)) { NodeRef sourceNodeRef = new NodeRef(this.sourceWebProject[0]); - branchStoreId = (String)this.nodeService.getProperty(sourceNodeRef, WCMAppModel.PROP_AVMSTORE); + branchStoreId = (String)getNodeService().getProperty(sourceNodeRef, WCMAppModel.PROP_AVMSTORE); } // create the AVM staging store to represent the newly created location website @@ -262,7 +264,7 @@ public class CreateWebsiteWizard extends BaseWizardBean } // set the property on the node to reference the root AVM store - this.nodeService.setProperty(nodeRef, WCMAppModel.PROP_AVMSTORE, avmStore); + getNodeService().setProperty(nodeRef, WCMAppModel.PROP_AVMSTORE, avmStore); // persist the forms, templates, workflows and workflow defaults to the model for this web project saveWebProjectModel(nodeRef); @@ -271,12 +273,12 @@ public class CreateWebsiteWizard extends BaseWizardBean this.navigator.setCurrentNodeId(websiteParent.getId()); // inform the locking service about this new instance - this.avmLockingService.addWebProject(avmStore); + this.getAvmLockingService().addWebProject(avmStore); outcome = AlfrescoNavigationHandler.CLOSE_WIZARD_OUTCOME; // Snapshot the store with the empty webapp - this.avmService.createSnapshot( avmStore, null, null); + getAvmService().createSnapshot( avmStore, null, null); } return outcome; } @@ -322,7 +324,7 @@ public class CreateWebsiteWizard extends BaseWizardBean { // 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 = this.nodeService.createNode(nodeRef, + NodeRef formRef = getNodeService().createNode(nodeRef, WCMAppModel.ASSOC_WEBFORM, WCMAppModel.ASSOC_WEBFORM, WCMAppModel.TYPE_WEBFORM, @@ -332,14 +334,14 @@ public class CreateWebsiteWizard extends BaseWizardBean props.clear(); props.put(ContentModel.PROP_TITLE, form.getTitle()); props.put(ContentModel.PROP_DESCRIPTION, form.getDescription()); - this.nodeService.addAspect(formRef, ContentModel.ASPECT_TITLED, props); + 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()); - this.nodeService.addAspect(formRef, WCMAppModel.ASPECT_OUTPUT_PATH_PATTERN, props); + getNodeService().addAspect(formRef, WCMAppModel.ASPECT_OUTPUT_PATH_PATTERN, props); } // associate to workflow defaults if any are present @@ -348,7 +350,7 @@ public class CreateWebsiteWizard extends BaseWizardBean WorkflowWrapper workflow = form.getWorkflow(); props.clear(); props.put(WCMAppModel.PROP_WORKFLOW_NAME, workflow.getName()); - NodeRef workflowRef = this.nodeService.createNode(formRef, + NodeRef workflowRef = getNodeService().createNode(formRef, WCMAppModel.ASSOC_WORKFLOWDEFAULTS, WCMAppModel.ASSOC_WORKFLOWDEFAULTS, WCMAppModel.TYPE_WORKFLOW_DEFAULTS, @@ -367,7 +369,7 @@ public class CreateWebsiteWizard extends BaseWizardBean props.clear(); props.put(WCMAppModel.PROP_BASE_RENDERING_ENGINE_TEMPLATE_NAME, template.getRenderingEngineTemplate().getName()); - NodeRef templateRef = this.nodeService.createNode(formRef, + NodeRef templateRef = getNodeService().createNode(formRef, WCMAppModel.ASSOC_WEBFORMTEMPLATE, WCMAppModel.ASSOC_WEBFORMTEMPLATE, WCMAppModel.TYPE_WEBFORMTEMPLATE, @@ -378,7 +380,7 @@ public class CreateWebsiteWizard extends BaseWizardBean { props.clear(); props.put(WCMAppModel.PROP_OUTPUT_PATH_PATTERN, template.getOutputPathPattern()); - this.nodeService.addAspect(templateRef, WCMAppModel.ASPECT_OUTPUT_PATH_PATTERN, props); + getNodeService().addAspect(templateRef, WCMAppModel.ASPECT_OUTPUT_PATH_PATTERN, props); } } } @@ -388,7 +390,7 @@ public class CreateWebsiteWizard extends BaseWizardBean { props.clear(); props.put(WCMAppModel.PROP_WORKFLOW_NAME, workflow.getName()); - NodeRef workflowRef = this.nodeService.createNode(nodeRef, + NodeRef workflowRef = getNodeService().createNode(nodeRef, WCMAppModel.ASSOC_WEBWORKFLOWDEFAULTS, WCMAppModel.ASSOC_WEBWORKFLOWDEFAULTS, WCMAppModel.TYPE_WEBWORKFLOWDEFAULTS, @@ -405,7 +407,7 @@ public class CreateWebsiteWizard extends BaseWizardBean { props.clear(); props.put(WCMAppModel.PROP_FILENAMEPATTERN, workflow.getFilenamePattern()); - this.nodeService.addAspect(workflowRef, WCMAppModel.ASPECT_FILENAMEPATTERN, props); + getNodeService().addAspect(workflowRef, WCMAppModel.ASPECT_FILENAMEPATTERN, props); } } } @@ -424,7 +426,7 @@ public class CreateWebsiteWizard extends BaseWizardBean // simple properties are optionally loaded if (loadProperties) { - Map props = this.nodeService.getProperties(nodeRef); + Map props = getNodeService().getProperties(nodeRef); this.name = (String)props.get(ContentModel.PROP_NAME); this.title = (String)props.get(ContentModel.PROP_TITLE); this.description = (String)props.get(ContentModel.PROP_DESCRIPTION); @@ -443,65 +445,65 @@ public class CreateWebsiteWizard extends BaseWizardBean wiz.reset(); // load the users assigned to the web project - List userInfoRefs = this.nodeService.getChildAssocs( + List userInfoRefs = getNodeService().getChildAssocs( nodeRef, WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef ref : userInfoRefs) { NodeRef userRef = ref.getChildRef(); - String username = (String)this.nodeService.getProperty(userRef, WCMAppModel.PROP_WEBUSERNAME); - String userrole = (String)this.nodeService.getProperty(userRef, WCMAppModel.PROP_WEBUSERROLE); + String username = (String)getNodeService().getProperty(userRef, WCMAppModel.PROP_WEBUSERNAME); + String userrole = (String)getNodeService().getProperty(userRef, WCMAppModel.PROP_WEBUSERROLE); wiz.addAuthorityWithRole(username, userrole); } } // load the form templates - List webFormRefs = this.nodeService.getChildAssocs( + List webFormRefs = getNodeService().getChildAssocs( nodeRef, WCMAppModel.ASSOC_WEBFORM, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef ref : webFormRefs) { NodeRef formRef = ref.getChildRef(); - String name = (String)this.nodeService.getProperty(formRef, WCMAppModel.PROP_FORMNAME); + String name = (String)getNodeService().getProperty(formRef, WCMAppModel.PROP_FORMNAME); try { - Form formImpl = this.formsService.getWebForm(name); + Form formImpl = getFormsService().getWebForm(name); FormWrapper form = new FormWrapper(formImpl); - form.setTitle((String)this.nodeService.getProperty(formRef, ContentModel.PROP_TITLE)); - form.setDescription((String)this.nodeService.getProperty(formRef, ContentModel.PROP_DESCRIPTION)); - form.setOutputPathPattern((String)this.nodeService.getProperty(formRef, WCMAppModel.PROP_OUTPUT_PATH_PATTERN)); + 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 = this.nodeService.getChildAssocs( + List workflowRefs = getNodeService().getChildAssocs( formRef, WCMAppModel.ASSOC_WORKFLOWDEFAULTS, RegexQNamePattern.MATCH_ALL); if (workflowRefs.size() == 1) { NodeRef wfRef = workflowRefs.get(0).getChildRef(); - String wfName = (String)this.nodeService.getProperty(wfRef, WCMAppModel.PROP_WORKFLOW_NAME); - WorkflowDefinition wfDef = this.workflowService.getDefinitionByName(wfName); + 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.startTaskDefinition != null) + if (wfDef.getStartTaskDefinition() != null) { - wfWrapper.setType(wfDef.startTaskDefinition.metadata.getName()); + wfWrapper.setType(wfDef.getStartTaskDefinition().metadata.getName()); } form.setWorkflow(wfWrapper); } } // the templates attached to the form - List templateRefs = this.nodeService.getChildAssocs( + List templateRefs = getNodeService().getChildAssocs( formRef, WCMAppModel.ASSOC_WEBFORMTEMPLATE, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef tChildRef : templateRefs) { NodeRef templateRef = tChildRef.getChildRef(); - String renderingEngineTemplateName = (String)this.nodeService.getProperty( + String renderingEngineTemplateName = (String)getNodeService().getProperty( templateRef, WCMAppModel.PROP_BASE_RENDERING_ENGINE_TEMPLATE_NAME); RenderingEngineTemplate ret = formImpl.getRenderingEngineTemplate(renderingEngineTemplateName); if (ret != null) { - String outputPathPattern = (String)this.nodeService.getProperty( + String outputPathPattern = (String)getNodeService().getProperty( templateRef, WCMAppModel.PROP_OUTPUT_PATH_PATTERN); form.addTemplate(new PresentationTemplate(ret, outputPathPattern)); } @@ -519,22 +521,22 @@ public class CreateWebsiteWizard extends BaseWizardBean } // load the workflows associated with the website - List workflowRefs = this.nodeService.getChildAssocs( + List workflowRefs = getNodeService().getChildAssocs( nodeRef, WCMAppModel.ASSOC_WEBWORKFLOWDEFAULTS, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef wChildRef : workflowRefs) { NodeRef wfRef = wChildRef.getChildRef(); - String wfName = (String)this.nodeService.getProperty(wfRef, WCMAppModel.PROP_WORKFLOW_NAME); + String wfName = (String)getNodeService().getProperty(wfRef, WCMAppModel.PROP_WORKFLOW_NAME); WorkflowDefinition wfDef = this.workflowService.getDefinitionByName(wfName); if (wfDef != null) { WorkflowWrapper wfWrapper = new WorkflowWrapper(wfName, wfDef.getTitle(), wfDef.getDescription()); wfWrapper.setParams((Map)AVMWorkflowUtil.deserializeWorkflowParams(wfRef)); - wfWrapper.setFilenamePattern((String)this.nodeService.getProperty(wfRef, + wfWrapper.setFilenamePattern((String)getNodeService().getProperty(wfRef, WCMAppModel.PROP_FILENAMEPATTERN)); - if (wfDef.startTaskDefinition != null) + if (wfDef.getStartTaskDefinition() != null) { - wfWrapper.setType(wfDef.startTaskDefinition.metadata.getName()); + wfWrapper.setType(wfDef.getStartTaskDefinition().metadata.getName()); } this.workflows.add(wfWrapper); } @@ -553,6 +555,15 @@ public class CreateWebsiteWizard extends BaseWizardBean this.avmService = avmService; } + protected AVMService getAvmService() + { + if (avmService == null) + { + avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); + } + return avmService; + } + /** * @param workflowService The WorkflowService to set. */ @@ -560,6 +571,15 @@ public class CreateWebsiteWizard extends BaseWizardBean { this.workflowService = workflowService; } + + protected WorkflowService getWorkflowService() + { + if (workflowService == null) + { + workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService(); + } + return workflowService; + } /** * @param personService The PersonService to set. @@ -569,6 +589,15 @@ public class CreateWebsiteWizard extends BaseWizardBean this.personService = personService; } + protected PersonService getPersonService() + { + if (personService == null) + { + personService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPersonService(); + } + return personService; + } + /** * @param avmLockingService The AVMLockingService to set */ @@ -576,6 +605,15 @@ public class CreateWebsiteWizard extends BaseWizardBean { this.avmLockingService = avmLockingService; } + + protected AVMLockingService getAvmLockingService() + { + if (avmLockingService == null) + { + avmLockingService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMLockingService(); + } + return avmLockingService; + } /** * @param formsService The FormsService to set. @@ -584,6 +622,16 @@ public class CreateWebsiteWizard extends BaseWizardBean { this.formsService = formsService; } + + protected FormsService getFormsService() + { + if (formsService == null) + { + formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); + } + return formsService; + } + // ------------------------------------------------------------------------------ @@ -746,7 +794,7 @@ public class CreateWebsiteWizard extends BaseWizardBean (this.sourceWebProject != null && this.sourceWebProject.length != 0)) { NodeRef sourceNodeRef = new NodeRef(this.sourceWebProject[0]); - name = (String)this.nodeService.getProperty(sourceNodeRef, ContentModel.PROP_NAME); + name = (String)getNodeService().getProperty(sourceNodeRef, ContentModel.PROP_NAME); } return name; } @@ -792,14 +840,14 @@ public class CreateWebsiteWizard extends BaseWizardBean try { // execute the query - results = searchService.query(Repository.getStoreRef(), + results = getSearchService().query(Repository.getStoreRef(), SearchService.LANGUAGE_LUCENE, query.toString()); webProjects = new ArrayList(results.length()); for (ResultSetRow row : results) { NodeRef ref = row.getNodeRef(); - String name = (String)this.nodeService.getProperty(ref, ContentModel.PROP_NAME); - String desc = (String)this.nodeService.getProperty(ref, ContentModel.PROP_DESCRIPTION); + String name = (String)getNodeService().getProperty(ref, ContentModel.PROP_NAME); + String desc = (String)getNodeService().getProperty(ref, ContentModel.PROP_DESCRIPTION); UIListItem item = new UIListItem(); item.setLabel(name); item.setDescription(desc); @@ -981,7 +1029,7 @@ public class CreateWebsiteWizard extends BaseWizardBean */ public List getFormsList() { - Collection
      forms = this.formsService.getWebForms(); + Collection forms = this.getFormsService().getWebForms(); List items = new ArrayList(forms.size()); for (Form form : forms) { @@ -1018,7 +1066,7 @@ public class CreateWebsiteWizard extends BaseWizardBean */ public void removeForm(ActionEvent event) { - FormWrapper wrapper = (FormWrapper)this.formsDataModel.getRowData(); + FormWrapper wrapper = (FormWrapper)this.getFormsDataModel().getRowData(); if (wrapper != null) { this.forms.remove(wrapper); @@ -1030,7 +1078,7 @@ public class CreateWebsiteWizard extends BaseWizardBean */ public void setupFormAction(ActionEvent event) { - setActionForm( (FormWrapper)this.formsDataModel.getRowData() ); + setActionForm( (FormWrapper)this.getFormsDataModel().getRowData() ); } /** @@ -1146,7 +1194,7 @@ public class CreateWebsiteWizard extends BaseWizardBean int index = selectList.getRowIndex(); if (index != -1) { - WorkflowDefinition workflow = (WorkflowDefinition)this.workflowsList.get(index).getValue(); + WorkflowDefinition workflow = (WorkflowDefinition)this.getWorkflowList().get(index).getValue(); this.workflows.add(new WorkflowWrapper( workflow.getName(), workflow.getTitle(), workflow.getDescription(), MATCH_DEFAULT)); } @@ -1157,7 +1205,7 @@ public class CreateWebsiteWizard extends BaseWizardBean */ public void removeWorkflow(ActionEvent event) { - WorkflowWrapper wrapper = (WorkflowWrapper)this.workflowsDataModel.getRowData(); + WorkflowWrapper wrapper = (WorkflowWrapper)this.getWorkflowsDataModel().getRowData(); if (wrapper != null) { this.workflows.remove(wrapper); @@ -1184,8 +1232,10 @@ public class CreateWebsiteWizard extends BaseWizardBean /** * Wrapper class for a configurable template Form instance */ - public static class FormWrapper + public static class FormWrapper implements Serializable { + private static final long serialVersionUID = -1452145043222643362L; + private Form form; private String title; private String description; @@ -1317,8 +1367,10 @@ public class CreateWebsiteWizard extends BaseWizardBean /** * Class to represent a single configured Presentation Template instance */ - public static class PresentationTemplate + public static class PresentationTemplate implements Serializable { + private static final long serialVersionUID = 5148139895329524483L; + private RenderingEngineTemplate ret; private String title; private String description; @@ -1385,6 +1437,8 @@ public class CreateWebsiteWizard extends BaseWizardBean */ public static class WorkflowWrapper implements WorkflowConfiguration { + private static final long serialVersionUID = -5570490335442743685L; + private String name; private String title; private String description; @@ -1481,8 +1535,10 @@ public class CreateWebsiteWizard extends BaseWizardBean } - public class UserWrapper + public class UserWrapper implements Serializable { + private static final long serialVersionUID = 6546685548198253273L; + private final String name, role; public UserWrapper(final String authority, final String role) @@ -1491,12 +1547,9 @@ public class CreateWebsiteWizard extends BaseWizardBean if (AuthorityType.getAuthorityType(authority) == AuthorityType.USER || AuthorityType.getAuthorityType(authority) == AuthorityType.GUEST) { - final NodeRef ref = - CreateWebsiteWizard.this.personService.getPerson(authority); - final String firstName = (String) - CreateWebsiteWizard.this.nodeService.getProperty(ref, ContentModel.PROP_FIRSTNAME); - final String lastName = (String) - CreateWebsiteWizard.this.nodeService.getProperty(ref, ContentModel.PROP_LASTNAME); + 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 diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteFileBrowseDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteFileBrowseDialog.java index d450942a20..e9237c1387 100644 --- a/source/java/org/alfresco/web/bean/wcm/DeleteFileBrowseDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/DeleteFileBrowseDialog.java @@ -33,6 +33,8 @@ import org.alfresco.web.app.AlfrescoNavigationHandler; */ public class DeleteFileBrowseDialog extends DeleteFileDialog { + private static final long serialVersionUID = 8731204315036822222L; + @Override protected String doPostCommitProcessing(FacesContext context, String outcome) { diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteFileDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteFileDialog.java index 4cf870db1c..e78229efd4 100644 --- a/source/java/org/alfresco/web/bean/wcm/DeleteFileDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/DeleteFileDialog.java @@ -35,7 +35,9 @@ 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.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -47,11 +49,13 @@ import org.apache.commons.logging.LogFactory; */ public class DeleteFileDialog extends BaseDialogBean { + private static final long serialVersionUID = -3962232696127851920L; + private static final Log logger = LogFactory.getLog(DeleteFileDialog.class); - protected AVMService avmService; + transient private AVMService avmService; protected AVMBrowseBean avmBrowseBean; - protected FormsService formsService; + transient private FormsService formsService; /** * @param avmBrowseBean The avmBrowseBean to set. @@ -68,6 +72,15 @@ public class DeleteFileDialog extends BaseDialogBean { this.avmService = avmService; } + + protected AVMService getAvmService() + { + if (avmService == null) + { + avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); + } + return avmService; + } /** * @param formsService The FormsService to set. @@ -77,6 +90,16 @@ public class DeleteFileDialog extends BaseDialogBean this.formsService = formsService; } + protected FormsService getFormsService() + { + if (formsService == null) + { + formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); + } + return formsService; + } + + // ------------------------------------------------------------------------------ // Dialog implementation @@ -99,7 +122,7 @@ public class DeleteFileDialog extends BaseDialogBean { try { - fid = this.formsService.getRendition(node.getNodeRef()).getPrimaryFormInstanceData(); + fid = this.getFormsService().getRendition(node.getNodeRef()).getPrimaryFormInstanceData(); } catch (FileNotFoundException fnfe) { @@ -108,23 +131,23 @@ public class DeleteFileDialog extends BaseDialogBean } else if (node.hasAspect(WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) { - fid = this.formsService.getFormInstanceData(node.getNodeRef()); + fid = this.getFormsService().getFormInstanceData(node.getNodeRef()); } if (fid != null) { final List renditions = fid.getRenditions(); for (final Rendition r : renditions) { - this.avmService.removeNode(AVMNodeConverter.SplitBase(r.getPath())[0], + this.getAvmService().removeNode(AVMNodeConverter.SplitBase(r.getPath())[0], AVMNodeConverter.SplitBase(r.getPath())[1]); } - this.avmService.removeNode(AVMNodeConverter.SplitBase(fid.getPath())[0], + this.getAvmService().removeNode(AVMNodeConverter.SplitBase(fid.getPath())[0], AVMNodeConverter.SplitBase(fid.getPath())[1]); } else { // delete the node - this.avmService.removeNode(AVMNodeConverter.SplitBase(node.getPath())[0], + this.getAvmService().removeNode(AVMNodeConverter.SplitBase(node.getPath())[0], AVMNodeConverter.SplitBase(node.getPath())[1]); } } @@ -166,7 +189,7 @@ public class DeleteFileDialog extends BaseDialogBean { try { - final FormInstanceData fid = this.formsService.getRendition(node.getNodeRef()).getPrimaryFormInstanceData(); + final FormInstanceData fid = this.getFormsService().getRendition(node.getNodeRef()).getPrimaryFormInstanceData(); return MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), "delete_rendition_confirm"), node.getName(), @@ -181,7 +204,7 @@ public class DeleteFileDialog extends BaseDialogBean } else if (node.hasAspect(WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) { - final FormInstanceData fid = this.formsService.getFormInstanceData(node.getNodeRef()); + final FormInstanceData fid = this.getFormsService().getFormInstanceData(node.getNodeRef()); return MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), "delete_form_instance_data_confirm"), fid.getName(), diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteFolderBrowseDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteFolderBrowseDialog.java index e6f4121875..7f11d201f1 100644 --- a/source/java/org/alfresco/web/bean/wcm/DeleteFolderBrowseDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/DeleteFolderBrowseDialog.java @@ -33,6 +33,8 @@ import org.alfresco.web.app.AlfrescoNavigationHandler; */ public class DeleteFolderBrowseDialog extends DeleteFolderDialog { + private static final long serialVersionUID = -8223178194058011913L; + @Override protected String doPostCommitProcessing(FacesContext context, String outcome) { diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteFolderDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteFolderDialog.java index 8761800704..238b6773a3 100644 --- a/source/java/org/alfresco/web/bean/wcm/DeleteFolderDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/DeleteFolderDialog.java @@ -32,6 +32,7 @@ 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; @@ -42,9 +43,11 @@ import org.apache.commons.logging.LogFactory; */ public class DeleteFolderDialog extends BaseDialogBean { + private static final long serialVersionUID = 4188977806570877462L; + private static final Log logger = LogFactory.getLog(DeleteFolderDialog.class); - protected AVMService avmService; + transient private AVMService avmService; protected AVMBrowseBean avmBrowseBean; @@ -64,6 +67,15 @@ public class DeleteFolderDialog extends BaseDialogBean this.avmService = avmService; } + protected AVMService getAvmService() + { + if (avmService == null) + { + avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); + } + return avmService; + } + // ------------------------------------------------------------------------------ // Dialog implementation @@ -80,7 +92,7 @@ public class DeleteFolderDialog extends BaseDialogBean logger.debug("Trying to delete AVM node: " + node.getPath()); // delete the node - this.avmService.removeNode( + this.getAvmService().removeNode( node.getPath().substring(0, node.getPath().lastIndexOf('/')), node.getPath().substring(node.getPath().lastIndexOf('/') + 1)); } diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteSandboxDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteSandboxDialog.java index 70c67112ea..1ad76c4385 100644 --- a/source/java/org/alfresco/web/bean/wcm/DeleteSandboxDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/DeleteSandboxDialog.java @@ -39,6 +39,7 @@ 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; @@ -49,11 +50,13 @@ import org.apache.commons.logging.LogFactory; */ public class DeleteSandboxDialog extends BaseDialogBean { + private static final long serialVersionUID = 6139801947722234685L; + private static final Log logger = LogFactory.getLog(DeleteSandboxDialog.class); - protected AVMService avmService; + transient private AVMService avmService; protected AVMBrowseBean avmBrowseBean; - protected AVMLockingService avmLockingService; + transient private AVMLockingService avmLockingService; // ------------------------------------------------------------------------------ @@ -75,6 +78,15 @@ public class DeleteSandboxDialog extends BaseDialogBean this.avmService = avmService; } + protected AVMService getAvmService() + { + if (avmService == null) + { + avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); + } + return avmService; + } + /** * @param avmLockingService The AVMLockingService to set */ @@ -83,6 +95,15 @@ public class DeleteSandboxDialog extends BaseDialogBean this.avmLockingService = avmLockingService; } + protected AVMLockingService getAvmLockingService() + { + if (avmLockingService == null) + { + avmLockingService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMLockingService(); + } + return avmLockingService; + } + // ------------------------------------------------------------------------------ // Dialog implementation @@ -98,14 +119,14 @@ public class DeleteSandboxDialog extends BaseDialogBean Node website = this.avmBrowseBean.getWebsite(); // remove the store reference from the website folder meta-data - List userInfoRefs = this.nodeService.getChildAssocs( + List userInfoRefs = this.getNodeService().getChildAssocs( website.getNodeRef(), WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef ref : userInfoRefs) { NodeRef userInfoRef = ref.getChildRef(); - String user = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME); - String role = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE); + String user = (String)getNodeService().getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME); + String role = (String)getNodeService().getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE); if (username.equals(user)) { @@ -137,18 +158,18 @@ public class DeleteSandboxDialog extends BaseDialogBean // layer attached. // purge the user main sandbox store from the system - this.avmService.purgeStore(sandbox); + this.getAvmService().purgeStore(sandbox); // remove any locks this user may have - this.avmLockingService.removeStoreLocks(sandbox); + this.getAvmLockingService().removeStoreLocks(sandbox); // purge the user preview sandbox store from the system sandbox = AVMUtil.buildUserPreviewStoreName(storeRoot, username); - this.avmService.purgeStore(sandbox); + this.getAvmService().purgeStore(sandbox); // remove any locks this user may have - this.avmLockingService.removeStoreLocks(sandbox); + this.getAvmLockingService().removeStoreLocks(sandbox); // remove the association to this web project user meta-data - this.nodeService.removeChild(website.getNodeRef(), ref.getChildRef()); + this.getNodeService().removeChild(website.getNodeRef(), ref.getChildRef()); break; } diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteWebsiteDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteWebsiteDialog.java index 5c9af4b187..653e94bbf3 100644 --- a/source/java/org/alfresco/web/bean/wcm/DeleteWebsiteDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/DeleteWebsiteDialog.java @@ -33,6 +33,7 @@ import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.web.bean.repository.Node; +import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.spaces.DeleteSpaceDialog; /** @@ -43,7 +44,9 @@ import org.alfresco.web.bean.spaces.DeleteSpaceDialog; */ public class DeleteWebsiteDialog extends DeleteSpaceDialog { - protected AVMService avmService; + private static final long serialVersionUID = -3598950865168230942L; + + transient private AVMService avmService; // ------------------------------------------------------------------------------ // Bean property getters and setters @@ -56,6 +59,15 @@ public class DeleteWebsiteDialog extends DeleteSpaceDialog this.avmService = avmService; } + protected AVMService getAvmService() + { + if (avmService == null) + { + avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); + } + return avmService; + } + // ------------------------------------------------------------------------------ // Dialog implementation @@ -100,11 +112,11 @@ public class DeleteWebsiteDialog extends DeleteSpaceDialog AVMUtil.removeAllVServerWebapps(path, true); // get the list of users who have a sandbox in the website - List userInfoRefs = nodeService.getChildAssocs( + List userInfoRefs = getNodeService().getChildAssocs( websiteNode.getNodeRef(), WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef ref : userInfoRefs) { - String username = (String)nodeService.getProperty(ref.getChildRef(), WCMAppModel.PROP_WEBUSERNAME); + String username = (String)getNodeService().getProperty(ref.getChildRef(), WCMAppModel.PROP_WEBUSERNAME); // delete the preview store for this user deleteStore(AVMUtil.buildUserPreviewStoreName(storeRoot, username)); @@ -131,9 +143,9 @@ public class DeleteWebsiteDialog extends DeleteSpaceDialog private void deleteStore(String store) { // check it exists before we try to remove it - if (this.avmService.getStore(store) != null) + if (this.getAvmService().getStore(store) != null) { - this.avmService.purgeStore(store); + this.getAvmService().purgeStore(store); } } diff --git a/source/java/org/alfresco/web/bean/wcm/DeploySnapshotDialog.java b/source/java/org/alfresco/web/bean/wcm/DeploySnapshotDialog.java index 8818f2df98..777bdedf5d 100644 --- a/source/java/org/alfresco/web/bean/wcm/DeploySnapshotDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/DeploySnapshotDialog.java @@ -46,6 +46,7 @@ import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName; import org.alfresco.util.GUID; 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; @@ -56,6 +57,8 @@ import org.apache.commons.logging.LogFactory; */ public class DeploySnapshotDialog extends BaseDialogBean { + private static final long serialVersionUID = 62702082716235924L; + protected int versionToDeploy; protected String[] deployTo; protected String stagingStore; @@ -63,8 +66,8 @@ public class DeploySnapshotDialog extends BaseDialogBean protected NodeRef webProjectRef; protected AVMBrowseBean avmBrowseBean; - protected AVMService avmService; - protected ActionService actionService; + transient private AVMService avmService; + transient private ActionService actionService; private static final Log logger = LogFactory.getLog(DeploySnapshotDialog.class); @@ -110,7 +113,7 @@ public class DeploySnapshotDialog extends BaseDialogBean props.put(WCMAppModel.PROP_DEPLOYATTEMPTSTORE, this.stagingStore); props.put(WCMAppModel.PROP_DEPLOYATTEMPTVERSION, this.versionToDeploy); props.put(WCMAppModel.PROP_DEPLOYATTEMPTTIME, new Date()); - NodeRef attempt = this.nodeService.createNode(webProjectRef, + NodeRef attempt = getNodeService().createNode(webProjectRef, WCMAppModel.ASSOC_DEPLOYMENTATTEMPT, WCMAppModel.ASSOC_DEPLOYMENTATTEMPT, WCMAppModel.TYPE_DEPLOYMENTATTEMPT, props).getChildRef(); @@ -120,10 +123,10 @@ public class DeploySnapshotDialog extends BaseDialogBean if (targetServer.length() > 0) { NodeRef serverRef = new NodeRef(targetServer); - if (nodeService.exists(serverRef)) + if (getNodeService().exists(serverRef)) { // get all properties of the target server - Map serverProps = nodeService.getProperties(serverRef); + Map serverProps = getNodeService().getProperties(serverRef); String serverUri = AVMDeploySnapshotAction.calculateServerUri(serverProps); String serverName = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERNAME); @@ -151,8 +154,8 @@ public class DeploySnapshotDialog extends BaseDialogBean args.put(AVMDeploySnapshotAction.PARAM_SERVER, serverRef); args.put(AVMDeploySnapshotAction.PARAM_ATTEMPT, attempt); args.put(AVMDeploySnapshotAction.PARAM_CALLBACK, monitor); - Action action = this.actionService.createAction(AVMDeploySnapshotAction.NAME, args); - this.actionService.executeAction(action, this.websiteRef, false, true); + Action action = getActionService().createAction(AVMDeploySnapshotAction.NAME, args); + getActionService().executeAction(action, this.websiteRef, false, true); } else if (logger.isWarnEnabled()) { @@ -162,12 +165,12 @@ public class DeploySnapshotDialog extends BaseDialogBean } // now we know the list of selected servers set the property on the attempt node - this.nodeService.setProperty(attempt, WCMAppModel.PROP_DEPLOYATTEMPTSERVERS, + getNodeService().setProperty(attempt, WCMAppModel.PROP_DEPLOYATTEMPTSERVERS, (Serializable)selectedDeployToNames); // set the deploymentattempid property on the store this deployment was for - this.avmService.deleteStoreProperty(this.stagingStore, SandboxConstants.PROP_LAST_DEPLOYMENT_ID); - this.avmService.setStoreProperty(this.stagingStore, SandboxConstants.PROP_LAST_DEPLOYMENT_ID, + getAvmService().deleteStoreProperty(this.stagingStore, SandboxConstants.PROP_LAST_DEPLOYMENT_ID); + getAvmService().setStoreProperty(this.stagingStore, SandboxConstants.PROP_LAST_DEPLOYMENT_ID, new PropertyValue(DataTypeDefinition.TEXT, attemptId)); // close this dialog and immediately open the monitorDeployment dialog @@ -191,6 +194,7 @@ public class DeploySnapshotDialog extends BaseDialogBean return super.getCancelButtonLabel(); } + // ------------------------------------------------------------------------------ // Bean getters and setters @@ -210,6 +214,15 @@ public class DeploySnapshotDialog extends BaseDialogBean this.avmService = avmService; } + protected AVMService getAvmService() + { + if (avmService == null) + { + avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); + } + return avmService; + } + /** * @param actionService The actionService to set. */ @@ -218,6 +231,15 @@ public class DeploySnapshotDialog extends BaseDialogBean 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 * diff --git a/source/java/org/alfresco/web/bean/wcm/DeploymentMonitor.java b/source/java/org/alfresco/web/bean/wcm/DeploymentMonitor.java index 1e0cf9006b..531e78c567 100644 --- a/source/java/org/alfresco/web/bean/wcm/DeploymentMonitor.java +++ b/source/java/org/alfresco/web/bean/wcm/DeploymentMonitor.java @@ -41,9 +41,11 @@ import org.apache.commons.logging.LogFactory; * * @author gavinc */ -@SuppressWarnings("serial") + public class DeploymentMonitor implements DeploymentCallback, Serializable { + private static final long serialVersionUID = 8167554931073708558L; + private String id; private NodeRef website; private NodeRef targetServer; diff --git a/source/java/org/alfresco/web/bean/wcm/DeploymentProgressBean.java b/source/java/org/alfresco/web/bean/wcm/DeploymentProgressBean.java index 8b2bb64f7b..2b1e24145c 100644 --- a/source/java/org/alfresco/web/bean/wcm/DeploymentProgressBean.java +++ b/source/java/org/alfresco/web/bean/wcm/DeploymentProgressBean.java @@ -25,6 +25,7 @@ package org.alfresco.web.bean.wcm; import java.io.IOException; +import java.io.Serializable; import java.util.Map; import java.util.StringTokenizer; @@ -40,8 +41,10 @@ import org.apache.commons.logging.LogFactory; * * @author gavinc */ -public class DeploymentProgressBean +public class DeploymentProgressBean implements Serializable { + private static final long serialVersionUID = 3940559099944268131L; + private static Log logger = LogFactory.getLog(DeploymentProgressBean.class); public void getStatus() throws IOException diff --git a/source/java/org/alfresco/web/bean/wcm/EditAvmFileDialog.java b/source/java/org/alfresco/web/bean/wcm/EditAvmFileDialog.java index 2adb318079..b57e13809e 100644 --- a/source/java/org/alfresco/web/bean/wcm/EditAvmFileDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/EditAvmFileDialog.java @@ -1,141 +1,147 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing - */ -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.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.DownloadContentServlet; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.ui.common.Utils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * @author arielb - */ -public class EditAvmFileDialog - extends BaseDialogBean -{ - private static final Log LOGGER = LogFactory.getLog(EditAvmFileDialog.class); - - /** AVM service reference */ - protected 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; - } - - /** - * @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 Utils.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"); - } +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing + */ +package org.alfresco.web.bean.wcm; + +import java.util.Map; + +import javax.faces.context.FacesContext; + +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.DownloadContentServlet; +import org.alfresco.web.bean.dialog.BaseDialogBean; +import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.ui.common.Utils; +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 Utils.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 index 1a5d01c456..0c110c5a44 100644 --- a/source/java/org/alfresco/web/bean/wcm/EditFilePropertiesDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/EditFilePropertiesDialog.java @@ -46,6 +46,7 @@ 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; @@ -61,9 +62,11 @@ import org.alfresco.web.ui.common.Utils; */ public class EditFilePropertiesDialog extends EditContentPropertiesDialog { + private static final long serialVersionUID = 635722726225138092L; + protected AVMBrowseBean avmBrowseBean; - protected AVMService avmService; - protected FormsService formsService; + transient private AVMService avmService; + transient private FormsService formsService; // ------------------------------------------------------------------------------ @@ -85,6 +88,15 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog this.avmService = avmService; } + protected AVMService getAvmService() + { + if (avmService == null) + { + avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); + } + return avmService; + } + /** * @param formsService The FormsService to set. */ @@ -93,6 +105,16 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog this.formsService = formsService; } + protected FormsService getFormsService() + { + if (formsService == null) + { + formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); + } + return formsService; + } + + // ------------------------------------------------------------------------------ // Dialog implementation @@ -121,7 +143,7 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog // we need to put all the properties from the editable bag back into // the format expected by the repository - Map repoProps = this.nodeService.getProperties(nodeRef); + 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); @@ -138,9 +160,9 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog } // add the "titled" aspect if required, properties will get set below - if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TITLED) == false) + if (this.getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_TITLED) == false) { - nodeService.addAspect(nodeRef, ContentModel.ASPECT_TITLED, null); + getNodeService().addAspect(nodeRef, ContentModel.ASPECT_TITLED, null); } // add the remaining properties @@ -157,7 +179,7 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog if ((propValue != null) && (propValue instanceof String) && (propValue.toString().length() == 0)) { - PropertyDefinition propDef = this.dictionaryService.getProperty(qname); + PropertyDefinition propDef = this.getDictionaryService().getProperty(qname); if (propDef != null) { if (propDef.getDataType().getName().equals(DataTypeDefinition.DOUBLE) || @@ -185,7 +207,7 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog } } // send the properties back to the repository - this.avmService.setNodeProperties(AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond(), avmProps); + 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(); @@ -194,32 +216,32 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog if (name != null && name.equals(oldName) == false) { - if (this.nodeService.hasAspect(nodeRef, WCMAppModel.ASPECT_RENDITION)) + if (this.getNodeService().hasAspect(nodeRef, WCMAppModel.ASPECT_RENDITION)) { - throw new UnsupportedOperationException(this.nodeService.getProperty(nodeRef, ContentModel.PROP_NAME) + + 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.nodeService.hasAspect(nodeRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) + if (this.getNodeService().hasAspect(nodeRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) { - final FormInstanceData fid = this.formsService.getFormInstanceData(nodeRef); + final FormInstanceData fid = this.getFormsService().getFormInstanceData(nodeRef); // delete all existing renditions for (final Rendition r : fid.getRenditions()) { - this.avmService.removeNode(r.getPath()); + this.getAvmService().removeNode(r.getPath()); } - this.nodeService.removeProperty(nodeRef, WCMAppModel.PROP_RENDITIONS); + this.getNodeService().removeProperty(nodeRef, WCMAppModel.PROP_RENDITIONS); } - this.avmService.rename(parentPath, oldName, parentPath, name); + this.getAvmService().rename(parentPath, oldName, parentPath, name); nodeRef = AVMNodeConverter.ToNodeRef(-1, AVMNodeConverter.ExtendAVMPath(parentPath, name)); - if (this.nodeService.hasAspect(nodeRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) + if (this.getNodeService().hasAspect(nodeRef, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) { - final FormInstanceData fid = this.formsService.getFormInstanceData(nodeRef); + final FormInstanceData fid = this.getFormsService().getFormInstanceData(nodeRef); for (final FormInstanceData.RegenerateResult rr : fid.regenerateRenditions()) { if (rr.getException() != null) @@ -250,7 +272,7 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog 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.avmService.lookup(-1, newPath))); + this.avmBrowseBean.setAvmActionNode(new AVMNode(this.getAvmService().lookup(-1, newPath))); return outcome; } diff --git a/source/java/org/alfresco/web/bean/wcm/EditFolderPropertiesDialog.java b/source/java/org/alfresco/web/bean/wcm/EditFolderPropertiesDialog.java index 2e3eab1907..ce9f146d0d 100644 --- a/source/java/org/alfresco/web/bean/wcm/EditFolderPropertiesDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/EditFolderPropertiesDialog.java @@ -26,8 +26,6 @@ package org.alfresco.web.bean.wcm; import java.io.Serializable; import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -43,9 +41,9 @@ 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.dictionary.TypeDefinition; 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; @@ -58,8 +56,10 @@ import org.alfresco.web.ui.common.component.UIListItem; */ public class EditFolderPropertiesDialog extends EditSpaceDialog { + private static final long serialVersionUID = -6423913727249054187L; + protected AVMBrowseBean avmBrowseBean; - protected AVMService avmService; + transient private AVMService avmService; // ------------------------------------------------------------------------------ @@ -81,6 +81,15 @@ public class EditFolderPropertiesDialog extends EditSpaceDialog this.avmService = avmService; } + protected AVMService getAvmService() + { + if (avmService == null) + { + avmService = (AVMService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "AVMLockingAwareService"); + } + return avmService; + } + // ------------------------------------------------------------------------------ // Dialog implementation @@ -109,12 +118,12 @@ public class EditFolderPropertiesDialog extends EditSpaceDialog } // get the current set of properties from the repository - Map repoProps = this.nodeService.getProperties(nodeRef); + Map repoProps = this.getNodeService().getProperties(nodeRef); // add the "uifacets" aspect if required, properties will get set below - if (this.nodeService.hasAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS) == false) + if (this.getNodeService().hasAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS) == false) { - this.nodeService.addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, null); + this.getNodeService().addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, null); } // overwrite the current properties with the edited ones @@ -131,7 +140,7 @@ public class EditFolderPropertiesDialog extends EditSpaceDialog if ((propValue != null) && (propValue instanceof String) && (propValue.toString().length() == 0)) { - PropertyDefinition propDef = this.dictionaryService.getProperty(qname); + PropertyDefinition propDef = this.getDictionaryService().getProperty(qname); if (propDef != null) { if (propDef.getDataType().getName().equals(DataTypeDefinition.DOUBLE) || @@ -160,12 +169,12 @@ public class EditFolderPropertiesDialog extends EditSpaceDialog } // send the properties back to the repository - this.avmService.setNodeProperties(AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond(), avmProps); + this.getAvmService().setNodeProperties(AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond(), avmProps); // perform the rename last as for an AVM it changes the NodeRef if (name != null) { - this.fileFolderService.rename(nodeRef, name); + this.getFileFolderService().rename(nodeRef, name); editedProps.put(ContentModel.PROP_NAME.toString(), name); } @@ -180,7 +189,7 @@ public class EditFolderPropertiesDialog extends EditSpaceDialog 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.avmService.lookup(-1, newPath))); + this.avmBrowseBean.setAvmActionNode(new AVMNode(this.getAvmService().lookup(-1, newPath))); return outcome; } @@ -188,12 +197,12 @@ public class EditFolderPropertiesDialog extends EditSpaceDialog 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 index 01d3a0fac1..fc2e788e55 100644 --- a/source/java/org/alfresco/web/bean/wcm/EditFormWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/EditFormWizard.java @@ -57,6 +57,8 @@ import org.apache.commons.logging.LogFactory; public class EditFormWizard extends CreateFormWizard { + private static final long serialVersionUID = -3260838389223325316L; + private final static Log LOGGER = LogFactory.getLog(EditFormWizard.class); private List removedRenderingEngineTemplates; @@ -79,23 +81,23 @@ public class EditFormWizard throw new IllegalArgumentException("Edit Form wizard requires action node context."); } - final Form form = this.formsService.getForm(formNodeRef); + 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.nodeService.getProperty(formNodeRef, WCMAppModel.PROP_XML_SCHEMA); + this.getNodeService().getProperty(formNodeRef, WCMAppModel.PROP_XML_SCHEMA); if (schemaNodeRef == null) { LOGGER.debug(WCMAppModel.PROP_XML_SCHEMA + " not set on " + formNodeRef + ", checking " + WCMAppModel.PROP_XML_SCHEMA_OLD); schemaNodeRef = (NodeRef) - nodeService.getProperty(formNodeRef, WCMAppModel.PROP_XML_SCHEMA_OLD); + getNodeService().getProperty(formNodeRef, WCMAppModel.PROP_XML_SCHEMA_OLD); if (schemaNodeRef != null) { - nodeService.setProperty(formNodeRef, WCMAppModel.PROP_XML_SCHEMA, schemaNodeRef); + getNodeService().setProperty(formNodeRef, WCMAppModel.PROP_XML_SCHEMA, schemaNodeRef); } } if (schemaNodeRef == null) @@ -105,7 +107,7 @@ public class EditFormWizard " for form " + form.getName() + " not to be null."); } - this.setSchemaFileName((String)this.nodeService.getProperty(schemaNodeRef, + this.setSchemaFileName((String)this.getNodeService().getProperty(schemaNodeRef, ContentModel.PROP_NAME)); try { @@ -137,7 +139,7 @@ public class EditFormWizard if (getIsWebForm() == true) { - this.associatedWebProjects = this.formsService.getAssociatedWebProjects(form); + this.associatedWebProjects = this.getFormsService().getAssociatedWebProjects(form); } } @@ -152,22 +154,22 @@ public class EditFormWizard final NodeRef formNodeRef = this.browseBean.getActionSpace().getNodeRef(); // apply the name, title and description props - if (!this.getFormName().equals(this.nodeService.getProperty(formNodeRef, ContentModel.PROP_NAME))) + if (!this.getFormName().equals(this.getNodeService().getProperty(formNodeRef, ContentModel.PROP_NAME))) { - this.fileFolderService.rename(formNodeRef, this.getFormName()); + this.getFileFolderService().rename(formNodeRef, this.getFormName()); } - this.nodeService.setProperty(formNodeRef, ContentModel.PROP_TITLE, this.getFormTitle()); - this.nodeService.setProperty(formNodeRef, ContentModel.PROP_DESCRIPTION, this.getFormDescription()); - this.nodeService.setProperty(formNodeRef, + 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.nodeService.setProperty(formNodeRef, + this.getNodeService().setProperty(formNodeRef, WCMAppModel.PROP_XML_SCHEMA_ROOT_ELEMENT_NAME, this.getSchemaRootElementName()); final WorkflowDefinition wd = this.getDefaultWorkflowDefinition(); final List workflowRefs = - this.nodeService.getChildAssocs(formNodeRef, + this.getNodeService().getChildAssocs(formNodeRef, WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS, RegexQNamePattern.MATCH_ALL); @@ -177,7 +179,7 @@ public class EditFormWizard " to form " + this.getFormName()); final Map props = new HashMap(1, 1.0f); props.put(WCMAppModel.PROP_WORKFLOW_NAME, wd.getName()); - this.nodeService.createNode(formNodeRef, + this.getNodeService().createNode(formNodeRef, WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS, WCMAppModel.ASSOC_FORM_WORKFLOW_DEFAULTS, WCMAppModel.TYPE_WORKFLOW_DEFAULTS, @@ -187,20 +189,20 @@ public class EditFormWizard { LOGGER.debug("setting workflow definition " + wd.getName() + " to form " + this.getFormName()); - this.nodeService.setProperty(workflowRefs.get(0).getChildRef(), + this.getNodeService().setProperty(workflowRefs.get(0).getChildRef(), WCMAppModel.PROP_WORKFLOW_NAME, wd.getName()); } else if (wd == null && workflowRefs.size() == 1) { LOGGER.debug("removing workflow definitions from form " + this.getFormName()); - this.nodeService.removeChild(formNodeRef, workflowRefs.get(0).getChildRef()); + this.getNodeService().removeChild(formNodeRef, workflowRefs.get(0).getChildRef()); } if (this.getSchemaFile() != null) { final FileInfo fileInfo = - this.fileFolderService.create(formNodeRef, + this.getFileFolderService().create(formNodeRef, this.getSchemaFileName(), ContentModel.TYPE_CONTENT); // get a writer for the content and put the file @@ -211,7 +213,7 @@ public class EditFormWizard writer.setMimetype(MimetypeMap.MIMETYPE_XML); writer.setEncoding("UTF-8"); writer.putContent(this.getSchemaFile()); - this.nodeService.setProperty(formNodeRef, + this.getNodeService().setProperty(formNodeRef, WCMAppModel.PROP_XML_SCHEMA, fileInfo.getNodeRef()); } @@ -223,7 +225,7 @@ public class EditFormWizard LOGGER.debug("removing rendering engine template " + retd); assert retd != null; assert retd.getNodeRef() != null; - this.nodeService.removeChild(formNodeRef, retd.getNodeRef()); + this.getNodeService().removeChild(formNodeRef, retd.getNodeRef()); } } @@ -245,7 +247,7 @@ public class EditFormWizard public void removeSelectedRenderingEngineTemplate(final ActionEvent event) { final RenderingEngineTemplateData wrapper = (RenderingEngineTemplateData) - this.renderingEngineTemplatesDataModel.getRowData(); + this.getRenderingEngineTemplatesDataModel().getRowData(); if (wrapper != null) { if (this.removedRenderingEngineTemplates == null) diff --git a/source/java/org/alfresco/web/bean/wcm/EditWebContentWizard.java b/source/java/org/alfresco/web/bean/wcm/EditWebContentWizard.java index 595b14712f..e62cbc55fc 100644 --- a/source/java/org/alfresco/web/bean/wcm/EditWebContentWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/EditWebContentWizard.java @@ -1,249 +1,249 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing - */ -package org.alfresco.web.bean.wcm; - -import java.io.ByteArrayInputStream; -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.ValueChangeEvent; -import javax.faces.model.SelectItem; - -import org.alfresco.config.Config; -import org.alfresco.config.ConfigElement; -import org.alfresco.config.ConfigService; -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.model.WCMAppModel; -import org.alfresco.model.WCMWorkflowModel; -import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.workflow.WorkflowModel; -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.AVMLock; -import org.alfresco.service.cmr.avmsync.AVMDifference; -import org.alfresco.service.cmr.avmsync.AVMSyncService; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.ContentWriter; -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.WorkflowPath; -import org.alfresco.service.cmr.workflow.WorkflowService; -import org.alfresco.service.cmr.workflow.WorkflowTask; -import org.alfresco.service.cmr.workflow.WorkflowTaskState; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.content.BaseContentWizard; -import org.alfresco.web.bean.repository.Node; -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.FormProcessor; -import org.alfresco.web.forms.FormsService; -import org.alfresco.web.forms.RenderingEngineTemplate; -import org.alfresco.web.forms.Rendition; -import org.alfresco.web.forms.XMLUtil; -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.w3c.dom.Document; - -/** - * Bean implementation for the "Edit Web Content Wizard" dialog - */ -public class EditWebContentWizard extends CreateWebContentWizard -{ - private static final Log LOGGER = LogFactory.getLog(EditWebContentWizard.class); - - private AVMNode avmNode; - private Form form; - - // ------------------------------------------------------------------------------ - // 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()); - - this.formInstanceData = this.formsService.getFormInstanceData(-1, this.createdPath); - final WebProject webProject = new WebProject(this.createdPath); - try - { - this.formName = this.formInstanceData.getForm().getName(); - this.form = webProject.getForm(this.formName); - } - catch (FormNotFoundException fnfe) - { - Utils.addErrorMessage(fnfe.getMessage(), fnfe); - } - - this.content = this.avmService.getContentReader(-1, this.createdPath).getContentString(); - this.fileName = this.formInstanceData.getName(); - this.mimeType = MimetypeMap.MIMETYPE_XML; - } - - @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); - } - AVMLock lock = this.avmLockingService.getLock(AVMUtil.getStoreId(this.createdPath), - AVMUtil.getStoreRelativePath(this.createdPath)); - if (lock != null) - { - LOGGER.debug("transferring lock from " + lock.getStore() + - " to " + AVMUtil.getStoreName(this.createdPath)); - this.avmLockingService.modifyLock(AVMUtil.getStoreId(this.createdPath), - AVMUtil.getStoreRelativePath(this.createdPath), - null, - AVMUtil.getStoreName(this.createdPath), - null, - null); - } - - final ContentWriter writer = this.avmService.getContentWriter(this.createdPath); - this.content = XMLUtil.toString(this.instanceDataDocument, false); - writer.putContent(this.content); - - // XXXarielb might not need to do this reload - this.formInstanceData = this.formsService.getFormInstanceData(-1, this.createdPath); - for (final Rendition r : this.formInstanceData.getRenditions()) - { - lock = this.avmLockingService.getLock(AVMUtil.getStoreId(r.getPath()), - AVMUtil.getStoreRelativePath(r.getPath())); - if (lock != null) - { - LOGGER.debug("transferring lock from " + lock.getStore() + - " to " + AVMUtil.getStoreName(r.getPath())); - this.avmLockingService.modifyLock(AVMUtil.getStoreId(r.getPath()), - AVMUtil.getStoreRelativePath(r.getPath()), - null, - AVMUtil.getStoreName(r.getPath()), - null, - null); - } - } - 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()); - } - else - { - final Rendition r = rr.getRendition(); - this.renditions.add(r); - LOGGER.debug("transferring lock for " + r.getPath() + - " back to " + AVMUtil.getCorrespondingMainStoreName(AVMUtil.getStoreName(r.getPath()))); - this.avmLockingService.modifyLock(AVMUtil.getStoreId(r.getPath()), - AVMUtil.getStoreRelativePath(r.getPath()), - null, - AVMUtil.getCorrespondingMainStoreName(AVMUtil.getStoreName(r.getPath())), - null, - null); - - } - } - LOGGER.debug("transferring form instance data lock back to " + - AVMUtil.getCorrespondingMainStoreName(AVMUtil.getStoreName(this.createdPath))); - this.avmLockingService.modifyLock(AVMUtil.getStoreId(this.createdPath), - AVMUtil.getStoreRelativePath(this.createdPath), - null, - AVMUtil.getCorrespondingMainStoreName(AVMUtil.getStoreName(this.createdPath)), - null, - null); - } - - /** 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; - } -} +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing + */ +package org.alfresco.web.bean.wcm; + +import java.io.ByteArrayInputStream; +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.ValueChangeEvent; +import javax.faces.model.SelectItem; + +import org.alfresco.config.Config; +import org.alfresco.config.ConfigElement; +import org.alfresco.config.ConfigService; +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.model.WCMAppModel; +import org.alfresco.model.WCMWorkflowModel; +import org.alfresco.repo.avm.AVMNodeConverter; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.workflow.WorkflowModel; +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.AVMLock; +import org.alfresco.service.cmr.avmsync.AVMDifference; +import org.alfresco.service.cmr.avmsync.AVMSyncService; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.ContentWriter; +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.WorkflowPath; +import org.alfresco.service.cmr.workflow.WorkflowService; +import org.alfresco.service.cmr.workflow.WorkflowTask; +import org.alfresco.service.cmr.workflow.WorkflowTaskState; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.alfresco.web.app.Application; +import org.alfresco.web.bean.content.BaseContentWizard; +import org.alfresco.web.bean.repository.Node; +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.FormProcessor; +import org.alfresco.web.forms.FormsService; +import org.alfresco.web.forms.RenderingEngineTemplate; +import org.alfresco.web.forms.Rendition; +import org.alfresco.web.forms.XMLUtil; +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.w3c.dom.Document; + +/** + * 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; + + // ------------------------------------------------------------------------------ + // 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()); + this.formInstanceData = this.getFormsService().getFormInstanceData(-1, this.createdPath); + final WebProject webProject = new WebProject(this.createdPath); + try + { + this.formName = this.formInstanceData.getForm().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.fileName = this.formInstanceData.getName(); + this.mimeType = MimetypeMap.MIMETYPE_XML; + } + + @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); + } + AVMLock lock = this.getAvmLockingService().getLock(AVMUtil.getStoreId(this.createdPath), + AVMUtil.getStoreRelativePath(this.createdPath)); + if (lock != null) + { + LOGGER.debug("transferring lock from " + lock.getStore() + + " to " + AVMUtil.getStoreName(this.createdPath)); + this.getAvmLockingService().modifyLock(AVMUtil.getStoreId(this.createdPath), + AVMUtil.getStoreRelativePath(this.createdPath), + null, + AVMUtil.getStoreName(this.createdPath), + null, + null); + } + + final ContentWriter writer = this.getAvmService().getContentWriter(this.createdPath); + 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); + for (final Rendition r : this.formInstanceData.getRenditions()) + { + lock = this.getAvmLockingService().getLock(AVMUtil.getStoreId(r.getPath()), + AVMUtil.getStoreRelativePath(r.getPath())); + if (lock != null) + { + LOGGER.debug("transferring lock from " + lock.getStore() + + " to " + AVMUtil.getStoreName(r.getPath())); + this.getAvmLockingService().modifyLock(AVMUtil.getStoreId(r.getPath()), + AVMUtil.getStoreRelativePath(r.getPath()), + null, + AVMUtil.getStoreName(r.getPath()), + null, + null); + } + } + 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()); + } + else + { + final Rendition r = rr.getRendition(); + this.renditions.add(r); + LOGGER.debug("transferring lock for " + r.getPath() + + " back to " + AVMUtil.getCorrespondingMainStoreName(AVMUtil.getStoreName(r.getPath()))); + this.getAvmLockingService().modifyLock(AVMUtil.getStoreId(r.getPath()), + AVMUtil.getStoreRelativePath(r.getPath()), + null, + AVMUtil.getCorrespondingMainStoreName(AVMUtil.getStoreName(r.getPath())), + null, + null); + + } + } + LOGGER.debug("transferring form instance data lock back to " + + AVMUtil.getCorrespondingMainStoreName(AVMUtil.getStoreName(this.createdPath))); + this.getAvmLockingService().modifyLock(AVMUtil.getStoreId(this.createdPath), + AVMUtil.getStoreRelativePath(this.createdPath), + null, + AVMUtil.getCorrespondingMainStoreName(AVMUtil.getStoreName(this.createdPath)), + null, + null); + } + + /** 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 index 8a5ac57e06..a46df47f8b 100644 --- a/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java @@ -46,6 +46,8 @@ public class EditWebsiteWizard extends CreateWebsiteWizard // ------------------------------------------------------------------------------ // Wizard implementation + private static final long serialVersionUID = -4856350244207566218L; + /** * Initialises the wizard */ @@ -81,10 +83,10 @@ public class EditWebsiteWizard extends CreateWebsiteWizard NodeRef nodeRef = this.browseBean.getActionSpace().getNodeRef(); // apply the name, title and description props - this.nodeService.setProperty(nodeRef, ContentModel.PROP_NAME, this.name); - this.nodeService.setProperty(nodeRef, ContentModel.PROP_TITLE, this.title); - this.nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, this.description); - this.nodeService.setProperty(nodeRef, WCMAppModel.PROP_ISSOURCE, this.isSource); + getNodeService().setProperty(nodeRef, ContentModel.PROP_NAME, this.name); + getNodeService().setProperty(nodeRef, ContentModel.PROP_TITLE, this.title); + getNodeService().setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, this.description); + getNodeService().setProperty(nodeRef, WCMAppModel.PROP_ISSOURCE, this.isSource); // clear the existing settings for forms, template and workflows - then the existing methods // can be used to apply the modified and previous settings from scratch @@ -95,11 +97,11 @@ public class EditWebsiteWizard extends CreateWebsiteWizard { String stagingStore = AVMUtil.buildStagingStoreName(this.dnsName); String webappPath = AVMUtil.buildStoreWebappPath(stagingStore, this.webapp); - if (this.avmService.lookup(-1, webappPath) == null) + if (getAvmService().lookup(-1, webappPath) == null) { - this.avmService.createDirectory(AVMUtil.buildSandboxRootPath(stagingStore), this.webapp); + getAvmService().createDirectory(AVMUtil.buildSandboxRootPath(stagingStore), this.webapp); } - this.nodeService.setProperty(nodeRef, WCMAppModel.PROP_DEFAULTWEBAPP, this.webapp); + getNodeService().setProperty(nodeRef, WCMAppModel.PROP_DEFAULTWEBAPP, this.webapp); } // TODO: allow change of dns name - via store rename functionality @@ -117,19 +119,19 @@ public class EditWebsiteWizard extends CreateWebsiteWizard */ private void clearWebProjectModel(NodeRef nodeRef) { - List webFormRefs = nodeService.getChildAssocs( + List webFormRefs = getNodeService().getChildAssocs( nodeRef, WCMAppModel.ASSOC_WEBFORM, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef ref : webFormRefs) { // cascade delete will take case of child-child relationships - this.nodeService.removeChild(nodeRef, ref.getChildRef()); + getNodeService().removeChild(nodeRef, ref.getChildRef()); } - List wfRefs = nodeService.getChildAssocs( + List wfRefs = getNodeService().getChildAssocs( nodeRef, WCMAppModel.ASSOC_WEBWORKFLOWDEFAULTS, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef ref : wfRefs) { - this.nodeService.removeChild(nodeRef, ref.getChildRef()); + 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 index 28a8296ccd..e8a7bfa6bd 100644 --- a/source/java/org/alfresco/web/bean/wcm/FileDetailsBean.java +++ b/source/java/org/alfresco/web/bean/wcm/FileDetailsBean.java @@ -57,8 +57,10 @@ import org.alfresco.web.ui.common.component.data.UIRichList; */ public class FileDetailsBean extends AVMDetailsBean { + private static final long serialVersionUID = -3263315503769148385L; + /** Action service bean reference */ - private ActionService actionService; + transient private ActionService actionService; // ------------------------------------------------------------------------------ @@ -87,6 +89,15 @@ public class FileDetailsBean extends AVMDetailsBean 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() */ @@ -157,7 +168,7 @@ public class FileDetailsBean extends AVMDetailsBean public List> getVersionHistory() { AVMNode avmNode = getAvmNode(); - List history = this.avmService.getHistory(avmNode.getDescriptor(), -1); + List history = this.getAvmService().getHistory(avmNode.getDescriptor(), -1); List> wrappers = new ArrayList>(history.size()); for (AVMNodeDescriptor record : history) { @@ -166,7 +177,7 @@ public class FileDetailsBean extends AVMDetailsBean wrapper.put("version", record.getVersionID()); wrapper.put("strVersion", Integer.toString(record.getVersionID())); wrapper.put("modifiedDate", new Date(record.getModDate())); - Pair path = this.avmService.getAPath(record); + Pair path = this.getAvmService().getAPath(record); if (path != null) { wrapper.put("url", DownloadContentServlet.generateBrowserURL( @@ -196,7 +207,7 @@ public class FileDetailsBean extends AVMDetailsBean tx.begin(); Map args = new HashMap(1, 1.0f); - List history = this.avmService.getHistory(getAvmNode().getDescriptor(), -1); + List history = this.getAvmService().getHistory(getAvmNode().getDescriptor(), -1); // the history list should contain the version ID we are looking for for (AVMNodeDescriptor record : history) { @@ -204,16 +215,16 @@ public class FileDetailsBean extends AVMDetailsBean { // the action expects the HEAD revision as the noderef and // the to-revert param as the previous version to revert to - Action action = this.actionService.createAction(AVMRevertToVersionAction.NAME, args); + Action action = this.getActionService().createAction(AVMRevertToVersionAction.NAME, args); args.put(AVMRevertToVersionAction.TOREVERT, record); - this.actionService.executeAction(action, getAvmNode().getNodeRef()); + 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(avmService.lookup(-1, getAvmNode().getPath()))); + avmBrowseBean.setAvmActionNode(new AVMNode(getAvmService().lookup(-1, getAvmNode().getPath()))); break; } } diff --git a/source/java/org/alfresco/web/bean/wcm/FilePickerBean.java b/source/java/org/alfresco/web/bean/wcm/FilePickerBean.java index a2ec6549f0..7421ab220d 100644 --- a/source/java/org/alfresco/web/bean/wcm/FilePickerBean.java +++ b/source/java/org/alfresco/web/bean/wcm/FilePickerBean.java @@ -1,398 +1,411 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.web.bean.wcm; - -import java.io.*; -import java.util.regex.Pattern; -import java.text.MessageFormat; -import java.util.*; - -import javax.faces.context.ExternalContext; -import javax.faces.context.FacesContext; -import javax.faces.context.ResponseWriter; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; - -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.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.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.TempFileProvider; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.servlet.FacesHelper; -import org.alfresco.web.app.servlet.ajax.InvokeCommand; -import org.alfresco.web.bean.FileUploadBean; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.forms.*; -import org.alfresco.web.ui.common.Utils; - -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; -import org.apache.commons.fileupload.servlet.ServletFileUpload; -import org.apache.commons.fileupload.servlet.ServletRequestContext; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.util.FileCopyUtils; - -import org.w3c.dom.*; -import org.w3c.dom.bootstrap.DOMImplementationRegistry; -import org.w3c.dom.events.Event; -import org.w3c.dom.events.EventListener; -import org.w3c.dom.events.EventTarget; -import org.w3c.dom.ls.*; -import org.xml.sax.SAXException; - -/** - * Bean for interacting with the file picker widget using ajax requests. - */ -public class FilePickerBean -{ - private static final Log LOGGER = LogFactory.getLog(FilePickerBean.class); - private final Set uploads = new HashSet(); - - private AVMBrowseBean avmBrowseBean; - private AVMService avmService; - private NamespaceService namespaceService; - - public FilePickerBean() - { - } - - public void clearUploadedFiles() - { - this.uploads.clear(); - } - - public NodeRef[] getUploadedFiles() - { - return (NodeRef[])this.uploads.toArray(new NodeRef[this.uploads.size()]); - } - - /** - * @param avmBrowseBean the avmBrowseBean to set. - */ - public void setAvmBrowseBean(final AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - /** - * @param avmService the avmService to set. - */ - public void setAvmService(final AVMService avmService) - { - this.avmService = avmService; - } - - /** - * @param namespaceService the namespaceService to set. - */ - public void setNamespaceService(final NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * 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(); - - String currentPath = (String)externalContext.getRequestParameterMap().get("currentPath"); - if (currentPath == null) - { - currentPath = this.getCurrentAVMPath(); - } - else - { - final String previewStorePath = - AVMUtil.getCorrespondingPathInPreviewStore(this.getCurrentAVMPath()); - currentPath = AVMUtil.buildPath(previewStorePath, - currentPath, - AVMUtil.PathRelation.WEBAPP_RELATIVE); - } - - final QName[] selectableTypes = - this.getSelectableTypes((String[])externalContext.getRequestParameterValuesMap().get("selectableTypes")); - final Pattern[] filterMimetypes = - this.getFilterMimetypes((String[])externalContext.getRequestParameterValuesMap().get("filterMimetypes")); - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(this + ".getFilePickerData(path = " + currentPath + - ", selectableTypes = [" + StringUtils.join(selectableTypes, ",") + - "], filterMimetypes = [" + StringUtils.join(filterMimetypes, ",") + - "])"); - } - - final Document result = XMLUtil.newDocument(); - final Element filePickerDataElement = result.createElement("file-picker-data"); - result.appendChild(filePickerDataElement); - - - final AVMNodeDescriptor currentNode = this.avmService.lookup(-1, currentPath); - 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("/"))))); - currentPath = this.getCurrentAVMPath(); - } - else if (! currentNode.isDirectory()) - { - currentPath = AVMNodeConverter.SplitBase(currentPath)[0]; - } - - Element e = result.createElement("current-node"); - e.setAttribute("avmPath", currentPath); - e.setAttribute("webappRelativePath", - AVMUtil.getWebappRelativePath(currentPath)); - e.setAttribute("type", "directory"); - e.setAttribute("image", "/images/icons/space_small.gif"); - filePickerDataElement.appendChild(e); - - for (final Map.Entry entry : - this.avmService.getDirectoryListing(-1, currentPath).entrySet()) - { - if (!entry.getValue().isDirectory() && filterMimetypes.length != 0) - { - final String contentMimetype = this.avmService.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 (!matched) - { - continue; - } - } - e = result.createElement("child-node"); - e.setAttribute("avmPath", entry.getValue().getPath()); - e.setAttribute("webappRelativePath", - AVMUtil.getWebappRelativePath(entry.getValue().getPath())); - e.setAttribute("type", entry.getValue().isDirectory() ? "directory" : "file"); - e.setAttribute("image", (entry.getValue().isDirectory() - ? "/images/icons/space_small.gif" - : Utils.getFileTypeImage(facesContext, - entry.getValue().getName(), - true))); - - boolean selectable = false; - // 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) && - entry.getValue().isDirectory()); - selectable = selectable || (WCMModel.TYPE_AVM_CONTENT.equals(typeQName) && - !entry.getValue().isDirectory()); - } - e.setAttribute("selectable", Boolean.toString(selectable)); - filePickerDataElement.appendChild(e); - } - - final ResponseWriter out = facesContext.getResponseWriter(); - XMLUtil.print(result, 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.avmService.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.avmService.setNodeProperties(currentPath + "/" + filename, props); - this.avmService.addAspect(currentPath + "/" + filename, ContentModel.ASPECT_TITLED); - - this.uploads.add(AVMNodeConverter.ToNodeRef(-1, currentPath + "/" + filename)); - returnPage = returnPage.replace("${_FILE_TYPE_IMAGE}", - Utils.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 Document result = XMLUtil.newDocument(); - final Element htmlEl = result.createElement("html"); - result.appendChild(htmlEl); - final Element bodyEl = result.createElement("body"); - htmlEl.appendChild(bodyEl); - - final Element scriptEl = result.createElement("script"); - bodyEl.appendChild(scriptEl); - scriptEl.setAttribute("type", "text/javascript"); - final Node scriptText = result.createTextNode(returnPage); - scriptEl.appendChild(scriptText); - - final ResponseWriter out = facesContext.getResponseWriter(); - XMLUtil.print(result, out); - } - - private String getCurrentAVMPath() - { - final AVMNode node = this.avmBrowseBean.getAvmActionNode(); - if (node == null) - { - return this.avmBrowseBean.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.namespaceService, 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; - } -} +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean.wcm; + +import java.io.InputStream; +import java.io.Serializable; +import java.text.MessageFormat; +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.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.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.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +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.Repository; +import org.alfresco.web.forms.XMLUtil; +import org.alfresco.web.ui.common.Utils; +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.springframework.util.FileCopyUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * Bean for interacting with the file picker widget using ajax requests. + */ +public class FilePickerBean implements Serializable +{ + private static final long serialVersionUID = -8301307105698624196L; + + private static final Log LOGGER = LogFactory.getLog(FilePickerBean.class); + private final Set uploads = new HashSet(); + + private AVMBrowseBean avmBrowseBean; + transient private AVMService avmService; + transient private NamespaceService namespaceService; + + public FilePickerBean() + { + } + + public void clearUploadedFiles() + { + this.uploads.clear(); + } + + public NodeRef[] getUploadedFiles() + { + return (NodeRef[])this.uploads.toArray(new NodeRef[this.uploads.size()]); + } + + /** + * @param avmBrowseBean the avmBrowseBean to set. + */ + public void setAvmBrowseBean(final AVMBrowseBean avmBrowseBean) + { + this.avmBrowseBean = avmBrowseBean; + } + + /** + * @param avmService the avmService to set. + */ + public void setAvmService(final AVMService avmService) + { + this.avmService = avmService; + } + + private AVMService getAvmService() + { + if (avmService == null) + { + avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); + } + return avmService; + } + + /** + * @param namespaceService the namespaceService to set. + */ + public void setNamespaceService(final NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + private NamespaceService getNamespaceService() + { + if (namespaceService == null) + { + namespaceService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNamespaceService(); + } + return namespaceService; + } + + /** + * 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(); + + String currentPath = (String)externalContext.getRequestParameterMap().get("currentPath"); + if (currentPath == null) + { + currentPath = this.getCurrentAVMPath(); + } + else + { + final String previewStorePath = + AVMUtil.getCorrespondingPathInPreviewStore(this.getCurrentAVMPath()); + currentPath = AVMUtil.buildPath(previewStorePath, + currentPath, + AVMUtil.PathRelation.WEBAPP_RELATIVE); + } + + final QName[] selectableTypes = + this.getSelectableTypes((String[])externalContext.getRequestParameterValuesMap().get("selectableTypes")); + final Pattern[] filterMimetypes = + this.getFilterMimetypes((String[])externalContext.getRequestParameterValuesMap().get("filterMimetypes")); + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(this + ".getFilePickerData(path = " + currentPath + + ", selectableTypes = [" + StringUtils.join(selectableTypes, ",") + + "], filterMimetypes = [" + StringUtils.join(filterMimetypes, ",") + + "])"); + } + + final Document result = XMLUtil.newDocument(); + final Element filePickerDataElement = result.createElement("file-picker-data"); + result.appendChild(filePickerDataElement); + + + final AVMNodeDescriptor currentNode = this.getAvmService().lookup(-1, currentPath); + 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("/"))))); + currentPath = this.getCurrentAVMPath(); + } + else if (! currentNode.isDirectory()) + { + currentPath = AVMNodeConverter.SplitBase(currentPath)[0]; + } + + Element e = result.createElement("current-node"); + e.setAttribute("avmPath", currentPath); + e.setAttribute("webappRelativePath", + AVMUtil.getWebappRelativePath(currentPath)); + e.setAttribute("type", "directory"); + e.setAttribute("image", "/images/icons/space_small.gif"); + filePickerDataElement.appendChild(e); + + for (final Map.Entry entry : + this.getAvmService().getDirectoryListing(-1, currentPath).entrySet()) + { + 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 (!matched) + { + continue; + } + } + e = result.createElement("child-node"); + e.setAttribute("avmPath", entry.getValue().getPath()); + e.setAttribute("webappRelativePath", + AVMUtil.getWebappRelativePath(entry.getValue().getPath())); + e.setAttribute("type", entry.getValue().isDirectory() ? "directory" : "file"); + e.setAttribute("image", (entry.getValue().isDirectory() + ? "/images/icons/space_small.gif" + : Utils.getFileTypeImage(facesContext, + entry.getValue().getName(), + true))); + + boolean selectable = false; + // 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) && + entry.getValue().isDirectory()); + selectable = selectable || (WCMModel.TYPE_AVM_CONTENT.equals(typeQName) && + !entry.getValue().isDirectory()); + } + e.setAttribute("selectable", Boolean.toString(selectable)); + filePickerDataElement.appendChild(e); + } + + final ResponseWriter out = facesContext.getResponseWriter(); + XMLUtil.print(result, 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}", + Utils.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 Document result = XMLUtil.newDocument(); + final Element htmlEl = result.createElement("html"); + result.appendChild(htmlEl); + final Element bodyEl = result.createElement("body"); + htmlEl.appendChild(bodyEl); + + final Element scriptEl = result.createElement("script"); + bodyEl.appendChild(scriptEl); + scriptEl.setAttribute("type", "text/javascript"); + final Node scriptText = result.createTextNode(returnPage); + scriptEl.appendChild(scriptText); + + final ResponseWriter out = facesContext.getResponseWriter(); + XMLUtil.print(result, out); + } + + private String getCurrentAVMPath() + { + final AVMNode node = this.avmBrowseBean.getAvmActionNode(); + if (node == null) + { + return this.avmBrowseBean.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; + } +} diff --git a/source/java/org/alfresco/web/bean/wcm/FolderDetailsBean.java b/source/java/org/alfresco/web/bean/wcm/FolderDetailsBean.java index 92dbfdc37d..c28ee4433e 100644 --- a/source/java/org/alfresco/web/bean/wcm/FolderDetailsBean.java +++ b/source/java/org/alfresco/web/bean/wcm/FolderDetailsBean.java @@ -38,6 +38,8 @@ import org.alfresco.web.bean.repository.Node; */ public class FolderDetailsBean extends AVMDetailsBean { + private static final long serialVersionUID = -2668158215990649862L; + /** * @see org.alfresco.web.bean.wcm.AVMDetailsBean#getAvmNode() */ diff --git a/source/java/org/alfresco/web/bean/wcm/FormDetailsDialog.java b/source/java/org/alfresco/web/bean/wcm/FormDetailsDialog.java index d085976a16..5a8ecaf5f0 100644 --- a/source/java/org/alfresco/web/bean/wcm/FormDetailsDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/FormDetailsDialog.java @@ -30,13 +30,13 @@ import java.util.List; import java.util.Map; import javax.faces.context.FacesContext; -import javax.faces.model.SelectItem; 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; @@ -52,11 +52,13 @@ import org.apache.commons.logging.LogFactory; */ public class FormDetailsDialog extends BaseDialogBean { + private static final long serialVersionUID = -7191411837509451750L; + private static final Log logger = LogFactory.getLog(FormDetailsDialog.class); - protected AVMService avmService; + transient private AVMService avmService; protected CreateWebsiteWizard websiteWizard; - protected WorkflowService workflowService; + transient private WorkflowService workflowService; private String title; private String description; @@ -93,6 +95,16 @@ public class FormDetailsDialog extends BaseDialogBean 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. */ @@ -109,6 +121,15 @@ public class FormDetailsDialog extends BaseDialogBean 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 */ @@ -252,7 +273,7 @@ public class FormDetailsDialog extends BaseDialogBean String wfSelected = this.workflowSelectedValue[0]; if (form.getWorkflow() == null || form.getWorkflow().getName().equals(wfSelected) == false) { - WorkflowDefinition def = this.workflowService.getDefinitionByName(wfSelected); + WorkflowDefinition def = this.getWorkflowService().getDefinitionByName(wfSelected); form.setWorkflow(new CreateWebsiteWizard.WorkflowWrapper(def.getName(), def.getTitle(), def.getDescription())); } } diff --git a/source/java/org/alfresco/web/bean/wcm/FormTemplatesDialog.java b/source/java/org/alfresco/web/bean/wcm/FormTemplatesDialog.java index 3534a823df..0ea86907f1 100644 --- a/source/java/org/alfresco/web/bean/wcm/FormTemplatesDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/FormTemplatesDialog.java @@ -37,6 +37,7 @@ 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; @@ -55,15 +56,17 @@ import org.apache.commons.logging.LogFactory; */ 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); - protected AVMService avmService; + transient private AVMService avmService; protected CreateWebsiteWizard websiteWizard; /** datamodel for table of selected presentation templates */ - private DataModel templatesDataModel = null; + transient private DataModel templatesDataModel = null; /** list of objects describing the selected presentation templates*/ private List templates = null; @@ -79,6 +82,15 @@ public class FormTemplatesDialog extends BaseDialogBean 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. */ @@ -180,7 +192,7 @@ public class FormTemplatesDialog extends BaseDialogBean */ public void removeTemplate(ActionEvent event) { - PresentationTemplate wrapper = (PresentationTemplate)this.templatesDataModel.getRowData(); + PresentationTemplate wrapper = (PresentationTemplate)this.getTemplatesDataModel().getRowData(); if (wrapper != null) { this.templates.remove(wrapper); diff --git a/source/java/org/alfresco/web/bean/wcm/FormWorkflowDialog.java b/source/java/org/alfresco/web/bean/wcm/FormWorkflowDialog.java index cc9b015a1c..065088598e 100644 --- a/source/java/org/alfresco/web/bean/wcm/FormWorkflowDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/FormWorkflowDialog.java @@ -26,7 +26,6 @@ package org.alfresco.web.bean.wcm; import java.io.Serializable; import java.text.MessageFormat; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.regex.Pattern; @@ -36,7 +35,6 @@ import javax.faces.context.FacesContext; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.service.cmr.repository.AssociationRef; -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.WorkflowTaskDefinition; @@ -58,13 +56,16 @@ import org.apache.commons.logging.LogFactory; */ 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; - protected WorkflowService workflowService; + transient private WorkflowService workflowService; + protected CreateWebsiteWizard websiteWizard; protected TransientNode workflowNode; @@ -76,6 +77,15 @@ public class FormWorkflowDialog extends BaseDialogBean { 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. @@ -135,10 +145,10 @@ public class FormWorkflowDialog extends BaseDialogBean else { // no type found - init workflow node type based on workflow definition - WorkflowDefinition flowDef = this.workflowService.getDefinitionByName(workflow.getName()); + WorkflowDefinition flowDef = this.getWorkflowService().getDefinitionByName(workflow.getName()); if (flowDef != null) { - WorkflowTaskDefinition taskDef = flowDef.startTaskDefinition; + WorkflowTaskDefinition taskDef = flowDef.getStartTaskDefinition(); if (taskDef != null) { // create an instance of a task from the data dictionary diff --git a/source/java/org/alfresco/web/bean/wcm/ImportWebsiteDialog.java b/source/java/org/alfresco/web/bean/wcm/ImportWebsiteDialog.java index 1af373a3b5..d6aa896717 100644 --- a/source/java/org/alfresco/web/bean/wcm/ImportWebsiteDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/ImportWebsiteDialog.java @@ -29,6 +29,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; +import java.io.Serializable; import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; @@ -78,6 +79,8 @@ import org.apache.tools.zip.ZipFile; */ public class ImportWebsiteDialog extends BaseDialogBean { + private static final long serialVersionUID = -432986732265292504L; + private static final int BUFFER_SIZE = 16384; private static Log logger = LogFactory.getLog(ImportWebsiteDialog.class); @@ -86,13 +89,15 @@ public class ImportWebsiteDialog extends BaseDialogBean protected boolean isFinished = false; protected boolean highByteZip = false; - protected FileFolderService fileFolderService; - protected ContentService contentService; + transient private FileFolderService fileFolderService; + transient private ContentService contentService; + protected AVMBrowseBean avmBrowseBean; - protected AVMService avmService; - protected NodeService nodeService; - - + + transient private AVMService avmService; + transient private NodeService nodeService; + + /** * @param contentService The ContentService to set. */ @@ -100,6 +105,15 @@ public class ImportWebsiteDialog extends BaseDialogBean { this.contentService = contentService; } + + protected ContentService getContentService() + { + if (this.contentService == null) + { + this.contentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentService(); + } + return this.contentService; + } /** * @param fileFolderService The FileFolderService to set. @@ -109,6 +123,15 @@ public class ImportWebsiteDialog extends BaseDialogBean this.fileFolderService = fileFolderService; } + protected FileFolderService getFileFolderService() + { + if (this.fileFolderService == null) + { + this.fileFolderService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getFileFolderService(); + } + return this.fileFolderService; + } + /** * @param avmBrowseBean The AVMBrowseBean to set. */ @@ -125,6 +148,15 @@ public class ImportWebsiteDialog extends BaseDialogBean this.avmService = avmService; } + protected AVMService getAvmService() + { + if (this.avmService == null) + { + this.avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMLockingAwareService(); + } + return this.avmService; + } + /** * @param nodeService The NodeService to set. */ @@ -132,6 +164,15 @@ public class ImportWebsiteDialog extends BaseDialogBean { this.nodeService = nodeService; } + + protected NodeService getNodeService() + { + if (this.nodeService == null) + { + this.nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + } + return this.nodeService; + } /** * @return Returns the name of the file @@ -224,22 +265,22 @@ public class ImportWebsiteDialog extends BaseDialogBean RetryingTransactionHelper.RetryingTransactionCallback cb = new RetryingTransactionHelper.RetryingTransactionCallback() { - public String execute() - { - // get the AVM path that will contain the imported content - String rootPath = avmBrowseBean.getCurrentPath(); - - // convert the AVM path to a NodeRef so we can use the NodeService to perform import - NodeRef importRef = AVMNodeConverter.ToNodeRef(-1, rootPath); - processZipImport(file, importRef); - - // After a bulk import it's a good idea to snapshot the store - avmService.createSnapshot( - AVMUtil.getStoreName(rootPath), - "Import of file: " + fileName, null); - - return rootPath; - } + public String execute() + { + // get the AVM path that will contain the imported content + String rootPath = avmBrowseBean.getCurrentPath(); + + // convert the AVM path to a NodeRef so we can use the NodeService to perform import + NodeRef importRef = AVMNodeConverter.ToNodeRef(-1, rootPath); + processZipImport(file, importRef); + + // After a bulk import it's a good idea to snapshot the store + getAvmService().createSnapshot( + AVMUtil.getStoreName(rootPath), + "Import of file: " + fileName, null); + + return rootPath; + } }; String rootPath = Repository.getRetryingTransactionHelper(context).doInTransaction(cb); @@ -373,7 +414,7 @@ public class ImportWebsiteDialog extends BaseDialogBean Map properties = new HashMap(); properties.put(ContentModel.PROP_TITLE, new PropertyValue(DataTypeDefinition.TEXT, fileName)); - this.avmService.createFile( + this.getAvmService().createFile( avmPath, fileName,new BufferedInputStream(new FileInputStream(file), BUFFER_SIZE), aspects, properties); @@ -411,7 +452,7 @@ public class ImportWebsiteDialog extends BaseDialogBean String avmPath = AVMNodeConverter.ToAVMVersionPath(root).getSecond(); List aspects = new ArrayList(); aspects.add(ApplicationModel.ASPECT_UIFACETS); - this.avmService.createDirectory(avmPath, file.getName(), aspects, null); + this.getAvmService().createDirectory(avmPath, file.getName(), aspects, null); String folderPath = avmPath + '/' + file.getName(); NodeRef folderRef = AVMNodeConverter.ToNodeRef(-1, folderPath); diff --git a/source/java/org/alfresco/web/bean/wcm/InviteWebsiteUsersWizard.java b/source/java/org/alfresco/web/bean/wcm/InviteWebsiteUsersWizard.java index 9cdfcda89a..97bf1722ca 100644 --- a/source/java/org/alfresco/web/bean/wcm/InviteWebsiteUsersWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/InviteWebsiteUsersWizard.java @@ -54,6 +54,8 @@ import org.alfresco.web.ui.common.Utils; */ public class InviteWebsiteUsersWizard extends BaseInviteUsersWizard { + private static final long serialVersionUID = -8128781845465773847L; + /** Cache of available folder permissions */ Set folderPermissions = null; @@ -159,13 +161,13 @@ public class InviteWebsiteUsersWizard extends BaseInviteUsersWizard } } - List userInfoRefs = this.nodeService.getChildAssocs( + List userInfoRefs = this.getNodeService().getChildAssocs( getNode().getNodeRef(), WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef ref : userInfoRefs) { NodeRef userInfoRef = ref.getChildRef(); - String username = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME); - String userrole = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE); + String username = (String)getNodeService().getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME); + String userrole = (String)getNodeService().getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE); if (AVMUtil.ROLE_CONTENT_MANAGER.equals(userrole) && managers.contains(username) == false) @@ -199,7 +201,7 @@ public class InviteWebsiteUsersWizard extends BaseInviteUsersWizard Map props = new HashMap(2, 1.0f); props.put(WCMAppModel.PROP_WEBUSERNAME, userAuth); props.put(WCMAppModel.PROP_WEBUSERROLE, userRole.getRole()); - this.nodeService.createNode(getNode().getNodeRef(), + this.getNodeService().createNode(getNode().getNodeRef(), WCMAppModel.ASSOC_WEBUSER, WCMAppModel.ASSOC_WEBUSER, WCMAppModel.TYPE_WEBUSER, @@ -215,12 +217,12 @@ public class InviteWebsiteUsersWizard extends BaseInviteUsersWizard if (isStandalone() == true && managersUpdateRequired == true) { // walk existing sandboxes and reapply manager permissions to include any new manager users - List userInfoRefs = this.nodeService.getChildAssocs( + List userInfoRefs = this.getNodeService().getChildAssocs( getNode().getNodeRef(), WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef ref : userInfoRefs) { NodeRef userInfoRef = ref.getChildRef(); - String username = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME); + String username = (String)getNodeService().getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME); if (existingUsers.contains(username)) { // only need to modify the sandboxes we haven't just created @@ -272,7 +274,7 @@ public class InviteWebsiteUsersWizard extends BaseInviteUsersWizard if (authType.equals(AuthorityType.USER)) { users = new HashSet(1, 1.0f); - if (this.personService.personExists(authority) == true) + if (this.getPersonService().personExists(authority) == true) { users.add(authority); } @@ -280,10 +282,10 @@ public class InviteWebsiteUsersWizard extends BaseInviteUsersWizard else if (authType.equals(AuthorityType.GROUP)) { // walk each member of the group - users = this.authorityService.getContainedAuthorities(AuthorityType.USER, authority, false); + users = this.getAuthorityService().getContainedAuthorities(AuthorityType.USER, authority, false); for (String userAuth : users) { - if (this.personService.personExists(userAuth) == false) + if (this.getPersonService().personExists(userAuth) == false) { users.remove(authType); } @@ -334,7 +336,7 @@ public class InviteWebsiteUsersWizard extends BaseInviteUsersWizard if (this.folderPermissions == null) { // get permissions and roles for a website folder type - this.folderPermissions = this.permissionService.getSettablePermissions(WCMAppModel.TYPE_AVMWEBFOLDER); + this.folderPermissions = this.getPermissionService().getSettablePermissions(WCMAppModel.TYPE_AVMWEBFOLDER); } return this.folderPermissions; diff --git a/source/java/org/alfresco/web/bean/wcm/LinkValidationDialog.java b/source/java/org/alfresco/web/bean/wcm/LinkValidationDialog.java index b78676b525..a9545d103d 100644 --- a/source/java/org/alfresco/web/bean/wcm/LinkValidationDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/LinkValidationDialog.java @@ -63,9 +63,12 @@ import org.apache.commons.logging.LogFactory; */ public class LinkValidationDialog extends BaseDialogBean { + private static final long serialVersionUID = 3459041471664931826L; + protected AVMBrowseBean avmBrowseBean; - protected AVMService avmService; - protected ActionService actionService; + + transient private AVMService avmService; + transient private ActionService actionService; private String store; private String webapp; @@ -122,7 +125,7 @@ public class LinkValidationDialog extends BaseDialogBean // work out title for dialog by examining store type FacesContext context = FacesContext.getCurrentInstance(); - if (this.avmService.getStoreProperty(this.store, + if (this.getAvmService().getStoreProperty(this.store, SandboxConstants.PROP_SANDBOX_AUTHOR_MAIN) != null) { String pattern = Application.getMessage(context, "link_validaton_dialog_title_user"); @@ -131,12 +134,12 @@ public class LinkValidationDialog extends BaseDialogBean this.title = MessageFormat.format(pattern, new Object[] {user}); } - else if (this.avmService.getStoreProperty(this.store, + else if (this.getAvmService().getStoreProperty(this.store, SandboxConstants.PROP_SANDBOX_STAGING_MAIN) != null) { this.title = Application.getMessage(context, "link_validaton_dialog_title_staging"); } - else if (this.avmService.getStoreProperty(this.store, + else if (this.getAvmService().getStoreProperty(this.store, SandboxConstants.PROP_SANDBOX_WORKFLOW_MAIN) != null) { this.title = Application.getMessage(context, "link_validaton_dialog_title_workflow"); @@ -236,7 +239,7 @@ public class LinkValidationDialog extends BaseDialogBean tx = Repository.getUserTransaction(context, true); tx.begin(); - PropertyValue val = this.avmService.getStoreProperty(this.store, + PropertyValue val = this.getAvmService().getStoreProperty(this.store, SandboxConstants.PROP_LINK_VALIDATION_REPORT); if (val != null) { @@ -317,8 +320,8 @@ public class LinkValidationDialog extends BaseDialogBean this.avmBrowseBean.setLinkValidationMonitor(monitor); // create and execute the action in the background - Action action = this.actionService.createAction(LinkValidationAction.NAME, args); - this.actionService.executeAction(action, this.webappPathRef, false, true); + Action action = this.getActionService().createAction(LinkValidationAction.NAME, args); + this.getActionService().executeAction(action, this.webappPathRef, false, true); } // ------------------------------------------------------------------------------ @@ -386,6 +389,15 @@ public class LinkValidationDialog extends BaseDialogBean this.avmService = avmService; } + protected AVMService getAvmService() + { + if (this.avmService == null) + { + this.avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); + } + return this.avmService; + } + /** * @param actionService The actionService to set. */ @@ -393,4 +405,14 @@ public class LinkValidationDialog extends BaseDialogBean { this.actionService = actionService; } + + protected ActionService getActionService() + { + if (this.actionService == null) + { + this.actionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getActionService(); + } + return this.actionService; + } + } diff --git a/source/java/org/alfresco/web/bean/wcm/LinkValidationProgressBean.java b/source/java/org/alfresco/web/bean/wcm/LinkValidationProgressBean.java index ed0164829c..df4acbc3c2 100644 --- a/source/java/org/alfresco/web/bean/wcm/LinkValidationProgressBean.java +++ b/source/java/org/alfresco/web/bean/wcm/LinkValidationProgressBean.java @@ -25,6 +25,7 @@ package org.alfresco.web.bean.wcm; import java.io.IOException; +import java.io.Serializable; import javax.faces.context.FacesContext; import javax.faces.context.ResponseWriter; @@ -37,8 +38,10 @@ import org.apache.commons.logging.LogFactory; * * @author gavinc */ -public class LinkValidationProgressBean +public class LinkValidationProgressBean implements Serializable { + private static final long serialVersionUID = -6250162468103556028L; + private AVMBrowseBean avmBrowseBean; private static Log logger = LogFactory.getLog(LinkValidationProgressBean.class); diff --git a/source/java/org/alfresco/web/bean/wcm/LinkValidationState.java b/source/java/org/alfresco/web/bean/wcm/LinkValidationState.java index adafa11f7a..fb736e240a 100644 --- a/source/java/org/alfresco/web/bean/wcm/LinkValidationState.java +++ b/source/java/org/alfresco/web/bean/wcm/LinkValidationState.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.bean.wcm; +import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -55,8 +56,10 @@ import org.apache.commons.logging.LogFactory; * * @author gavinc */ -public class LinkValidationState +public class LinkValidationState implements Serializable { + private static final long serialVersionUID = 3798453845183433843L; + private String store; private String webapp; private boolean checkBeenReRun = false; diff --git a/source/java/org/alfresco/web/bean/wcm/ManageChangeRequestTaskDialog.java b/source/java/org/alfresco/web/bean/wcm/ManageChangeRequestTaskDialog.java index 6f504bc512..e96384df11 100644 --- a/source/java/org/alfresco/web/bean/wcm/ManageChangeRequestTaskDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/ManageChangeRequestTaskDialog.java @@ -61,9 +61,11 @@ import org.apache.commons.logging.LogFactory; */ public class ManageChangeRequestTaskDialog extends ManageTaskDialog { + private static final long serialVersionUID = -236829535702107101L; + protected boolean doResubmitNow = false; protected AVMBrowseBean avmBrowseBean; - protected AVMLockingService avmLockingService; + transient private AVMLockingService avmLockingService; private final static Log logger = LogFactory.getLog(ManageChangeRequestTaskDialog.class); @@ -103,7 +105,7 @@ public class ManageChangeRequestTaskDialog extends ManageTaskDialog String outcome = getDefaultFinishOutcome(); if (logger.isDebugEnabled()) - logger.debug("Transitioning change request task: " + this.task.id); + logger.debug("Transitioning change request task: " + this.getWorkflowTask().id); FacesContext context = FacesContext.getCurrentInstance(); UserTransaction tx = null; @@ -122,20 +124,20 @@ public class ManageChangeRequestTaskDialog extends ManageTaskDialog Map params = WorkflowUtil.prepareTaskParams(this.taskNode); // update the task with the updated parameters and resources - this.workflowService.updateTask(this.task.id, params, null, null); + this.getWorkflowService().updateTask(this.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(this.workflowPackage); - AVMNodeDescriptor pkgDesc = this.avmService.lookup(pkgPath.getFirst(), pkgPath.getSecond()); + AVMNodeDescriptor pkgDesc = this.getAvmService().lookup(pkgPath.getFirst(), pkgPath.getSecond()); String targetPath = pkgDesc.getIndirection(); - List diffs = this.avmSyncService.compare(pkgPath.getFirst(), + List diffs = this.getAvmSyncService().compare(pkgPath.getFirst(), pkgPath.getSecond(), -1, targetPath, null); // update the users main store with the changes from the workflow store - this.avmSyncService.update(diffs, null, false, false, true, true, null, null); + this.getAvmSyncService().update(diffs, null, false, false, true, true, null, null); // move locks for (AVMDifference diff : diffs) @@ -144,11 +146,11 @@ public class ManageChangeRequestTaskDialog extends ManageTaskDialog String destPath = diff.getDestinationPath(); // move the lock for this path from the user workflow sandbox to the users main store - AVMLock lock = this.avmLockingService.getLock(AVMUtil.getStoreId(sourcePath), + AVMLock lock = this.getAvmLockingService().getLock(AVMUtil.getStoreId(sourcePath), AVMUtil.getStoreRelativePath(sourcePath)); if (lock != null) { - this.avmLockingService.modifyLock(AVMUtil.getStoreId(sourcePath), + this.getAvmLockingService().modifyLock(AVMUtil.getStoreId(sourcePath), AVMUtil.getStoreRelativePath(sourcePath), null, AVMUtil.getStoreName(destPath), lock.getOwners(), newLockOwners); @@ -156,7 +158,7 @@ public class ManageChangeRequestTaskDialog extends ManageTaskDialog if (logger.isDebugEnabled()) { logger.debug("Moved lock: " + lock + " to: " + - this.avmLockingService.getLock(AVMUtil.getStoreId(destPath), + this.getAvmLockingService().getLock(AVMUtil.getStoreId(destPath), AVMUtil.getStoreRelativePath(destPath))); } } @@ -169,7 +171,7 @@ public class ManageChangeRequestTaskDialog extends ManageTaskDialog { String destPath = diff.getDestinationPath(); - AVMNodeDescriptor node = this.avmService.lookup(diff.getDestinationVersion(), + AVMNodeDescriptor node = this.getAvmService().lookup(diff.getDestinationVersion(), destPath, true); if (node != null) { @@ -182,7 +184,7 @@ public class ManageChangeRequestTaskDialog extends ManageTaskDialog } // signal the default transition to the workflow task - this.workflowService.endTask(this.task.id, null); + this.getWorkflowService().endTask(this.getWorkflowTask().id, null); // commit the changes tx.commit(); @@ -238,6 +240,15 @@ public class ManageChangeRequestTaskDialog extends ManageTaskDialog // ------------------------------------------------------------------------------ // 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 @@ -256,11 +267,11 @@ public class ManageChangeRequestTaskDialog extends ManageTaskDialog // 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.nodeService.getProperty( + NodeRef userStoreNodeRef = (NodeRef)this.getNodeService().getProperty( this.workflowPackage, WCMModel.PROP_AVM_DIR_INDIRECTION); String userStoreAvmPath = AVMNodeConverter.ToAVMVersionPath(userStoreNodeRef).getSecond(); String userStoreName = AVMUtil.getStoreName(userStoreAvmPath); - String stagingStoreName = this.avmService.getStoreProperty(userStoreName, + String stagingStoreName = this.getAvmService().getStoreProperty(userStoreName, SandboxConstants.PROP_WEBSITE_NAME).getStringValue(); NodeRef webProjectRef = AVMUtil.getWebProjectNodeFromStore(stagingStoreName); diff --git a/source/java/org/alfresco/web/bean/wcm/ManageLinkValidationTaskDialog.java b/source/java/org/alfresco/web/bean/wcm/ManageLinkValidationTaskDialog.java index 3fe1661b8f..a84703310e 100644 --- a/source/java/org/alfresco/web/bean/wcm/ManageLinkValidationTaskDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/ManageLinkValidationTaskDialog.java @@ -48,6 +48,8 @@ import org.apache.commons.logging.LogFactory; */ public class ManageLinkValidationTaskDialog extends ManageTaskDialog { + private static final long serialVersionUID = 59524560340308134L; + protected String store; protected String webapp; protected AVMBrowseBean avmBrowseBean; @@ -81,7 +83,7 @@ public class ManageLinkValidationTaskDialog extends ManageTaskDialog if (logger.isDebugEnabled()) logger.debug("Retrieving link validation report from store '" + storeName + "'"); - PropertyValue val = this.avmService.getStoreProperty(storeName, + PropertyValue val = this.getAvmService().getStoreProperty(storeName, SandboxConstants.PROP_LINK_VALIDATION_REPORT); if (val != null) { diff --git a/source/java/org/alfresco/web/bean/wcm/MonitorDeploymentDialog.java b/source/java/org/alfresco/web/bean/wcm/MonitorDeploymentDialog.java index 9a546803dd..139ec5d1ef 100644 --- a/source/java/org/alfresco/web/bean/wcm/MonitorDeploymentDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/MonitorDeploymentDialog.java @@ -41,6 +41,8 @@ import org.apache.commons.logging.LogFactory; */ public class MonitorDeploymentDialog extends BaseDialogBean { + private static final long serialVersionUID = -2800892205678915972L; + protected NodeRef webProjectRef; protected AVMBrowseBean avmBrowseBean; diff --git a/source/java/org/alfresco/web/bean/wcm/PromptForWebFormDialog.java b/source/java/org/alfresco/web/bean/wcm/PromptForWebFormDialog.java index af3366be0d..01c54195e9 100644 --- a/source/java/org/alfresco/web/bean/wcm/PromptForWebFormDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/PromptForWebFormDialog.java @@ -1,236 +1,259 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -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.WCMAppModel; -import org.alfresco.repo.domain.PropertyValue; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -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.data.IDataContainer; -import org.alfresco.web.data.QuickSort; -import org.alfresco.web.forms.*; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * @author arielb - */ -public class PromptForWebFormDialog - extends BaseDialogBean -{ - private static final Log LOGGER = LogFactory.getLog(PromptForWebFormDialog.class); - - /** AVM service reference */ - protected AVMService avmService; - - /** AVM Browse Bean reference */ - protected AVMBrowseBean avmBrowseBean; - - /** The FormsService reference */ - protected 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; - } - - /** - * @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; - } - - /** - * @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.avmService.hasAspect(this.getAvmNode().getVersion(), - avmPath, - WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) - { - // build a status message if this is an error case - final FormInstanceData fid = this.formsService.getFormInstanceData(this.getAvmNode().getVersion(), avmPath); - try - { - final Form f = fid.getForm(); - this.formName = f.getName(); - // 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); - 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 - protected String finishImpl(final FacesContext context, String outcome) - throws Exception - { - LOGGER.debug("configuring " + this.getAvmNode().getPath() + - " to use form " + this.getFormName()); - - this.avmService.setNodeProperty(this.getAvmNode().getPath(), - WCMAppModel.PROP_PARENT_FORM_NAME, - new PropertyValue(DataTypeDefinition.TEXT, this.getFormName())); - - if (!this.avmService.hasAspect(this.getAvmNode().getVersion(), - this.getAvmNode().getPath(), - WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) - { - this.avmService.addAspect(this.getAvmNode().getPath(), WCMAppModel.ASPECT_FORM_INSTANCE_DATA); - } - 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; - } -} +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +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.WCMAppModel; +import org.alfresco.repo.domain.PropertyValue; +import org.alfresco.service.cmr.avm.AVMService; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +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 + final FormInstanceData fid = this.getFormsService().getFormInstanceData(this.getAvmNode().getVersion(), avmPath); + try + { + final Form f = fid.getForm(); + this.formName = f.getName(); + // 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); + 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 + protected String finishImpl(final FacesContext context, String outcome) + throws Exception + { + LOGGER.debug("configuring " + this.getAvmNode().getPath() + + " to use form " + this.getFormName()); + + this.getAvmService().setNodeProperty(this.getAvmNode().getPath(), + WCMAppModel.PROP_PARENT_FORM_NAME, + new PropertyValue(DataTypeDefinition.TEXT, this.getFormName())); + + if (!this.getAvmService().hasAspect(this.getAvmNode().getVersion(), + this.getAvmNode().getPath(), + WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) + { + this.getAvmService().addAspect(this.getAvmNode().getPath(), WCMAppModel.ASPECT_FORM_INSTANCE_DATA); + } + 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 index 7fd903525a..c4aad0f73c 100644 --- a/source/java/org/alfresco/web/bean/wcm/RegenerateRenditionsWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/RegenerateRenditionsWizard.java @@ -48,6 +48,7 @@ import org.alfresco.service.cmr.search.ResultSetRow; import org.alfresco.service.cmr.search.SearchParameters; import org.alfresco.service.cmr.search.SearchService; 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.forms.Form; @@ -77,12 +78,12 @@ public class RegenerateRenditionsWizard private final static Log LOGGER = LogFactory.getLog(RegenerateRenditionsWizard.class); - private AVMLockingService avmLockingService; - private AVMService avmService; - private AVMSyncService avmSyncService; - private ContentService contentService; - private SearchService searchService; - private FormsService formsService; + transient private AVMLockingService avmLockingService; + transient private AVMService avmService; + transient private AVMSyncService avmSyncService; + transient private SearchService searchService; + transient private FormsService formsService; + private WebProject selectedWebProject; private String[] selectedForms; private String[] selectedRenderingEngineTemplates; @@ -108,7 +109,7 @@ public class RegenerateRenditionsWizard } if (LOGGER.isDebugEnabled()) LOGGER.debug("updating " + diffList.size() + " renditions in staging"); - this.avmSyncService.update(diffList, null, true, true, true, true, null, null); + 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)) @@ -126,7 +127,7 @@ public class RegenerateRenditionsWizard description = MessageFormat.format(bundle.getString("regenerate_renditions_snapshot_description_scope_web_project"), this.selectedWebProject.getName()); } - this.avmService.createSnapshot(this.selectedWebProject.getStoreId(), + getAvmService().createSnapshot(this.selectedWebProject.getStoreId(), MessageFormat.format(bundle.getString("regenerate_renditions_snapshot_short_description"), diffList.size()), description); @@ -183,7 +184,7 @@ public class RegenerateRenditionsWizard { final String stagingStoreName = this.selectedWebProject.getStoreId(); final String previewStoreName = AVMUtil.getCorrespondingPreviewStoreName(stagingStoreName); - this.avmSyncService.resetLayer(AVMUtil.buildStoreRootPath(previewStoreName)); + getAvmSyncService().resetLayer(AVMUtil.buildStoreRootPath(previewStoreName)); } return super.cancel(); } @@ -358,15 +359,7 @@ public class RegenerateRenditionsWizard // ------------------------------------------------------------------------------ // Service Injection - - /** - * @param contentService The contentService to set. - */ - public void setContentService(final ContentService contentService) - { - this.contentService = contentService; - } - + /** * @param avmService The AVMService to set. */ @@ -375,6 +368,15 @@ public class RegenerateRenditionsWizard 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. */ @@ -383,6 +385,15 @@ public class RegenerateRenditionsWizard 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. */ @@ -391,6 +402,15 @@ public class RegenerateRenditionsWizard 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. */ @@ -399,6 +419,15 @@ public class RegenerateRenditionsWizard 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. */ @@ -407,6 +436,15 @@ public class RegenerateRenditionsWizard this.formsService = formsService; } + private FormsService getFormsService() + { + if (this.formsService == null) + { + this.formsService = (FormsService)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); + } + return this.formsService; + } + // ------------------------------------------------------------------------------ // Helper Methods @@ -425,13 +463,13 @@ public class RegenerateRenditionsWizard if (LOGGER.isDebugEnabled()) LOGGER.debug("running query " + query); sp.setQuery(query.toString()); - final ResultSet rs = this.searchService.query(sp); + final ResultSet rs = getSearchService().query(sp); 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(this.formsService.getFormInstanceData(-1, previewAvmPath)); + result.add(getFormsService().getFormInstanceData(-1, previewAvmPath)); } return result; } @@ -449,13 +487,13 @@ public class RegenerateRenditionsWizard if (LOGGER.isDebugEnabled()) LOGGER.debug("running query " + query); sp.setQuery(query.toString()); - final ResultSet rs = this.searchService.query(sp); + final ResultSet rs = getSearchService().query(sp); 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(this.formsService.getRendition(-1, previewAvmPath)); + result.add(getFormsService().getRendition(-1, previewAvmPath)); } return result; } @@ -464,7 +502,7 @@ public class RegenerateRenditionsWizard { final String stagingStoreName = this.selectedWebProject.getStoreId(); final String previewStoreName = AVMUtil.getCorrespondingPreviewStoreName(stagingStoreName); - this.avmSyncService.resetLayer(AVMUtil.buildStoreRootPath(previewStoreName)); + getAvmSyncService().resetLayer(AVMUtil.buildStoreRootPath(previewStoreName)); final SearchParameters sp = new SearchParameters(); final StoreRef storeRef = AVMNodeConverter.ToStoreRef(this.selectedWebProject.getStagingStore()); @@ -529,7 +567,7 @@ public class RegenerateRenditionsWizard if (LOGGER.isDebugEnabled()) LOGGER.debug("running query " + query); sp.setQuery(query.toString()); - final ResultSet rs = this.searchService.query(sp); + final ResultSet rs = getSearchService().query(sp); if (LOGGER.isDebugEnabled()) LOGGER.debug("received " + rs.length() + " results"); @@ -541,7 +579,7 @@ public class RegenerateRenditionsWizard if (this.regenerateScope.equals(REGENERATE_SCOPE_ALL) || this.regenerateScope.equals(REGENERATE_SCOPE_FORM)) { - final FormInstanceData fid = this.formsService.getFormInstanceData(-1, previewAvmPath); + final FormInstanceData fid = getFormsService().getFormInstanceData(-1, previewAvmPath); try { final List regenResults = fid.regenerateRenditions(); @@ -560,7 +598,7 @@ public class RegenerateRenditionsWizard } if (rr.getRendition() != null) { - this.avmLockingService.removeLock(AVMUtil.getStoreId(rr.getRendition().getPath()), + getAvmLockingService().removeLock(AVMUtil.getStoreId(rr.getRendition().getPath()), AVMUtil.getStoreRelativePath(rr.getRendition().getPath())); } } @@ -574,7 +612,7 @@ public class RegenerateRenditionsWizard } else { - final Rendition r = this.formsService.getRendition(-1, previewAvmPath); + final Rendition r = getFormsService().getRendition(-1, previewAvmPath); try { r.regenerate(); diff --git a/source/java/org/alfresco/web/bean/wcm/RevertAllDialog.java b/source/java/org/alfresco/web/bean/wcm/RevertAllDialog.java index 294c172844..0bd8087a2e 100644 --- a/source/java/org/alfresco/web/bean/wcm/RevertAllDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/RevertAllDialog.java @@ -48,6 +48,7 @@ import org.alfresco.util.Pair; import org.alfresco.util.VirtServerUtils; 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. @@ -56,12 +57,16 @@ import org.alfresco.web.bean.dialog.BaseDialogBean; */ public class RevertAllDialog extends BaseDialogBean { + private static final long serialVersionUID = 2693006540783155474L; + private static final String MSG_REVERTALL_SUCCESS = "revertall_success"; protected AVMBrowseBean avmBrowseBean; - protected AVMService avmService; - protected AVMSyncService avmSyncService; - protected ActionService actionService; + + transient private AVMService avmService; + transient private AVMSyncService avmSyncService; + transient private ActionService actionService; + protected NameMatcher nameMatcher; // The virtualization server might need to be notified @@ -78,6 +83,17 @@ public class RevertAllDialog extends BaseDialogBean { this.avmService = avmService; } + + + protected AVMService getAvmService() + { + if (this.avmService == null) + { + this.avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); + } + return this.avmService; + } + /** * @param avmBrowseBean The AVM BrowseBean to set @@ -95,6 +111,15 @@ public class RevertAllDialog extends BaseDialogBean this.avmSyncService = avmSyncService; } + protected AVMSyncService getAvmSyncService() + { + if (this.avmSyncService == null) + { + this.avmSyncService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMSyncService(); + } + return this.avmSyncService; + } + /** * @param actionService The actionService to set. */ @@ -103,6 +128,15 @@ public class RevertAllDialog extends BaseDialogBean this.actionService = actionService; } + protected ActionService getActionService() + { + if (this.actionService == null) + { + this.actionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getActionService(); + } + return this.actionService; + } + /** * @param nameMatcher The nameMatcher to set. */ @@ -123,7 +157,7 @@ public class RevertAllDialog extends BaseDialogBean String stagingStore = AVMUtil.buildStoreWebappPath(this.avmBrowseBean.getStagingStore(), webapp); // calcluate the list of differences between the user store and the staging area - List diffs = this.avmSyncService.compare( + List diffs = this.getAvmSyncService().compare( -1, userStore, -1, stagingStore, this.nameMatcher); List> versionPaths = new ArrayList>(); @@ -131,7 +165,7 @@ public class RevertAllDialog extends BaseDialogBean List tasks = null; for (AVMDifference diff : diffs) { - AVMNodeDescriptor node = avmService.lookup(-1, diff.getSourcePath(), true); + AVMNodeDescriptor node = getAvmService().lookup(-1, diff.getSourcePath(), true); if (tasks == null) { tasks = AVMWorkflowUtil.getAssociatedTasksForSandbox(AVMUtil.getStoreName(diff.getSourcePath())); @@ -151,8 +185,8 @@ public class RevertAllDialog extends BaseDialogBean Map args = new HashMap(1, 1.0f); args.put(AVMUndoSandboxListAction.PARAM_NODE_LIST, (Serializable)versionPaths); - Action action = this.actionService.createAction(AVMUndoSandboxListAction.NAME, args); - this.actionService.executeAction(action, null); // dummy action ref, list passed as action arg + Action action = this.getActionService().createAction(AVMUndoSandboxListAction.NAME, args); + this.getActionService().executeAction(action, null); // dummy action ref, list passed as action arg String msg = MessageFormat.format(Application.getMessage( context, MSG_REVERTALL_SUCCESS), this.avmBrowseBean.getUsername()); diff --git a/source/java/org/alfresco/web/bean/wcm/RevertSelectedDialog.java b/source/java/org/alfresco/web/bean/wcm/RevertSelectedDialog.java index a3f61e2854..7aeb466f4a 100644 --- a/source/java/org/alfresco/web/bean/wcm/RevertSelectedDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/RevertSelectedDialog.java @@ -44,6 +44,7 @@ import org.alfresco.service.cmr.workflow.WorkflowTask; import org.alfresco.util.Pair; import org.alfresco.web.app.Application; import org.alfresco.web.bean.dialog.BaseDialogBean; +import org.alfresco.web.bean.repository.Repository; import org.alfresco.util.VirtServerUtils; /** @@ -53,10 +54,12 @@ import org.alfresco.util.VirtServerUtils; */ public class RevertSelectedDialog extends BaseDialogBean { + private static final long serialVersionUID = -8432152646736206685L; + private static final String MSG_REVERTSELECTED_SUCCESS = "revertselected_success"; protected AVMBrowseBean avmBrowseBean; - protected ActionService actionService; + transient private ActionService actionService; // The virtualization server might need to be notified // because one or more of the files reverted could alter @@ -82,7 +85,15 @@ public class RevertSelectedDialog extends BaseDialogBean this.actionService = actionService; } - + protected ActionService getActionService() + { + if (this.actionService == null) + { + this.actionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getActionService(); + } + return actionService; + } + /** * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) */ @@ -114,8 +125,8 @@ public class RevertSelectedDialog extends BaseDialogBean Map args = new HashMap(1, 1.0f); args.put(AVMUndoSandboxListAction.PARAM_NODE_LIST, (Serializable)versionPaths); - Action action = this.actionService.createAction(AVMUndoSandboxListAction.NAME, args); - this.actionService.executeAction(action, null); // dummy action ref, list passed as action arg + Action action = this.getActionService().createAction(AVMUndoSandboxListAction.NAME, args); + this.getActionService().executeAction(action, null); // dummy action ref, list passed as action arg String msg = MessageFormat.format(Application.getMessage( context, MSG_REVERTSELECTED_SUCCESS), this.avmBrowseBean.getUsername()); diff --git a/source/java/org/alfresco/web/bean/wcm/SandboxInfo.java b/source/java/org/alfresco/web/bean/wcm/SandboxInfo.java index b02f6449ab..3991fbe4fa 100644 --- a/source/java/org/alfresco/web/bean/wcm/SandboxInfo.java +++ b/source/java/org/alfresco/web/bean/wcm/SandboxInfo.java @@ -1,53 +1,57 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.web.bean.wcm; - -/** -* Provides information about a sandbox created by SandboxFactory. -*/ -public final class SandboxInfo -{ - String [] store_names_; - public SandboxInfo(String [] store_names) - { - store_names_ = store_names; - } - - /** - * A list of names of the stores within this sandbox. - * The "main" store should come first in this list; - * any other stores should appear in the order that - * they are overlaid on "main" (e.g.: any "preview" - * layers should come afterward, in "lowest first" order). - *

      - * Note: all sandboxes must have a "main" layer. - */ - public String [] getStoreNames() { return store_names_; } - - /** - * The name of the "main" store within this sandbox. - */ - public String getMainStoreName() { return store_names_[0]; } -} +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean.wcm; + +import java.io.Serializable; + +/** +* Provides information about a sandbox created by SandboxFactory. +*/ +public final class SandboxInfo implements Serializable +{ + private static final long serialVersionUID = 3615436375385857404L; + + String [] store_names_; + public SandboxInfo(String [] store_names) + { + store_names_ = store_names; + } + + /** + * A list of names of the stores within this sandbox. + * The "main" store should come first in this list; + * any other stores should appear in the order that + * they are overlaid on "main" (e.g.: any "preview" + * layers should come afterward, in "lowest first" order). + *

      + * Note: all sandboxes must have a "main" layer. + */ + public String [] getStoreNames() { return store_names_; } + + /** + * The name of the "main" store within this sandbox. + */ + public String getMainStoreName() { return store_names_[0]; } +} diff --git a/source/java/org/alfresco/web/bean/wcm/SnapshotSandboxDialog.java b/source/java/org/alfresco/web/bean/wcm/SnapshotSandboxDialog.java index de1496bc00..141b1b455c 100644 --- a/source/java/org/alfresco/web/bean/wcm/SnapshotSandboxDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/SnapshotSandboxDialog.java @@ -32,6 +32,7 @@ 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; @@ -42,12 +43,14 @@ import org.apache.commons.logging.LogFactory; */ 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"; - protected AVMService avmService; + transient private AVMService avmService; protected AVMBrowseBean avmBrowseBean; private String label; @@ -70,6 +73,15 @@ public class SnapshotSandboxDialog extends BaseDialogBean 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. */ @@ -121,8 +133,8 @@ public class SnapshotSandboxDialog extends BaseDialogBean protected String finishImpl(FacesContext context, String outcome) throws Exception { // find the previous version - to see if a snapshot was acutally performed - int oldVersion = this.avmService.getLatestSnapshotID(this.avmBrowseBean.getSandbox()); - int version = this.avmService.createSnapshot( + 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) diff --git a/source/java/org/alfresco/web/bean/wcm/SubmitConfigureWorkflowDialog.java b/source/java/org/alfresco/web/bean/wcm/SubmitConfigureWorkflowDialog.java index 4ae1d0a0d0..1b7def7c78 100644 --- a/source/java/org/alfresco/web/bean/wcm/SubmitConfigureWorkflowDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/SubmitConfigureWorkflowDialog.java @@ -32,6 +32,8 @@ package org.alfresco.web.bean.wcm; */ public class SubmitConfigureWorkflowDialog extends FormWorkflowDialog { + private static final long serialVersionUID = 3828466420354771233L; + protected SubmitDialog submitDialog; diff --git a/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java b/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java index c0247a63d9..29eb2192ad 100644 --- a/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java @@ -51,7 +51,6 @@ import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransacti 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.avm.locking.AVMLock; import org.alfresco.service.cmr.avm.locking.AVMLockingService; import org.alfresco.service.cmr.avmsync.AVMDifference; import org.alfresco.service.cmr.avmsync.AVMSyncService; @@ -70,6 +69,7 @@ import org.alfresco.util.NameMatcher; import org.alfresco.util.VirtServerUtils; 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; @@ -89,6 +89,8 @@ import org.apache.commons.logging.LogFactory; */ 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"; @@ -122,13 +124,17 @@ public class SubmitDialog extends BaseDialogBean // updated webapp so it can happen in doPostCommitProcessing. private String virtUpdatePath; - protected AVMService avmService; + protected AVMBrowseBean avmBrowseBean; - protected WorkflowService workflowService; - protected AVMSyncService avmSyncService; - protected AVMLockingService avmLockingService; + + transient private AVMService avmService; + transient private WorkflowService workflowService; + transient private AVMSyncService avmSyncService; + transient private AVMLockingService avmLockingService; + transient private FormsService formsService; + protected NameMatcher nameMatcher; - protected FormsService formsService; + /** Current workflow for dialog context */ protected WorkflowConfiguration actionWorkflow = null; @@ -143,6 +149,15 @@ public class SubmitDialog extends BaseDialogBean this.avmService = avmService; } + protected AVMService getAvmService() + { + if (avmService == null) + { + avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); + } + return avmService; + } + /** * @param avmSyncService The AVMSyncService to set. */ @@ -151,6 +166,15 @@ public class SubmitDialog extends BaseDialogBean this.avmSyncService = avmSyncService; } + protected AVMSyncService getAvmSyncService() + { + if (this.avmSyncService == null) + { + this.avmSyncService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMSyncService(); + } + return this.avmSyncService; + } + /** * @param avmLockingService The AVMLockingService to set */ @@ -159,6 +183,15 @@ public class SubmitDialog extends BaseDialogBean this.avmLockingService = avmLockingService; } + protected AVMLockingService getAvmLockingService() + { + if (this.avmLockingService == null) + { + this.avmLockingService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMLockingService(); + } + return this.avmLockingService; + } + /** * @param avmBrowseBean The AVM BrowseBean to set */ @@ -175,6 +208,15 @@ public class SubmitDialog extends BaseDialogBean this.workflowService = workflowService; } + protected WorkflowService getWorkflowService() + { + if (workflowService == null) + { + workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService(); + } + return workflowService; + } + /** * @param nameMatcher The nameMatcher to set. */ @@ -190,6 +232,16 @@ public class SubmitDialog extends BaseDialogBean { this.formsService = formsService; } + + protected FormsService getFormsService() + { + if (formsService == null) + { + formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); + } + return formsService; + } + /** * @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map) @@ -419,7 +471,7 @@ public class SubmitDialog extends BaseDialogBean processExpirationDate(srcPath); // recursively remove locks from this item - recursivelyRemoveLocks(storeId, -1, this.avmService.lookup(-1, srcPath, true), srcPath); + recursivelyRemoveLocks(storeId, -1, getAvmService().lookup(-1, srcPath, true), srcPath); // If nothing has required notifying the virtualization server // so far, check to see if destPath forces a notification @@ -431,9 +483,9 @@ public class SubmitDialog extends BaseDialogBean } } // write changes to layer so files are marked as modified - this.avmSyncService.update(diffs, null, true, true, false, false, this.label, this.comment); + this.getAvmSyncService().update(diffs, null, true, true, false, false, this.label, this.comment); AVMDAOs.Instance().fAVMNodeDAO.flush(); - avmSyncService.flatten(sandboxPath, stagingPath); + getAvmSyncService().flatten(sandboxPath, stagingPath); // if we get this far return the default outcome return this.getDefaultFinishOutcome(); } @@ -518,7 +570,7 @@ public class SubmitDialog extends BaseDialogBean } // write changes to layer so files are marked as modified - avmSyncService.update(diffs, null, true, true, false, false, null, null); + getAvmSyncService().update(diffs, null, true, true, false, false, null, null); } else { @@ -537,12 +589,12 @@ public class SubmitDialog extends BaseDialogBean { // start the workflow to get access to the start task String workflowName = this.workflowSelectedValue[0]; - WorkflowDefinition wfDef = workflowService.getDefinitionByName(workflowName); - WorkflowPath path = this.workflowService.startWorkflow(wfDef.id, null); + WorkflowDefinition wfDef = getWorkflowService().getDefinitionByName(workflowName); + WorkflowPath path = getWorkflowService().startWorkflow(wfDef.id, null); if (path != null) { // extract the start task - List tasks = this.workflowService.getTasksForWorkflowPath(path.id); + List tasks = getWorkflowService().getTasksForWorkflowPath(path.id); if (tasks.size() == 1) { WorkflowTask startTask = tasks.get(0); @@ -568,10 +620,10 @@ public class SubmitDialog extends BaseDialogBean this.avmBrowseBean.getWebsite().getNodeRef()); // update start task with submit parameters - this.workflowService.updateTask(startTask.id, this.workflowParams, null, null); + getWorkflowService().updateTask(startTask.id, this.workflowParams, null, null); // end the start task to trigger the first 'proper' task in the workflow - this.workflowService.endTask(startTask.id, null); + getWorkflowService().endTask(startTask.id, null); } } } @@ -617,14 +669,14 @@ public class SubmitDialog extends BaseDialogBean if (this.sandboxInfo != null) { String mainWorkflowStore = this.sandboxInfo.getMainStoreName(); - Map matches = this.avmService.queryStorePropertyKey(mainWorkflowStore, + Map matches = getAvmService().queryStorePropertyKey(mainWorkflowStore, QName.createQName(null, ".sandbox-id%")); QName sandboxID = matches.keySet().iterator().next(); // Get all the stores in the sandbox. - Map> stores = this.avmService.queryStoresPropertyKeys(sandboxID); + Map> stores = getAvmService().queryStoresPropertyKeys(sandboxID); for (String storeName : stores.keySet()) { - this.avmService.purgeStore(storeName); + getAvmService().purgeStore(storeName); } } } @@ -637,14 +689,14 @@ public class SubmitDialog extends BaseDialogBean { if (desc.isFile() || desc.isDeletedFile()) { - this.avmLockingService.removeLock(webProject, path.substring(path.indexOf(":") + 1)); + this.getAvmLockingService().removeLock(webProject, path.substring(path.indexOf(":") + 1)); } else { if (desc.isDeletedDirectory()) { // lookup the previous child and get its contents - final List history = avmService.getHistory(desc, 2); + final List history = getAvmService().getHistory(desc, 2); if (history.size() == 1) { return; @@ -652,7 +704,7 @@ public class SubmitDialog extends BaseDialogBean desc = history.get(1); } - Map list = avmService.getDirectoryListingDirect(desc, true); + Map list = getAvmService().getDirectoryListingDirect(desc, true); for (Map.Entry child : list.entrySet()) { String name = child.getKey(); @@ -795,16 +847,16 @@ public class SubmitDialog extends BaseDialogBean // add the list of workflows for the website itself to the set NodeRef websiteRef = this.avmBrowseBean.getWebsite().getNodeRef(); - List webWorkflowRefs = this.nodeService.getChildAssocs( + 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)this.nodeService.getProperty(wfDefaultsRef, WCMAppModel.PROP_WORKFLOW_NAME); + String wfName = (String)getNodeService().getProperty(wfDefaultsRef, WCMAppModel.PROP_WORKFLOW_NAME); Map params = (Map)AVMWorkflowUtil.deserializeWorkflowParams( wfDefaultsRef); - String matchPattern = (String)this.nodeService.getProperty( + String matchPattern = (String)getNodeService().getProperty( wfDefaultsRef, WCMAppModel.PROP_FILENAMEPATTERN); if (matchPattern != null) { @@ -838,7 +890,7 @@ public class SubmitDialog extends BaseDialogBean List items = new ArrayList(this.workflows.size()); for (FormWorkflowWrapper wrapper : this.workflows) { - WorkflowDefinition workflowDef = this.workflowService.getDefinitionByName(wrapper.name); + WorkflowDefinition workflowDef = getWorkflowService().getDefinitionByName(wrapper.name); UIListItem item = new UIListItem(); item.setValue(workflowDef.getName()); String label = workflowDef.getTitle(); @@ -939,11 +991,11 @@ public class SubmitDialog extends BaseDialogBean String webapp = this.avmBrowseBean.getWebapp(); String userStore = AVMUtil.buildStoreWebappPath(this.avmBrowseBean.getSandbox(), webapp); String stagingStore = AVMUtil.buildStoreWebappPath(this.avmBrowseBean.getStagingStore(), webapp); - List diffs = this.avmSyncService.compare(-1, userStore, -1, stagingStore, nameMatcher); + List diffs = this.getAvmSyncService().compare(-1, userStore, -1, stagingStore, nameMatcher); selected = new ArrayList(diffs.size()); for (AVMDifference diff : diffs) { - selected.add(this.avmService.lookup(-1, diff.getSourcePath(), true)); + selected.add(getAvmService().lookup(-1, diff.getSourcePath(), true)); } } else if (this.avmBrowseBean.getAvmActionNode() == null) @@ -955,7 +1007,7 @@ public class SubmitDialog extends BaseDialogBean { // single item selected selected = new ArrayList(1); - selected.add(this.avmService.lookup(-1, this.avmBrowseBean.getAvmActionNode().getPath(), true)); + selected.add(getAvmService().lookup(-1, this.avmBrowseBean.getAvmActionNode().getPath(), true)); } if (selected == null) @@ -993,7 +1045,7 @@ public class SubmitDialog extends BaseDialogBean } // lookup if this item was created via a form - then lookup the workflow defaults // for that form and store into the list of available workflows - else if (!this.nodeService.hasAspect(ref, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) + else if (!getNodeService().hasAspect(ref, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) { this.submitItems.add(new ItemWrapper(node)); submittedPaths.add(node.getPath()); @@ -1002,22 +1054,22 @@ public class SubmitDialog extends BaseDialogBean { FormInstanceData fid = null; // check if this is a rendition - as they also have the forminstancedata aspect - if (this.nodeService.hasAspect(ref, WCMAppModel.ASPECT_RENDITION)) + if (getNodeService().hasAspect(ref, WCMAppModel.ASPECT_RENDITION)) { // 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 = this.formsService.getRendition(ref).getPrimaryFormInstanceData(); + fid = getFormsService().getRendition(ref).getPrimaryFormInstanceData(); } else { - fid = this.formsService.getFormInstanceData(ref); + fid = getFormsService().getFormInstanceData(ref); } // add the form instance data file to the list for submission if (!submittedPaths.contains(fid.getPath())) { - this.submitItems.add(new ItemWrapper(this.avmService.lookup(-1, fid.getPath()))); + this.submitItems.add(new ItemWrapper(getAvmService().lookup(-1, fid.getPath()))); submittedPaths.add(fid.getPath()); } @@ -1027,7 +1079,7 @@ public class SubmitDialog extends BaseDialogBean final String renditionPath = rendition.getPath(); if (!submittedPaths.contains(renditionPath)) { - this.submitItems.add(new ItemWrapper(this.avmService.lookup(-1, renditionPath))); + this.submitItems.add(new ItemWrapper(getAvmService().lookup(-1, renditionPath))); submittedPaths.add(renditionPath); } } @@ -1068,13 +1120,13 @@ public class SubmitDialog extends BaseDialogBean return; } // make sure the aspect is present - if (this.avmService.hasAspect(-1, srcPath, WCMAppModel.ASPECT_EXPIRES) == false) + if (getAvmService().hasAspect(-1, srcPath, WCMAppModel.ASPECT_EXPIRES) == false) { - this.avmService.addAspect(srcPath, WCMAppModel.ASPECT_EXPIRES); + getAvmService().addAspect(srcPath, WCMAppModel.ASPECT_EXPIRES); } // set the expiration date - this.avmService.setNodeProperty(srcPath, WCMAppModel.PROP_EXPIRATIONDATE, + getAvmService().setNodeProperty(srcPath, WCMAppModel.PROP_EXPIRATIONDATE, new PropertyValue(DataTypeDefinition.DATETIME, expirationDate)); if (logger.isDebugEnabled()) @@ -1153,6 +1205,8 @@ public class SubmitDialog extends BaseDialogBean */ private static class FormWorkflowWrapper implements WorkflowConfiguration { + private static final long serialVersionUID = -6264439015998987731L; + private String name; private Map params; private QName type; @@ -1234,8 +1288,10 @@ public class SubmitDialog extends BaseDialogBean /** * Wrapper class to provide UI RichList component getters for an AVM node descriptor */ - public class ItemWrapper + public class ItemWrapper implements Serializable { + private static final long serialVersionUID = 6079164681664703986L; + private static final String rootPath = '/' + JNDIConstants.DIR_DEFAULT_APPBASE; private AVMNodeDescriptor descriptor; @@ -1286,7 +1342,7 @@ public class SubmitDialog extends BaseDialogBean { if (descriptor.isDeleted() == false) { - return (String)nodeService.getProperty( + return (String)getNodeService().getProperty( AVMNodeConverter.ToNodeRef(-1, descriptor.getPath()), ContentModel.PROP_DESCRIPTION); } else diff --git a/source/java/org/alfresco/web/bean/wcm/ViewDeploymentReportDialog.java b/source/java/org/alfresco/web/bean/wcm/ViewDeploymentReportDialog.java index b6223f05e8..a70f09f7f0 100644 --- a/source/java/org/alfresco/web/bean/wcm/ViewDeploymentReportDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/ViewDeploymentReportDialog.java @@ -41,6 +41,8 @@ import org.apache.commons.logging.LogFactory; */ public class ViewDeploymentReportDialog extends BaseDialogBean { + private static final long serialVersionUID = -8054466371051782132L; + protected NodeRef webProjectRef; protected Integer deployedVersion; diff --git a/source/java/org/alfresco/web/bean/wcm/WebProject.java b/source/java/org/alfresco/web/bean/wcm/WebProject.java index d96900cbae..a5c82e9dda 100644 --- a/source/java/org/alfresco/web/bean/wcm/WebProject.java +++ b/source/java/org/alfresco/web/bean/wcm/WebProject.java @@ -70,18 +70,20 @@ import org.apache.commons.logging.LogFactory; * * @author Ariel Backenroth */ -public class WebProject - implements Serializable +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 class FormWrapper extends FormImpl { + private static final long serialVersionUID = 1L; + private final NodeRef formNodeRef; private Form baseForm; private NodeRef defaultWorkflowNodeRef; @@ -164,8 +166,10 @@ public class WebProject result.put(ret.getName(), new RenderingEngineTemplateImpl(ret.getNodeRef(), ret.getRenditionPropertiesNodeRef(), - this.formsService) + this.getFormsService()) { + private static final long serialVersionUID = -5498865830153013192L; + @Override public String getOutputPathPattern() { diff --git a/source/java/org/alfresco/web/bean/wcm/WebSiteDetailsDialog.java b/source/java/org/alfresco/web/bean/wcm/WebSiteDetailsDialog.java index 78cd578740..2220800730 100644 --- a/source/java/org/alfresco/web/bean/wcm/WebSiteDetailsDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/WebSiteDetailsDialog.java @@ -67,7 +67,7 @@ public class WebSiteDetailsDialog extends BaseDetailsBean implements NavigationS if (ApplicationModel.TYPE_FOLDERLINK.equals(space.getType())) { NodeRef destRef = (NodeRef) space.getProperties().get(ContentModel.PROP_LINK_DESTINATION); - if (nodeService.exists(destRef)) + if (getNodeService().exists(destRef)) { space = new Node(destRef); } @@ -232,7 +232,8 @@ public class WebSiteDetailsDialog extends BaseDetailsBean implements NavigationS @Override public String getContainerSubTitle() { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + getSpace().getNodePath().toDisplayPath(nodeService, permissionService); + return Application.getMessage(FacesContext.getCurrentInstance(), MSG_LOCATION) + ": " + + getSpace().getNodePath().toDisplayPath(getNodeService(), getPermissionService()); } public String getContainerTitle() diff --git a/source/java/org/alfresco/web/bean/wcm/WorkflowConfiguration.java b/source/java/org/alfresco/web/bean/wcm/WorkflowConfiguration.java index 59428242f1..96d22950f2 100644 --- a/source/java/org/alfresco/web/bean/wcm/WorkflowConfiguration.java +++ b/source/java/org/alfresco/web/bean/wcm/WorkflowConfiguration.java @@ -34,7 +34,7 @@ import org.alfresco.service.namespace.QName; * * @author Kevin Roast */ -public interface WorkflowConfiguration +public interface WorkflowConfiguration extends Serializable { /** * @return definition name of the workflow diff --git a/source/java/org/alfresco/web/bean/wizard/AbstractWizardBean.java b/source/java/org/alfresco/web/bean/wizard/AbstractWizardBean.java index c2fb8846b6..f5b5270bcf 100644 --- a/source/java/org/alfresco/web/bean/wizard/AbstractWizardBean.java +++ b/source/java/org/alfresco/web/bean/wizard/AbstractWizardBean.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.bean.wizard; +import java.io.Serializable; + import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; @@ -34,6 +36,7 @@ import org.alfresco.web.app.Application; import org.alfresco.web.app.context.UIContextService; import org.alfresco.web.bean.BrowseBean; import org.alfresco.web.bean.NavigationBean; +import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.ui.common.Utils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -43,7 +46,7 @@ import org.apache.commons.logging.LogFactory; * * @author gavinc */ -public abstract class AbstractWizardBean +public abstract class AbstractWizardBean implements Serializable { private static Log logger = LogFactory.getLog(AbstractWizardBean.class); @@ -59,9 +62,9 @@ public abstract class AbstractWizardBean // common wizard properties protected int currentStep = 1; protected boolean editMode = false; - protected NodeService nodeService; - protected FileFolderService fileFolderService; - protected SearchService searchService; + transient private NodeService nodeService; + transient private FileFolderService fileFolderService; + transient private SearchService searchService; protected NavigationBean navigator; protected BrowseBean browseBean; @@ -237,6 +240,10 @@ public abstract class AbstractWizardBean */ public NodeService getNodeService() { + if (nodeService == null) + { + nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + } return this.nodeService; } @@ -255,6 +262,15 @@ public abstract class AbstractWizardBean { this.fileFolderService = fileFolderService; } + + protected FileFolderService getFileFolderService() + { + if (fileFolderService == null) + { + fileFolderService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getFileFolderService(); + } + return fileFolderService; + } /** * @param searchService the service used to find nodes @@ -263,6 +279,15 @@ public abstract class AbstractWizardBean { this.searchService = searchService; } + + protected SearchService getSearchService() + { + if (searchService == null) + { + searchService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSearchService(); + } + return searchService; + } /** * @return Returns the navigation bean instance. diff --git a/source/java/org/alfresco/web/bean/wizard/BaseInviteUsersWizard.java b/source/java/org/alfresco/web/bean/wizard/BaseInviteUsersWizard.java index 6e8c6d331c..24a543bf5e 100644 --- a/source/java/org/alfresco/web/bean/wizard/BaseInviteUsersWizard.java +++ b/source/java/org/alfresco/web/bean/wizard/BaseInviteUsersWizard.java @@ -24,6 +24,9 @@ */ package org.alfresco.web.bean.wizard; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.Serializable; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Arrays; @@ -66,6 +69,8 @@ import org.springframework.mail.javamail.JavaMailSender; */ public abstract class BaseInviteUsersWizard extends BaseWizardBean { + private static final long serialVersionUID = -5145813383038390250L; + /** I18N message strings */ protected static final String MSG_USERROLES = "invite_users_summary"; private static final String MSG_USERS = "users"; @@ -79,25 +84,25 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean private static final String NOTIFY_NO = "no"; /** NamespaceService bean reference */ - protected NamespaceService namespaceService; + transient private NamespaceService namespaceService; /** JavaMailSender bean reference */ - protected JavaMailSender mailSender; + transient private JavaMailSender mailSender; /** AuthorityService bean reference */ - protected AuthorityService authorityService; + transient private AuthorityService authorityService; /** PermissionService bean reference */ - protected PermissionService permissionService; + transient private PermissionService permissionService; /** personService bean reference */ - protected PersonService personService; + transient private PersonService personService; /** Helper providing template based mailing facilities */ protected TemplateMailHelperBean mailHelper; /** datamodel for table of roles for users */ - protected DataModel userRolesDataModel = null; + transient private DataModel userRolesDataModel = null; /** list of user/group role wrapper objects */ protected List userGroupRoles = null; @@ -126,6 +131,15 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean this.namespaceService = namespaceService; } + protected NamespaceService getNamespaceService() + { + if (namespaceService == null) + { + namespaceService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNamespaceService(); + } + return namespaceService; + } + /** * @param mailSender The JavaMailSender to set. */ @@ -142,6 +156,15 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean this.permissionService = permissionService; } + protected PermissionService getPermissionService() + { + if (permissionService == null) + { + permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService(); + } + return permissionService; + } + /** * @param personService The PersonService to set. */ @@ -150,6 +173,15 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean this.personService = personService; } + protected PersonService getPersonService() + { + if (personService == null) + { + personService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPersonService(); + } + return personService; + } + /** * @param authorityService The authorityService to set. */ @@ -157,6 +189,15 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean { this.authorityService = authorityService; } + + protected AuthorityService getAuthorityService() + { + if (authorityService == null) + { + authorityService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAuthorityService(); + } + return authorityService; + } /** * Initialises the wizard @@ -170,7 +211,7 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean userGroupRoles = new ArrayList(8); mailHelper = new TemplateMailHelperBean(); mailHelper.setMailSender(mailSender); - mailHelper.setNodeService(nodeService); + mailHelper.setNodeService(getNodeService()); } /** @@ -180,7 +221,7 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean protected String finishImpl(FacesContext context, String outcome) throws Exception { User user = Application.getCurrentUser(context); - String from = (String)this.nodeService.getProperty(user.getPerson(), ContentModel.PROP_EMAIL); + String from = (String)this.getNodeService().getProperty(user.getPerson(), ContentModel.PROP_EMAIL); if (from == null || from.length() == 0) { // if the user does not have an email address get the default one from the config service @@ -202,7 +243,7 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean { if (userGroupRole.getRole().equals(permission)) { - this.permissionService.setPermission( + this.getPermissionService().setPermission( nodeRef, authority, permission, @@ -218,22 +259,22 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean AuthorityType authType = AuthorityType.getAuthorityType(authority); if (authType.equals(AuthorityType.USER)) { - if (this.personService.personExists(authority) == true) + if (this.getPersonService().personExists(authority) == true) { this.mailHelper.notifyUser( - this.personService.getPerson(authority), nodeRef, from, userGroupRole.getRole()); + this.getPersonService().getPerson(authority), nodeRef, from, userGroupRole.getRole()); } } else if (authType.equals(AuthorityType.GROUP)) { // else notify all members of the group - Set users = this.authorityService.getContainedAuthorities(AuthorityType.USER, authority, false); + Set users = this.getAuthorityService().getContainedAuthorities(AuthorityType.USER, authority, false); for (String userAuth : users) { - if (this.personService.personExists(userAuth) == true) + if (this.getPersonService().personExists(userAuth) == true) { this.mailHelper.notifyUser( - this.personService.getPerson(userAuth), nodeRef, from, userGroupRole.getRole()); + this.getPersonService().getPerson(userAuth), nodeRef, from, userGroupRole.getRole()); } } } @@ -302,21 +343,21 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean if (filterIndex == 0) { // build xpath to match available User/Person objects - NodeRef peopleRef = personService.getPeopleContainer(); + NodeRef peopleRef = getPersonService().getPeopleContainer(); // Use lucene search to retrieve user details String lucene = "@" + NamespaceService.CONTENT_MODEL_PREFIX + "\\:firstName:*" + contains + "* " + "@" + NamespaceService.CONTENT_MODEL_PREFIX + "\\:lastName:*" + contains + "* "; - ResultSet resultSet = searchService.query(peopleRef.getStoreRef(), SearchService.LANGUAGE_LUCENE, lucene); + ResultSet resultSet = getSearchService().query(peopleRef.getStoreRef(), SearchService.LANGUAGE_LUCENE, lucene); List nodes = resultSet.getNodeRefs(); items = new SelectItem[nodes.size()]; for (int index=0; index groups = authorityService.getAllAuthorities(AuthorityType.GROUP); - groups.addAll(authorityService.getAllAuthorities(AuthorityType.EVERYONE)); + Set groups = getAuthorityService().getAllAuthorities(AuthorityType.GROUP); + groups.addAll(getAuthorityService().getAllAuthorities(AuthorityType.EVERYONE)); List results = new ArrayList(groups.size()); String containsLower = contains.toLowerCase(); @@ -409,7 +450,7 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean AuthorityType authType = AuthorityType.getAuthorityType(authority); if (authType == AuthorityType.GUEST || authType == AuthorityType.USER) { - if (authType == AuthorityType.GUEST || this.personService.personExists(authority) == true) + if (authType == AuthorityType.GUEST || getPersonService().personExists(authority) == true) { // found a User authority label.append(buildLabelForUserAuthorityRole(authority, role)); @@ -430,7 +471,7 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean */ public void removeSelection(ActionEvent event) { - UserGroupRole wrapper = (UserGroupRole)this.userRolesDataModel.getRowData(); + UserGroupRole wrapper = (UserGroupRole)getUserRolesDataModel().getRowData(); if (wrapper != null) { this.userGroupRoles.remove(wrapper); @@ -499,11 +540,11 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean // prepare automatic text for email and display StringBuilder buf = new StringBuilder(256); - String personName = Application.getCurrentUser(context).getFullName(this.nodeService); + String personName = Application.getCurrentUser(context).getFullName(this.getNodeService()); String msgInvitedTo = Application.getMessage(context, MSG_INVITED_TO); Node node = this.getNode(); - String path = this.nodeService.getPath(node.getNodeRef()).toDisplayPath( - this.nodeService, this.permissionService); + String path = this.getNodeService().getPath(node.getNodeRef()).toDisplayPath( + this.getNodeService(), getPermissionService()); buf.append(MessageFormat.format(msgInvitedTo, new Object[] { path + '/' + node.getName(), personName}) ); @@ -551,9 +592,9 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean public String buildLabelForUserAuthorityRole(String authority, String role) { // found a User authority - NodeRef ref = this.personService.getPerson(authority); - String firstName = (String)this.nodeService.getProperty(ref, ContentModel.PROP_FIRSTNAME); - String lastName = (String)this.nodeService.getProperty(ref, ContentModel.PROP_LASTNAME); + NodeRef ref = this.getPersonService().getPerson(authority); + String firstName = (String)this.getNodeService().getProperty(ref, ContentModel.PROP_FIRSTNAME); + String lastName = (String)this.getNodeService().getProperty(ref, ContentModel.PROP_LASTNAME); StringBuilder buf = new StringBuilder(100); buf.append(firstName) @@ -601,12 +642,22 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean new String[] {buf.toString()}); } + private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException + { + in.defaultReadObject(); + + this.userRolesDataModel = new ListDataModel(); + this.userRolesDataModel.setWrappedData(this.userGroupRoles); + + } /** * Simple wrapper class to represent a user/group and a role combination */ - public static class UserGroupRole + public static class UserGroupRole implements Serializable { + private static final long serialVersionUID = -3200146057437311225L; + public UserGroupRole(String authority, String role, String label) { this.authority = authority; diff --git a/source/java/org/alfresco/web/bean/wizard/NewUserWizard.java b/source/java/org/alfresco/web/bean/wizard/NewUserWizard.java index 321957bed3..beb2d76ce6 100644 --- a/source/java/org/alfresco/web/bean/wizard/NewUserWizard.java +++ b/source/java/org/alfresco/web/bean/wizard/NewUserWizard.java @@ -1,1020 +1,1070 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.web.bean.wizard; - -import java.io.Serializable; -import java.text.MessageFormat; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.ResourceBundle; - -import javax.faces.application.FacesMessage; -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; -import javax.faces.validator.ValidatorException; -import javax.transaction.UserTransaction; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ApplicationModel; -import org.alfresco.model.ContentModel; -import org.alfresco.repo.security.authentication.AuthenticationException; -import org.alfresco.repo.tenant.TenantService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.InvalidNodeRefException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AuthenticationService; -import org.alfresco.service.cmr.security.OwnableService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.context.UIContextService; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.spaces.CreateSpaceWizard; -import org.alfresco.web.bean.users.UsersDialog; -import org.alfresco.web.config.ClientConfigElement; -import org.alfresco.web.ui.common.Utils; -import org.alfresco.web.ui.common.component.UIActionLink; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * @author Kevin Roast - */ -public class NewUserWizard extends AbstractWizardBean -{ - private static Log logger = LogFactory.getLog(NewUserWizard.class); - - private static final String WIZARD_TITLE_NEW_ID = "new_user_title"; - private static final String WIZARD_DESC_NEW_ID = "new_user_desc"; - private static final String WIZARD_TITLE_EDIT_ID = "new_user_title_edit"; - private static final String WIZARD_DESC_EDIT_ID = "new_user_desc_edit"; - private static final String STEP1_TITLE_ID = "new_user_step1_title"; - private static final String STEP1_DESCRIPTION_ID = "new_user_step1_desc"; - private static final String STEP2_TITLE_ID = "new_user_step2_title"; - private static final String STEP2_DESCRIPTION_ID = "new_user_step2_desc"; - private static final String FINISH_INSTRUCTION_ID = "new_user_finish_instruction"; - private static final String ERROR = "error_person"; - - /** form variables */ - private String firstName = null; - private String lastName = null; - private String userName = null; - private String password = null; - private String confirm = null; - private String email = null; - private String companyId = null; - private String homeSpaceName = ""; - private NodeRef homeSpaceLocation = null; - - /** AuthenticationService bean reference */ - private AuthenticationService authenticationService; - - /** NamespaceService bean reference */ - private NamespaceService namespaceService; - - /** PermissionService bean reference */ - private PermissionService permissionService; - - /** PersonService bean reference */ - private PersonService personService; - - /** TenantService bean reference */ - private TenantService tenantService; - - /** OwnableService bean reference */ - private OwnableService ownableService; - - /** action context */ - private Node person = null; - - /** ref to the company home space folder */ - private NodeRef companyHomeSpaceRef = null; - - /** ref to the default home location */ - private NodeRef defaultHomeSpaceRef; - - - /** - * @param authenticationService The AuthenticationService to set. - */ - public void setAuthenticationService(AuthenticationService authenticationService) - { - this.authenticationService = authenticationService; - } - - /** - * @param namespaceService The namespaceService to set. - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param permissionService The PermissionService to set. - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @param personService The person service. - */ - public void setPersonService(PersonService personService) - { - this.personService = personService; - } - - /** - * @param ownableService The ownableService to set. - */ - public void setOwnableService(OwnableService ownableService) - { - this.ownableService = ownableService; - } - - /** - * @param tenantService The tenantService to set. - */ - public void setTenantService(TenantService tenantService) - { - this.tenantService = tenantService; - } - - /** - * Initialises the wizard - */ - public void init() - { - super.init(); - - // reset all variables - this.firstName = ""; - this.lastName = ""; - this.userName = ""; - this.password = ""; - this.confirm = ""; - this.email = ""; - this.companyId = ""; - this.homeSpaceName = ""; - this.homeSpaceLocation = getDefaultHomeSpace(); - } - - /** - * @see org.alfresco.web.bean.wizard.AbstractWizardBean#populate() - */ - public void populate() - { - // set values for edit mode - Map props = getPerson().getProperties(); - - this.firstName = (String) props.get("firstName"); - this.lastName = (String) props.get("lastName"); - this.userName = (String) props.get("userName"); - this.password = ""; - this.confirm = ""; - this.email = (String) props.get("email"); - this.companyId = (String) props.get("organizationId"); - - // calculate home space name and parent space Id from homeFolderId - this.homeSpaceLocation = null; // default to Company root space - this.homeSpaceName = ""; // default to none set below root - NodeRef homeFolderRef = (NodeRef) props.get("homeFolder"); - if (this.nodeService.exists(homeFolderRef) == true) - { - ChildAssociationRef childAssocRef = this.nodeService.getPrimaryParent(homeFolderRef); - NodeRef parentRef = childAssocRef.getParentRef(); - if (this.nodeService.getRootNode(Repository.getStoreRef()).equals(parentRef) == false) - { - this.homeSpaceLocation = parentRef; - this.homeSpaceName = Repository.getNameForNode(nodeService, homeFolderRef); - } - else - { - this.homeSpaceLocation = homeFolderRef; - } - } - - if (logger.isDebugEnabled()) - logger.debug("Edit user home space location: " + homeSpaceLocation + " home space name: " + homeSpaceName); - } - - /** - * @see org.alfresco.web.bean.wizard.AbstractWizardBean#getWizardDescription() - */ - public String getWizardDescription() - { - if (this.editMode) - { - return Application.getMessage(FacesContext.getCurrentInstance(), WIZARD_DESC_EDIT_ID); - } - else - { - return Application.getMessage(FacesContext.getCurrentInstance(), WIZARD_DESC_NEW_ID); - } - } - - /** - * @see org.alfresco.web.bean.wizard.AbstractWizardBean#getWizardTitle() - */ - public String getWizardTitle() - { - if (this.editMode) - { - return Application.getMessage(FacesContext.getCurrentInstance(), WIZARD_TITLE_EDIT_ID); - } - else - { - return Application.getMessage(FacesContext.getCurrentInstance(), WIZARD_TITLE_NEW_ID); - } - } - - /** - * @see org.alfresco.web.bean.wizard.AbstractWizardBean#getStepTitle() - */ - public String getStepTitle() - { - String stepTitle = null; - - switch (this.currentStep) - { - case 1: - { - stepTitle = Application.getMessage(FacesContext.getCurrentInstance(), STEP1_TITLE_ID); - break; - } - case 2: - { - stepTitle = Application.getMessage(FacesContext.getCurrentInstance(), STEP2_TITLE_ID); - break; - } - case 3: - { - stepTitle = Application.getMessage(FacesContext.getCurrentInstance(), SUMMARY_TITLE_ID); - break; - } - default: - { - stepTitle = ""; - } - } - - return stepTitle; - } - - /** - * @see org.alfresco.web.bean.wizard.AbstractWizardBean#getStepDescription() - */ - public String getStepDescription() - { - String stepDesc = null; - - switch (this.currentStep) - { - case 1: - { - stepDesc = Application.getMessage(FacesContext.getCurrentInstance(), STEP1_DESCRIPTION_ID); - break; - } - case 2: - { - stepDesc = Application.getMessage(FacesContext.getCurrentInstance(), STEP2_DESCRIPTION_ID); - break; - } - case 3: - { - stepDesc = Application.getMessage(FacesContext.getCurrentInstance(), SUMMARY_DESCRIPTION_ID); - break; - } - default: - { - stepDesc = ""; - } - } - - return stepDesc; - } - - /** - * @see org.alfresco.web.bean.wizard.AbstractWizardBean#getStepInstructions() - */ - public String getStepInstructions() - { - String stepInstruction = null; - - switch (this.currentStep) - { - case 3: - { - stepInstruction = Application.getMessage(FacesContext.getCurrentInstance(), FINISH_INSTRUCTION_ID); - break; - } - default: - { - stepInstruction = Application.getMessage(FacesContext.getCurrentInstance(), DEFAULT_INSTRUCTION_ID); - } - } - - return stepInstruction; - } - - /** - * @see org.alfresco.web.bean.wizard.AbstractWizardBean#determineOutcomeForStep(int) - */ - protected String determineOutcomeForStep(int step) - { - String outcome = null; - - switch (step) - { - case 1: - { - outcome = "person-properties"; - break; - } - case 2: - { - outcome = "user-properties"; - break; - } - case 3: - { - outcome = "summary"; - break; - } - default: - { - outcome = CANCEL_OUTCOME; - } - } - - return outcome; - } - - /** - * @see org.alfresco.web.bean.wizard.AbstractWizardBean#finish() - */ - public String finish() - { - String outcome = FINISH_OUTCOME; - - // TODO: implement create new Person object from specified details - UserTransaction tx = null; - - try - { - FacesContext context = FacesContext.getCurrentInstance(); - tx = Repository.getUserTransaction(context); - tx.begin(); - - if (this.editMode) - { - // update the existing node in the repository - NodeRef nodeRef = getPerson().getNodeRef(); - - Map props = this.nodeService.getProperties(nodeRef); - props.put(ContentModel.PROP_USERNAME, this.userName); - props.put(ContentModel.PROP_FIRSTNAME, this.firstName); - props.put(ContentModel.PROP_LASTNAME, this.lastName); - - // calculate whether we need to move the old home space or create new - NodeRef newHomeFolderRef; - NodeRef oldHomeFolderRef = (NodeRef)this.nodeService.getProperty(nodeRef, ContentModel.PROP_HOMEFOLDER); - boolean moveHomeSpace = false; - boolean renameHomeSpace = false; - if (oldHomeFolderRef != null && this.nodeService.exists(oldHomeFolderRef) == true) - { - // the original home folder ref exists so may need moving if it has been changed - ChildAssociationRef childAssocRef = this.nodeService.getPrimaryParent(oldHomeFolderRef); - NodeRef currentHomeSpaceLocation = childAssocRef.getParentRef(); - if (this.homeSpaceName.length() != 0) - { - if (currentHomeSpaceLocation.equals(this.homeSpaceLocation) == false && - oldHomeFolderRef.equals(this.homeSpaceLocation) == false && - currentHomeSpaceLocation.equals(getCompanyHomeSpace()) == false && - currentHomeSpaceLocation.equals(getDefaultHomeSpace()) == false) - { - moveHomeSpace = true; - } - - String oldHomeSpaceName = Repository.getNameForNode(nodeService, oldHomeFolderRef); - if (oldHomeSpaceName.equals(this.homeSpaceName) == false && - oldHomeFolderRef.equals(this.homeSpaceLocation) == false && - oldHomeFolderRef.equals(this.defaultHomeSpaceRef) == false) - { - renameHomeSpace = true; - } - } - } - - if (logger.isDebugEnabled()) - logger.debug("Moving space: " + moveHomeSpace + " and renaming space: " + renameHomeSpace); - - if (moveHomeSpace == false && renameHomeSpace == false) - { - if (this.homeSpaceLocation != null && this.homeSpaceName.length() != 0) - { - newHomeFolderRef = createHomeSpace(this.homeSpaceLocation.getId(), this.homeSpaceName, false); - } - else if (this.homeSpaceLocation != null) - { - // location selected but no home space name entered, - // so the home ref should be set to the newly selected space - newHomeFolderRef = this.homeSpaceLocation; - - // set the permissions for this space so the user can access it - - } - else - { - // nothing selected - use Company Home by default - newHomeFolderRef = getCompanyHomeSpace(); - } - } - else - { - // either move, rename or both required - if (moveHomeSpace == true) - { - this.nodeService.moveNode( - oldHomeFolderRef, - this.homeSpaceLocation, - ContentModel.ASSOC_CONTAINS, - this.nodeService.getPrimaryParent(oldHomeFolderRef).getQName()); - } - newHomeFolderRef = oldHomeFolderRef; // ref ID doesn't change - - if (renameHomeSpace == true) - { - // change HomeSpace node name - this.nodeService.setProperty(newHomeFolderRef, ContentModel.PROP_NAME, this.homeSpaceName); - } - } - - props.put(ContentModel.PROP_HOMEFOLDER, newHomeFolderRef); - props.put(ContentModel.PROP_EMAIL, this.email); - props.put(ContentModel.PROP_ORGID, this.companyId); - this.nodeService.setProperties(nodeRef, props); - - // TODO: RESET HomeSpace Ref found in top-level navigation bar! - // NOTE: not need cos only admin can do this? - } - else - { - if (tenantService.isEnabled()) - { - String currentDomain = tenantService.getCurrentUserDomain(); - if (! currentDomain.equals(TenantService.DEFAULT_DOMAIN)) - { - if (! tenantService.isTenantUser(this.userName)) - { - // force domain onto the end of the username - this.userName = tenantService.getDomainUser(this.userName, currentDomain); - logger.warn("Added domain to username: " + this.userName); - } - else - { - try - { - tenantService.checkDomainUser(this.userName); - } - catch (RuntimeException re) - { - throw new AuthenticationException("User must belong to same domain as admin: " + currentDomain); - } - } - } - } - - if (this.password.equals(this.confirm)) - { - // create properties for Person type from submitted Form data - Map props = new HashMap(7, 1.0f); - props.put(ContentModel.PROP_USERNAME, this.userName); - props.put(ContentModel.PROP_FIRSTNAME, this.firstName); - props.put(ContentModel.PROP_LASTNAME, this.lastName); - NodeRef homeSpaceNodeRef; - if (this.homeSpaceLocation != null && this.homeSpaceName.length() != 0) - { - // create new - homeSpaceNodeRef = createHomeSpace(this.homeSpaceLocation.getId(), this.homeSpaceName, true); - } - else if (this.homeSpaceLocation != null) - { - // set to existing - homeSpaceNodeRef = homeSpaceLocation; - setupHomeSpacePermissions(homeSpaceNodeRef); - } - else - { - // default to Company Home - homeSpaceNodeRef = getCompanyHomeSpace(); - } - props.put(ContentModel.PROP_HOMEFOLDER, homeSpaceNodeRef); - props.put(ContentModel.PROP_EMAIL, this.email); - props.put(ContentModel.PROP_ORGID, this.companyId); - - // create the node to represent the Person - NodeRef newPerson = this.personService.createPerson(props); - - // ensure the user can access their own Person object - this.permissionService.setPermission(newPerson, this.userName, permissionService.getAllPermission(), true); - - if (logger.isDebugEnabled()) logger.debug("Created Person node for username: " + this.userName); - - // create the ACEGI Authentication instance for the new user - this.authenticationService.createAuthentication(this.userName, this.password.toCharArray()); - - if (logger.isDebugEnabled()) logger.debug("Created User Authentication instance for username: " + this.userName); - } - else - { - outcome = null; - Utils.addErrorMessage(Application.getMessage(context, UsersDialog.ERROR_PASSWORD_MATCH)); - } - } - - // commit the transaction - tx.commit(); - - // reset the richlist component so it rebinds to the users list - invalidateUserList(); - } - catch (Throwable e) - { - // rollback the transaction - try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} - Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), ERROR), e - .getMessage()), e); - outcome = null; - } - - return outcome; - } - - /** - * @return Returns the summary data for the wizard. - */ - public String getSummary() - { - String homeSpaceLabel = this.homeSpaceName; - if (this.homeSpaceName.length() == 0 && this.homeSpaceLocation != null) - { - homeSpaceLabel = Repository.getNameForNode(this.nodeService, this.homeSpaceLocation); - } - - ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); - - return buildSummary(new String[] { bundle.getString("name"), bundle.getString("username"), - bundle.getString("password"), bundle.getString("homespace") }, new String[] { - this.firstName + " " + this.lastName, this.userName, "********", homeSpaceLabel }); - } - - /** - * Init the users screen - */ - public void setupUsers(ActionEvent event) - { - invalidateUserList(); - } - - /** - * Action listener called when the wizard is being launched for editing an - * existing node. - */ - public void startWizardForEdit(ActionEvent event) - { - UIActionLink link = (UIActionLink) event.getComponent(); - Map params = link.getParameterMap(); - String id = params.get("id"); - if (id != null && id.length() != 0) - { - try - { - // create the node ref, then our node representation - NodeRef ref = new NodeRef(Repository.getStoreRef(), id); - Node node = new Node(ref); - - // remember the Person node - setPerson(node); - - // set the wizard in edit mode - this.editMode = true; - - // populate the wizard's default values with the current value - // from the node being edited - init(); - populate(); - - // clear the UI state in preparation for finishing the action - // and returning to the main page - invalidateUserList(); - - if (logger.isDebugEnabled()) logger.debug("Started wizard : " + getWizardTitle() + " for editing"); - } - catch (InvalidNodeRefException refErr) - { - Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), - Repository.ERROR_NODEREF), new Object[] { id })); - } - } - else - { - setPerson(null); - } - } - - /** - * @return Returns the companyId. - */ - public String getCompanyId() - { - return this.companyId; - } - - /** - * @param companyId - * The companyId to set. - */ - public void setCompanyId(String companyId) - { - this.companyId = companyId; - } - - /** - * @return Returns the email. - */ - public String getEmail() - { - return this.email; - } - - /** - * @param email - * The email to set. - */ - public void setEmail(String email) - { - this.email = email; - } - - /** - * @return Returns the firstName. - */ - public String getFirstName() - { - return this.firstName; - } - - /** - * @param firstName The firstName to set. - */ - public void setFirstName(String firstName) - { - this.firstName = firstName; - } - - /** - * @return Returns the homeSpaceLocation. - */ - public NodeRef getHomeSpaceLocation() - { - return this.homeSpaceLocation; - } - - /** - * @param homeSpaceLocation The homeSpaceLocation to set. - */ - public void setHomeSpaceLocation(NodeRef homeSpaceLocation) - { - this.homeSpaceLocation = homeSpaceLocation; - } - - /** - * @return Returns the homeSpaceName. - */ - public String getHomeSpaceName() - { - return this.homeSpaceName; - } - - /** - * @param homeSpaceName The homeSpaceName to set. - */ - public void setHomeSpaceName(String homeSpaceName) - { - this.homeSpaceName = homeSpaceName; - } - - /** - * @return Returns the lastName. - */ - public String getLastName() - { - return this.lastName; - } - - /** - * @param lastName The lastName to set. - */ - public void setLastName(String lastName) - { - this.lastName = lastName; - } - - /** - * @return Returns the userName. - */ - public String getUserName() - { - return this.userName; - } - - /** - * @param userName The userName to set. - */ - public void setUserName(String userName) - { - this.userName = userName; - } - - /** - * @return Returns the password. - */ - public String getPassword() - { - return this.password; - } - - /** - * @param password The password to set. - */ - public void setPassword(String password) - { - this.password = password; - } - - /** - * @return Returns the confirm password. - */ - public String getConfirm() - { - return this.confirm; - } - - /** - * @param confirm The confirm password to set. - */ - public void setConfirm(String confirm) - { - this.confirm = confirm; - } - - /** - * @return Returns the person context. - */ - public Node getPerson() - { - return this.person; - } - - /** - * @param person The person context to set. - */ - public void setPerson(Node person) - { - this.person = person; - } - - public boolean getEditMode() - { - return this.editMode; - } - - - // ------------------------------------------------------------------------------ - // Validator methods - - /** - * Validate password field data is acceptable - */ - public void validatePassword(FacesContext context, UIComponent component, Object value) throws ValidatorException - { - String pass = (String) value; - if (pass.length() < 5 || pass.length() > 12) - { - String err = "Password must be between 5 and 12 characters in length."; - throw new ValidatorException(new FacesMessage(err)); - } - - for (int i = 0; i < pass.length(); i++) - { - if (Character.isLetterOrDigit(pass.charAt(i)) == false) - { - String err = "Password can only contain characters or digits."; - throw new ValidatorException(new FacesMessage(err)); - } - } - } - - /** - * Validate Username field data is acceptable - */ - public void validateUsername(FacesContext context, UIComponent component, Object value) throws ValidatorException - { - String pass = (String) value; - if (pass.length() < 5 || pass.length() > 12) - { - String err = "Username must be between 5 and 12 characters in length."; - throw new ValidatorException(new FacesMessage(err)); - } - - for (int i = 0; i < pass.length(); i++) - { - if (Character.isLetterOrDigit(pass.charAt(i)) == false) - { - String err = "Username can only contain characters or digits."; - throw new ValidatorException(new FacesMessage(err)); - } - } - } - - - // ------------------------------------------------------------------------------ - // Helper methods - - /** - * Helper to return the company home space - * - * @return company home space NodeRef - */ - private NodeRef getCompanyHomeSpace() - { - if (this.companyHomeSpaceRef == null) - { - this.companyHomeSpaceRef = Repository.getCompanyRoot(FacesContext.getCurrentInstance()); - } - - return this.companyHomeSpaceRef; - } - - private NodeRef getDefaultHomeSpace() - { - if ((this.defaultHomeSpaceRef == null) || !nodeService.exists(this.defaultHomeSpaceRef)) - { - String defaultHomeSpacePath = Application.getClientConfig(FacesContext.getCurrentInstance()).getDefaultHomeSpacePath(); - - NodeRef rootNodeRef = this.nodeService.getRootNode(Repository.getStoreRef()); - List nodes = this.searchService.selectNodes(rootNodeRef, defaultHomeSpacePath, null, this.namespaceService, - false); - - if (nodes.size() == 0) - { - return getCompanyHomeSpace(); - } - - this.defaultHomeSpaceRef = nodes.get(0); - } - - return this.defaultHomeSpaceRef; - } - - - - /** - * Create the specified home space if it does not exist, and return the ID - * - * @param locationId - * Parent location - * @param spaceName - * Home space to create, can be null to simply return the parent - * @param error - * True to throw an error if the space already exists, else - * ignore and return - * - * @return ID of the home space - */ - private NodeRef createHomeSpace(String locationId, String spaceName, boolean error) - { - NodeRef homeSpaceNodeRef = null; - if (spaceName != null && spaceName.length() != 0) - { - NodeRef parentRef = new NodeRef(Repository.getStoreRef(), locationId); - - // check for existance of home space with same name - return immediately - // if it exists or throw an exception an give user chance to enter another name - // TODO: this might be better replaced with an XPath query! - List children = this.nodeService.getChildAssocs(parentRef); - for (ChildAssociationRef ref : children) - { - String childNodeName = (String) this.nodeService.getProperty(ref.getChildRef(), ContentModel.PROP_NAME); - if (spaceName.equals(childNodeName)) - { - if (error) - { - throw new AlfrescoRuntimeException("A Home Space with the same name already exists."); - } - else - { - return ref.getChildRef(); - } - } - } - - // space does not exist already, create a new Space under it with - // the specified name - String qname = QName.createValidLocalName(spaceName); - ChildAssociationRef assocRef = this.nodeService.createNode(parentRef, ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, qname), ContentModel.TYPE_FOLDER); - - NodeRef nodeRef = assocRef.getChildRef(); - - // set the name property on the node - this.nodeService.setProperty(nodeRef, ContentModel.PROP_NAME, spaceName); - - if (logger.isDebugEnabled()) logger.debug("Created Home Space for with name: " + spaceName); - - // apply the uifacets aspect - icon, title and description props - Map uiFacetsProps = new HashMap(3); - uiFacetsProps.put(ApplicationModel.PROP_ICON, CreateSpaceWizard.DEFAULT_SPACE_ICON_NAME); - uiFacetsProps.put(ContentModel.PROP_TITLE, spaceName); - this.nodeService.addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, uiFacetsProps); - - setupHomeSpacePermissions(nodeRef); - - // return the ID of the created space - homeSpaceNodeRef = nodeRef; - } - - return homeSpaceNodeRef; - } - - /** - * Setup the default permissions for this and other users on the Home Space - * - * @param homeSpaceRef Home Space reference - */ - private void setupHomeSpacePermissions(NodeRef homeSpaceRef) - { - // Admin Authority has full permissions by default (automatic - set in the permission config) - // give full permissions to the new user - this.permissionService.setPermission(homeSpaceRef, this.userName, permissionService.getAllPermission(), true); - - // by default other users will only have GUEST access to the space contents - // or whatever is configured as the default in the web-client-xml config - String permission = getDefaultPermission(); - if (permission != null && permission.length() != 0) - { - this.permissionService.setPermission(homeSpaceRef, permissionService.getAllAuthorities(), permission, true); - } - - // the new user is the OWNER of their own space and always has full permissions - this.ownableService.setOwner(homeSpaceRef, this.userName); - this.permissionService.setPermission(homeSpaceRef, permissionService.getOwnerAuthority(), permissionService.getAllPermission(), true); - - // now detach (if we did this first we could not set any permissions!) - this.permissionService.setInheritParentPermissions(homeSpaceRef, false); - } - - /** - * @return default permission string to set for other users for a new Home Space - */ - private String getDefaultPermission() - { - ClientConfigElement config = Application.getClientConfig(FacesContext.getCurrentInstance()); - return config.getHomeSpacePermission(); - } - - private void invalidateUserList() - { - UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); - } -} +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean.wizard; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.Serializable; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.ResourceBundle; + +import javax.faces.application.FacesMessage; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.event.ActionEvent; +import javax.faces.validator.ValidatorException; +import javax.transaction.UserTransaction; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ApplicationModel; +import org.alfresco.model.ContentModel; +import org.alfresco.repo.security.authentication.AuthenticationException; +import org.alfresco.repo.tenant.TenantService; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.InvalidNodeRefException; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AuthenticationService; +import org.alfresco.service.cmr.security.OwnableService; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.service.cmr.security.PersonService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.web.app.Application; +import org.alfresco.web.app.context.UIContextService; +import org.alfresco.web.bean.repository.Node; +import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.bean.spaces.CreateSpaceWizard; +import org.alfresco.web.bean.users.UsersDialog; +import org.alfresco.web.config.ClientConfigElement; +import org.alfresco.web.ui.common.Utils; +import org.alfresco.web.ui.common.component.UIActionLink; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author Kevin Roast + */ +public class NewUserWizard extends AbstractWizardBean +{ + private static final long serialVersionUID = -4608152661068880638L; + + private static Log logger = LogFactory.getLog(NewUserWizard.class); + + private static final String WIZARD_TITLE_NEW_ID = "new_user_title"; + private static final String WIZARD_DESC_NEW_ID = "new_user_desc"; + private static final String WIZARD_TITLE_EDIT_ID = "new_user_title_edit"; + private static final String WIZARD_DESC_EDIT_ID = "new_user_desc_edit"; + private static final String STEP1_TITLE_ID = "new_user_step1_title"; + private static final String STEP1_DESCRIPTION_ID = "new_user_step1_desc"; + private static final String STEP2_TITLE_ID = "new_user_step2_title"; + private static final String STEP2_DESCRIPTION_ID = "new_user_step2_desc"; + private static final String FINISH_INSTRUCTION_ID = "new_user_finish_instruction"; + private static final String ERROR = "error_person"; + + /** form variables */ + private String firstName = null; + private String lastName = null; + private String userName = null; + private String password = null; + private String confirm = null; + private String email = null; + private String companyId = null; + private String homeSpaceName = ""; + private NodeRef homeSpaceLocation = null; + + /** AuthenticationService bean reference */ + transient private AuthenticationService authenticationService; + + /** NamespaceService bean reference */ + transient private NamespaceService namespaceService; + + /** PermissionService bean reference */ + transient private PermissionService permissionService; + + /** PersonService bean reference */ + transient private PersonService personService; + + /** TenantService bean reference */ + private TenantService tenantService; + + /** OwnableService bean reference */ + transient private OwnableService ownableService; + + /** action context */ + private Node person = null; + + /** ref to the company home space folder */ + private NodeRef companyHomeSpaceRef = null; + + /** ref to the default home location */ + private NodeRef defaultHomeSpaceRef; + + + /** + * @param authenticationService The AuthenticationService to set. + */ + public void setAuthenticationService(AuthenticationService authenticationService) + { + this.authenticationService = authenticationService; + } + + private AuthenticationService getAuthenticationService() + { + if (authenticationService == null) + { + authenticationService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAuthenticationService(); + } + return authenticationService; + } + + /** + * @param namespaceService The namespaceService to set. + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + private NamespaceService getNamespaceService() + { + if (namespaceService == null) + { + namespaceService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNamespaceService(); + } + return namespaceService; + } + + /** + * @param permissionService The PermissionService to set. + */ + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + + private PermissionService getPermissionService() + { + if (permissionService == null) + { + permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService(); + } + return permissionService; + } + + /** + * @param personService The person service. + */ + public void setPersonService(PersonService personService) + { + this.personService = personService; + } + + private PersonService getPersonService() + { + if (personService == null) + { + personService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPersonService(); + } + return personService; + } + + /** + * @param ownableService The ownableService to set. + */ + public void setOwnableService(OwnableService ownableService) + { + this.ownableService = ownableService; + } + + private OwnableService getOwnableService() + { + if (ownableService == null) + { + ownableService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getOwnableService(); + } + return ownableService; + } + + /** + * @param tenantService The tenantService to set. + */ + public void setTenantService(TenantService tenantService) + { + this.tenantService = tenantService; + } + + /** + * Initialises the wizard + */ + public void init() + { + super.init(); + + // reset all variables + this.firstName = ""; + this.lastName = ""; + this.userName = ""; + this.password = ""; + this.confirm = ""; + this.email = ""; + this.companyId = ""; + this.homeSpaceName = ""; + this.homeSpaceLocation = getDefaultHomeSpace(); + } + + /** + * @see org.alfresco.web.bean.wizard.AbstractWizardBean#populate() + */ + public void populate() + { + // set values for edit mode + Map props = getPerson().getProperties(); + + this.firstName = (String) props.get("firstName"); + this.lastName = (String) props.get("lastName"); + this.userName = (String) props.get("userName"); + this.password = ""; + this.confirm = ""; + this.email = (String) props.get("email"); + this.companyId = (String) props.get("organizationId"); + + // calculate home space name and parent space Id from homeFolderId + this.homeSpaceLocation = null; // default to Company root space + this.homeSpaceName = ""; // default to none set below root + NodeRef homeFolderRef = (NodeRef) props.get("homeFolder"); + if (this.getNodeService().exists(homeFolderRef) == true) + { + ChildAssociationRef childAssocRef = this.getNodeService().getPrimaryParent(homeFolderRef); + NodeRef parentRef = childAssocRef.getParentRef(); + if (this.getNodeService().getRootNode(Repository.getStoreRef()).equals(parentRef) == false) + { + this.homeSpaceLocation = parentRef; + this.homeSpaceName = Repository.getNameForNode(getNodeService(), homeFolderRef); + } + else + { + this.homeSpaceLocation = homeFolderRef; + } + } + + if (logger.isDebugEnabled()) + logger.debug("Edit user home space location: " + homeSpaceLocation + " home space name: " + homeSpaceName); + } + + /** + * @see org.alfresco.web.bean.wizard.AbstractWizardBean#getWizardDescription() + */ + public String getWizardDescription() + { + if (this.editMode) + { + return Application.getMessage(FacesContext.getCurrentInstance(), WIZARD_DESC_EDIT_ID); + } + else + { + return Application.getMessage(FacesContext.getCurrentInstance(), WIZARD_DESC_NEW_ID); + } + } + + /** + * @see org.alfresco.web.bean.wizard.AbstractWizardBean#getWizardTitle() + */ + public String getWizardTitle() + { + if (this.editMode) + { + return Application.getMessage(FacesContext.getCurrentInstance(), WIZARD_TITLE_EDIT_ID); + } + else + { + return Application.getMessage(FacesContext.getCurrentInstance(), WIZARD_TITLE_NEW_ID); + } + } + + /** + * @see org.alfresco.web.bean.wizard.AbstractWizardBean#getStepTitle() + */ + public String getStepTitle() + { + String stepTitle = null; + + switch (this.currentStep) + { + case 1: + { + stepTitle = Application.getMessage(FacesContext.getCurrentInstance(), STEP1_TITLE_ID); + break; + } + case 2: + { + stepTitle = Application.getMessage(FacesContext.getCurrentInstance(), STEP2_TITLE_ID); + break; + } + case 3: + { + stepTitle = Application.getMessage(FacesContext.getCurrentInstance(), SUMMARY_TITLE_ID); + break; + } + default: + { + stepTitle = ""; + } + } + + return stepTitle; + } + + /** + * @see org.alfresco.web.bean.wizard.AbstractWizardBean#getStepDescription() + */ + public String getStepDescription() + { + String stepDesc = null; + + switch (this.currentStep) + { + case 1: + { + stepDesc = Application.getMessage(FacesContext.getCurrentInstance(), STEP1_DESCRIPTION_ID); + break; + } + case 2: + { + stepDesc = Application.getMessage(FacesContext.getCurrentInstance(), STEP2_DESCRIPTION_ID); + break; + } + case 3: + { + stepDesc = Application.getMessage(FacesContext.getCurrentInstance(), SUMMARY_DESCRIPTION_ID); + break; + } + default: + { + stepDesc = ""; + } + } + + return stepDesc; + } + + /** + * @see org.alfresco.web.bean.wizard.AbstractWizardBean#getStepInstructions() + */ + public String getStepInstructions() + { + String stepInstruction = null; + + switch (this.currentStep) + { + case 3: + { + stepInstruction = Application.getMessage(FacesContext.getCurrentInstance(), FINISH_INSTRUCTION_ID); + break; + } + default: + { + stepInstruction = Application.getMessage(FacesContext.getCurrentInstance(), DEFAULT_INSTRUCTION_ID); + } + } + + return stepInstruction; + } + + /** + * @see org.alfresco.web.bean.wizard.AbstractWizardBean#determineOutcomeForStep(int) + */ + protected String determineOutcomeForStep(int step) + { + String outcome = null; + + switch (step) + { + case 1: + { + outcome = "person-properties"; + break; + } + case 2: + { + outcome = "user-properties"; + break; + } + case 3: + { + outcome = "summary"; + break; + } + default: + { + outcome = CANCEL_OUTCOME; + } + } + + return outcome; + } + + /** + * @see org.alfresco.web.bean.wizard.AbstractWizardBean#finish() + */ + public String finish() + { + String outcome = FINISH_OUTCOME; + + // TODO: implement create new Person object from specified details + UserTransaction tx = null; + + try + { + FacesContext context = FacesContext.getCurrentInstance(); + tx = Repository.getUserTransaction(context); + tx.begin(); + + if (this.editMode) + { + // update the existing node in the repository + NodeRef nodeRef = getPerson().getNodeRef(); + + Map props = this.getNodeService().getProperties(nodeRef); + props.put(ContentModel.PROP_USERNAME, this.userName); + props.put(ContentModel.PROP_FIRSTNAME, this.firstName); + props.put(ContentModel.PROP_LASTNAME, this.lastName); + + // calculate whether we need to move the old home space or create new + NodeRef newHomeFolderRef; + NodeRef oldHomeFolderRef = (NodeRef)this.getNodeService().getProperty(nodeRef, ContentModel.PROP_HOMEFOLDER); + boolean moveHomeSpace = false; + boolean renameHomeSpace = false; + if (oldHomeFolderRef != null && this.getNodeService().exists(oldHomeFolderRef) == true) + { + // the original home folder ref exists so may need moving if it has been changed + ChildAssociationRef childAssocRef = this.getNodeService().getPrimaryParent(oldHomeFolderRef); + NodeRef currentHomeSpaceLocation = childAssocRef.getParentRef(); + if (this.homeSpaceName.length() != 0) + { + if (currentHomeSpaceLocation.equals(this.homeSpaceLocation) == false && + oldHomeFolderRef.equals(this.homeSpaceLocation) == false && + currentHomeSpaceLocation.equals(getCompanyHomeSpace()) == false && + currentHomeSpaceLocation.equals(getDefaultHomeSpace()) == false) + { + moveHomeSpace = true; + } + + String oldHomeSpaceName = Repository.getNameForNode(getNodeService(), oldHomeFolderRef); + if (oldHomeSpaceName.equals(this.homeSpaceName) == false && + oldHomeFolderRef.equals(this.homeSpaceLocation) == false && + oldHomeFolderRef.equals(this.defaultHomeSpaceRef) == false) + { + renameHomeSpace = true; + } + } + } + + if (logger.isDebugEnabled()) + logger.debug("Moving space: " + moveHomeSpace + " and renaming space: " + renameHomeSpace); + + if (moveHomeSpace == false && renameHomeSpace == false) + { + if (this.homeSpaceLocation != null && this.homeSpaceName.length() != 0) + { + newHomeFolderRef = createHomeSpace(this.homeSpaceLocation.getId(), this.homeSpaceName, false); + } + else if (this.homeSpaceLocation != null) + { + // location selected but no home space name entered, + // so the home ref should be set to the newly selected space + newHomeFolderRef = this.homeSpaceLocation; + + // set the permissions for this space so the user can access it + + } + else + { + // nothing selected - use Company Home by default + newHomeFolderRef = getCompanyHomeSpace(); + } + } + else + { + // either move, rename or both required + if (moveHomeSpace == true) + { + this.getNodeService().moveNode( + oldHomeFolderRef, + this.homeSpaceLocation, + ContentModel.ASSOC_CONTAINS, + this.getNodeService().getPrimaryParent(oldHomeFolderRef).getQName()); + } + newHomeFolderRef = oldHomeFolderRef; // ref ID doesn't change + + if (renameHomeSpace == true) + { + // change HomeSpace node name + this.getNodeService().setProperty(newHomeFolderRef, ContentModel.PROP_NAME, this.homeSpaceName); + } + } + + props.put(ContentModel.PROP_HOMEFOLDER, newHomeFolderRef); + props.put(ContentModel.PROP_EMAIL, this.email); + props.put(ContentModel.PROP_ORGID, this.companyId); + this.getNodeService().setProperties(nodeRef, props); + + // TODO: RESET HomeSpace Ref found in top-level navigation bar! + // NOTE: not need cos only admin can do this? + } + else + { + if (tenantService.isEnabled()) + { + String currentDomain = tenantService.getCurrentUserDomain(); + if (! currentDomain.equals(TenantService.DEFAULT_DOMAIN)) + { + if (! tenantService.isTenantUser(this.userName)) + { + // force domain onto the end of the username + this.userName = tenantService.getDomainUser(this.userName, currentDomain); + logger.warn("Added domain to username: " + this.userName); + } + else + { + try + { + tenantService.checkDomainUser(this.userName); + } + catch (RuntimeException re) + { + throw new AuthenticationException("User must belong to same domain as admin: " + currentDomain); + } + } + } + } + + if (this.password.equals(this.confirm)) + { + // create properties for Person type from submitted Form data + Map props = new HashMap(7, 1.0f); + props.put(ContentModel.PROP_USERNAME, this.userName); + props.put(ContentModel.PROP_FIRSTNAME, this.firstName); + props.put(ContentModel.PROP_LASTNAME, this.lastName); + NodeRef homeSpaceNodeRef; + if (this.homeSpaceLocation != null && this.homeSpaceName.length() != 0) + { + // create new + homeSpaceNodeRef = createHomeSpace(this.homeSpaceLocation.getId(), this.homeSpaceName, true); + } + else if (this.homeSpaceLocation != null) + { + // set to existing + homeSpaceNodeRef = homeSpaceLocation; + setupHomeSpacePermissions(homeSpaceNodeRef); + } + else + { + // default to Company Home + homeSpaceNodeRef = getCompanyHomeSpace(); + } + props.put(ContentModel.PROP_HOMEFOLDER, homeSpaceNodeRef); + props.put(ContentModel.PROP_EMAIL, this.email); + props.put(ContentModel.PROP_ORGID, this.companyId); + + // create the node to represent the Person + NodeRef newPerson = this.getPersonService().createPerson(props); + + // ensure the user can access their own Person object + this.getPermissionService().setPermission(newPerson, this.userName, getPermissionService().getAllPermission(), true); + + if (logger.isDebugEnabled()) logger.debug("Created Person node for username: " + this.userName); + + // create the ACEGI Authentication instance for the new user + this.getAuthenticationService().createAuthentication(this.userName, this.password.toCharArray()); + + if (logger.isDebugEnabled()) logger.debug("Created User Authentication instance for username: " + this.userName); + } + else + { + outcome = null; + Utils.addErrorMessage(Application.getMessage(context, UsersDialog.ERROR_PASSWORD_MATCH)); + } + } + + // commit the transaction + tx.commit(); + + // reset the richlist component so it rebinds to the users list + invalidateUserList(); + } + catch (Throwable e) + { + // rollback the transaction + try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} + Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), ERROR), e + .getMessage()), e); + outcome = null; + } + + return outcome; + } + + /** + * @return Returns the summary data for the wizard. + */ + public String getSummary() + { + String homeSpaceLabel = this.homeSpaceName; + if (this.homeSpaceName.length() == 0 && this.homeSpaceLocation != null) + { + homeSpaceLabel = Repository.getNameForNode(this.getNodeService(), this.homeSpaceLocation); + } + + ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); + + return buildSummary(new String[] { bundle.getString("name"), bundle.getString("username"), + bundle.getString("password"), bundle.getString("homespace") }, new String[] { + this.firstName + " " + this.lastName, this.userName, "********", homeSpaceLabel }); + } + + /** + * Init the users screen + */ + public void setupUsers(ActionEvent event) + { + invalidateUserList(); + } + + /** + * Action listener called when the wizard is being launched for editing an + * existing node. + */ + public void startWizardForEdit(ActionEvent event) + { + UIActionLink link = (UIActionLink) event.getComponent(); + Map params = link.getParameterMap(); + String id = params.get("id"); + if (id != null && id.length() != 0) + { + try + { + // create the node ref, then our node representation + NodeRef ref = new NodeRef(Repository.getStoreRef(), id); + Node node = new Node(ref); + + // remember the Person node + setPerson(node); + + // set the wizard in edit mode + this.editMode = true; + + // populate the wizard's default values with the current value + // from the node being edited + init(); + populate(); + + // clear the UI state in preparation for finishing the action + // and returning to the main page + invalidateUserList(); + + if (logger.isDebugEnabled()) logger.debug("Started wizard : " + getWizardTitle() + " for editing"); + } + catch (InvalidNodeRefException refErr) + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), + Repository.ERROR_NODEREF), new Object[] { id })); + } + } + else + { + setPerson(null); + } + } + + /** + * @return Returns the companyId. + */ + public String getCompanyId() + { + return this.companyId; + } + + /** + * @param companyId + * The companyId to set. + */ + public void setCompanyId(String companyId) + { + this.companyId = companyId; + } + + /** + * @return Returns the email. + */ + public String getEmail() + { + return this.email; + } + + /** + * @param email + * The email to set. + */ + public void setEmail(String email) + { + this.email = email; + } + + /** + * @return Returns the firstName. + */ + public String getFirstName() + { + return this.firstName; + } + + /** + * @param firstName The firstName to set. + */ + public void setFirstName(String firstName) + { + this.firstName = firstName; + } + + /** + * @return Returns the homeSpaceLocation. + */ + public NodeRef getHomeSpaceLocation() + { + return this.homeSpaceLocation; + } + + /** + * @param homeSpaceLocation The homeSpaceLocation to set. + */ + public void setHomeSpaceLocation(NodeRef homeSpaceLocation) + { + this.homeSpaceLocation = homeSpaceLocation; + } + + /** + * @return Returns the homeSpaceName. + */ + public String getHomeSpaceName() + { + return this.homeSpaceName; + } + + /** + * @param homeSpaceName The homeSpaceName to set. + */ + public void setHomeSpaceName(String homeSpaceName) + { + this.homeSpaceName = homeSpaceName; + } + + /** + * @return Returns the lastName. + */ + public String getLastName() + { + return this.lastName; + } + + /** + * @param lastName The lastName to set. + */ + public void setLastName(String lastName) + { + this.lastName = lastName; + } + + /** + * @return Returns the userName. + */ + public String getUserName() + { + return this.userName; + } + + /** + * @param userName The userName to set. + */ + public void setUserName(String userName) + { + this.userName = userName; + } + + /** + * @return Returns the password. + */ + public String getPassword() + { + return this.password; + } + + /** + * @param password The password to set. + */ + public void setPassword(String password) + { + this.password = password; + } + + /** + * @return Returns the confirm password. + */ + public String getConfirm() + { + return this.confirm; + } + + /** + * @param confirm The confirm password to set. + */ + public void setConfirm(String confirm) + { + this.confirm = confirm; + } + + /** + * @return Returns the person context. + */ + public Node getPerson() + { + return this.person; + } + + /** + * @param person The person context to set. + */ + public void setPerson(Node person) + { + this.person = person; + } + + public boolean getEditMode() + { + return this.editMode; + } + + + // ------------------------------------------------------------------------------ + // Validator methods + + /** + * Validate password field data is acceptable + */ + public void validatePassword(FacesContext context, UIComponent component, Object value) throws ValidatorException + { + String pass = (String) value; + if (pass.length() < 5 || pass.length() > 12) + { + String err = "Password must be between 5 and 12 characters in length."; + throw new ValidatorException(new FacesMessage(err)); + } + + for (int i = 0; i < pass.length(); i++) + { + if (Character.isLetterOrDigit(pass.charAt(i)) == false) + { + String err = "Password can only contain characters or digits."; + throw new ValidatorException(new FacesMessage(err)); + } + } + } + + /** + * Validate Username field data is acceptable + */ + public void validateUsername(FacesContext context, UIComponent component, Object value) throws ValidatorException + { + String pass = (String) value; + if (pass.length() < 5 || pass.length() > 12) + { + String err = "Username must be between 5 and 12 characters in length."; + throw new ValidatorException(new FacesMessage(err)); + } + + for (int i = 0; i < pass.length(); i++) + { + if (Character.isLetterOrDigit(pass.charAt(i)) == false) + { + String err = "Username can only contain characters or digits."; + throw new ValidatorException(new FacesMessage(err)); + } + } + } + + + // ------------------------------------------------------------------------------ + // Helper methods + + /** + * Helper to return the company home space + * + * @return company home space NodeRef + */ + private NodeRef getCompanyHomeSpace() + { + if (this.companyHomeSpaceRef == null) + { + this.companyHomeSpaceRef = Repository.getCompanyRoot(FacesContext.getCurrentInstance()); + } + + return this.companyHomeSpaceRef; + } + + private NodeRef getDefaultHomeSpace() + { + if ((this.defaultHomeSpaceRef == null) || !getNodeService().exists(this.defaultHomeSpaceRef)) + { + String defaultHomeSpacePath = Application.getClientConfig(FacesContext.getCurrentInstance()).getDefaultHomeSpacePath(); + + NodeRef rootNodeRef = this.getNodeService().getRootNode(Repository.getStoreRef()); + List nodes = this.getSearchService().selectNodes(rootNodeRef, defaultHomeSpacePath, null, this.getNamespaceService(), + false); + + if (nodes.size() == 0) + { + return getCompanyHomeSpace(); + } + + this.defaultHomeSpaceRef = nodes.get(0); + } + + return this.defaultHomeSpaceRef; + } + + + + /** + * Create the specified home space if it does not exist, and return the ID + * + * @param locationId + * Parent location + * @param spaceName + * Home space to create, can be null to simply return the parent + * @param error + * True to throw an error if the space already exists, else + * ignore and return + * + * @return ID of the home space + */ + private NodeRef createHomeSpace(String locationId, String spaceName, boolean error) + { + NodeRef homeSpaceNodeRef = null; + if (spaceName != null && spaceName.length() != 0) + { + NodeRef parentRef = new NodeRef(Repository.getStoreRef(), locationId); + + // check for existance of home space with same name - return immediately + // if it exists or throw an exception an give user chance to enter another name + // TODO: this might be better replaced with an XPath query! + List children = this.getNodeService().getChildAssocs(parentRef); + for (ChildAssociationRef ref : children) + { + String childNodeName = (String) this.getNodeService().getProperty(ref.getChildRef(), ContentModel.PROP_NAME); + if (spaceName.equals(childNodeName)) + { + if (error) + { + throw new AlfrescoRuntimeException("A Home Space with the same name already exists."); + } + else + { + return ref.getChildRef(); + } + } + } + + // space does not exist already, create a new Space under it with + // the specified name + String qname = QName.createValidLocalName(spaceName); + ChildAssociationRef assocRef = this.getNodeService().createNode(parentRef, ContentModel.ASSOC_CONTAINS, + QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, qname), ContentModel.TYPE_FOLDER); + + NodeRef nodeRef = assocRef.getChildRef(); + + // set the name property on the node + this.getNodeService().setProperty(nodeRef, ContentModel.PROP_NAME, spaceName); + + if (logger.isDebugEnabled()) logger.debug("Created Home Space for with name: " + spaceName); + + // apply the uifacets aspect - icon, title and description props + Map uiFacetsProps = new HashMap(3); + uiFacetsProps.put(ApplicationModel.PROP_ICON, CreateSpaceWizard.DEFAULT_SPACE_ICON_NAME); + uiFacetsProps.put(ContentModel.PROP_TITLE, spaceName); + this.getNodeService().addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, uiFacetsProps); + + setupHomeSpacePermissions(nodeRef); + + // return the ID of the created space + homeSpaceNodeRef = nodeRef; + } + + return homeSpaceNodeRef; + } + + /** + * Setup the default permissions for this and other users on the Home Space + * + * @param homeSpaceRef Home Space reference + */ + private void setupHomeSpacePermissions(NodeRef homeSpaceRef) + { + // Admin Authority has full permissions by default (automatic - set in the permission config) + // give full permissions to the new user + this.getPermissionService().setPermission(homeSpaceRef, this.userName, getPermissionService().getAllPermission(), true); + + // by default other users will only have GUEST access to the space contents + // or whatever is configured as the default in the web-client-xml config + String permission = getDefaultPermission(); + if (permission != null && permission.length() != 0) + { + this.getPermissionService().setPermission(homeSpaceRef, getPermissionService().getAllAuthorities(), permission, true); + } + + // the new user is the OWNER of their own space and always has full permissions + this.getOwnableService().setOwner(homeSpaceRef, this.userName); + this.getPermissionService().setPermission(homeSpaceRef, getPermissionService().getOwnerAuthority(), getPermissionService().getAllPermission(), true); + + // now detach (if we did this first we could not set any permissions!) + this.getPermissionService().setInheritParentPermissions(homeSpaceRef, false); + } + + /** + * @return default permission string to set for other users for a new Home Space + */ + private String getDefaultPermission() + { + ClientConfigElement config = Application.getClientConfig(FacesContext.getCurrentInstance()); + return config.getHomeSpacePermission(); + } + + private void invalidateUserList() + { + UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); + } + +} diff --git a/source/java/org/alfresco/web/bean/wizard/WizardManager.java b/source/java/org/alfresco/web/bean/wizard/WizardManager.java index 838dde8f87..6117b3eb67 100644 --- a/source/java/org/alfresco/web/bean/wizard/WizardManager.java +++ b/source/java/org/alfresco/web/bean/wizard/WizardManager.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.bean.wizard; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -50,8 +51,10 @@ import org.apache.commons.logging.LogFactory; * * @author gavinc */ -public final class WizardManager +public final class WizardManager implements Serializable { + private static final long serialVersionUID = -5029787339914973070L; + /** public JSF bean name */ public final static String BEAN_NAME = "WizardManager"; diff --git a/source/java/org/alfresco/web/bean/wizard/WizardState.java b/source/java/org/alfresco/web/bean/wizard/WizardState.java index 2208c34914..59d9322eb4 100644 --- a/source/java/org/alfresco/web/bean/wizard/WizardState.java +++ b/source/java/org/alfresco/web/bean/wizard/WizardState.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.bean.wizard; +import java.io.Serializable; import java.util.List; import org.alfresco.web.app.AlfrescoNavigationHandler; @@ -36,8 +37,10 @@ import org.alfresco.web.config.WizardsConfigElement.WizardConfig; * * @author gavinc */ -public final class WizardState +public final class WizardState implements Serializable { + private static final long serialVersionUID = -6816474382767569256L; + private int currentStep = 1; private PageConfig currentPageCfg; private WizardConfig config; diff --git a/source/java/org/alfresco/web/bean/workflow/CancelWorkflowDialog.java b/source/java/org/alfresco/web/bean/workflow/CancelWorkflowDialog.java index 1744502336..1f6415dba5 100644 --- a/source/java/org/alfresco/web/bean/workflow/CancelWorkflowDialog.java +++ b/source/java/org/alfresco/web/bean/workflow/CancelWorkflowDialog.java @@ -33,6 +33,7 @@ import org.alfresco.service.cmr.workflow.WorkflowInstance; 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.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -43,8 +44,10 @@ import org.apache.commons.logging.LogFactory; */ public class CancelWorkflowDialog extends BaseDialogBean { - protected WorkflowInstance workflowInstance; - protected WorkflowService workflowService; + private static final long serialVersionUID = -7875582893750792200L; + + transient private WorkflowInstance workflowInstance; + transient private WorkflowService workflowService; private static final Log logger = LogFactory.getLog(CancelWorkflowDialog.class); @@ -63,7 +66,7 @@ public class CancelWorkflowDialog extends BaseDialogBean throw new IllegalArgumentException("Cancel workflow dialog called without workflow instance id"); } - this.workflowInstance = workflowService.getWorkflowById(workflowInstanceId); + this.workflowInstance = getWorkflowService().getWorkflowById(workflowInstanceId); if (this.workflowInstance == null) { throw new IllegalArgumentException("Failed to find workflow instance for id: " + workflowInstanceId); @@ -75,13 +78,13 @@ public class CancelWorkflowDialog extends BaseDialogBean throws Exception { if (logger.isDebugEnabled()) - logger.debug("Cancelling workflow with id: " + this.workflowInstance.id); + logger.debug("Cancelling workflow with id: " + this.getWorkflowInstance().id); // cancel the workflow - this.workflowService.cancelWorkflow(this.workflowInstance.id); + this.getWorkflowService().cancelWorkflow(this.getWorkflowInstance().id); if (logger.isDebugEnabled()) - logger.debug("Cancelled workflow with id: " + this.workflowInstance.id); + logger.debug("Cancelled workflow with id: " + this.getWorkflowInstance().id); return outcome; } @@ -123,10 +126,10 @@ public class CancelWorkflowDialog extends BaseDialogBean String confirmMsg = Application.getMessage(FacesContext.getCurrentInstance(), "cancel_workflow_confirm"); - String workflowLabel = this.workflowInstance.definition.title; - if (this.workflowInstance.description != null && this.workflowInstance.description.length() > 0) + String workflowLabel = this.getWorkflowInstance().definition.title; + if (this.getWorkflowInstance().description != null && this.getWorkflowInstance().description.length() > 0) { - workflowLabel = workflowLabel + " (" + this.workflowInstance.description + ")"; + workflowLabel = workflowLabel + " (" + this.getWorkflowInstance().description + ")"; } return MessageFormat.format(confirmMsg, new Object[] {workflowLabel}); @@ -139,6 +142,10 @@ public class CancelWorkflowDialog extends BaseDialogBean */ public WorkflowService getWorkflowService() { + if (workflowService == null) + { + workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService(); + } return workflowService; } @@ -151,4 +158,24 @@ public class CancelWorkflowDialog extends BaseDialogBean { this.workflowService = workflowService; } + + protected WorkflowInstance getWorkflowInstance() + { + if (workflowInstance == null) + { + String workflowInstanceId = this.parameters.get("workflow-instance-id"); + if (workflowInstanceId == null || workflowInstanceId.length() == 0) + { + throw new IllegalArgumentException("Cancel workflow dialog called without workflow instance id"); + } + + this.workflowInstance = getWorkflowService().getWorkflowById(workflowInstanceId); + if (this.workflowInstance == null) + { + throw new IllegalArgumentException("Failed to find workflow instance for id: " + workflowInstanceId); + } + } + return workflowInstance; + } + } diff --git a/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java b/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java index 3ecc74acfc..f95784648f 100644 --- a/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java +++ b/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java @@ -68,13 +68,10 @@ 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.bean.wcm.AVMUtil; -import org.alfresco.web.bean.wcm.AVMWorkflowUtil; import org.alfresco.web.config.DialogsConfigElement.DialogButtonConfig; import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.component.UIActionLink; 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; @@ -85,13 +82,15 @@ import org.apache.commons.logging.LogFactory; */ public class ManageTaskDialog extends BaseDialogBean { - protected WorkflowService workflowService; - protected AVMService avmService; - protected AVMSyncService avmSyncService; + private static final long serialVersionUID = -3209544870892993135L; + + transient private WorkflowService workflowService; + transient private AVMService avmService; + transient private AVMSyncService avmSyncService; protected Node taskNode; - protected WorkflowTask task; - protected WorkflowInstance workflowInstance; - protected WorkflowTransition[] transitions; + transient private WorkflowTask task; + transient private WorkflowInstance workflowInstance; + transient private WorkflowTransition[] transitions; protected NodeRef workflowPackage; protected List resources; protected TaskCompleteResolver completeResolver = new TaskCompleteResolver(); @@ -133,7 +132,7 @@ public class ManageTaskDialog extends BaseDialogBean // get the task details String taskId = this.parameters.get("id"); - this.task = this.workflowService.getTaskById(taskId); + this.task = this.getWorkflowService().getTaskById(taskId); if (this.task != null) { @@ -153,7 +152,7 @@ public class ManageTaskDialog extends BaseDialogBean LOGGER.debug("Task: " + this.task); LOGGER.debug("Trasient node: " + this.taskNode); Boolean isSystemPackage = (Boolean) - this.nodeService.getProperty(this.workflowPackage, + this.getNodeService().getProperty(this.workflowPackage, WorkflowModel.PROP_IS_SYSTEM_PACKAGE); LOGGER.debug("Workflow package: " + this.workflowPackage + " system package: " + isSystemPackage); @@ -180,7 +179,7 @@ public class ManageTaskDialog extends BaseDialogBean throws Exception { if (LOGGER.isDebugEnabled()) - LOGGER.debug("Saving task: " + this.task.id); + LOGGER.debug("Saving task: " + this.getWorkflowTask().id); // prepare the edited parameters for saving Map params = WorkflowUtil.prepareTaskParams(this.taskNode); @@ -190,7 +189,7 @@ public class ManageTaskDialog extends BaseDialogBean // update the task with the updated parameters and resources updateResources(); - this.workflowService.updateTask(this.task.id, params, null, null); + this.getWorkflowService().updateTask(this.getWorkflowTask().id, params, null, null); return outcome; } @@ -200,11 +199,11 @@ public class ManageTaskDialog extends BaseDialogBean { List buttons = null; - if (this.task != null) + if (this.getWorkflowTask() != null) { // get the transitions available from this task and // show them in the dialog as additional buttons - this.transitions = this.task.path.node.transitions; + this.transitions = this.getWorkflowTask().path.node.transitions; boolean isPooledTask = isPooledTask(); if (isPooledTask || this.transitions != null) @@ -256,13 +255,13 @@ public class ManageTaskDialog extends BaseDialogBean { String titleStart = Application.getMessage(FacesContext.getCurrentInstance(), "manage_task_title"); - return titleStart + ": " + this.task.title; + return titleStart + ": " + this.getWorkflowTask().title; } @Override public String getContainerDescription() { - return this.task.description; + return this.getWorkflowTask().description; } // ------------------------------------------------------------------------------ @@ -274,7 +273,7 @@ public class ManageTaskDialog extends BaseDialogBean String outcome = getDefaultFinishOutcome(); if (LOGGER.isDebugEnabled()) - LOGGER.debug("Taking ownership of task: " + this.task.id); + LOGGER.debug("Taking ownership of task: " + this.getWorkflowTask().id); FacesContext context = FacesContext.getCurrentInstance(); UserTransaction tx = null; @@ -292,7 +291,7 @@ public class ManageTaskDialog extends BaseDialogBean // update the task with the updated parameters and resources updateResources(); - this.workflowService.updateTask(this.task.id, params, null, null); + this.getWorkflowService().updateTask(this.getWorkflowTask().id, params, null, null); // commit the changes tx.commit(); @@ -314,7 +313,7 @@ public class ManageTaskDialog extends BaseDialogBean String outcome = getDefaultFinishOutcome(); if (LOGGER.isDebugEnabled()) - LOGGER.debug("Returning ownership of task to pool: " + this.task.id); + LOGGER.debug("Returning ownership of task to pool: " + this.getWorkflowTask().id); FacesContext context = FacesContext.getCurrentInstance(); UserTransaction tx = null; @@ -330,7 +329,7 @@ public class ManageTaskDialog extends BaseDialogBean // update the task with the updated parameters and resources updateResources(); - this.workflowService.updateTask(this.task.id, params, null, null); + this.getWorkflowService().updateTask(this.getWorkflowTask().id, params, null, null); // commit the changes tx.commit(); @@ -352,7 +351,7 @@ public class ManageTaskDialog extends BaseDialogBean String outcome = getDefaultFinishOutcome(); if (LOGGER.isDebugEnabled()) - LOGGER.debug("Transitioning task: " + this.task.id); + LOGGER.debug("Transitioning task: " + this.getWorkflowTask().id); // to find out which transition button was pressed we need // to look for the button's id in the request parameters, @@ -361,7 +360,7 @@ public class ManageTaskDialog extends BaseDialogBean Map reqParams = context.getExternalContext().getRequestParameterMap(); String selectedTransition = null; - for (WorkflowTransition trans : this.transitions) + for (WorkflowTransition trans : this.getWorkflowTransitions()) { Object result = reqParams.get(CLIENT_ID_PREFIX + FacesHelper.makeLegalId(trans.title)); if (result != null) @@ -387,10 +386,10 @@ public class ManageTaskDialog extends BaseDialogBean // update the task with the updated parameters and resources updateResources(); - this.workflowService.updateTask(this.task.id, params, null, null); + this.getWorkflowService().updateTask(this.getWorkflowTask().id, params, null, null); // signal the selected transition to the workflow task - this.workflowService.endTask(this.task.id, selectedTransition); + this.getWorkflowService().endTask(this.getWorkflowTask().id, selectedTransition); // commit the changes tx.commit(); @@ -601,6 +600,10 @@ public class ManageTaskDialog extends BaseDialogBean */ public WorkflowInstance getWorkflowInstance() { + if (workflowInstance == null) + { + workflowInstance = getWorkflowTask().path.instance; + } return this.workflowInstance; } @@ -611,7 +614,7 @@ public class ManageTaskDialog extends BaseDialogBean */ public String getWorkflowDefinitionImageUrl() { - return "/workflowdefinitionimage/" + this.workflowInstance.definition.id; + return "/workflowdefinitionimage/" + this.getWorkflowInstance().definition.id; } /** @@ -621,7 +624,7 @@ public class ManageTaskDialog extends BaseDialogBean */ public String getPackageActionGroup() { - return (String)this.task.properties.get( + return (String)this.getWorkflowTask().properties.get( WorkflowModel.PROP_PACKAGE_ACTION_GROUP); } @@ -632,7 +635,7 @@ public class ManageTaskDialog extends BaseDialogBean */ public String getPackageItemActionGroup() { - return (String)this.task.properties.get( + return (String)this.getWorkflowTask().properties.get( WorkflowModel.PROP_PACKAGE_ITEM_ACTION_GROUP); } @@ -657,16 +660,16 @@ public class ManageTaskDialog extends BaseDialogBean if (this.workflowPackage.getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM)) { - if (this.nodeService.exists(this.workflowPackage)) + if (this.getNodeService().exists(this.workflowPackage)) { final NodeRef stagingNodeRef = (NodeRef) - this.nodeService.getProperty(this.workflowPackage, + this.getNodeService().getProperty(this.workflowPackage, WCMModel.PROP_AVM_DIR_INDIRECTION); final String stagingAvmPath = AVMNodeConverter.ToAVMVersionPath(stagingNodeRef).getSecond(); final String packageAvmPath = AVMNodeConverter.ToAVMVersionPath(this.workflowPackage).getSecond(); if (LOGGER.isDebugEnabled()) LOGGER.debug("comparing " + packageAvmPath + " with " + stagingAvmPath); - for (AVMDifference d : this.avmSyncService.compare(-1, packageAvmPath, + for (AVMDifference d : this.getAvmSyncService().compare(-1, packageAvmPath, -1, stagingAvmPath, null)) { @@ -675,7 +678,7 @@ public class ManageTaskDialog extends BaseDialogBean if (d.getDifferenceCode() == AVMDifference.NEWER || d.getDifferenceCode() == AVMDifference.CONFLICT) { - this.addAVMNode(new AVMNode(this.avmService.lookup(d.getSourceVersion(), + this.addAVMNode(new AVMNode(this.getAvmService().lookup(d.getSourceVersion(), d.getSourcePath(), true))); } @@ -685,7 +688,7 @@ public class ManageTaskDialog extends BaseDialogBean else { // get existing workflow package items - List childRefs = this.nodeService.getChildAssocs( + List childRefs = this.getNodeService().getChildAssocs( this.workflowPackage, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); @@ -694,7 +697,7 @@ public class ManageTaskDialog extends BaseDialogBean // create our Node representation from the NodeRef NodeRef nodeRef = ref.getChildRef(); - if (!this.nodeService.exists(nodeRef)) + if (!this.getNodeService().exists(nodeRef)) { if (LOGGER.isDebugEnabled()) LOGGER.debug("Ignoring " + nodeRef + " as it has been removed from the repository"); @@ -702,10 +705,10 @@ public class ManageTaskDialog extends BaseDialogBean else { // find it's type so we can see if it's a node we are interested in - QName type = this.nodeService.getType(nodeRef); + QName type = this.getNodeService().getType(nodeRef); // make sure the type is defined in the data dictionary - TypeDefinition typeDef = this.dictionaryService.getType(type); + TypeDefinition typeDef = this.getDictionaryService().getType(type); if (typeDef == null) { @@ -717,7 +720,7 @@ public class ManageTaskDialog extends BaseDialogBean { // look for content nodes or links to content // NOTE: folders within workflow packages are ignored for now - if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT) || + 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 @@ -738,7 +741,7 @@ public class ManageTaskDialog extends BaseDialogBean for (String newItem : this.packageItemsToAdd) { NodeRef nodeRef = new NodeRef(newItem); - if (this.nodeService.exists(nodeRef)) + if (this.getNodeService().exists(nodeRef)) { // we know the type is correct as this was added as a result of a query // for all content items so just add the item to the resources list @@ -765,7 +768,7 @@ public class ManageTaskDialog extends BaseDialogBean } else if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Failed to find workflow package for task: " + this.task.id); + LOGGER.debug("Failed to find workflow package for task: " + this.getWorkflowTask().id); } return this.resources; @@ -782,6 +785,15 @@ public class ManageTaskDialog extends BaseDialogBean this.workflowService = workflowService; } + protected WorkflowService getWorkflowService() + { + if (workflowService == null) + { + workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService(); + } + return workflowService; + } + /** * Sets the avm service to use * @@ -792,6 +804,15 @@ public class ManageTaskDialog extends BaseDialogBean { this.avmService = avmService; } + + protected AVMService getAvmService() + { + if (avmService == null) + { + avmService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); + } + return avmService; + } /** * Sets the avm sync service to use @@ -804,12 +825,40 @@ public class ManageTaskDialog extends BaseDialogBean this.avmSyncService = avmSyncService; } + protected AVMSyncService getAvmSyncService() + { + if (avmSyncService == null) + { + avmSyncService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMSyncService(); + } + return avmSyncService; + } + + protected WorkflowTask getWorkflowTask() + { + if (task == null) + { + String taskId = this.parameters.get("id"); + task = this.getWorkflowService().getTaskById(taskId); + } + return task; + } + + protected WorkflowTransition[] getWorkflowTransitions() + { + if (transitions == null) + { + transitions = getWorkflowTask().path.node.transitions; + } + return transitions; + } + // ------------------------------------------------------------------------------ // Helper methods protected void addAVMNode(final AVMNode node) { - node.getProperties().put("taskId", this.task.id); + 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); @@ -822,7 +871,7 @@ public class ManageTaskDialog extends BaseDialogBean if (node.isDirectory() && !node.getDescriptor().isDeleted()) { for (final AVMNodeDescriptor d : - this.avmService.getDirectoryListingArray(node.getDescriptor(), true)) + this.getAvmService().getDirectoryListingArray(node.getDescriptor(), true)) { this.addAVMNode(new AVMNode(d)); } @@ -832,7 +881,7 @@ public class ManageTaskDialog extends BaseDialogBean protected void createAndAddNode(NodeRef nodeRef) { // create our Node representation - MapNode node = new MapNode(nodeRef, this.nodeService, true); + MapNode node = new MapNode(nodeRef, this.getNodeService(), true); this.browseBean.setupCommonBindingProperties(node); // add property resolvers to show path information @@ -843,7 +892,7 @@ public class ManageTaskDialog extends BaseDialogBean // node.addPropertyResolver("completed", this.completeResolver); // add the id of the task being managed - node.getProperties().put("taskId", this.task.id); + node.getProperties().put("taskId", this.getWorkflowTask().id); this.resources.add(node); } @@ -856,7 +905,7 @@ public class ManageTaskDialog extends BaseDialogBean { for (String removedItem : this.packageItemsToRemove) { - this.nodeService.removeChild(this.workflowPackage, new NodeRef(removedItem)); + this.getNodeService().removeChild(this.workflowPackage, new NodeRef(removedItem)); } } @@ -867,9 +916,9 @@ public class ManageTaskDialog extends BaseDialogBean for (String addedItem : this.packageItemsToAdd) { NodeRef addedNodeRef = new NodeRef(addedItem); - this.nodeService.addChild(this.workflowPackage, addedNodeRef, + this.getNodeService().addChild(this.workflowPackage, addedNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, - QName.createValidLocalName((String)this.nodeService.getProperty( + QName.createValidLocalName((String)this.getNodeService().getProperty( addedNodeRef, ContentModel.PROP_NAME)))); } } @@ -883,11 +932,13 @@ public class ManageTaskDialog extends BaseDialogBean */ protected class TaskCompleteResolver implements NodePropertyResolver { + private static final long serialVersionUID = 5862037943275638314L; + public Object get(Node node) { String result = Application.getMessage(FacesContext.getCurrentInstance(), "no"); - List completedItems = (List)task.properties.get( + List completedItems = (List)getWorkflowTask().properties.get( WorkflowModel.PROP_COMPLETED_ITEMS); if (completedItems != null && completedItems.size() > 0 && diff --git a/source/java/org/alfresco/web/bean/workflow/ReassignTaskDialog.java b/source/java/org/alfresco/web/bean/workflow/ReassignTaskDialog.java index f876ae45e3..55a902d9be 100644 --- a/source/java/org/alfresco/web/bean/workflow/ReassignTaskDialog.java +++ b/source/java/org/alfresco/web/bean/workflow/ReassignTaskDialog.java @@ -59,10 +59,12 @@ import org.apache.commons.logging.LogFactory; */ public class ReassignTaskDialog extends BaseDialogBean { + private static final long serialVersionUID = 5804171557325189475L; + protected String taskId; - protected WorkflowService workflowService; - protected PersonService personService; + transient private WorkflowService workflowService; + transient private PersonService personService; private static final Log logger = LogFactory.getLog(ReassignTaskDialog.class); @@ -100,7 +102,7 @@ public class ReassignTaskDialog extends BaseDialogBean String userName = user[0]; Map params = new HashMap(1); params.put(ContentModel.PROP_OWNER, userName); - this.workflowService.updateTask(this.taskId, params, null, null); + this.getWorkflowService().updateTask(this.taskId, params, null, null); } else { @@ -163,26 +165,26 @@ public class ReassignTaskDialog extends BaseDialogBean tx.begin(); // build xpath to match available User/Person objects - NodeRef peopleRef = personService.getPeopleContainer(); + NodeRef peopleRef = getPersonService().getPeopleContainer(); // NOTE: see SearcherComponentTest String xpath = "*[not(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + "userName='guest') and " + "(like(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + "firstName, '%" + contains + "%', false)" + " or " + "like(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + "lastName, '%" + contains + "%', false))]"; - List nodes = searchService.selectNodes( + List nodes = getSearchService().selectNodes( peopleRef, xpath, null, - this.namespaceService, + this.getNamespaceService(), false); items = new SelectItem[nodes.size()]; for (int index=0; index params = new HashMap(1); params.put(ContentModel.PROP_OWNER, userName); - this.workflowService.updateTask(this.workItemId, params, null, null); + this.getWorkflowService().updateTask(this.workItemId, params, null, null); } else { @@ -163,25 +165,25 @@ public class ReassignWorkItemDialog extends BaseDialogBean tx.begin(); // build xpath to match available User/Person objects - NodeRef peopleRef = personService.getPeopleContainer(); + NodeRef peopleRef = getPersonService().getPeopleContainer(); // NOTE: see SearcherComponentTest String xpath = "*[like(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + "firstName, '%" + contains + "%', false)" + " or " + "like(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + "lastName, '%" + contains + "%', false)]"; - List nodes = searchService.selectNodes( + List nodes = getSearchService().selectNodes( peopleRef, xpath, null, - this.namespaceService, + this.getNamespaceService(), false); items = new SelectItem[nodes.size()]; for (int index=0; index availableWorkflows; - protected Map workflows; + + transient protected List availableWorkflows; + transient private Map workflows; + protected Map wcmWorkflows; - protected WorkflowService workflowService; + + transient private WorkflowService workflowService; + protected Node startTaskNode; protected List resources; protected List packageItemsToAdd; @@ -87,7 +94,7 @@ public class StartWorkflowWizard extends BaseWizardBean protected boolean isItemBeingAdded = false; protected boolean nextButtonDisabled = false; - protected NodeService unprotectedNodeService; + transient private NodeService unprotectedNodeService; private static final Log logger = LogFactory.getLog(StartWorkflowWizard.class); @@ -96,9 +103,27 @@ public class StartWorkflowWizard extends BaseWizardBean this.unprotectedNodeService = unprotectedNodeService; } + protected NodeService getUnprotectedNodeService() + { + if (this.unprotectedNodeService == null) + { + this.unprotectedNodeService = (NodeService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "nodeService"); + } + return this.unprotectedNodeService; + } + + protected Map getWorkflows() + { + if (this.workflows == null) + { + initializeWorkflows(); + } + return this.workflows; + } + // ------------------------------------------------------------------------------ // Wizard implementation - + @Override public void init(Map parameters) { @@ -128,10 +153,10 @@ public class StartWorkflowWizard extends BaseWizardBean { // create the node ref for the item and determine its type NodeRef itemToWorkflow = new NodeRef(Repository.getStoreRef(), itemToWorkflowId); - QName type = this.nodeService.getType(itemToWorkflow); + QName type = this.getNodeService().getType(itemToWorkflow); - if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT) || - this.dictionaryService.isSubClass(type, ApplicationModel.TYPE_FILELINK)) + if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_CONTENT) || + this.getDictionaryService().isSubClass(type, ApplicationModel.TYPE_FILELINK)) { this.packageItemsToAdd.add(itemToWorkflow.toString()); } @@ -161,15 +186,15 @@ public class StartWorkflowWizard extends BaseWizardBean logger.debug("Starting workflow with parameters: " + params); // create a workflow package for the attached items and add them - NodeRef workflowPackage = this.workflowService.createPackage(null); + NodeRef workflowPackage = this.getWorkflowService().createPackage(null); params.put(WorkflowModel.ASSOC_PACKAGE, workflowPackage); for (String addedItem : this.packageItemsToAdd) { NodeRef addedNodeRef = new NodeRef(addedItem); - this.unprotectedNodeService.addChild(workflowPackage, addedNodeRef, + this.getUnprotectedNodeService().addChild(workflowPackage, addedNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, - QName.createValidLocalName((String)this.nodeService.getProperty( + QName.createValidLocalName((String)this.getNodeService().getProperty( addedNodeRef, ContentModel.PROP_NAME)))); } @@ -181,11 +206,11 @@ public class StartWorkflowWizard extends BaseWizardBean } // start the workflow to get access to the start task - WorkflowPath path = this.workflowService.startWorkflow(this.selectedWorkflow, params); + WorkflowPath path = this.getWorkflowService().startWorkflow(this.selectedWorkflow, params); if (path != null) { // extract the start task - List tasks = this.workflowService.getTasksForWorkflowPath(path.id); + List tasks = this.getWorkflowService().getTasksForWorkflowPath(path.id); if (tasks.size() == 1) { WorkflowTask startTask = tasks.get(0); @@ -197,7 +222,7 @@ public class StartWorkflowWizard extends BaseWizardBean { // end the start task to trigger the first 'proper' // task in the workflow - this.workflowService.endTask(startTask.id, null); + this.getWorkflowService().endTask(startTask.id, null); } } @@ -220,19 +245,19 @@ public class StartWorkflowWizard extends BaseWizardBean // definition and create a transient node to allow the property // sheet to collect the required data. - WorkflowDefinition flowDef = this.workflows.get(this.selectedWorkflow); + WorkflowDefinition flowDef = this.getWorkflows().get(this.selectedWorkflow); if (logger.isDebugEnabled()) logger.debug("Selected workflow: "+ flowDef); - WorkflowTaskDefinition taskDef = flowDef.startTaskDefinition; + WorkflowTaskDefinition taskDef = flowDef.getStartTaskDefinition(); if (taskDef != null) { if (logger.isDebugEnabled()) logger.debug("Start task definition: " + taskDef); // create an instance of a task from the data dictionary - this.startTaskNode = TransientNode.createNew(dictionaryService, taskDef.metadata, + this.startTaskNode = TransientNode.createNew(getDictionaryService(), taskDef.metadata, "task_" + System.currentTimeMillis(), null); } @@ -275,7 +300,7 @@ public class StartWorkflowWizard extends BaseWizardBean if ("choose-workflow".equals(stepName) == false && this.selectedWorkflow != null) { String titlePattern = bundle.getString("start_named_workflow_wizard"); - WorkflowDefinition workflowDef = this.workflows.get(this.selectedWorkflow); + WorkflowDefinition workflowDef = this.getWorkflows().get(this.selectedWorkflow); wizTitle = MessageFormat.format(titlePattern, new Object[] {workflowDef.title}); } else @@ -450,8 +475,8 @@ public class StartWorkflowWizard extends BaseWizardBean { String actionGroup = null; - WorkflowDefinition flowDef = this.workflows.get(this.selectedWorkflow); - WorkflowTaskDefinition taskDef = flowDef.startTaskDefinition; + WorkflowDefinition flowDef = this.getWorkflows().get(this.selectedWorkflow); + WorkflowTaskDefinition taskDef = flowDef.getStartTaskDefinition(); if (taskDef != null) { PropertyDefinition propDef = taskDef.metadata.getProperties().get( @@ -474,8 +499,8 @@ public class StartWorkflowWizard extends BaseWizardBean { String actionGroup = null; - WorkflowDefinition flowDef = this.workflows.get(this.selectedWorkflow); - WorkflowTaskDefinition taskDef = flowDef.startTaskDefinition; + WorkflowDefinition flowDef = this.getWorkflows().get(this.selectedWorkflow); + WorkflowTaskDefinition taskDef = flowDef.getStartTaskDefinition(); if (taskDef != null) { PropertyDefinition propDef = taskDef.metadata.getProperties().get( @@ -523,12 +548,7 @@ public class StartWorkflowWizard extends BaseWizardBean return (workflows.size() > 0); } - /** - * Returns a list of workflows that can be started. - * - * @return List of SelectItem objects representing the workflows - */ - public List getStartableWorkflows() + private void initializeWorkflows() { // NOTE: we don't cache the list of startable workflows as they could get // updated, in which case we need the latest instance id, they could @@ -541,7 +561,7 @@ public class StartWorkflowWizard extends BaseWizardBean // the list as these workflows are specific to WCM functionality and AVM stores Map configuredWcmWorkflows = this.getWCMWorkflows(); - List workflowDefs = this.workflowService.getDefinitions(); + List workflowDefs = this.getWorkflowService().getDefinitions(); for (WorkflowDefinition workflowDef : workflowDefs) { String name = workflowDef.name; @@ -568,7 +588,19 @@ public class StartWorkflowWizard extends BaseWizardBean { this.nextButtonDisabled = true; } - + } + + /** + * Returns a list of workflows that can be started. + * + * @return List of SelectItem objects representing the workflows + */ + public List getStartableWorkflows() + { + if (availableWorkflows == null) + { + initializeWorkflows(); + } return availableWorkflows; } @@ -582,7 +614,7 @@ public class StartWorkflowWizard extends BaseWizardBean String url = null; if (selectedWorkflow != null) { - WorkflowDefinition def = workflows.get(selectedWorkflow); + WorkflowDefinition def = getWorkflows().get(selectedWorkflow); url = "/workflowdefinitionimage/" + def.id; } return url; @@ -608,10 +640,10 @@ public class StartWorkflowWizard extends BaseWizardBean for (String newItem : this.packageItemsToAdd) { NodeRef nodeRef = new NodeRef(newItem); - if (this.nodeService.exists(nodeRef)) + if (this.getNodeService().exists(nodeRef)) { // create our Node representation - MapNode node = new MapNode(nodeRef, this.nodeService, true); + MapNode node = new MapNode(nodeRef, this.getNodeService(), true); this.browseBean.setupCommonBindingProperties(node); // add property resolvers to show path information @@ -651,9 +683,19 @@ public class StartWorkflowWizard extends BaseWizardBean this.workflowService = workflowService; } + + protected WorkflowService getWorkflowService() + { + if (this.workflowService == null) + { + this.workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService(); + } + return this.workflowService; + } + // ------------------------------------------------------------------------------ // Helper methods - + /** * Resets the rich list */ diff --git a/source/java/org/alfresco/web/bean/workflow/ViewCompletedTaskDialog.java b/source/java/org/alfresco/web/bean/workflow/ViewCompletedTaskDialog.java index 6ab6cbb067..7628893a8b 100644 --- a/source/java/org/alfresco/web/bean/workflow/ViewCompletedTaskDialog.java +++ b/source/java/org/alfresco/web/bean/workflow/ViewCompletedTaskDialog.java @@ -41,6 +41,8 @@ public class ViewCompletedTaskDialog extends ManageTaskDialog // ------------------------------------------------------------------------------ // Dialog implementation + private static final long serialVersionUID = 1568710712589201055L; + @Override protected String finishImpl(FacesContext context, String outcome) throws Exception @@ -67,6 +69,6 @@ public class ViewCompletedTaskDialog extends ManageTaskDialog { String titleStart = Application.getMessage(FacesContext.getCurrentInstance(), "view_completed_task_title"); - return titleStart + ": " + this.task.title; + return titleStart + ": " + this.getWorkflowTask().title; } } diff --git a/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java b/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java index 5875cfe0d5..664ee0893f 100644 --- a/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java +++ b/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.bean.workflow; +import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -61,11 +62,15 @@ import org.apache.commons.logging.LogFactory; * * @author gavinc */ -public class WorkflowBean +public class WorkflowBean implements Serializable { + private static final long serialVersionUID = 2950475254440425384L; + protected NavigationBean navigationBean; - protected NodeService nodeService; - protected WorkflowService workflowService; + + transient private NodeService nodeService; + transient private WorkflowService workflowService; + protected List tasks; protected List activeTasks; protected List pooledTasks; @@ -101,7 +106,7 @@ public class WorkflowBean // query for all active tasks WorkflowTaskQuery query = new WorkflowTaskQuery(); - List tasks = this.workflowService.queryTasks(query); + List tasks = this.getWorkflowService().queryTasks(query); // create a list of transient nodes to represent this.activeTasks = new ArrayList(tasks.size()); @@ -150,7 +155,7 @@ public class WorkflowBean tx.begin(); // get the current pooled tasks for the current user - List tasks = this.workflowService.getPooledTasks(userName); + List tasks = this.getWorkflowService().getPooledTasks(userName); // create a list of transient nodes to represent this.pooledTasks = new ArrayList(tasks.size()); @@ -199,7 +204,7 @@ public class WorkflowBean tx.begin(); // get the current in progress tasks for the current user - List tasks = this.workflowService.getAssignedTasks( + List tasks = this.getWorkflowService().getAssignedTasks( userName, WorkflowTaskState.IN_PROGRESS); // create a list of transient nodes to represent @@ -249,7 +254,7 @@ public class WorkflowBean tx.begin(); // get the current in progress tasks for the current user - List tasks = this.workflowService.getAssignedTasks( + List tasks = this.getWorkflowService().getAssignedTasks( userName, WorkflowTaskState.COMPLETED); // create a list of transient nodes to represent @@ -297,6 +302,15 @@ public class WorkflowBean this.workflowService = workflowService; } + protected WorkflowService getWorkflowService() + { + if (this.workflowService == null) + { + this.workflowService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWorkflowService(); + } + return this.workflowService; + } + /** * Sets the node service to use * @@ -307,7 +321,14 @@ public class WorkflowBean this.nodeService = nodeService; } - + protected NodeService getNodeService() + { + if (this.nodeService == null) + { + this.nodeService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService(); + } + return this.nodeService; + } // ------------------------------------------------------------------------------ // Navigation handlers diff --git a/source/java/org/alfresco/web/bean/workflow/WorkflowConsoleBean.java b/source/java/org/alfresco/web/bean/workflow/WorkflowConsoleBean.java index 9d2a9bce89..71a3d5927e 100644 --- a/source/java/org/alfresco/web/bean/workflow/WorkflowConsoleBean.java +++ b/source/java/org/alfresco/web/bean/workflow/WorkflowConsoleBean.java @@ -24,15 +24,22 @@ */ package org.alfresco.web.bean.workflow; +import java.io.Serializable; + +import javax.faces.context.FacesContext; + import org.alfresco.repo.workflow.WorkflowInterpreter; import org.alfresco.service.cmr.workflow.WorkflowDefinition; +import org.alfresco.web.app.servlet.FacesHelper; /** * Backing bean to support the Workflow Console */ -public class WorkflowConsoleBean +public class WorkflowConsoleBean implements Serializable { + private static final long serialVersionUID = -7531838393180855185L; + // command private String command = ""; private String submittedCommand = "none"; @@ -40,7 +47,7 @@ public class WorkflowConsoleBean private String result = null; // supporting repository services - private WorkflowInterpreter workflowInterpreter; + transient private WorkflowInterpreter workflowInterpreter; /** @@ -50,8 +57,17 @@ public class WorkflowConsoleBean { this.workflowInterpreter = workflowInterpreter; } + + private WorkflowInterpreter getWorkflowInterpreter() + { + if (this.workflowInterpreter == null) + { + this.workflowInterpreter = (WorkflowInterpreter) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "workflowInterpreter"); + } + return this.workflowInterpreter; + } - /** + /** * Gets the command result * * @return result @@ -153,7 +169,7 @@ public class WorkflowConsoleBean */ public String getCurrentUserName() { - return workflowInterpreter.getCurrentUserName(); + return getWorkflowInterpreter().getCurrentUserName(); } /** @@ -163,7 +179,7 @@ public class WorkflowConsoleBean */ public String getCurrentWorkflowDef() { - WorkflowDefinition def = workflowInterpreter.getCurrentWorkflowDef(); + WorkflowDefinition def = getWorkflowInterpreter().getCurrentWorkflowDef(); return (def == null) ? "None" : def.title + " v" + def.version; } @@ -177,7 +193,7 @@ public class WorkflowConsoleBean try { long startms = System.currentTimeMillis(); - String result = workflowInterpreter.interpretCommand(command); + String result = getWorkflowInterpreter().interpretCommand(command); setDuration(System.currentTimeMillis() - startms); setResult(result); setCommand(""); diff --git a/source/java/org/alfresco/web/config/AdvancedSearchConfigElement.java b/source/java/org/alfresco/web/config/AdvancedSearchConfigElement.java index 847775da81..5a538b5ef8 100644 --- a/source/java/org/alfresco/web/config/AdvancedSearchConfigElement.java +++ b/source/java/org/alfresco/web/config/AdvancedSearchConfigElement.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.config; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -36,8 +37,10 @@ import org.alfresco.config.element.ConfigElementAdapter; * * @author Gavin Cornwell */ -public class AdvancedSearchConfigElement extends ConfigElementAdapter +public class AdvancedSearchConfigElement extends ConfigElementAdapter implements Serializable { + private static final long serialVersionUID = -6427054671579839728L; + public static final String CONFIG_ELEMENT_ID = "advanced-search"; private List contentTypes = null; diff --git a/source/java/org/alfresco/web/config/ClientConfigElement.java b/source/java/org/alfresco/web/config/ClientConfigElement.java index a0bb0dab5b..1eca053209 100644 --- a/source/java/org/alfresco/web/config/ClientConfigElement.java +++ b/source/java/org/alfresco/web/config/ClientConfigElement.java @@ -45,6 +45,8 @@ import org.apache.commons.logging.LogFactory; */ public class ClientConfigElement extends ConfigElementAdapter { + private static final long serialVersionUID = 825650925215057110L; + private static Log logger = LogFactory.getLog(ClientConfigElement.class); public static final String CONFIG_ELEMENT_ID = "client"; diff --git a/source/java/org/alfresco/web/config/DashboardsConfigElement.java b/source/java/org/alfresco/web/config/DashboardsConfigElement.java index b331b22a88..8fca09eb84 100644 --- a/source/java/org/alfresco/web/config/DashboardsConfigElement.java +++ b/source/java/org/alfresco/web/config/DashboardsConfigElement.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.config; +import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; @@ -165,8 +166,10 @@ public class DashboardsConfigElement extends ConfigElementAdapter /** * Structure class for the definition of a dashboard page layout */ - public static class LayoutDefinition + public static class LayoutDefinition implements Serializable { + private static final long serialVersionUID = -3014156293576142077L; + LayoutDefinition(String id) { this.Id = id; @@ -186,8 +189,10 @@ public class DashboardsConfigElement extends ConfigElementAdapter /** * Structure class for the definition of a dashboard dashlet component */ - public static class DashletDefinition + public static class DashletDefinition implements Serializable { + private static final long serialVersionUID = -5755903997700459631L; + DashletDefinition(String id) { this.Id = id; diff --git a/source/java/org/alfresco/web/config/DialogsConfigElement.java b/source/java/org/alfresco/web/config/DialogsConfigElement.java index cc4f401b57..deffec3d6c 100644 --- a/source/java/org/alfresco/web/config/DialogsConfigElement.java +++ b/source/java/org/alfresco/web/config/DialogsConfigElement.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.config; +import java.io.Serializable; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -40,6 +41,8 @@ import org.alfresco.util.ParameterCheck; */ public class DialogsConfigElement extends ConfigElementAdapter { + private static final long serialVersionUID = 8265738244249506534L; + public static final String CONFIG_ELEMENT_ID = "dialogs"; private Map dialogs = new LinkedHashMap(8, 10f); @@ -127,8 +130,10 @@ public class DialogsConfigElement extends ConfigElementAdapter * * @author gavinc */ - public static class DialogConfig + public static class DialogConfig implements Serializable { + private static final long serialVersionUID = -3163053165721862390L; + protected DialogAttributes attributes; public DialogConfig(DialogAttributes attrs) @@ -257,8 +262,10 @@ public class DialogsConfigElement extends ConfigElementAdapter * * @author gavinc */ - public static class DialogButtonConfig + public static class DialogButtonConfig implements Serializable { + private static final long serialVersionUID = -6897300549206163138L; + private String id; private String label; private String labelId; diff --git a/source/java/org/alfresco/web/config/SidebarConfigElement.java b/source/java/org/alfresco/web/config/SidebarConfigElement.java index 14868c9b39..efe096dfe6 100644 --- a/source/java/org/alfresco/web/config/SidebarConfigElement.java +++ b/source/java/org/alfresco/web/config/SidebarConfigElement.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.config; +import java.io.Serializable; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -38,8 +39,10 @@ import org.alfresco.util.ParameterCheck; * * @author gavinc */ -public class SidebarConfigElement extends ConfigElementAdapter +public class SidebarConfigElement extends ConfigElementAdapter implements Serializable { + private static final long serialVersionUID = -251308123183340915L; + public static final String CONFIG_ELEMENT_ID = "sidebar"; private String defaultPlugin; @@ -158,8 +161,10 @@ public class SidebarConfigElement extends ConfigElementAdapter * * @author gavinc */ - public static class SidebarPluginConfig + public static class SidebarPluginConfig implements Serializable { + private static final long serialVersionUID = 1400852211128756652L; + protected String id; protected String page; protected String actionsConfigId; diff --git a/source/java/org/alfresco/web/config/ViewsConfigElement.java b/source/java/org/alfresco/web/config/ViewsConfigElement.java index 342fb009e0..5f129669da 100644 --- a/source/java/org/alfresco/web/config/ViewsConfigElement.java +++ b/source/java/org/alfresco/web/config/ViewsConfigElement.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.config; +import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -38,8 +39,10 @@ import org.alfresco.config.element.ConfigElementAdapter; * * @author Gavin Cornwell */ -public class ViewsConfigElement extends ConfigElementAdapter +public class ViewsConfigElement extends ConfigElementAdapter implements Serializable { + private static final long serialVersionUID = -503735723795178986L; + public static final String CONFIG_ELEMENT_ID = "views"; public static final String VIEW_DETAILS = "details"; diff --git a/source/java/org/alfresco/web/config/WizardsConfigElement.java b/source/java/org/alfresco/web/config/WizardsConfigElement.java index b473ba2cf2..3302c2da6a 100644 --- a/source/java/org/alfresco/web/config/WizardsConfigElement.java +++ b/source/java/org/alfresco/web/config/WizardsConfigElement.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.config; +import java.io.Serializable; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; @@ -122,13 +123,20 @@ public class WizardsConfigElement extends ConfigElementAdapter this.wizards.put(wizardConfig.getName(), wizardConfig); } - public abstract static class AbstractConfig + public abstract static class AbstractConfig implements Serializable { protected String title; protected String titleId; protected String description; protected String descriptionId; + + + protected AbstractConfig() + { + super(); + } + public AbstractConfig(String title, String titleId, String description, String descriptionId) { @@ -162,8 +170,10 @@ public class WizardsConfigElement extends ConfigElementAdapter /** * Represents the configuration of a single wizard i.e. the <wizard> element */ - public static class WizardConfig extends AbstractConfig + public static class WizardConfig extends AbstractConfig implements Serializable { + private static final long serialVersionUID = -3377339374041580932L; + protected String subTitle; protected String subTitleId; protected String name; @@ -172,6 +182,11 @@ public class WizardsConfigElement extends ConfigElementAdapter protected String errorMsgId = "error_wizard"; protected Map steps = new LinkedHashMap(4); + + protected WizardConfig() + { + super(); + } public WizardConfig(String name, String bean, String icon, String title, String titleId, @@ -282,8 +297,10 @@ public class WizardsConfigElement extends ConfigElementAdapter /** * Represents the configuration of a page in a wizard i.e. the <page> element */ - public static class PageConfig extends AbstractConfig + public static class PageConfig extends AbstractConfig implements Serializable { + private static final long serialVersionUID = 4154515148190230391L; + protected String path; protected String instruction; protected String instructionId; @@ -343,6 +360,8 @@ public class WizardsConfigElement extends ConfigElementAdapter */ public static class ConditionalPageConfig extends PageConfig { + private static final long serialVersionUID = -3398913681170199314L; + protected String condition; public ConditionalPageConfig(String path, String condition, @@ -386,8 +405,10 @@ public class WizardsConfigElement extends ConfigElementAdapter * Represents the configuration of a step in a wizard * i.e. the <step> element. */ - public static class StepConfig extends AbstractConfig + public static class StepConfig extends AbstractConfig implements Serializable { + private static final long serialVersionUID = -3707570689181455754L; + protected String name; protected PageConfig defaultPage; protected List conditionalPages = diff --git a/source/java/org/alfresco/web/forms/FormImpl.java b/source/java/org/alfresco/web/forms/FormImpl.java index 86ae24c642..5821cd11f6 100644 --- a/source/java/org/alfresco/web/forms/FormImpl.java +++ b/source/java/org/alfresco/web/forms/FormImpl.java @@ -50,6 +50,7 @@ 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.web.app.servlet.FacesHelper; import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.wcm.AVMUtil; import org.alfresco.web.bean.wcm.AVMWorkflowUtil; @@ -63,13 +64,14 @@ import freemarker.ext.dom.NodeModel; import freemarker.template.SimpleDate; import freemarker.template.SimpleHash; -public class FormImpl - implements Form +public class FormImpl implements Form { + private static final long serialVersionUID = 1L; + private static final Log LOGGER = LogFactory.getLog(FormImpl.class); private final NodeRef folderNodeRef; - protected final FormsService formsService; + private transient FormsService formsService; private transient Map renderingEngineTemplates; private final static LinkedList PROCESSORS = @@ -100,6 +102,15 @@ public class FormImpl this.formsService = formsService; } + protected FormsService getFormsService() + { + if (formsService == null) + { + formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); + } + return formsService; + } + public String getName() { final NodeService nodeService = this.getServiceRegistry().getNodeService(); @@ -340,7 +351,7 @@ public class FormImpl final NodeRef renditionPropertiesNodeRef = assoc2.getChildRef(); final RenderingEngineTemplate ret = - new RenderingEngineTemplateImpl(retNodeRef, renditionPropertiesNodeRef, this.formsService); + new RenderingEngineTemplateImpl(retNodeRef, renditionPropertiesNodeRef, this.getFormsService()); LOGGER.debug("loaded rendering engine template " + ret); result.put(ret.getName(), ret); } diff --git a/source/java/org/alfresco/web/forms/FormInstanceData.java b/source/java/org/alfresco/web/forms/FormInstanceData.java index f37e030363..259487a2f2 100644 --- a/source/java/org/alfresco/web/forms/FormInstanceData.java +++ b/source/java/org/alfresco/web/forms/FormInstanceData.java @@ -1,114 +1,116 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.web.forms; - -import java.io.IOException; -import java.io.Serializable; -import java.util.List; -import org.alfresco.service.cmr.repository.NodeRef; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; - -/** - * Encapsulation of form instance data. - * - * @author Ariel Backenroth - */ -public interface FormInstanceData - extends Serializable -{ - - ///////////////////////////////////////////////////////////////////////////// - - public static class RegenerateResult - { - - private final RenderingEngineTemplate ret; - private final Rendition r; - private final Exception e; - - public RegenerateResult(final RenderingEngineTemplate ret, - final Rendition r) - { - this.ret = ret; - this.r = r; - this.e = null; - } - - public RegenerateResult(final RenderingEngineTemplate ret, - final Exception e) - { - this.ret = ret; - this.e = e; - this.r = null; - } - - public RenderingEngineTemplate getRenderingEngineTemplate() - { - return this.ret; - } - - public Rendition getRendition() - { - return this.r; - } - - public Exception getException() - { - return this.e; - } - } - - ///////////////////////////////////////////////////////////////////////////// - - /** the form generate this form instance data */ - public Form getForm() - throws FormNotFoundException; - - /** the name of this instance data */ - public String getName(); - - /** the path relative to the containing webapp */ - public String getWebappRelativePath(); - - /** the path relative to the sandbox */ - public String getSandboxRelativePath(); - - /** the path to the contents of this form instance data */ - public String getPath(); - - /** the url to the asset */ - public String getUrl(); - - /** returns the parsed form instance data */ - public Document getDocument() - throws IOException, SAXException; - - /** Regenerates all renditions of this form instance data */ - public List regenerateRenditions() - throws FormNotFoundException; - - /** returns all renditions of this form instance data */ - public List getRenditions(); -} +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.forms; + +import java.io.IOException; +import java.io.Serializable; +import java.util.List; + +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +/** + * Encapsulation of form instance data. + * + * @author Ariel Backenroth + */ +public interface FormInstanceData + extends Serializable +{ + + ///////////////////////////////////////////////////////////////////////////// + + public static class RegenerateResult implements Serializable + { + + private static final long serialVersionUID = -3827878774655260635L; + + private final RenderingEngineTemplate ret; + private final Rendition r; + private final Exception e; + + public RegenerateResult(final RenderingEngineTemplate ret, + final Rendition r) + { + this.ret = ret; + this.r = r; + this.e = null; + } + + public RegenerateResult(final RenderingEngineTemplate ret, + final Exception e) + { + this.ret = ret; + this.e = e; + this.r = null; + } + + public RenderingEngineTemplate getRenderingEngineTemplate() + { + return this.ret; + } + + public Rendition getRendition() + { + return this.r; + } + + public Exception getException() + { + return this.e; + } + } + + ///////////////////////////////////////////////////////////////////////////// + + /** the form generate this form instance data */ + public Form getForm() + throws FormNotFoundException; + + /** the name of this instance data */ + public String getName(); + + /** the path relative to the containing webapp */ + public String getWebappRelativePath(); + + /** the path relative to the sandbox */ + public String getSandboxRelativePath(); + + /** the path to the contents of this form instance data */ + public String getPath(); + + /** the url to the asset */ + public String getUrl(); + + /** returns the parsed form instance data */ + public Document getDocument() + throws IOException, SAXException; + + /** Regenerates all renditions of this form instance data */ + public List regenerateRenditions() + throws FormNotFoundException; + + /** returns all renditions of this form instance data */ + public List getRenditions(); +} diff --git a/source/java/org/alfresco/web/forms/FormInstanceDataImpl.java b/source/java/org/alfresco/web/forms/FormInstanceDataImpl.java index 99a920281f..f01988acd3 100644 --- a/source/java/org/alfresco/web/forms/FormInstanceDataImpl.java +++ b/source/java/org/alfresco/web/forms/FormInstanceDataImpl.java @@ -39,10 +39,13 @@ import org.alfresco.model.WCMAppModel; import org.alfresco.repo.avm.AVMNodeConverter; import org.alfresco.repo.domain.PropertyValue; import org.alfresco.service.ServiceRegistry; +import org.alfresco.service.cmr.avm.AVMNotFoundException; 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.StoreRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.web.app.servlet.FacesHelper; import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.wcm.AVMUtil; import org.apache.commons.logging.Log; @@ -57,10 +60,12 @@ import org.xml.sax.SAXException; */ /* package */ class FormInstanceDataImpl implements FormInstanceData { + private static final long serialVersionUID = -7806221587661854013L; + private static final Log LOGGER = LogFactory.getLog(RenditionImpl.class); private final NodeRef nodeRef; - private final FormsService formsService; + private transient FormsService formsService; /* package */ FormInstanceDataImpl(final NodeRef nodeRef, final FormsService formsService) @@ -91,6 +96,15 @@ import org.xml.sax.SAXException; { this(AVMNodeConverter.ToNodeRef(version, avmPath), formsService); } + + private FormsService getFormsService() + { + if (formsService == null) + { + formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); + } + return formsService; + } /** the name of this rendition */ public String getName() @@ -134,11 +148,11 @@ import org.xml.sax.SAXException; // TODO - forms should be identified by nodeRef rather than name (which can be non-unique) if (getNodeRef().getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_AVM)) { - return this.formsService.getWebForm(parentFormName); + return this.getFormsService().getWebForm(parentFormName); } else { - return this.formsService.getForm(parentFormName); + return this.getFormsService().getForm(parentFormName); } } catch (FormNotFoundException fnfe) @@ -236,7 +250,7 @@ import org.xml.sax.SAXException; { final Rendition r = new RenditionImpl(-1, storeName + ':' + (String)path, - this.formsService); + this.getFormsService()); try { if (!this.equals(r.getPrimaryFormInstanceData())) diff --git a/source/java/org/alfresco/web/forms/FormProcessor.java b/source/java/org/alfresco/web/forms/FormProcessor.java index 17f4a01228..d12bd7664c 100644 --- a/source/java/org/alfresco/web/forms/FormProcessor.java +++ b/source/java/org/alfresco/web/forms/FormProcessor.java @@ -1,114 +1,116 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.web.forms; - -import java.io.Serializable; -import java.io.Writer; -import org.alfresco.service.cmr.repository.NodeRef; -import org.w3c.dom.Document; - -/** - * Generates a user interface for inputing data into a template. - * @author Ariel Backenroth - */ -public interface FormProcessor - extends Serializable -{ - - ///////////////////////////////////////////////////////////////////////////// - - /** - * An abstraction layer around the xml content which allows - * for reseting the xml content being collected by the input method. - */ - public interface Session - { - - /** Returns the set of file uploaded during the session. */ -// public NodeRef[] getUploadedFiles(); - - /** Destroys the session and releases all resources used by it */ - public void destroy(); - - /** Returns the form used by the session. */ - public Form getForm(); - - /** Returns the current state of the form instance data */ - public Document getFormInstanceData(); - - /** Returns the name of the form instance data being modified */ - public String getFormInstanceDataName(); - } - - ///////////////////////////////////////////////////////////////////////////// - - /** - * Exception for errors encoutered during form processing. - */ - public static class ProcessingException - extends Exception - { - - public ProcessingException(final String msg) - { - super(msg); - } - - public ProcessingException(final Exception cause) - { - super(cause); - } - - public ProcessingException(final String msg, final Exception cause) - { - super(msg, cause); - } - } - - ///////////////////////////////////////////////////////////////////////////// - - /** - * Processes a user interface for inputing data into a form. - * - * @param formInstanceData provides the xml instance data if available. - * @param formInstanceDataName the name of the form instance data being modified. - * @param form the form to generate for - * @param out the writer to write the output to. - */ - public Session process(final Document formInstanceData, - final String formInstanceDataName, - final Form form, - final Writer out) - throws ProcessingException; - - /** - * Processes a user interface for inputing data into a form. - * - * @param session the session to use. - * @param out the writer to write the output to. - */ - public void process(final Session session, - final Writer out) - throws ProcessingException; -} +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.forms; + +import java.io.Serializable; +import java.io.Writer; + +import org.w3c.dom.Document; + +/** + * Generates a user interface for inputing data into a template. + * @author Ariel Backenroth + */ +public interface FormProcessor + extends Serializable +{ + + ///////////////////////////////////////////////////////////////////////////// + + /** + * An abstraction layer around the xml content which allows + * for reseting the xml content being collected by the input method. + */ + public interface Session extends Serializable + { + + /** Returns the set of file uploaded during the session. */ +// public NodeRef[] getUploadedFiles(); + + /** Destroys the session and releases all resources used by it */ + public void destroy(); + + /** Returns the form used by the session. */ + public Form getForm(); + + /** Returns the current state of the form instance data */ + public Document getFormInstanceData(); + + /** Returns the name of the form instance data being modified */ + public String getFormInstanceDataName(); + } + + ///////////////////////////////////////////////////////////////////////////// + + /** + * Exception for errors encoutered during form processing. + */ + public static class ProcessingException + extends Exception + { + + private static final long serialVersionUID = -1067792684180745503L; + + public ProcessingException(final String msg) + { + super(msg); + } + + public ProcessingException(final Exception cause) + { + super(cause); + } + + public ProcessingException(final String msg, final Exception cause) + { + super(msg, cause); + } + } + + ///////////////////////////////////////////////////////////////////////////// + + /** + * Processes a user interface for inputing data into a form. + * + * @param formInstanceData provides the xml instance data if available. + * @param formInstanceDataName the name of the form instance data being modified. + * @param form the form to generate for + * @param out the writer to write the output to. + */ + public Session process(final Document formInstanceData, + final String formInstanceDataName, + final Form form, + final Writer out) + throws ProcessingException; + + /** + * Processes a user interface for inputing data into a form. + * + * @param session the session to use. + * @param out the writer to write the output to. + */ + public void process(final Session session, + final Writer out) + throws ProcessingException; +} diff --git a/source/java/org/alfresco/web/forms/FormsService.java b/source/java/org/alfresco/web/forms/FormsService.java index d0e9e4d05c..9b29a2b4e7 100644 --- a/source/java/org/alfresco/web/forms/FormsService.java +++ b/source/java/org/alfresco/web/forms/FormsService.java @@ -23,55 +23,34 @@ */ package org.alfresco.web.forms; -import java.io.*; 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.ResourceBundle; import javax.faces.context.FacesContext; -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.policy.PolicyComponent; import org.alfresco.repo.policy.Behaviour; import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.search.impl.lucene.QueryParser; -import org.alfresco.service.cmr.avm.AVMNotFoundException; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.repository.AssociationRef; +import org.alfresco.repo.policy.PolicyComponent; 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.MimetypeService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.TemplateService; 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.namespace.NamespaceService; import org.alfresco.service.namespace.QName; -import org.alfresco.util.ISO9075; 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.WebProject; import org.alfresco.web.data.IDataContainer; import org.alfresco.web.data.QuickSort; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.xml.sax.SAXException; /** * Provides management of forms. @@ -79,7 +58,6 @@ import org.xml.sax.SAXException; * @author Ariel Backenroth */ public final class FormsService - implements Serializable { private static final Log LOGGER = LogFactory.getLog(FormsService.class); diff --git a/source/java/org/alfresco/web/forms/FormsTest.java b/source/java/org/alfresco/web/forms/FormsTest.java index 264af465c8..42aae65c02 100644 --- a/source/java/org/alfresco/web/forms/FormsTest.java +++ b/source/java/org/alfresco/web/forms/FormsTest.java @@ -1,304 +1,304 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing - */ -package org.alfresco.web.forms; - -import java.io.*; -import java.util.*; -import org.alfresco.service.namespace.QName; -import org.alfresco.model.WCMAppModel; -import junit.framework.AssertionFailedError; -import org.alfresco.service.cmr.repository.*; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.util.BaseSpringTest; -import org.alfresco.web.forms.XMLUtil; -import org.apache.commons.jxpath.JXPathContext; -import org.apache.commons.jxpath.Pointer; -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chiba.xml.ns.NamespaceConstants; -import org.chiba.xml.events.XFormsEventNames; -import org.chiba.xml.events.XMLEvent; -import org.chiba.xml.xforms.ChibaBean; -import org.chiba.xml.xforms.exception.XFormsException; -import org.chiba.xml.xforms.XFormsElement; -import org.chiba.xml.events.DOMEventNames; -import org.w3c.dom.*; -import org.w3c.dom.events.*; -import org.xml.sax.*; -import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.springframework.context.ConfigurableApplicationContext; -import org.alfresco.service.cmr.security.AuthenticationService; -import org.alfresco.service.cmr.model.*; -import org.alfresco.repo.security.authentication.MutableAuthenticationDao; -import org.alfresco.util.TestWithUserUtils; -import org.apache.shale.test.mock.*; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.StaticWebApplicationContext; - -/** - * JUnit tests to exercise parts of the forms codebase - * - * @author ariel backenroth - */ -public class FormsTest - extends BaseSpringTest -{ - - ///////////////////////////////////////////////////////////////////////////// - - private static class MockForm - extends FormImpl - { - - MockForm(final NodeRef folderNodeRef, - final FormsService formsService) - { - super(folderNodeRef, formsService); - } - - - public void setOutputPathPattern(final String opp) - { - final NodeService nodeService = this.getServiceRegistry().getNodeService(); - nodeService.setProperty(this.getNodeRef(), WCMAppModel.PROP_OUTPUT_PATH_PATTERN, opp); - } - } - - ///////////////////////////////////////////////////////////////////////////// - - private final static Log LOGGER = LogFactory.getLog(FormsTest.class); - private final static String WEB_CLIENT_APPLICATION_CONTEXT = - "classpath:alfresco/web-client-application-context.xml"; - - private NodeService nodeService; - private FormsService formsService; - private MockForm mockForm; - - protected void onSetUpInTransaction() - throws Exception - { - System.err.println("onSetUpInTransaction"); - super.onSetUpInTransaction(); - this.nodeService = (NodeService)super.applicationContext.getBean("dbNodeService"); - assertNotNull(this.nodeService); - final FileFolderService fileFolderService = (FileFolderService) - super.applicationContext.getBean("fileFolderService"); - assertNotNull(fileFolderService); - this.formsService = (FormsService)super.applicationContext.getBean("FormsService"); - assertNotNull(this.formsService); - final AuthenticationService authenticationService = (AuthenticationService) - applicationContext.getBean("authenticationService"); - authenticationService.clearCurrentSecurityContext(); - final MutableAuthenticationDao authenticationDAO = (MutableAuthenticationDao) - applicationContext.getBean("authenticationDao"); - - // Create a workspace that contains the 'live' nodes - final StoreRef testStoreRef = this.nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, - "Test_" + System.currentTimeMillis()); - - // Get a reference to the root node - final NodeRef rootNodeRef = this.nodeService.getRootNode(testStoreRef); - - // Create an authenticate the user - if(!authenticationDAO.userExists("admin")) - { - authenticationService.createAuthentication("admin", "admin".toCharArray()); - } - - TestWithUserUtils.authenticateUser("admin", - "admin", - rootNodeRef, - authenticationService); - - // set up a faces context - final MockExternalContext ec = new MockExternalContext(new MockServletContext(), - new MockHttpServletRequest(), - new MockHttpServletResponse()); - final StaticWebApplicationContext ac = new StaticWebApplicationContext(); - ac.setParent(this.applicationContext); - this.applicationContext = ac; - ec.getApplicationMap().put(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, - this.applicationContext); - new MockFacesContext(ec); - - - final FileInfo folderInfo = - fileFolderService.create(rootNodeRef, - "test_form", - WCMAppModel.TYPE_FORMFOLDER); - final HashMap props = new HashMap(); - this.nodeService.addAspect(folderInfo.getNodeRef(), - WCMAppModel.ASPECT_FORM, - props); - this.mockForm = new MockForm(folderInfo.getNodeRef(), this.formsService); - } - - @Override - protected String[] getConfigLocations() - { - return (String[])ArrayUtils.add(super.getConfigLocations(), - WEB_CLIENT_APPLICATION_CONTEXT); - } - - @Override - protected ConfigurableApplicationContext loadContext(Object key) - throws Exception - { - return new ClassPathXmlApplicationContext((String[])key); - } - - public void testOutputPathPatternForFormInstanceData() - throws Exception - { - class OutputPathPatternTest - { - public final String expected; - public final String pattern; - public final Document xml; - public final String name; - public final String parentAVMPath; - public final String webapp; - - public OutputPathPatternTest(final String expected, - final String pattern, - final Document xml, - final String name, - final String parentAVMPath, - final String webapp) - { - this.expected = expected; - this.pattern = pattern; - this.xml = xml; - this.name = name; - this.parentAVMPath = parentAVMPath; - this.webapp = webapp; - } - } - - final OutputPathPatternTest[] opps = new OutputPathPatternTest[] { - new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir/foo.xml", - "${name}.xml", - XMLUtil.parse(""), - "foo", - "avmstore:/www/avm_webapps/webapp/dir", - "webapp"), - new OutputPathPatternTest("avmstore:/www/avm_webapps/foo.xml", - "/${name}.xml", - XMLUtil.parse(""), - "foo", - "avmstore:/www/avm_webapps/webapp/dir", - "webapp"), - new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/foo.xml", - "/${webapp}/${name}.xml", - XMLUtil.parse(""), - "foo", - "avmstore:/www/avm_webapps/webapp/dir", - "webapp"), - new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/foo.xml", - "/${webapp}/${name}.xml", - XMLUtil.parse(""), - "foo", - "avmstore:/www/avm_webapps/another_webapp/dir", - "webapp"), - new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir1/dir2/foo.xml", - "/${webapp}/${cwd}/${name}.xml", - XMLUtil.parse(""), - "foo", - "avmstore:/www/avm_webapps/another_webapp/dir1/dir2", - "webapp"), - new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir/" + Calendar.getInstance().get(Calendar.YEAR) + "_foo.xml", - "${date?string('yyyy')}_${name}.xml", - XMLUtil.parse(""), - "foo", - "avmstore:/www/avm_webapps/webapp/dir", - "webapp"), - new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir/foo.xml", - "${xml.root_tag.name}.xml", - XMLUtil.parse("foo"), - "foo", - "avmstore:/www/avm_webapps/webapp/dir", - "webapp"), - new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir/07.xml", - "${xml.root_tag.date?date('yyyy-MM-dd')?string('MM')}.xml", - XMLUtil.parse("1776-07-04"), - "foo", - "avmstore:/www/avm_webapps/webapp/dir", - "webapp"), - new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir/foo.xml", - "${xml['foons:root_tag/foons:name']}.xml", - XMLUtil.parse("foo"), - "foo", - "avmstore:/www/avm_webapps/webapp/dir", - "webapp"), - new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir/foo.xml", - "${xml[\"/*[name()='foons:root_tag']/*[name()='foons:name']\"]}.xml", - XMLUtil.parse("foo"), - "foo", - "avmstore:/www/avm_webapps/webapp/dir", - "webapp"), - new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir/foo.xml", - "${xml['/foons:root_tag/foons:name']}.xml", - XMLUtil.parse("foo"), - "foo", - "avmstore:/www/avm_webapps/webapp/dir", - "webapp"), - new OutputPathPatternTest(null, - "${xml.root_tag.name}", - XMLUtil.parse("foo"), - "foo", - "avmstore:/www/avm_webapps/webapp/dir", - "webapp") - }; - for (final OutputPathPatternTest oppt : opps) - { - this.mockForm.setOutputPathPattern(oppt.pattern); - if (oppt.expected == null) - { - try - { - this.mockForm.getOutputPathForFormInstanceData(oppt.xml, - oppt.name, - oppt.parentAVMPath, - oppt.webapp); - fail("expected pattern " + oppt.pattern + " to fail"); - } - catch (Exception e) - { - // expected failure - } - } - else - { - assertEquals(oppt.pattern + " failed", - oppt.expected, - this.mockForm.getOutputPathForFormInstanceData(oppt.xml, - oppt.name, - oppt.parentAVMPath, - oppt.webapp)); - } - } - } -} \ No newline at end of file +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing + */ +package org.alfresco.web.forms; + +import java.io.*; +import java.util.*; +import org.alfresco.service.namespace.QName; +import org.alfresco.model.WCMAppModel; +import junit.framework.AssertionFailedError; +import org.alfresco.service.cmr.repository.*; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.util.BaseSpringTest; +import org.alfresco.web.forms.XMLUtil; +import org.apache.commons.jxpath.JXPathContext; +import org.apache.commons.jxpath.Pointer; +import org.apache.commons.lang.ArrayUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chiba.xml.ns.NamespaceConstants; +import org.chiba.xml.events.XFormsEventNames; +import org.chiba.xml.events.XMLEvent; +import org.chiba.xml.xforms.ChibaBean; +import org.chiba.xml.xforms.exception.XFormsException; +import org.chiba.xml.xforms.XFormsElement; +import org.chiba.xml.events.DOMEventNames; +import org.w3c.dom.*; +import org.w3c.dom.events.*; +import org.xml.sax.*; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.context.ConfigurableApplicationContext; +import org.alfresco.service.cmr.security.AuthenticationService; +import org.alfresco.service.cmr.model.*; +import org.alfresco.repo.security.authentication.MutableAuthenticationDao; +import org.alfresco.util.TestWithUserUtils; +import org.apache.shale.test.mock.*; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.StaticWebApplicationContext; + +/** + * JUnit tests to exercise parts of the forms codebase + * + * @author ariel backenroth + */ +public class FormsTest + extends BaseSpringTest +{ + + ///////////////////////////////////////////////////////////////////////////// + + private static class MockForm + extends FormImpl + { + + MockForm(final NodeRef folderNodeRef, + final FormsService formsService) + { + super(folderNodeRef, formsService); + } + + + public void setOutputPathPattern(final String opp) + { + final NodeService nodeService = this.getServiceRegistry().getNodeService(); + nodeService.setProperty(this.getNodeRef(), WCMAppModel.PROP_OUTPUT_PATH_PATTERN, opp); + } + } + + ///////////////////////////////////////////////////////////////////////////// + + private final static Log LOGGER = LogFactory.getLog(FormsTest.class); + private final static String WEB_CLIENT_APPLICATION_CONTEXT = + "classpath:alfresco/web-client-application-context.xml"; + + private NodeService nodeService; + private FormsService formsService; + private MockForm mockForm; + + protected void onSetUpInTransaction() + throws Exception + { + System.err.println("onSetUpInTransaction"); + super.onSetUpInTransaction(); + this.nodeService = (NodeService)super.applicationContext.getBean("dbNodeService"); + assertNotNull(this.nodeService); + final FileFolderService fileFolderService = (FileFolderService) + super.applicationContext.getBean("fileFolderService"); + assertNotNull(fileFolderService); + this.formsService = (FormsService)super.applicationContext.getBean("FormsService"); + assertNotNull(this.formsService); + final AuthenticationService authenticationService = (AuthenticationService) + applicationContext.getBean("authenticationService"); + authenticationService.clearCurrentSecurityContext(); + final MutableAuthenticationDao authenticationDAO = (MutableAuthenticationDao) + applicationContext.getBean("authenticationDao"); + + // Create a workspace that contains the 'live' nodes + final StoreRef testStoreRef = this.nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, + "Test_" + System.currentTimeMillis()); + + // Get a reference to the root node + final NodeRef rootNodeRef = this.nodeService.getRootNode(testStoreRef); + + // Create an authenticate the user + if(!authenticationDAO.userExists("admin")) + { + authenticationService.createAuthentication("admin", "admin".toCharArray()); + } + + TestWithUserUtils.authenticateUser("admin", + "admin", + rootNodeRef, + authenticationService); + + // set up a faces context + final MockExternalContext ec = new MockExternalContext(new MockServletContext(), + new MockHttpServletRequest(), + new MockHttpServletResponse()); + final StaticWebApplicationContext ac = new StaticWebApplicationContext(); + ac.setParent(this.applicationContext); + this.applicationContext = ac; + ec.getApplicationMap().put(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, + this.applicationContext); + new MockFacesContext(ec); + + + final FileInfo folderInfo = + fileFolderService.create(rootNodeRef, + "test_form", + WCMAppModel.TYPE_FORMFOLDER); + final HashMap props = new HashMap(); + this.nodeService.addAspect(folderInfo.getNodeRef(), + WCMAppModel.ASPECT_FORM, + props); + this.mockForm = new MockForm(folderInfo.getNodeRef(), this.formsService); + } + + @Override + protected String[] getConfigLocations() + { + return (String[])ArrayUtils.add(super.getConfigLocations(), + WEB_CLIENT_APPLICATION_CONTEXT); + } + + @Override + protected ConfigurableApplicationContext loadContext(Object key) + throws Exception + { + return new ClassPathXmlApplicationContext((String[])key); + } + + public void testOutputPathPatternForFormInstanceData() + throws Exception + { + class OutputPathPatternTest + { + public final String expected; + public final String pattern; + public final Document xml; + public final String name; + public final String parentAVMPath; + public final String webapp; + + public OutputPathPatternTest(final String expected, + final String pattern, + final Document xml, + final String name, + final String parentAVMPath, + final String webapp) + { + this.expected = expected; + this.pattern = pattern; + this.xml = xml; + this.name = name; + this.parentAVMPath = parentAVMPath; + this.webapp = webapp; + } + } + + final OutputPathPatternTest[] opps = new OutputPathPatternTest[] { + new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir/foo.xml", + "${name}.xml", + XMLUtil.parse(""), + "foo", + "avmstore:/www/avm_webapps/webapp/dir", + "webapp"), + new OutputPathPatternTest("avmstore:/www/avm_webapps/foo.xml", + "/${name}.xml", + XMLUtil.parse(""), + "foo", + "avmstore:/www/avm_webapps/webapp/dir", + "webapp"), + new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/foo.xml", + "/${webapp}/${name}.xml", + XMLUtil.parse(""), + "foo", + "avmstore:/www/avm_webapps/webapp/dir", + "webapp"), + new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/foo.xml", + "/${webapp}/${name}.xml", + XMLUtil.parse(""), + "foo", + "avmstore:/www/avm_webapps/another_webapp/dir", + "webapp"), + new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir1/dir2/foo.xml", + "/${webapp}/${cwd}/${name}.xml", + XMLUtil.parse(""), + "foo", + "avmstore:/www/avm_webapps/another_webapp/dir1/dir2", + "webapp"), + new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir/" + Calendar.getInstance().get(Calendar.YEAR) + "_foo.xml", + "${date?string('yyyy')}_${name}.xml", + XMLUtil.parse(""), + "foo", + "avmstore:/www/avm_webapps/webapp/dir", + "webapp"), + new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir/foo.xml", + "${xml.root_tag.name}.xml", + XMLUtil.parse("foo"), + "foo", + "avmstore:/www/avm_webapps/webapp/dir", + "webapp"), + new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir/07.xml", + "${xml.root_tag.date?date('yyyy-MM-dd')?string('MM')}.xml", + XMLUtil.parse("1776-07-04"), + "foo", + "avmstore:/www/avm_webapps/webapp/dir", + "webapp"), + new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir/foo.xml", + "${xml['foons:root_tag/foons:name']}.xml", + XMLUtil.parse("foo"), + "foo", + "avmstore:/www/avm_webapps/webapp/dir", + "webapp"), + new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir/foo.xml", + "${xml[\"/*[name()='foons:root_tag']/*[name()='foons:name']\"]}.xml", + XMLUtil.parse("foo"), + "foo", + "avmstore:/www/avm_webapps/webapp/dir", + "webapp"), + new OutputPathPatternTest("avmstore:/www/avm_webapps/webapp/dir/foo.xml", + "${xml['/foons:root_tag/foons:name']}.xml", + XMLUtil.parse("foo"), + "foo", + "avmstore:/www/avm_webapps/webapp/dir", + "webapp"), + new OutputPathPatternTest(null, + "${xml.root_tag.name}", + XMLUtil.parse("foo"), + "foo", + "avmstore:/www/avm_webapps/webapp/dir", + "webapp") + }; + for (final OutputPathPatternTest oppt : opps) + { + this.mockForm.setOutputPathPattern(oppt.pattern); + if (oppt.expected == null) + { + try + { + this.mockForm.getOutputPathForFormInstanceData(oppt.xml, + oppt.name, + oppt.parentAVMPath, + oppt.webapp); + fail("expected pattern " + oppt.pattern + " to fail"); + } + catch (Exception e) + { + // expected failure + } + } + else + { + assertEquals(oppt.pattern + " failed", + oppt.expected, + this.mockForm.getOutputPathForFormInstanceData(oppt.xml, + oppt.name, + oppt.parentAVMPath, + oppt.webapp)); + } + } + } +} \ No newline at end of file diff --git a/source/java/org/alfresco/web/forms/RenderingEngineTemplateImpl.java b/source/java/org/alfresco/web/forms/RenderingEngineTemplateImpl.java index fc40e3dc5c..c8bdd5ed68 100644 --- a/source/java/org/alfresco/web/forms/RenderingEngineTemplateImpl.java +++ b/source/java/org/alfresco/web/forms/RenderingEngineTemplateImpl.java @@ -61,6 +61,7 @@ import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; import org.alfresco.util.URLEncoder; 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.apache.commons.lang.StringUtils; @@ -84,6 +85,8 @@ import freemarker.template.SimpleHash; public class RenderingEngineTemplateImpl implements RenderingEngineTemplate { + private static final long serialVersionUID = -1656812676972437532L; + private static final Log LOGGER = LogFactory.getLog(RenderingEngineTemplateImpl.class); private static final DynamicNamespacePrefixResolver namespacePrefixResolver = @@ -100,7 +103,7 @@ public class RenderingEngineTemplateImpl private final NodeRef nodeRef; private final NodeRef renditionPropertiesNodeRef; - private final FormsService formsService; + private transient FormsService formsService; protected RenderingEngineTemplateImpl(final NodeRef nodeRef, final NodeRef renditionPropertiesNodeRef, @@ -123,6 +126,15 @@ public class RenderingEngineTemplateImpl this.formsService = formsService; } + private FormsService getFormsService() + { + if (formsService == null) + { + formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); + } + return formsService; + } + public String getName() { final NodeService nodeService = this.getServiceRegistry().getNodeService(); @@ -179,7 +191,7 @@ public class RenderingEngineTemplateImpl final String renderingEngineName = (String) nodeService.getProperty(this.nodeRef, WCMAppModel.PROP_PARENT_RENDERING_ENGINE_NAME); - return this.formsService.getRenderingEngine(renderingEngineName); + return this.getFormsService().getRenderingEngine(renderingEngineName); } /** @@ -286,7 +298,7 @@ public class RenderingEngineTemplateImpl final Rendition result = new RenditionImpl(-1, renditionAvmPath, - this.formsService); + this.getFormsService()); this.render(formInstanceData, result); if (!isRegenerate) diff --git a/source/java/org/alfresco/web/forms/RenditionImpl.java b/source/java/org/alfresco/web/forms/RenditionImpl.java index 43fbadc01e..e7d60e8e9f 100644 --- a/source/java/org/alfresco/web/forms/RenditionImpl.java +++ b/source/java/org/alfresco/web/forms/RenditionImpl.java @@ -1,257 +1,271 @@ -/* - * Copyright (C) 2005-2007 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program 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 General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.web.forms; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.OutputStream; - -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.ServiceRegistry; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.Pair; -import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.bean.wcm.AVMUtil; -import org.alfresco.web.ui.common.Utils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.xml.sax.SAXException; - -/** - * Encapsulation of a rendition. - * - * @author Ariel Backenroth - */ -/* package */ class RenditionImpl - implements Rendition -{ - - private static final Log LOGGER = LogFactory.getLog(RenditionImpl.class); - - private final NodeRef nodeRef; - private final FormsService formsService; - private transient RenderingEngineTemplate renderingEngineTemplate; - - /* package */ RenditionImpl(final NodeRef nodeRef, final FormsService formsService) - { - if (nodeRef == null) - { - throw new NullPointerException(); - } - if (formsService == null) - { - throw new NullPointerException(); - } - final AVMService avmService = this.getServiceRegistry().getAVMService(); - if (!avmService.hasAspect(AVMNodeConverter.ToAVMVersionPath(nodeRef).getFirst(), - AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond(), - WCMAppModel.ASPECT_RENDITION)) - { - throw new IllegalArgumentException("node " + nodeRef + - " does not have aspect " + WCMAppModel.ASPECT_RENDITION); - } - this.nodeRef = nodeRef; - this.formsService = formsService; - } - - /* package */ RenditionImpl(final int version, - final String avmPath, - final FormsService formsService) - { - this(AVMNodeConverter.ToNodeRef(version, avmPath), formsService); - } - - /** the name of this rendition */ - public String getName() - { -// final AVMService avmService = this.getServiceRegistry().getAVMService(); -// return avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(), -// AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(), -// ContentModel.PROP_NAME).getStringValue(); - return AVMNodeConverter.SplitBase(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond())[1]; - } - - /** the description of this rendition */ - public String getDescription() - { - final AVMService avmService = this.getServiceRegistry().getAVMService(); - return avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(), - AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(), - ContentModel.PROP_DESCRIPTION).getStringValue(); - } - - public String getWebappRelativePath() - { - return AVMUtil.getWebappRelativePath(this.getPath()); - } - - public String getSandboxRelativePath() - { - return AVMUtil.getSandboxRelativePath(this.getPath()); - } - - public FormInstanceData getPrimaryFormInstanceData() - throws FileNotFoundException - { - final AVMService avmService = this.getServiceRegistry().getAVMLockingAwareService(); - final String fidAVMStoreRelativePath = (String) - avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(), - AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(), - WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA).getValue(DataTypeDefinition.TEXT); - String avmStore = AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(); - avmStore = avmStore.substring(0, avmStore.indexOf(':')); - final String path = avmStore + ':' + fidAVMStoreRelativePath; - if (avmService.lookup(-1, path) == null) - { - throw new FileNotFoundException("unable to find primary form instance data " + path); - } - return this.formsService.getFormInstanceData(-1, path); - } - - /** the rendering engine template that generated this rendition */ - public RenderingEngineTemplate getRenderingEngineTemplate() - { - if (this.renderingEngineTemplate == null) - { - final AVMService avmService = this.getServiceRegistry().getAVMLockingAwareService(); - PropertyValue pv = - avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(), - AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(), - WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE); - if (pv == null) - { - LOGGER.debug("property " + WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE + - " not set on " + this.getPath()); - return null; - } - - final NodeRef retNodeRef = (NodeRef)pv.getValue(DataTypeDefinition.NODE_REF); - if (retNodeRef == null) - { - LOGGER.debug("unable to locate parent rendering engine template of rendition " + - this.getPath()); - return null; - } - pv = avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(), - AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(), - WCMAppModel.PROP_PARENT_RENDITION_PROPERTIES); - if (pv == null) - { - LOGGER.debug("property " + WCMAppModel.PROP_PARENT_RENDITION_PROPERTIES + - " not set on " + this.getPath()); - return null; - } - - final NodeRef rpNodeRef = (NodeRef)pv.getValue(DataTypeDefinition.NODE_REF); - if (rpNodeRef == null) - { - LOGGER.debug("unable to locate parent rendering engine template properties of rendition " + - this.getPath()); - return null; - } - this.renderingEngineTemplate = new RenderingEngineTemplateImpl(retNodeRef, rpNodeRef, this.formsService); - } - return this.renderingEngineTemplate; - } - - /** the node ref containing the contents of this rendition */ - public NodeRef getNodeRef() - { - return this.nodeRef; - } - - public String getPath() - { - return AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(); - } - - public String getUrl() - { - return AVMUtil.buildAssetUrl(this.getPath()); - } - - public String getFileTypeImage() - { - return Utils.getFileTypeImage(this.getName(), false); - } - - public OutputStream getOutputStream() - { - final AVMService avmService = this.getServiceRegistry().getAVMLockingAwareService(); - final Pair p = AVMNodeConverter.ToAVMVersionPath(this.nodeRef); - return (avmService.lookup(p.getFirst(), p.getSecond()) == null - ? avmService.createFile(AVMNodeConverter.SplitBase(p.getSecond())[0], - AVMNodeConverter.SplitBase(p.getSecond())[1]) - : avmService.getFileOutputStream(this.getPath())); - } - - public void regenerate() - throws IOException, - RenderingEngine.RenderingException, - SAXException - { - this.regenerate(this.getPrimaryFormInstanceData()); - } - - @Deprecated - public void regenerate(final FormInstanceData formInstanceData) - throws IOException, - RenderingEngine.RenderingException, - SAXException - { - this.getRenderingEngineTemplate().render(formInstanceData, this); - } - - private ServiceRegistry getServiceRegistry() - { - final FacesContext fc = FacesContext.getCurrentInstance(); - return Repository.getServiceRegistry(fc); - } - - public int hashCode() - { - return this.getPath().hashCode(); - } - - public boolean equals(final Object other) - { - return (other instanceof RenditionImpl && - this.getNodeRef().equals(((RenditionImpl)other).getNodeRef())); - } - - public String toString() - { - return (this.getClass().getName() + - "{path : " + this.getPath() + - ", rendering_engine_template : " + this.getRenderingEngineTemplate() + - "}"); - } -} +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program 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 General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.forms; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.OutputStream; + +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.ServiceRegistry; +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.util.Pair; +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.ui.common.Utils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.xml.sax.SAXException; + +/** + * Encapsulation of a rendition. + * + * @author Ariel Backenroth + */ +/* package */ class RenditionImpl + implements Rendition +{ + + private static final long serialVersionUID = -342658762155499039L; + + private static final Log LOGGER = LogFactory.getLog(RenditionImpl.class); + + private final NodeRef nodeRef; + transient private FormsService formsService; + transient private RenderingEngineTemplate renderingEngineTemplate; + + /* package */ RenditionImpl(final NodeRef nodeRef, final FormsService formsService) + { + if (nodeRef == null) + { + throw new NullPointerException(); + } + if (formsService == null) + { + throw new NullPointerException(); + } + final AVMService avmService = this.getServiceRegistry().getAVMService(); + if (!avmService.hasAspect(AVMNodeConverter.ToAVMVersionPath(nodeRef).getFirst(), + AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond(), + WCMAppModel.ASPECT_RENDITION)) + { + throw new IllegalArgumentException("node " + nodeRef + + " does not have aspect " + WCMAppModel.ASPECT_RENDITION); + } + this.nodeRef = nodeRef; + this.formsService = formsService; + } + + /* package */ RenditionImpl(final int version, + final String avmPath, + final FormsService formsService) + { + this(AVMNodeConverter.ToNodeRef(version, avmPath), formsService); + } + + private FormsService getFormsService() + { + if (formsService == null) + { + formsService = (FormsService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "FormsService"); + } + return formsService; + } + + + /** the name of this rendition */ + public String getName() + { +// final AVMService avmService = this.getServiceRegistry().getAVMService(); +// return avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(), +// AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(), +// ContentModel.PROP_NAME).getStringValue(); + return AVMNodeConverter.SplitBase(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond())[1]; + } + + /** the description of this rendition */ + public String getDescription() + { + final AVMService avmService = this.getServiceRegistry().getAVMService(); + return avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(), + AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(), + ContentModel.PROP_DESCRIPTION).getStringValue(); + } + + public String getWebappRelativePath() + { + return AVMUtil.getWebappRelativePath(this.getPath()); + } + + public String getSandboxRelativePath() + { + return AVMUtil.getSandboxRelativePath(this.getPath()); + } + + public FormInstanceData getPrimaryFormInstanceData() + throws FileNotFoundException + { + final AVMService avmService = this.getServiceRegistry().getAVMLockingAwareService(); + final String fidAVMStoreRelativePath = (String) + avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(), + AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(), + WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA).getValue(DataTypeDefinition.TEXT); + String avmStore = AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(); + avmStore = avmStore.substring(0, avmStore.indexOf(':')); + final String path = avmStore + ':' + fidAVMStoreRelativePath; + if (avmService.lookup(-1, path) == null) + { + throw new FileNotFoundException("unable to find primary form instance data " + path); + } + return this.getFormsService().getFormInstanceData(-1, path); + } + + /** the rendering engine template that generated this rendition */ + public RenderingEngineTemplate getRenderingEngineTemplate() + { + if (this.renderingEngineTemplate == null) + { + final AVMService avmService = this.getServiceRegistry().getAVMLockingAwareService(); + PropertyValue pv = + avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(), + AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(), + WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE); + if (pv == null) + { + LOGGER.debug("property " + WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE + + " not set on " + this.getPath()); + return null; + } + + final NodeRef retNodeRef = (NodeRef)pv.getValue(DataTypeDefinition.NODE_REF); + if (retNodeRef == null) + { + LOGGER.debug("unable to locate parent rendering engine template of rendition " + + this.getPath()); + return null; + } + pv = avmService.getNodeProperty(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getFirst(), + AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(), + WCMAppModel.PROP_PARENT_RENDITION_PROPERTIES); + if (pv == null) + { + LOGGER.debug("property " + WCMAppModel.PROP_PARENT_RENDITION_PROPERTIES + + " not set on " + this.getPath()); + return null; + } + + final NodeRef rpNodeRef = (NodeRef)pv.getValue(DataTypeDefinition.NODE_REF); + if (rpNodeRef == null) + { + LOGGER.debug("unable to locate parent rendering engine template properties of rendition " + + this.getPath()); + return null; + } + this.renderingEngineTemplate = new RenderingEngineTemplateImpl(retNodeRef, rpNodeRef, this.getFormsService()); + } + return this.renderingEngineTemplate; + } + + /** the node ref containing the contents of this rendition */ + public NodeRef getNodeRef() + { + return this.nodeRef; + } + + public String getPath() + { + return AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond(); + } + + public String getUrl() + { + return AVMUtil.buildAssetUrl(this.getPath()); + } + + public String getFileTypeImage() + { + return Utils.getFileTypeImage(this.getName(), false); + } + + public OutputStream getOutputStream() + { + final AVMService avmService = this.getServiceRegistry().getAVMLockingAwareService(); + final Pair p = AVMNodeConverter.ToAVMVersionPath(this.nodeRef); + return (avmService.lookup(p.getFirst(), p.getSecond()) == null + ? avmService.createFile(AVMNodeConverter.SplitBase(p.getSecond())[0], + AVMNodeConverter.SplitBase(p.getSecond())[1]) + : avmService.getFileOutputStream(this.getPath())); + } + + public void regenerate() + throws IOException, + RenderingEngine.RenderingException, + SAXException + { + this.regenerate(this.getPrimaryFormInstanceData()); + } + + @Deprecated + public void regenerate(final FormInstanceData formInstanceData) + throws IOException, + RenderingEngine.RenderingException, + SAXException + { + this.getRenderingEngineTemplate().render(formInstanceData, this); + } + + private ServiceRegistry getServiceRegistry() + { + final FacesContext fc = FacesContext.getCurrentInstance(); + return Repository.getServiceRegistry(fc); + } + + public int hashCode() + { + return this.getPath().hashCode(); + } + + public boolean equals(final Object other) + { + return (other instanceof RenditionImpl && + this.getNodeRef().equals(((RenditionImpl)other).getNodeRef())); + } + + public String toString() + { + return (this.getClass().getName() + + "{path : " + this.getPath() + + ", rendering_engine_template : " + this.getRenderingEngineTemplate() + + "}"); + } +} diff --git a/source/java/org/alfresco/web/forms/xforms/Schema2XForms.java b/source/java/org/alfresco/web/forms/xforms/Schema2XForms.java index a091f0f36f..f77ef1fb2d 100644 --- a/source/java/org/alfresco/web/forms/xforms/Schema2XForms.java +++ b/source/java/org/alfresco/web/forms/xforms/Schema2XForms.java @@ -25,6 +25,7 @@ package org.alfresco.web.forms.xforms; import java.io.File; import java.io.IOException; +import java.io.Serializable; import java.io.StringWriter; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -53,7 +54,7 @@ import org.w3c.dom.ls.*; * * @author $Author: unl $ */ -public class Schema2XForms +public class Schema2XForms implements Serializable { ///////////////////////////////////////////////////////////////////////////// diff --git a/source/java/org/alfresco/web/forms/xforms/XFormsBean.java b/source/java/org/alfresco/web/forms/xforms/XFormsBean.java index 73ec6765cd..9f43157714 100644 --- a/source/java/org/alfresco/web/forms/xforms/XFormsBean.java +++ b/source/java/org/alfresco/web/forms/xforms/XFormsBean.java @@ -24,6 +24,7 @@ package org.alfresco.web.forms.xforms; import java.io.IOException; +import java.io.Serializable; import java.util.Collection; import java.util.Collections; import java.util.Iterator; @@ -40,7 +41,6 @@ import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.web.app.Application; import org.alfresco.web.app.servlet.FacesHelper; import org.alfresco.web.bean.NavigationBean; @@ -81,8 +81,9 @@ import org.xml.sax.SAXException; * Bean for interacting with the chiba processor from the ui using ajax requests. * Manages the chiba bean lifecycle. */ -public class XFormsBean +public class XFormsBean implements Serializable { + private static final long serialVersionUID = -7979077333882370784L; ///////////////////////////////////////////////////////////////////////////// @@ -102,7 +103,7 @@ public class XFormsBean } final FacesContext fc = FacesContext.getCurrentInstance(); //make the XFormsBean available for this session - final XFormsBean xforms = (XFormsBean)FacesHelper.getManagedBean(fc, "XFormsBean"); + final XFormsBean xforms = (XFormsBean)FacesHelper.getManagedBean(fc, BEAN_NAME); xforms.handleSubmit(instance); return Collections.EMPTY_MAP; } @@ -114,14 +115,12 @@ public class XFormsBean */ class XFormsSession implements FormProcessor.Session { - private final Document formInstanceData; private final String formInstanceDataName; private final Form form; private ChibaBean chibaBean; private final Schema2XForms schema2XForms; -// private final Set uploads = new HashSet(); private final List eventLog = new LinkedList(); public XFormsSession(final Document formInstanceData, @@ -170,15 +169,12 @@ public class XFormsBean private static final Log LOGGER = LogFactory.getLog(XFormsBean.class); private XFormsSession xformsSession; - private Schema2XFormsProperties schema2XFormsProperties; + private transient Schema2XFormsProperties schema2XFormsProperties; private AVMBrowseBean avmBrowseBean; - private AVMService avmService; private NavigationBean navigator; - public XFormsBean() - { - } - + public static String BEAN_NAME = "XFormsBean"; + /** * @param schema2XFormsProperties the schema2XFormsProperties to set. */ @@ -186,6 +182,16 @@ public class XFormsBean { this.schema2XFormsProperties = schema2XFormsProperties; } + + protected Schema2XFormsProperties getSchema2XFormsProperties() + { + if (schema2XFormsProperties == null) + { + schema2XFormsProperties = (Schema2XFormsProperties)FacesHelper.getManagedBean( + FacesContext.getCurrentInstance(), "Schema2XFormsProperties"); + } + return schema2XFormsProperties; + } /** * @param avmBrowseBean the avmBrowseBean to set. @@ -199,14 +205,6 @@ public class XFormsBean { this.navigator = navigator; } - - /** - * @param avmService the avmService to set. - */ - public void setAvmService(final AVMService avmService) - { - this.avmService = avmService; - } /** @param xformsSession the current session */ public void setXFormsSession(final XFormsSession xformsSession) @@ -224,7 +222,6 @@ public class XFormsBean final ChibaBean chibaBean = new ChibaBean(); chibaBean.setConfig(servletContext.getRealPath("/WEB-INF/chiba.xml")); -// XFormsBean.storeCookies(request.getCookies(), chibaBean); chibaBean.setXMLContainer(this.getXFormsDocument()); final EventTarget et = (EventTarget) @@ -234,7 +231,8 @@ public class XFormsBean public void handleEvent(final Event e) { final XMLEvent xmle = (XMLEvent)e; - XFormsBean.LOGGER.debug("received event " + xmle.getType() + ": " + xmle); + if (XFormsBean.LOGGER.isDebugEnabled()) + XFormsBean.LOGGER.debug("received event " + xmle.getType() + ": " + xmle); XFormsBean.this.xformsSession.eventLog.add(xmle); } }; @@ -310,7 +308,8 @@ public class XFormsBean throws IOException, XFormsException { - LOGGER.debug(this + ".getXForm()"); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(this + ".getXForm()"); final FacesContext context = FacesContext.getCurrentInstance(); final ResponseWriter out = context.getResponseWriter(); final ChibaBean chibaBean = this.xformsSession.chibaBean; @@ -329,7 +328,8 @@ public class XFormsBean final String id = (String)requestParameters.get("id"); final String value = (String)requestParameters.get("value"); - LOGGER.debug(this + ".setXFormsValue(" + id + ", " + value + ")"); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(this + ".setXFormsValue(" + id + ", " + value + ")"); final ChibaBean chibaBean = this.xformsSession.chibaBean; if (chibaBean.getContainer().lookup(id) instanceof Upload) { @@ -354,11 +354,13 @@ public class XFormsBean final FacesContext context = FacesContext.getCurrentInstance(); final Map requestParameters = context.getExternalContext().getRequestParameterMap(); final String repeatIds = (String)requestParameters.get("repeatIds"); - LOGGER.debug(this + ".setRepeatIndeces(" + repeatIds + ")"); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(this + ".setRepeatIndeces(" + repeatIds + ")"); for (String id : repeatIds.split(",")) { final int index = Integer.parseInt((String)requestParameters.get(id)); - LOGGER.debug(this + ".setRepeatIndex(" + id + ", " + index + ")"); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(this + ".setRepeatIndex(" + id + ", " + index + ")"); final ChibaBean chibaBean = this.xformsSession.chibaBean; chibaBean.updateRepeatIndex(id, index); } @@ -377,7 +379,8 @@ public class XFormsBean final Map requestParameters = context.getExternalContext().getRequestParameterMap(); final String id = (String)requestParameters.get("id"); - LOGGER.debug(this + ".fireAction(" + id + ")"); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(this + ".fireAction(" + id + ")"); final ChibaBean chibaBean = this.xformsSession.chibaBean; chibaBean.dispatch(id, DOMEventNames.ACTIVATE); @@ -391,7 +394,8 @@ public class XFormsBean */ public void handleAction() { - LOGGER.debug(this + ".handleAction"); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(this + ".handleAction"); try { final FacesContext context = FacesContext.getCurrentInstance(); @@ -439,7 +443,8 @@ public class XFormsBean final String fromItemId = (String)requestParameters.get("fromItemId"); final String toItemId = (String)requestParameters.get("toItemId"); - LOGGER.debug(this + ".swapRepeatItems(" + fromItemId + ", " + toItemId + ")"); + if (LOGGER.isDebugEnabled()) + LOGGER.debug(this + ".swapRepeatItems(" + fromItemId + ", " + toItemId + ")"); final ChibaBean chibaBean = this.xformsSession.chibaBean; final RepeatItem from = (RepeatItem)chibaBean.getContainer().lookup(fromItemId); if (from == null) @@ -462,9 +467,11 @@ public class XFormsBean final RepeatItem to) throws XFormsException { - LOGGER.debug("swapping repeat item " + from + " with " + to); - - LOGGER.debug("from instance id " + from.getInstanceId()); + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("swapping repeat item " + from + " with " + to); + LOGGER.debug("from instance id " + from.getInstanceId()); + } final Model model = from.getModel(); final Instance instance = model.getInstance(from.getInstanceId()); assert instance == to.getModel().getInstance(to.getInstanceId()); @@ -491,7 +498,8 @@ public class XFormsBean : to.getRepeat().getLocationPath().replaceAll("\\[position\\(\\)[\\s]*!=[\\s]*last\\(\\)]$", "[position()=last()]")); } - LOGGER.debug("inserting node before " + beforeLocation); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("inserting node before " + beforeLocation); instance.insertNode(fromLocationPath, beforeLocation); model.getContainer().dispatch(model.getTarget(), XFormsEventNames.REBUILD, null); @@ -499,7 +507,8 @@ public class XFormsBean model.getContainer().dispatch(model.getTarget(), XFormsEventNames.REVALIDATE, null); model.getContainer().dispatch(model.getTarget(), XFormsEventNames.REFRESH, null); - LOGGER.debug("deleting from " + from.getLocationPath()); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("deleting from " + from.getLocationPath()); // need to reload from location path since it has moved instance.deleteNode(from.getLocationPath()); @@ -528,7 +537,8 @@ public class XFormsBean final NodeList nl = XMLUtil.combine(schemaDocument.getElementsByTagNameNS(NamespaceConstants.XMLSCHEMA_NS, "include"), schemaDocument.getElementsByTagNameNS(NamespaceConstants.XMLSCHEMA_NS, "import")); - LOGGER.debug("rewriting " + nl.getLength() + " includes"); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("rewriting " + nl.getLength() + " includes"); for (int i = 0; i < nl.getLength(); i++) { final Element includeEl = (Element)nl.item(i); @@ -537,7 +547,8 @@ public class XFormsBean String uri = includeEl.getAttribute("schemaLocation"); if (uri != null && uri.startsWith("http://")) { - LOGGER.debug("not rewriting " + uri); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("not rewriting " + uri); continue; } @@ -545,7 +556,8 @@ public class XFormsBean ? AVMUtil.buildStoreUrl(cwdAvmPath) : AVMUtil.buildAssetUrl(cwdAvmPath)); - LOGGER.debug("rewriting " + uri + " as " + (baseURI + uri)); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("rewriting " + uri + " as " + (baseURI + uri)); includeEl.setAttribute("schemaLocation", baseURI + uri); } } @@ -677,7 +689,7 @@ public class XFormsBean final Locale locale = Application.getLanguage(FacesContext.getCurrentInstance()); final ResourceBundle resourceBundle = - this.schema2XFormsProperties.getResourceBundle(this.xformsSession.form, + getSchema2XFormsProperties().getResourceBundle(this.xformsSession.form, locale); try { diff --git a/source/java/org/alfresco/web/forms/xforms/XFormsProcessor.java b/source/java/org/alfresco/web/forms/xforms/XFormsProcessor.java index 36220e5bc1..bb5bffd1d1 100644 --- a/source/java/org/alfresco/web/forms/xforms/XFormsProcessor.java +++ b/source/java/org/alfresco/web/forms/xforms/XFormsProcessor.java @@ -17,35 +17,39 @@ */ package org.alfresco.web.forms.xforms; -import java.io.*; +import java.io.Writer; import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.ResourceBundle; +import java.util.TreeSet; + import javax.faces.context.FacesContext; -import javax.servlet.http.HttpServletRequest; import org.alfresco.config.ConfigElement; import org.alfresco.config.ConfigService; import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.web.app.Application; +import org.alfresco.web.app.servlet.FacesHelper; import org.alfresco.web.bean.wcm.AVMBrowseBean; import org.alfresco.web.bean.wcm.AVMUtil; -import org.alfresco.web.forms.*; +import org.alfresco.web.forms.Form; +import org.alfresco.web.forms.FormProcessor; +import org.alfresco.web.forms.XMLUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chiba.xml.ns.NamespaceConstants; +import org.chiba.xml.xforms.exception.XFormsException; import org.json.JSONException; import org.json.JSONObject; import org.springframework.web.util.JavaScriptUtils; - import org.w3c.dom.Document; import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.alfresco.web.app.Application; -import org.alfresco.web.app.servlet.FacesHelper; -import org.chiba.xml.ns.NamespaceConstants; -import org.chiba.xml.xforms.exception.XFormsException; -public class XFormsProcessor - implements FormProcessor +public class XFormsProcessor implements FormProcessor { private static final Log LOGGER = LogFactory.getLog(XFormsProcessor.class); @@ -116,7 +120,7 @@ public class XFormsProcessor final FacesContext fc = FacesContext.getCurrentInstance(); //make the XFormsBean available for this session final XFormsBean xforms = (XFormsBean) - FacesHelper.getManagedBean(fc, "XFormsBean"); + FacesHelper.getManagedBean(fc, XFormsBean.BEAN_NAME); final Session result = xforms.createSession(instanceDataDocument, formInstanceDataName, form); this.process(result, out); @@ -133,9 +137,9 @@ public class XFormsProcessor final FacesContext fc = FacesContext.getCurrentInstance(); //make the XFormsBean available for this session final XFormsBean xforms = (XFormsBean) - FacesHelper.getManagedBean(fc, "XFormsBean"); + FacesHelper.getManagedBean(fc, XFormsBean.BEAN_NAME); final AVMBrowseBean avmBrowseBean = (AVMBrowseBean) - FacesHelper.getManagedBean(fc, "AVMBrowseBean"); + FacesHelper.getManagedBean(fc, AVMBrowseBean.BEAN_NAME); try { xforms.setXFormsSession((XFormsBean.XFormsSession)session); diff --git a/source/java/org/alfresco/web/ui/common/component/UIGenericPicker.java b/source/java/org/alfresco/web/ui/common/component/UIGenericPicker.java index b764e3dca6..95bfab4803 100644 --- a/source/java/org/alfresco/web/ui/common/component/UIGenericPicker.java +++ b/source/java/org/alfresco/web/ui/common/component/UIGenericPicker.java @@ -122,7 +122,7 @@ public class UIGenericPicker extends UICommand height = (Integer)values[6]; filterIndex = (Integer)values[7]; contains = (String)values[8]; - queryCallback = (MethodBinding)values[9]; + queryCallback = (MethodBinding) restoreAttachedState(context, values[9]); selectedResults = (String[])values[10]; currentResults = (SelectItem[])values[11]; filters = (SelectItem[])values[12]; @@ -146,7 +146,7 @@ public class UIGenericPicker extends UICommand values[6] = height; values[7] = filterIndex; values[8] = contains; - values[9] = queryCallback; + values[9] = saveAttachedState(context, queryCallback); values[10] = selectedResults; values[11] = currentResults; values[12] = filters; diff --git a/source/java/org/alfresco/web/ui/common/component/UIListItem.java b/source/java/org/alfresco/web/ui/common/component/UIListItem.java index 070fa51292..0c2783c333 100644 --- a/source/java/org/alfresco/web/ui/common/component/UIListItem.java +++ b/source/java/org/alfresco/web/ui/common/component/UIListItem.java @@ -24,17 +24,21 @@ */ package org.alfresco.web.ui.common.component; +import java.io.Serializable; + import javax.faces.context.FacesContext; import javax.faces.el.ValueBinding; /** * @author kevinr */ -public class UIListItem extends SelfRenderingComponent +public class UIListItem extends SelfRenderingComponent implements Serializable { // ------------------------------------------------------------------------------ // Component Impl + private static final long serialVersionUID = 6654796229844597265L; + /** * @see javax.faces.component.UIComponent#getFamily() */ diff --git a/source/java/org/alfresco/web/ui/common/component/UIPanel.java b/source/java/org/alfresco/web/ui/common/component/UIPanel.java index 00845a974f..61de0993bd 100644 --- a/source/java/org/alfresco/web/ui/common/component/UIPanel.java +++ b/source/java/org/alfresco/web/ui/common/component/UIPanel.java @@ -42,6 +42,7 @@ import javax.faces.event.FacesEvent; import org.alfresco.web.ui.common.PanelGenerator; import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.WebResources; +import org.apache.myfaces.el.MethodBindingImpl; /** * @author kevinr @@ -334,7 +335,7 @@ public class UIPanel extends UICommand this.titleBgcolor = (String)values[6]; this.titleBorder = (String)values[7]; this.expandedTitleBorder = (String)values[8]; - this.expandedActionListener = (MethodBinding)values[9]; + this.expandedActionListener = (MethodBindingImpl) restoreAttachedState(context, values[9]); this.facetsId = (String)values[10]; } @@ -353,7 +354,7 @@ public class UIPanel extends UICommand this.titleBgcolor, this.titleBorder, this.expandedTitleBorder, - this.expandedActionListener, + saveAttachedState(context, this.expandedActionListener), this.facetsId}; return values; } diff --git a/source/java/org/alfresco/web/ui/common/component/UIStatusMessage.java b/source/java/org/alfresco/web/ui/common/component/UIStatusMessage.java index 5ff5a315ed..85691d110e 100644 --- a/source/java/org/alfresco/web/ui/common/component/UIStatusMessage.java +++ b/source/java/org/alfresco/web/ui/common/component/UIStatusMessage.java @@ -25,6 +25,7 @@ package org.alfresco.web.ui.common.component; import java.io.IOException; +import java.io.Serializable; import java.util.Date; import java.util.Iterator; import java.util.LinkedList; @@ -50,8 +51,11 @@ import org.alfresco.web.ui.common.WebResources; /** * @author Kevin Roast */ -public class UIStatusMessage extends SelfRenderingComponent +public class UIStatusMessage extends SelfRenderingComponent implements Serializable { + private static final long serialVersionUID = -575221861760604440L; + + /** * Default Constructor */ diff --git a/source/java/org/alfresco/web/ui/common/component/data/IGridDataModel.java b/source/java/org/alfresco/web/ui/common/component/data/IGridDataModel.java index c4a00ac729..4befa7fd6f 100644 --- a/source/java/org/alfresco/web/ui/common/component/data/IGridDataModel.java +++ b/source/java/org/alfresco/web/ui/common/component/data/IGridDataModel.java @@ -24,10 +24,12 @@ */ package org.alfresco.web.ui.common.component.data; +import java.io.Serializable; + /** * @author kevinr */ -public interface IGridDataModel +public interface IGridDataModel extends Serializable { /** * Get a row object for the specified row index diff --git a/source/java/org/alfresco/web/ui/common/component/data/UIRichList.java b/source/java/org/alfresco/web/ui/common/component/data/UIRichList.java index 2f1a3845ff..3b6ab59b50 100644 --- a/source/java/org/alfresco/web/ui/common/component/data/UIRichList.java +++ b/source/java/org/alfresco/web/ui/common/component/data/UIRichList.java @@ -24,6 +24,7 @@ */ package org.alfresco.web.ui.common.component.data; +import java.io.Serializable; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -45,11 +46,13 @@ import org.apache.commons.logging.LogFactory; /** * @author Kevin Roast */ -public class UIRichList extends UIComponentBase implements IDataContainer +public class UIRichList extends UIComponentBase implements IDataContainer,Serializable { // ------------------------------------------------------------------------------ // Construction + private static final long serialVersionUID = 4302199745018058173L; + /** * Default constructor */ diff --git a/source/java/org/alfresco/web/ui/common/component/description/UIDescription.java b/source/java/org/alfresco/web/ui/common/component/description/UIDescription.java index 9b72b0c8d1..e565c0a66d 100644 --- a/source/java/org/alfresco/web/ui/common/component/description/UIDescription.java +++ b/source/java/org/alfresco/web/ui/common/component/description/UIDescription.java @@ -24,6 +24,8 @@ */ package org.alfresco.web.ui.common.component.description; +import java.io.Serializable; + import javax.faces.context.FacesContext; import javax.faces.el.ValueBinding; @@ -34,8 +36,10 @@ import org.alfresco.web.ui.common.component.SelfRenderingComponent; * * @author gavinc */ -public class UIDescription extends SelfRenderingComponent +public class UIDescription extends SelfRenderingComponent implements Serializable { + private static final long serialVersionUID = -2319791691993957792L; + private String controlValue; private String text; diff --git a/source/java/org/alfresco/web/ui/common/renderer/data/IRichListRenderer.java b/source/java/org/alfresco/web/ui/common/renderer/data/IRichListRenderer.java index 096ba4b2d5..e74e85eaf0 100644 --- a/source/java/org/alfresco/web/ui/common/renderer/data/IRichListRenderer.java +++ b/source/java/org/alfresco/web/ui/common/renderer/data/IRichListRenderer.java @@ -25,6 +25,7 @@ package org.alfresco.web.ui.common.renderer.data; import java.io.IOException; +import java.io.Serializable; import javax.faces.context.FacesContext; @@ -37,7 +38,7 @@ import org.alfresco.web.ui.common.component.data.UIRichList; * * @author kevinr */ -public interface IRichListRenderer +public interface IRichListRenderer extends Serializable { /** * Callback executed by the RichList component to render any adornments before diff --git a/source/java/org/alfresco/web/ui/common/renderer/data/RichListRenderer.java b/source/java/org/alfresco/web/ui/common/renderer/data/RichListRenderer.java index b263a08140..54cd9db0a8 100644 --- a/source/java/org/alfresco/web/ui/common/renderer/data/RichListRenderer.java +++ b/source/java/org/alfresco/web/ui/common/renderer/data/RichListRenderer.java @@ -25,6 +25,7 @@ package org.alfresco.web.ui.common.renderer.data; import java.io.IOException; +import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -171,6 +172,8 @@ public class RichListRenderer extends BaseRenderer */ public static class DetailsViewRenderer implements IRichListRenderer { + private static final long serialVersionUID = -2753231623981676639L; + public static final String VIEWMODEID = "details"; public String getViewModeID() @@ -329,6 +332,8 @@ public class RichListRenderer extends BaseRenderer */ public static class ListViewRenderer implements IRichListRenderer { + private static final long serialVersionUID = -6468162313606829713L; + // maximum displayable textual lines within a single item cell private final static int MAX_DISPLAYABLE_LINES = 3; @@ -521,6 +526,8 @@ public class RichListRenderer extends BaseRenderer */ public static class IconViewRenderer implements IRichListRenderer { + private static final long serialVersionUID = -1961880941305536121L; + // number of vertical columns to render before starting new row private final static int COLUMNS = 3; diff --git a/source/java/org/alfresco/web/ui/repo/component/UITree.java b/source/java/org/alfresco/web/ui/repo/component/UITree.java index 649c2d8b96..3e21ab3974 100644 --- a/source/java/org/alfresco/web/ui/repo/component/UITree.java +++ b/source/java/org/alfresco/web/ui/repo/component/UITree.java @@ -24,8 +24,8 @@ */ package org.alfresco.web.ui.repo.component; +import java.io.Serializable; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import javax.faces.component.UIComponentBase; @@ -261,8 +261,10 @@ public class UITree extends UIComponentBase * * @author gavinc */ - public static class TreeNode + public static class TreeNode implements Serializable { + private static final long serialVersionUID = 8820468648920825139L; + private String nodeRef; private String name; private String icon; diff --git a/source/java/org/alfresco/web/ui/repo/component/shelf/UIClipboardShelfItem.java b/source/java/org/alfresco/web/ui/repo/component/shelf/UIClipboardShelfItem.java index 3877259716..e01203e32b 100644 --- a/source/java/org/alfresco/web/ui/repo/component/shelf/UIClipboardShelfItem.java +++ b/source/java/org/alfresco/web/ui/repo/component/shelf/UIClipboardShelfItem.java @@ -69,7 +69,7 @@ public class UIClipboardShelfItem extends UIShelfItem // standard component attributes are restored by the super class super.restoreState(context, values[0]); this.collections = (List)values[1]; - this.pasteActionListener = (MethodBinding)values[2]; + this.pasteActionListener = (MethodBinding) restoreAttachedState(context, values[2]); } /** @@ -81,7 +81,7 @@ public class UIClipboardShelfItem extends UIShelfItem // standard component attributes are saved by the super class values[0] = super.saveState(context); values[1] = this.collections; - values[2] = this.pasteActionListener; + values[2] = saveAttachedState(context, this.pasteActionListener); return values; } diff --git a/source/java/org/alfresco/web/ui/repo/component/shelf/UIRecentSpacesShelfItem.java b/source/java/org/alfresco/web/ui/repo/component/shelf/UIRecentSpacesShelfItem.java index 553909b381..3df03a9e80 100644 --- a/source/java/org/alfresco/web/ui/repo/component/shelf/UIRecentSpacesShelfItem.java +++ b/source/java/org/alfresco/web/ui/repo/component/shelf/UIRecentSpacesShelfItem.java @@ -61,7 +61,7 @@ public class UIRecentSpacesShelfItem extends UIShelfItem // standard component attributes are restored by the super class super.restoreState(context, values[0]); this.value = values[1]; - this.navigateActionListener = (MethodBinding)values[2]; + this.navigateActionListener = (MethodBinding) restoreAttachedState(context, values[2]); } /** @@ -73,7 +73,7 @@ public class UIRecentSpacesShelfItem extends UIShelfItem // standard component attributes are saved by the super class values[0] = super.saveState(context); values[1] = this.value; - values[2] = this.navigateActionListener; + values[2] = saveAttachedState(context, this.navigateActionListener); return (values); } diff --git a/source/java/org/alfresco/web/ui/repo/component/shelf/UIShelf.java b/source/java/org/alfresco/web/ui/repo/component/shelf/UIShelf.java index e52b5092be..dfc4556248 100644 --- a/source/java/org/alfresco/web/ui/repo/component/shelf/UIShelf.java +++ b/source/java/org/alfresco/web/ui/repo/component/shelf/UIShelf.java @@ -73,7 +73,7 @@ public class UIShelf extends SelfRenderingComponent this.selectedGroupBgcolor = (String)values[4]; this.innerGroupPanel = (String)values[5]; this.innerGroupBgcolor = (String)values[6]; - this.groupExpandedActionListener = (MethodBinding)values[7]; + this.groupExpandedActionListener = (MethodBinding)restoreAttachedState(context, values[7]); } /** @@ -90,7 +90,7 @@ public class UIShelf extends SelfRenderingComponent values[4] = this.selectedGroupBgcolor; values[5] = this.innerGroupPanel; values[6] = this.innerGroupBgcolor; - values[7] = this.groupExpandedActionListener; + values[7] = saveAttachedState(context, this.groupExpandedActionListener); return values; } diff --git a/source/java/org/alfresco/web/ui/repo/component/shelf/UIShortcutsShelfItem.java b/source/java/org/alfresco/web/ui/repo/component/shelf/UIShortcutsShelfItem.java index cc3b0e36f9..20aa7204dd 100644 --- a/source/java/org/alfresco/web/ui/repo/component/shelf/UIShortcutsShelfItem.java +++ b/source/java/org/alfresco/web/ui/repo/component/shelf/UIShortcutsShelfItem.java @@ -65,8 +65,8 @@ public class UIShortcutsShelfItem extends UIShelfItem // standard component attributes are restored by the super class super.restoreState(context, values[0]); this.value = values[1]; - this.clickActionListener = (MethodBinding)values[2]; - this.removeActionListener = (MethodBinding)values[3]; + this.clickActionListener = (MethodBinding) restoreAttachedState(context, values[2]); + this.removeActionListener = (MethodBinding) restoreAttachedState(context, values[3]); } /** @@ -78,8 +78,8 @@ public class UIShortcutsShelfItem extends UIShelfItem // standard component attributes are saved by the super class values[0] = super.saveState(context); values[1] = this.value; - values[2] = this.clickActionListener; - values[3] = this.removeActionListener; + values[2] = saveAttachedState(context, this.clickActionListener); + values[3] = saveAttachedState(context, this.removeActionListener); return (values); } diff --git a/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java b/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java index 3b12ae8b9d..121ec195c9 100644 --- a/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java +++ b/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java @@ -25,6 +25,7 @@ package org.alfresco.web.ui.wcm.component; import java.io.IOException; +import java.io.Serializable; import java.text.DateFormat; import java.util.ArrayList; import java.util.Date; @@ -95,8 +96,10 @@ import org.springframework.web.jsf.FacesContextUtils; * * @author Kevin Roast */ -public class UIUserSandboxes extends SelfRenderingComponent +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"; @@ -161,7 +164,7 @@ public class UIUserSandboxes extends SelfRenderingComponent private String webapp; /** cached converter instance */ - private ByteSizeConverter sizeConverter = null; + transient private ByteSizeConverter sizeConverter = null; /** set of exanded user panels */ private Set expandedPanels = new HashSet(); diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index 4586df0072..7297d7e65c 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -1,4340 +1,4324 @@ - - - - - - - - - The bean for the Delete Category screen. - - MultilingualManageDialog - - org.alfresco.web.bean.ml.MultilingualManageDialog - - session - - browseBean - #{BrowseBean} - - - nodeService - #{NodeService} - - - multilingualContentService - #{MultilingualContentService} - - - contentFilterLanguagesService - #{ContentFilterLanguagesService} - - - editionService - #{EditionService} - - - versionService - #{VersionService} - - - translationDocument - #{DocumentDetailsDialog.translationDocument} - - - - - - The bean that make a document multilingual - - MakeMultilingualDialog - org.alfresco.web.bean.ml.MakeMultilingualDialog - session - - multilingualContentService - #{MultilingualContentService} - - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - userPreferencesBean - #{UserPreferencesBean} - - - - - - The bean that edit the multilinguals properties of a document - - EditMLContainerDialog - org.alfresco.web.bean.ml.EditMLContainerDialog - session - - multilingualContentService - #{MultilingualContentService} - - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - - - - The bean that add a new translation without content - - AddTranslationWithoutContentDialog - org.alfresco.web.bean.ml.AddTranslationWithoutContentDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - dictionaryService - #{DictionaryService} - - - browseBean - #{BrowseBean} - - - multilingualContentService - #{MultilingualContentService} - - - userPreferencesBean - #{UserPreferencesBean} - - - - - - The bean that add a translation with a content - - AddTranslationDialog - org.alfresco.web.bean.ml.AddTranslationDialog - session - - multilingualContentService - #{MultilingualContentService} - - - userPreferencesBean - #{UserPreferencesBean} - - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - contentService - #{ContentService} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - - - - The bean that backs up the Login screen - - LoginBean - org.alfresco.web.bean.LoginBean - session - - nodeService - #{NodeService} - - - authenticationService - #{AuthenticationService} - - - personService - #{PersonService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - userPreferencesBean - #{UserPreferencesBean} - - - - - - The bean that holds navigation state. - - NavigationBean - org.alfresco.web.bean.NavigationBean - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - namespaceService - #{NamespaceService} - - - cifsServer - #{cifsServer} - - - ruleService - #{RuleService} - - - userPreferencesBean - #{UserPreferencesBean} - - - authenticationService - #{AuthenticationService} - - - permissionService - #{PermissionService} - - - - - - The bean that holds folder browse state. - - BrowseBean - org.alfresco.web.bean.BrowseBean - session - - navigator - #{NavigationBean} - - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - lockService - #{LockService} - - - dictionaryService - #{DictionaryService} - - - fileFolderService - #{FileFolderService} - - - userPreferencesBean - #{UserPreferencesBean} - - - multilingualContentService - #{MultilingualContentService} - - - - - Bean that provides information for the About page - AboutBean - org.alfresco.web.bean.AboutBean - session - - descriptorService - #{DescriptorService} - - - - - Bean that manages the dialog framework - DialogManager - org.alfresco.web.bean.dialog.DialogManager - session - - - - Bean that manages the wizard framework - WizardManager - org.alfresco.web.bean.wizard.WizardManager - session - - - - - The bean that backs up the Create Space Dialog - - CreateSpaceDialog - org.alfresco.web.bean.spaces.CreateSpaceDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - namespaceService - #{NamespaceService} - - - - - - The bean that backs up the Create Space Wizard - - CreateSpaceWizard - org.alfresco.web.bean.spaces.CreateSpaceWizard - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - - - - The bean that backs up the Delete Space Dialog - - DeleteSpaceDialog - org.alfresco.web.bean.spaces.DeleteSpaceDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - - - - The bean that manages a users Clipboard state. - - ClipboardBean - org.alfresco.web.bean.clipboard.ClipboardBean - session - - - - - The bean that manages the state for the Recent Spaces Shelf component. - - RecentSpacesBean - org.alfresco.web.bean.spaces.RecentSpacesBean - session - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - - - - The bean that manages the state for the User Shortcuts Shelf component. - - UserShortcutsBean - org.alfresco.web.bean.users.UserShortcutsBean - session - - nodeService - #{NodeService} - - - browseBean - #{BrowseBean} - - - permissionService - #{PermissionService} - - - - - - The bean that holds a state for the Advanced Search screen. - - SearchProperties - org.alfresco.web.bean.search.SearchProperties - session - - - - - The bean that holds a state for the Advanced Search screen. - - AdvancedSearchDialog - org.alfresco.web.bean.search.AdvancedSearchDialog - session - - navigator - #{NavigationBean} - - - nodeService - #{NodeService} - - - namespaceService - #{NamespaceService} - - - searchService - #{SearchService} - - - permissionService - #{PermissionService} - - - properties - #{SearchProperties} - - - - - - The bean that holds state for the Users screen. - - UsersBeanProperties - org.alfresco.web.bean.users.UsersBeanProperties - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - authenticationService - #{AuthenticationService} - - - personService - #{PersonService} - - - contentUsageService - #{ContentUsageService} - - - - - - The bean that holds state for the User Management screens. - - UsersDialog - org.alfresco.web.bean.users.UsersDialog - session - - properties - #{UsersBeanProperties} - - - - - - The bean that holds state for the Groups Management screens. - - GroupsDialog - org.alfresco.web.bean.groups.GroupsDialog - session - - nodeService - #{NodeService} - - - authService - #{AuthorityService} - - - personService - #{PersonService} - - - - - - The bean that holds state for the Category Management screens. - - CategoriesProperties - org.alfresco.web.bean.CategoriesProperties - session - - categoryService - #{CategoryService} - - - - - - The bean that holds state for the Category Management screens. - - CategoriesDialog - org.alfresco.web.bean.categories.CategoriesDialog - session - - nodeService - #{NodeService} - - - categoryService - #{CategoryService} - - - - - - The bean that backs up the Edit Space Dialog - - EditSpaceDialog - org.alfresco.web.bean.spaces.EditSpaceDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - searchService - #{SearchService} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - - - - The bean that backs up the Add Content Dialog - - AddContentDialog - org.alfresco.web.bean.content.AddContentDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - contentService - #{ContentService} - - - dictionaryService - #{DictionaryService} - - - - - - The bean that backs up the Create Content Wizard - - CreateContentWizard - org.alfresco.web.bean.content.CreateContentWizard - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - contentService - #{ContentService} - - - dictionaryService - #{DictionaryService} - - - formsService - #{FormsService} - - - - - - The bean that backs up the Edit Content Wizard - - EditContentWizard - org.alfresco.web.bean.content.EditContentWizard - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - contentService - #{ContentService} - - - dictionaryService - #{DictionaryService} - - - formsService - #{FormsService} - - - - - - The bean that backs up the View Content Properties Dialog - - ViewContentPropertiesDialog - org.alfresco.web.bean.content.ViewContentPropertiesDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - dictionaryService - #{DictionaryService} - - - browseBean - #{BrowseBean} - - - - - - The bean that backs up the Set Content Properties Dialog - - SetContentPropertiesDialog - org.alfresco.web.bean.content.SetContentPropertiesDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - dictionaryService - #{DictionaryService} - - - browseBean - #{BrowseBean} - - - - - - The bean that backs up the Edit Content Properties Dialog - - EditContentPropertiesDialog - org.alfresco.web.bean.content.EditContentPropertiesDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - dictionaryService - #{DictionaryService} - - - browseBean - #{BrowseBean} - - - - - - The bean that backs up the Delete Content Dialog - - DeleteContentDialog - org.alfresco.web.bean.content.DeleteContentDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - multilingualContentService - #{MultilingualContentService} - - - - - - The bean that backs up the Link Properties Dialog - - LinkPropertiesDialog - org.alfresco.web.bean.LinkPropertiesDialog - session - - nodeService - #{NodeService} - - - dictionaryService - #{DictionaryService} - - - browseBean - #{BrowseBean} - - - navigator - #{NavigationBean} - - - - - - The bean that backs up the Create Rule Wizard - - CreateRuleWizard - org.alfresco.web.bean.rules.CreateRuleWizard - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - ruleService - #{RuleService} - - - actionService - #{ActionService} - - - dictionaryService - #{DictionaryService} - - - mimetypeService - #{MimetypeService} - - - rulesDialog - #{RulesDialog} - - - personService - #{PersonService} - - - authorityService - #{AuthorityService} - - - - - - The bean that backs up the Edit Rule Wizard - - EditRuleWizard - org.alfresco.web.bean.rules.EditRuleWizard - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - ruleService - #{RuleService} - - - actionService - #{ActionService} - - - dictionaryService - #{DictionaryService} - - - mimetypeService - #{MimetypeService} - - - rulesDialog - #{RulesDialog} - - - personService - #{PersonService} - - - authorityService - #{AuthorityService} - - - - - - The bean that backs up the Run Action Wizard - - RunActionWizard - org.alfresco.web.bean.actions.RunActionWizard - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - actionService - #{ActionService} - - - dictionaryService - #{DictionaryService} - - - mimetypeService - #{MimetypeService} - - - personService - #{PersonService} - - - authorityService - #{AuthorityService} - - - - - - The bean that backs up the New User Wizard - - NewUserWizard - org.alfresco.web.bean.wizard.NewUserWizard - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - authenticationService - #{authenticationService} - - - permissionService - #{PermissionService} - - - namespaceService - #{NamespaceService} - - - personService - #{PersonService} - - - ownableService - #{OwnableService} - - - tenantService - #{tenantService} - - - - - - The bean that backs up the Manage Invited Users screens - - SpaceUsersBean - org.alfresco.web.bean.users.SpaceUsersBean - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - browseBean - #{BrowseBean} - - - permissionService - #{PermissionService} - - - ownableService - #{OwnableService} - - - personService - #{PersonService} - - - - - - The bean that backs up the Manage Content Users screens - - ContentUsersBean - org.alfresco.web.bean.users.ContentUsersBean - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - browseBean - #{BrowseBean} - - - permissionService - #{PermissionService} - - - ownableService - #{OwnableService} - - - personService - #{PersonService} - - - - - - The bean that backs up the Invite Users Wizard - - InviteSpaceUsersWizard - org.alfresco.web.bean.spaces.InviteSpaceUsersWizard - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - namespaceService - #{NamespaceService} - - - permissionService - #{PermissionService} - - - personService - #{PersonService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - mailSender - #{mailService} - - - authorityService - #{AuthorityService} - - - - - - The bean that backs up the Invite Content Users Wizard - - InviteContentUsersWizard - org.alfresco.web.bean.content.InviteContentUsersWizard - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - namespaceService - #{NamespaceService} - - - permissionService - #{PermissionService} - - - personService - #{PersonService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - mailSender - #{mailService} - - - authorityService - #{AuthorityService} - - - - - - The bean that presents the Checkin and Checkout bean's properties. - - CCProperties - org.alfresco.web.bean.coci.CCProperties - session - - versionOperationsService - #{CheckoutCheckinService} - - - contentService - #{ContentService} - - - workflowService - #{WorkflowService} - - - - - The bean that backs up the Checkin and Checkout pages. - CheckinCheckoutDialog - org.alfresco.web.bean.coci.CheckinCheckoutDialog - session - - browseBean - #{BrowseBean} - - - navigator - #{NavigationBean} - - - nodeService - #{NodeService} - - - property - #{CCProperties} - - - - - The bean for the Update File Screen. - CCUpdateFileDialog - - org.alfresco.web.bean.coci.CCUpdateFileDialog - - session - - property - #{CCProperties} - - - - - - The bean that holds manage content rules state - - RulesDialog - org.alfresco.web.bean.rules.RulesDialog - session - - browseBean - #{BrowseBean} - - - ruleService - #{RuleService} - - - actionService - #{ActionService} - - - nodeService - #{NodeService} - - - navigator - #{NavigationBean} - - - - - - The bean that holds delete content rules state - - DeleteRuleDialog - org.alfresco.web.bean.rules.DeleteRuleDialog - session - - browseBean - #{BrowseBean} - - - ruleService - #{RuleService} - - - nodeService - #{NodeService} - - - - - - Backing bean used by the document details dialog - - DocumentDetailsDialog - org.alfresco.web.bean.content.DocumentDetailsDialog - session - - browseBean - #{BrowseBean} - - - nodeService - #{NodeService} - - - lockService - #{LockService} - - - versionService - #{VersionService} - - - copyService - #{CopyService} - - - ownableService - #{OwnableService} - - - checkOutCheckInService - #{CheckoutCheckinService} - - - navigator - #{NavigationBean} - - - multilingualContentService - #{MultilingualContentService} - - - contentFilterLanguagesService - #{ContentFilterLanguagesService} - - - editionService - #{EditionService} - - - permissionService - #{PermissionService} - - - - - - Backing bean used by the document details dialog - - DocumentLinkDetailsDialog - org.alfresco.web.bean.content.DocumentLinkDetailsDialog - session - - browseBean - #{BrowseBean} - - - nodeService - #{NodeService} - - - copyService - #{CopyService} - - - ownableService - #{OwnableService} - - - - navigator - #{NavigationBean} - - - permissionService - #{PermissionService} - - - - - - Backing bean used by the Space details dialog - - SpaceDetailsDialog - org.alfresco.web.bean.spaces.SpaceDetailsDialog - session - - browseBean - #{BrowseBean} - - - navigator - #{NavigationBean} - - - nodeService - #{NodeService} - - - permissionService - #{PermissionService} - - - ownableService - #{OwnableService} - - - copyService - #{CopyService} - - - permissionService - #{PermissionService} - - - - - - Backing bean used by the SpaceLink details dialog - - SpaceLinkDetailsDialog - org.alfresco.web.bean.SpaceLinkDetailsDialog - session - - browseBean - #{BrowseBean} - - - navigator - #{NavigationBean} - - - nodeService - #{NodeService} - - - permissionService - #{PermissionService} - - - ownableService - #{OwnableService} - - - copyService - #{CopyService} - - - - - - Backing bean used by the forum details dialog - - ForumDetailsDialog - org.alfresco.web.bean.forums.ForumDetailsDialog - session - - browseBean - #{BrowseBean} - - - nodeService - #{NodeService} - - - copyService - #{CopyService} - - - ownableService - #{OwnableService} - - - - navigator - #{NavigationBean} - - - permissionService - #{PermissionService} - - - - - - Backing bean used by the forums details dialog - - ForumsDetailsDialog - org.alfresco.web.bean.forums.ForumsDetailsDialog - session - - browseBean - #{BrowseBean} - - - nodeService - #{NodeService} - - - copyService - #{CopyService} - - - ownableService - #{OwnableService} - - - navigator - #{NavigationBean} - - - permissionService - #{PermissionService} - - - - - - Backing bean used by the topic details dialog - - TopicDetailsDialog - org.alfresco.web.bean.forums.TopicDetailsDialog - session - - browseBean - #{BrowseBean} - - - nodeService - #{NodeService} - - - copyService - #{CopyService} - - - ownableService - #{OwnableService} - - - - navigator - #{NavigationBean} - - - permissionService - #{PermissionService} - - - - - - Backing bean used by screens requiring access to lists of Templates - - TemplateSupportBean - org.alfresco.web.bean.TemplateSupportBean - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - - - - Backing bean used by the document preview dialog - - DocumentPreviewBean - org.alfresco.web.bean.preview.DocumentPreviewBean - session - - browseBean - #{BrowseBean} - - - navigator - #{NavigationBean} - - - - - - Backing bean used by the document preview dialog - - SpacePreviewBean - org.alfresco.web.bean.preview.SpacePreviewBean - session - - browseBean - #{BrowseBean} - - - navigator - #{NavigationBean} - - - - - Backing bean used for the Export dialog - ExportDialog - org.alfresco.web.bean.admin.ExportDialog - session - - browseBean - #{BrowseBean} - - - nodeService - #{NodeService} - - - actionService - #{ActionService} - - - - - Backing bean used for the Import dialog - ImportDialog - org.alfresco.web.bean.admin.ImportDialog - session - - browseBean - #{BrowseBean} - - - nodeService - #{NodeService} - - - actionService - #{ActionService} - - - contentService - #{ContentService} - - - mimetypeService - #{MimetypeService} - - - - - - - Backing bean used for the low-level Node Browser - - AdminNodeBrowseBean - org.alfresco.web.bean.admin.AdminNodeBrowseBean - session - - nodeService - #{NodeService} - - - dictionaryService - #{DictionaryService} - - - searchService - #{SearchService} - - - namespaceService - #{NamespaceService} - - - permissionService - #{PermissionService} - - - - - - - The bean that holds forums state. - - ForumsBean - org.alfresco.web.bean.forums.ForumsBean - session - - nodeService - #{NodeService} - - - contentService - #{ContentService} - - - dictionaryService - #{DictionaryService} - - - browseBean - #{BrowseBean} - - - navigator - #{NavigationBean} - - - searchService - #{SearchService} - - - namespaceService - #{NamespaceService} - - - - - - The bean that backs up the Create Forums Dialog - - CreateForumsDialog - org.alfresco.web.bean.forums.CreateForumsDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - namespaceService - #{NamespaceService} - - - - - - The bean that backs up the Create Forum Dialog - - CreateForumDialog - org.alfresco.web.bean.forums.CreateForumDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - searchService - #{SearchService} - - - namespaceService - #{NamespaceService} - - - - - - The bean that backs up the Create Topic Dialog - - CreateTopicDialog - org.alfresco.web.bean.forums.CreateTopicDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - contentService - #{ContentService} - - - namespaceService - #{NamespaceService} - - - - - - The bean that backs up the Create Post Dialog - - CreatePostDialog - org.alfresco.web.bean.forums.CreatePostDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - contentService - #{ContentService} - - - dictionaryService - #{DictionaryService} - - - - - - The bean that backs up the Edit Post Dialog - - EditPostDialog - org.alfresco.web.bean.forums.EditPostDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - contentService - #{ContentService} - - - dictionaryService - #{DictionaryService} - - - - - - The bean that backs up the Create Reply Dialog - - CreateReplyDialog - org.alfresco.web.bean.forums.CreateReplyDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - contentService - #{ContentService} - - - dictionaryService - #{DictionaryService} - - - - - - The bean that backs up the Create Discussion Dialog - - CreateDiscussionDialog - org.alfresco.web.bean.forums.CreateDiscussionDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - contentService - #{ContentService} - - - namespaceService - #{NamespaceService} - - - - - - The bean that backs up the Delete Forum Space Dialog - - DeleteForumsDialog - org.alfresco.web.bean.forums.DeleteForumsDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - - - - The bean that backs up the Delete Forum Dialog - - DeleteForumDialog - org.alfresco.web.bean.forums.DeleteForumDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - - - - The bean that backs up the Delete Topic Dialog - - DeleteTopicDialog - org.alfresco.web.bean.forums.DeleteTopicDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - - - - The bean that backs up the Delete Post Dialog - - DeletePostDialog - org.alfresco.web.bean.forums.DeletePostDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - - - - The bean that holds state for the Manage Deleted Items screen. - - TrashcanDialogProperty - org.alfresco.web.bean.trashcan.TrashcanDialogProperty - session - - nodeArchiveService - #{nodeArchiveService} - - - - - - The bean that holds state for the Manage Deleted Items screen. - - TrashcanDialog - org.alfresco.web.bean.trashcan.TrashcanDialog - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - dictionaryService - #{DictionaryService} - - - property - #{TrashcanDialogProperty} - - - navigator - #{NavigationBean} - - - - - - Helper bean that caches the last item added to a multi - value editor component - - MultiValueEditorBean - org.alfresco.web.bean.MultiValueEditorBean - session - - - - Bean that manages the Dashboard framework - DashboardManager - org.alfresco.web.bean.dashboard.DashboardManager - session - - - - - The bean that backs up the Dashboard Config Wizard - - DashboardWizard - org.alfresco.web.bean.dashboard.DashboardWizard - session - - nodeService - #{NodeService} - - - dashboardManager - #{DashboardManager} - - - - - - The bean that backs up the Manage Task Dialog - - ManageTaskDialog - org.alfresco.web.bean.workflow.ManageTaskDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - 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 Verify Broken Links Task Dialog - - ManageLinkValidationTaskDialog - org.alfresco.web.bean.wcm.ManageLinkValidationTaskDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - workflowService - #{WorkflowService} - - - avmService - #{AVMLockingAwareService} - - - avmSyncService - #{AVMSyncService} - - - avmBrowseBean - #{AVMBrowseBean} - - - - - - The bean that backs up the View Completed Task Dialog - - ViewCompletedTaskDialog - org.alfresco.web.bean.workflow.ViewCompletedTaskDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - workflowService - #{WorkflowService} - - - - - StartWorkflowWizard - org.alfresco.web.bean.workflow.StartWorkflowWizard - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - workflowService - #{WorkflowService} - - - unprotectedNodeService - #{nodeService} - - - - - - The bean that backs up the New Edition Wizard - - NewEditionWizard - org.alfresco.web.bean.ml.NewEditionWizard - session - - editionService - #{EditionService} - - - multilingualContentService - #{MultilingualContentService} - - - nodeService - #{NodeService} - - - contentFilterLanguagesService - #{ContentFilterLanguagesService} - - - versionService - #{VersionService} - - - lockService - #{LockService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - - - - The bean that backs up the Cancel Workflow Dialog - - CancelWorkflowDialog - org.alfresco.web.bean.workflow.CancelWorkflowDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - workflowService - #{WorkflowService} - - - - - - The bean that backs up the Reassign Task Dialog - - ReassignTaskDialog - org.alfresco.web.bean.workflow.ReassignTaskDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - dictionaryService - #{DictionaryService} - - - namespaceService - #{NamespaceService} - - - workflowService - #{WorkflowService} - - - personService - #{PersonService} - - - - - WorkflowBean - org.alfresco.web.bean.workflow.WorkflowBean - request - - navigationBean - #{NavigationBean} - - - nodeService - #{NodeService} - - - workflowService - #{WorkflowService} - - - - - - Backing bean used for the Workflow Console - WorkflowConsoleBean - org.alfresco.web.bean.workflow.WorkflowConsoleBean - session - - workflowInterpreter - #{workflowInterpreter} - - - - - Backing bean used for the Web Client Config Admin Console - ConfigAdminConsoleBean - org.alfresco.web.bean.admin.ConfigAdminConsoleBean - session - - configAdminInterpreter - #{webClientConfigAdminInterpreter} - - - - - Backing bean used for the Repository Admin Console - RepoAdminConsoleBean - org.alfresco.web.bean.repository.admin.RepoAdminConsoleBean - session - - repoAdminInterpreter - #{repoAdminInterpreter} - - - - - Backing bean used for the Tenant Admin Console - TenantAdminConsoleBean - org.alfresco.web.bean.repository.tenant.TenantAdminConsoleBean - session - - tenantInterpreter - #{tenantInterpreter} - - - - - - The bean that backs up the Email Space Users Dialog - - EmailSpaceUsersDialog - org.alfresco.web.bean.users.EmailSpaceUsersDialog - session - - browseBean - #{BrowseBean} - - - nodeService - #{NodeService} - - - permissionService - #{PermissionService} - - - personService - #{PersonService} - - - authorityService - #{AuthorityService} - - - mailSender - #{mailService} - - - - - - The bean that backs up the Getting Started Dashlet page - - GettingStartedBean - org.alfresco.web.bean.dashboard.GettingStartedBean - session - - navigationBean - #{NavigationBean} - - - - - - The bean that backs up the User Preferences page - - UserPreferencesBean - org.alfresco.web.bean.users.UserPreferencesBean - session - - multilingualContentService - #{MultilingualContentService} - - - contentFilterLanguagesService - #{ContentFilterLanguagesService} - - - nodeService - #{NodeService} - - - - - - The bean that backs up the Sidebar component - - SidebarBean - org.alfresco.web.bean.SidebarBean - 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} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - namespaceService - #{NamespaceService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - contentService - #{ContentService} - - - avmService - #{AVMLockingAwareService} - - - avmLockingService - #{AVMLockingService} - - - avmSyncService - #{AVMSyncService} - - - formsService - #{FormsService} - - - - - - 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} - - - avmService - #{AVMLockingAwareService} - - - workflowService - #{WorkflowService} - - - personService - #{PersonService} - - - avmLockingService - #{AVMLockingService} - - - formsService - #{FormsService} - - - - - - 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} - - - avmService - #{AVMLockingAwareService} - - - workflowService - #{WorkflowService} - - - personService - #{PersonService} - - - formsService - #{FormsService} - - - - - - The bean that backs up the Import Website Dialog - - ImportWebsiteDialog - org.alfresco.web.bean.wcm.ImportWebsiteDialog - session - - nodeService - #{nodeService} - - - fileFolderService - #{FileFolderService} - - - contentService - #{ContentService} - - - avmService - #{AVMLockingAwareService} - - - 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} - - - avmBrowseBean - #{AVMBrowseBean} - - - - - - The bean that backs up the website file/folder browsing screens - - AVMBrowseBean - org.alfresco.web.bean.wcm.AVMBrowseBean - session - - avmService - #{AVMLockingAwareService} - - - avmSyncService - #{AVMSyncService} - - - navigationBean - #{NavigationBean} - - - nodeService - #{NodeService} - - - actionService - #{ActionService} - - - workflowService - #{WorkflowService} - - - formsService - #{FormsService} - - - searchService - #{SearchService} - - - - - - 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 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 User Sandbox Dialog - - DeleteSandboxDialog - org.alfresco.web.bean.wcm.DeleteSandboxDialog - session - - avmService - #{AVMLockingAwareService} - - - avmLockingService - #{AVMLockingService} - - - avmBrowseBean - #{AVMBrowseBean} - - - nodeService - #{NodeService} - - - - - - The bean that backs up the Create AVM Folder Dialog - - CreateFolderDialog - org.alfresco.web.bean.wcm.CreateFolderDialog - session - - 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 - - avmService - #{AVMLockingAwareService} - - - avmBrowseBean - #{AVMBrowseBean} - - - nodeService - #{NodeService} - - - - - - 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 - - avmService - #{AVMLockingAwareService} - - - 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} - - - avmLockingService - #{AVMLockingService} - - - avmBrowseBean - #{AVMBrowseBean} - - - workflowService - #{WorkflowService} - - - nodeService - #{NodeService} - - - nameMatcher - #{globalPathExcluder} - - - formsService - #{FormsService} - - - - - - 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} - - - actionService - #{ActionService} - - - - - - The bean that backs up the Revert all items Dialog - - RevertAllDialog - org.alfresco.web.bean.wcm.RevertAllDialog - session - - avmService - #{AVMLockingAwareService} - - - avmBrowseBean - #{AVMBrowseBean} - - - actionService - #{ActionService} - - - avmSyncService - #{AVMSyncService} - - - nameMatcher - #{globalPathExcluder} - - - - - - The bean that backs up the Deploy Snapshot Dialog - - DeploySnapshotDialog - org.alfresco.web.bean.wcm.DeploySnapshotDialog - session - - avmBrowseBean - #{AVMBrowseBean} + + + + + + + + + The bean for the Delete Category screen. + + MultilingualManageDialog + + org.alfresco.web.bean.ml.MultilingualManageDialog + + session + + browseBean + #{BrowseBean} + + + nodeService + #{NodeService} + + + multilingualContentService + #{MultilingualContentService} + + + contentFilterLanguagesService + #{ContentFilterLanguagesService} + + + editionService + #{EditionService} + + + versionService + #{VersionService} + + + translationDocument + #{DocumentDetailsDialog.translationDocument} + + + + + + The bean that make a document multilingual + + MakeMultilingualDialog + org.alfresco.web.bean.ml.MakeMultilingualDialog + session + + multilingualContentService + #{MultilingualContentService} + + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + userPreferencesBean + #{UserPreferencesBean} + + + + + + The bean that edit the multilinguals properties of a document + + EditMLContainerDialog + org.alfresco.web.bean.ml.EditMLContainerDialog + session + + multilingualContentService + #{MultilingualContentService} + + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + + + + The bean that add a new translation without content + + AddTranslationWithoutContentDialog + org.alfresco.web.bean.ml.AddTranslationWithoutContentDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + dictionaryService + #{DictionaryService} + + + browseBean + #{BrowseBean} + + + multilingualContentService + #{MultilingualContentService} + + + userPreferencesBean + #{UserPreferencesBean} + + + + + + The bean that add a translation with a content + + AddTranslationDialog + org.alfresco.web.bean.ml.AddTranslationDialog + session + + multilingualContentService + #{MultilingualContentService} + + + userPreferencesBean + #{UserPreferencesBean} + + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + contentService + #{ContentService} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + + + + The bean that backs up the Login screen + + LoginBean + org.alfresco.web.bean.LoginBean + session + + nodeService + #{NodeService} + + + authenticationService + #{AuthenticationService} + + + personService + #{PersonService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + userPreferencesBean + #{UserPreferencesBean} + + + + + + The bean that holds navigation state. + + NavigationBean + org.alfresco.web.bean.NavigationBean + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + namespaceService + #{NamespaceService} + + + cifsServer + #{cifsServer} + + + ruleService + #{RuleService} + + + userPreferencesBean + #{UserPreferencesBean} + + + authenticationService + #{AuthenticationService} + + + permissionService + #{PermissionService} + + + + + + The bean that holds folder browse state. + + BrowseBean + org.alfresco.web.bean.BrowseBean + session + + navigator + #{NavigationBean} + + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + lockService + #{LockService} + + + dictionaryService + #{DictionaryService} + + + fileFolderService + #{FileFolderService} + + + userPreferencesBean + #{UserPreferencesBean} + + + multilingualContentService + #{MultilingualContentService} + + + + + Bean that provides information for the About page + AboutBean + org.alfresco.web.bean.AboutBean + session + + descriptorService + #{DescriptorService} + + + + + Bean that manages the dialog framework + DialogManager + org.alfresco.web.bean.dialog.DialogManager + session + + + + Bean that manages the wizard framework + WizardManager + org.alfresco.web.bean.wizard.WizardManager + session + + + + + The bean that backs up the Create Space Dialog + + CreateSpaceDialog + org.alfresco.web.bean.spaces.CreateSpaceDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + namespaceService + #{NamespaceService} + + + + + + The bean that backs up the Create Space Wizard + + CreateSpaceWizard + org.alfresco.web.bean.spaces.CreateSpaceWizard + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + + + + The bean that backs up the Delete Space Dialog + + DeleteSpaceDialog + org.alfresco.web.bean.spaces.DeleteSpaceDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + + + + The bean that manages a users Clipboard state. + + ClipboardBean + org.alfresco.web.bean.clipboard.ClipboardBean + session + + + + + The bean that manages the state for the Recent Spaces Shelf component. + + RecentSpacesBean + org.alfresco.web.bean.spaces.RecentSpacesBean + session + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + + + + The bean that manages the state for the User Shortcuts Shelf component. + + UserShortcutsBean + org.alfresco.web.bean.users.UserShortcutsBean + session + + nodeService + #{NodeService} + + + browseBean + #{BrowseBean} + + + permissionService + #{PermissionService} + + + + + + The bean that holds a state for the Advanced Search screen. + + SearchProperties + org.alfresco.web.bean.search.SearchProperties + session + + + + + The bean that holds a state for the Advanced Search screen. + + AdvancedSearchDialog + org.alfresco.web.bean.search.AdvancedSearchDialog + session + + navigator + #{NavigationBean} + + + nodeService + #{NodeService} + + + namespaceService + #{NamespaceService} + + + searchService + #{SearchService} + + + permissionService + #{PermissionService} + + + properties + #{SearchProperties} + + + + + + The bean that holds state for the Users screen. + + UsersBeanProperties + org.alfresco.web.bean.users.UsersBeanProperties + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + authenticationService + #{AuthenticationService} + + + personService + #{PersonService} + + + contentUsageService + #{ContentUsageService} + + + + + + The bean that holds state for the User Management screens. + + UsersDialog + org.alfresco.web.bean.users.UsersDialog + session + + properties + #{UsersBeanProperties} + + + + + + The bean that holds state for the Groups Management screens. + + GroupsDialog + org.alfresco.web.bean.groups.GroupsDialog + session + + nodeService + #{NodeService} + + + authService + #{AuthorityService} + + + personService + #{PersonService} + + + + + + The bean that holds state for the Category Management screens. + + CategoriesProperties + org.alfresco.web.bean.CategoriesProperties + session + + categoryService + #{CategoryService} + + + + + + The bean that holds state for the Category Management screens. + + CategoriesDialog + org.alfresco.web.bean.categories.CategoriesDialog + session + + nodeService + #{NodeService} + + + categoryService + #{CategoryService} + + + + + + The bean that backs up the Edit Space Dialog + + EditSpaceDialog + org.alfresco.web.bean.spaces.EditSpaceDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + searchService + #{SearchService} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + + + + The bean that backs up the Add Content Dialog + + AddContentDialog + org.alfresco.web.bean.content.AddContentDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + contentService + #{ContentService} + + + dictionaryService + #{DictionaryService} + + + + + + The bean that backs up the Create Content Wizard + + CreateContentWizard + org.alfresco.web.bean.content.CreateContentWizard + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + contentService + #{ContentService} + + + dictionaryService + #{DictionaryService} + + + formsService + #{FormsService} + + + + + + The bean that backs up the Edit Content Wizard + + EditContentWizard + org.alfresco.web.bean.content.EditContentWizard + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + contentService + #{ContentService} + + + dictionaryService + #{DictionaryService} + + + formsService + #{FormsService} + + + + + + The bean that backs up the View Content Properties Dialog + + ViewContentPropertiesDialog + org.alfresco.web.bean.content.ViewContentPropertiesDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + dictionaryService + #{DictionaryService} + + + browseBean + #{BrowseBean} + + + + + + The bean that backs up the Set Content Properties Dialog + + SetContentPropertiesDialog + org.alfresco.web.bean.content.SetContentPropertiesDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + dictionaryService + #{DictionaryService} + + + browseBean + #{BrowseBean} + + + + + + The bean that backs up the Edit Content Properties Dialog + + EditContentPropertiesDialog + org.alfresco.web.bean.content.EditContentPropertiesDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + dictionaryService + #{DictionaryService} + + + browseBean + #{BrowseBean} + + + + + + The bean that backs up the Delete Content Dialog + + DeleteContentDialog + org.alfresco.web.bean.content.DeleteContentDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + multilingualContentService + #{MultilingualContentService} + + + + + + The bean that backs up the Link Properties Dialog + + LinkPropertiesDialog + org.alfresco.web.bean.LinkPropertiesDialog + session + + nodeService + #{NodeService} + + + dictionaryService + #{DictionaryService} + + + browseBean + #{BrowseBean} + + + navigator + #{NavigationBean} + + + + + + The bean that backs up the Create Rule Wizard + + CreateRuleWizard + org.alfresco.web.bean.rules.CreateRuleWizard + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + ruleService + #{RuleService} + + + actionService + #{ActionService} + + + dictionaryService + #{DictionaryService} + + + mimetypeService + #{MimetypeService} + + + rulesDialog + #{RulesDialog} + + + personService + #{PersonService} + + + authorityService + #{AuthorityService} + + + + + + The bean that backs up the Edit Rule Wizard + + EditRuleWizard + org.alfresco.web.bean.rules.EditRuleWizard + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + ruleService + #{RuleService} + + + actionService + #{ActionService} + + + dictionaryService + #{DictionaryService} + + + mimetypeService + #{MimetypeService} + + + rulesDialog + #{RulesDialog} + + + personService + #{PersonService} + + + authorityService + #{AuthorityService} + + + + + + The bean that backs up the Run Action Wizard + + RunActionWizard + org.alfresco.web.bean.actions.RunActionWizard + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + actionService + #{ActionService} + + + dictionaryService + #{DictionaryService} + + + mimetypeService + #{MimetypeService} + + + personService + #{PersonService} + + + authorityService + #{AuthorityService} + + + + + + The bean that backs up the New User Wizard + + NewUserWizard + org.alfresco.web.bean.wizard.NewUserWizard + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + authenticationService + #{authenticationService} + + + permissionService + #{PermissionService} + + + namespaceService + #{NamespaceService} + + + personService + #{PersonService} + + + ownableService + #{OwnableService} + + + tenantService + #{tenantService} + + + + + + The bean that backs up the Manage Invited Users screens + + SpaceUsersBean + org.alfresco.web.bean.users.SpaceUsersBean + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + browseBean + #{BrowseBean} + + + permissionService + #{PermissionService} + + + ownableService + #{OwnableService} + + + personService + #{PersonService} + + + + + + The bean that backs up the Manage Content Users screens + + ContentUsersBean + org.alfresco.web.bean.users.ContentUsersBean + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + browseBean + #{BrowseBean} + + + permissionService + #{PermissionService} + + + ownableService + #{OwnableService} + + + personService + #{PersonService} + + + + + + The bean that backs up the Invite Users Wizard + + InviteSpaceUsersWizard + org.alfresco.web.bean.spaces.InviteSpaceUsersWizard + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + namespaceService + #{NamespaceService} + + + permissionService + #{PermissionService} + + + personService + #{PersonService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + mailSender + #{mailService} + + + authorityService + #{AuthorityService} + + + + + + The bean that backs up the Invite Content Users Wizard + + InviteContentUsersWizard + org.alfresco.web.bean.content.InviteContentUsersWizard + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + namespaceService + #{NamespaceService} + + + permissionService + #{PermissionService} + + + personService + #{PersonService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + mailSender + #{mailService} + + + authorityService + #{AuthorityService} + + + + + + The bean that presents the Checkin and Checkout bean's properties. + + CCProperties + org.alfresco.web.bean.coci.CCProperties + session + + versionOperationsService + #{CheckoutCheckinService} + + + contentService + #{ContentService} + + + workflowService + #{WorkflowService} + + + + + The bean that backs up the Checkin and Checkout pages. + CheckinCheckoutDialog + org.alfresco.web.bean.coci.CheckinCheckoutDialog + session + + browseBean + #{BrowseBean} + + + navigator + #{NavigationBean} + + + nodeService + #{NodeService} + + + property + #{CCProperties} + + + + + The bean for the Update File Screen. + CCUpdateFileDialog + + org.alfresco.web.bean.coci.CCUpdateFileDialog + + session + + property + #{CCProperties} + + + + + + The bean that holds manage content rules state + + RulesDialog + org.alfresco.web.bean.rules.RulesDialog + session + + browseBean + #{BrowseBean} + + + ruleService + #{RuleService} + + + actionService + #{ActionService} + + + nodeService + #{NodeService} + + + navigator + #{NavigationBean} + + + + + + The bean that holds delete content rules state + + DeleteRuleDialog + org.alfresco.web.bean.rules.DeleteRuleDialog + session + + browseBean + #{BrowseBean} + + + ruleService + #{RuleService} + + + nodeService + #{NodeService} + + + + + + Backing bean used by the document details dialog + + DocumentDetailsDialog + org.alfresco.web.bean.content.DocumentDetailsDialog + session + + browseBean + #{BrowseBean} + + + nodeService + #{NodeService} + + + lockService + #{LockService} + + + versionService + #{VersionService} + + + copyService + #{CopyService} + + + ownableService + #{OwnableService} + + + checkOutCheckInService + #{CheckoutCheckinService} + + + navigator + #{NavigationBean} + + + multilingualContentService + #{MultilingualContentService} + + + contentFilterLanguagesService + #{ContentFilterLanguagesService} + + + editionService + #{EditionService} + + + permissionService + #{PermissionService} + + + + + + Backing bean used by the document details dialog + + DocumentLinkDetailsDialog + org.alfresco.web.bean.content.DocumentLinkDetailsDialog + session + + browseBean + #{BrowseBean} + + + nodeService + #{NodeService} + + + copyService + #{CopyService} + + + ownableService + #{OwnableService} + + + + navigator + #{NavigationBean} + + + permissionService + #{PermissionService} + + + + + + Backing bean used by the Space details dialog + + SpaceDetailsDialog + org.alfresco.web.bean.spaces.SpaceDetailsDialog + session + + browseBean + #{BrowseBean} + + + navigator + #{NavigationBean} + + + nodeService + #{NodeService} + + + permissionService + #{PermissionService} + + + ownableService + #{OwnableService} + + + copyService + #{CopyService} + + + permissionService + #{PermissionService} + + + + + + Backing bean used by the SpaceLink details dialog + + SpaceLinkDetailsDialog + org.alfresco.web.bean.SpaceLinkDetailsDialog + session + + browseBean + #{BrowseBean} + + + navigator + #{NavigationBean} + + + nodeService + #{NodeService} + + + permissionService + #{PermissionService} + + + ownableService + #{OwnableService} + + + copyService + #{CopyService} + + + + + + Backing bean used by the forum details dialog + + ForumDetailsDialog + org.alfresco.web.bean.forums.ForumDetailsDialog + session + + browseBean + #{BrowseBean} + + + nodeService + #{NodeService} + + + copyService + #{CopyService} + + + ownableService + #{OwnableService} + + + + navigator + #{NavigationBean} + + + permissionService + #{PermissionService} + + + + + + Backing bean used by the forums details dialog + + ForumsDetailsDialog + org.alfresco.web.bean.forums.ForumsDetailsDialog + session + + browseBean + #{BrowseBean} + + + nodeService + #{NodeService} + + + copyService + #{CopyService} + + + ownableService + #{OwnableService} + + + navigator + #{NavigationBean} + + + permissionService + #{PermissionService} + + + + + + Backing bean used by the topic details dialog + + TopicDetailsDialog + org.alfresco.web.bean.forums.TopicDetailsDialog + session + + browseBean + #{BrowseBean} + + + nodeService + #{NodeService} + + + copyService + #{CopyService} + + + ownableService + #{OwnableService} + + + + navigator + #{NavigationBean} + + + permissionService + #{PermissionService} + + + + + + Backing bean used by screens requiring access to lists of Templates + + TemplateSupportBean + org.alfresco.web.bean.TemplateSupportBean + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + + + + Backing bean used by the document preview dialog + + DocumentPreviewBean + org.alfresco.web.bean.preview.DocumentPreviewBean + session + + browseBean + #{BrowseBean} + + + navigator + #{NavigationBean} + + + + + + Backing bean used by the document preview dialog + + SpacePreviewBean + org.alfresco.web.bean.preview.SpacePreviewBean + session + + browseBean + #{BrowseBean} + + + navigator + #{NavigationBean} + + + + + Backing bean used for the Export dialog + ExportDialog + org.alfresco.web.bean.admin.ExportDialog + session + + browseBean + #{BrowseBean} + + + nodeService + #{NodeService} + + + actionService + #{ActionService} + + + + + Backing bean used for the Import dialog + ImportDialog + org.alfresco.web.bean.admin.ImportDialog + session + + browseBean + #{BrowseBean} + + + nodeService + #{NodeService} + + + actionService + #{ActionService} + + + contentService + #{ContentService} + + + mimetypeService + #{MimetypeService} + + + + + + + Backing bean used for the low-level Node Browser + + AdminNodeBrowseBean + org.alfresco.web.bean.admin.AdminNodeBrowseBean + session + + nodeService + #{NodeService} + + + dictionaryService + #{DictionaryService} + + + searchService + #{SearchService} + + + namespaceService + #{NamespaceService} + + + permissionService + #{PermissionService} + + + + + + + The bean that holds forums state. + + ForumsBean + org.alfresco.web.bean.forums.ForumsBean + session + + nodeService + #{NodeService} + + + contentService + #{ContentService} + + + dictionaryService + #{DictionaryService} + + + browseBean + #{BrowseBean} + + + navigator + #{NavigationBean} + + + searchService + #{SearchService} + + + namespaceService + #{NamespaceService} + + + + + + The bean that backs up the Create Forums Dialog + + CreateForumsDialog + org.alfresco.web.bean.forums.CreateForumsDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + namespaceService + #{NamespaceService} + + + + + + The bean that backs up the Create Forum Dialog + + CreateForumDialog + org.alfresco.web.bean.forums.CreateForumDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + searchService + #{SearchService} + + + namespaceService + #{NamespaceService} + + + + + + The bean that backs up the Create Topic Dialog + + CreateTopicDialog + org.alfresco.web.bean.forums.CreateTopicDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + contentService + #{ContentService} + + + namespaceService + #{NamespaceService} + + + + + + The bean that backs up the Create Post Dialog + + CreatePostDialog + org.alfresco.web.bean.forums.CreatePostDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + contentService + #{ContentService} + + + dictionaryService + #{DictionaryService} + + + + + + The bean that backs up the Edit Post Dialog + + EditPostDialog + org.alfresco.web.bean.forums.EditPostDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + contentService + #{ContentService} + + + dictionaryService + #{DictionaryService} + + + + + + The bean that backs up the Create Reply Dialog + + CreateReplyDialog + org.alfresco.web.bean.forums.CreateReplyDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + contentService + #{ContentService} + + + dictionaryService + #{DictionaryService} + + + + + + The bean that backs up the Create Discussion Dialog + + CreateDiscussionDialog + org.alfresco.web.bean.forums.CreateDiscussionDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + contentService + #{ContentService} + + + namespaceService + #{NamespaceService} + + + + + + The bean that backs up the Delete Forum Space Dialog + + DeleteForumsDialog + org.alfresco.web.bean.forums.DeleteForumsDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + + + + The bean that backs up the Delete Forum Dialog + + DeleteForumDialog + org.alfresco.web.bean.forums.DeleteForumDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + + + + The bean that backs up the Delete Topic Dialog + + DeleteTopicDialog + org.alfresco.web.bean.forums.DeleteTopicDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + + + + The bean that backs up the Delete Post Dialog + + DeletePostDialog + org.alfresco.web.bean.forums.DeletePostDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + + + + The bean that holds state for the Manage Deleted Items screen. + + TrashcanDialogProperty + org.alfresco.web.bean.trashcan.TrashcanDialogProperty + session + + nodeArchiveService + #{nodeArchiveService} + + + + + + The bean that holds state for the Manage Deleted Items screen. + + TrashcanDialog + org.alfresco.web.bean.trashcan.TrashcanDialog + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + dictionaryService + #{DictionaryService} + + + property + #{TrashcanDialogProperty} + + + navigator + #{NavigationBean} + + + + + + Helper bean that caches the last item added to a multi + value editor component + + MultiValueEditorBean + org.alfresco.web.bean.MultiValueEditorBean + session + + + + Bean that manages the Dashboard framework + DashboardManager + org.alfresco.web.bean.dashboard.DashboardManager + session + + + + + The bean that backs up the Dashboard Config Wizard + + DashboardWizard + org.alfresco.web.bean.dashboard.DashboardWizard + session + + nodeService + #{NodeService} + + + dashboardManager + #{DashboardManager} + + + + + + The bean that backs up the Manage Task Dialog + + ManageTaskDialog + org.alfresco.web.bean.workflow.ManageTaskDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + workflowService + #{WorkflowService} avmService #{AVMLockingAwareService} - - - actionService - #{ActionService} - - - nodeService - #{NodeService} - - - - - - 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 - - avmBrowseBean - #{AVMBrowseBean} - - - nodeService - #{NodeService} - - - - - - The bean that backs up the Link Validation Dialog - - LinkValidationDialog - org.alfresco.web.bean.wcm.LinkValidationDialog - session - - avmBrowseBean - #{AVMBrowseBean} - - - actionService - #{ActionService} - - - avmService - #{AVMLockingAwareService} - - - - - - - Bean that generates a text field component - - TextFieldGenerator - org.alfresco.web.bean.generator.TextFieldGenerator - request - - - - - - Bean that generates a mutlilingual text field component - - MultilingualTextFieldGenerator - org.alfresco.web.bean.generator.MultilingualTextFieldGenerator - request - - - - - - Bean that generates a link component - - LinkGenerator - org.alfresco.web.bean.generator.LinkGenerator - request - - - - - Bean that generates a text area component - - TextAreaGenerator - org.alfresco.web.bean.generator.TextAreaGenerator - request - - - - - - Bean that generates a multilingual text area component - - MultilingualTextAreaGenerator - org.alfresco.web.bean.generator.MultilingualTextAreaGenerator - request - - - - - - Bean that generates a checkbox component - - CheckboxGenerator - org.alfresco.web.bean.generator.CheckboxGenerator - request - - - - - Bean that generates a date picker component - - DatePickerGenerator - org.alfresco.web.bean.generator.DatePickerGenerator - request - - - - - - Bean that generates a datetime picker component - - DateTimePickerGenerator - org.alfresco.web.bean.generator.DateTimePickerGenerator - request - - - - - - Bean that generates a label component - - LabelGenerator - org.alfresco.web.bean.generator.LabelGenerator - request - - - - - Bean that generates a mime type selector component - - MimeTypeSelectorGenerator - org.alfresco.web.bean.generator.MimeTypeSelectorGenerator - request - - - - - Bean that generates a charset selector component - - CharsetSelectorGenerator - org.alfresco.web.bean.generator.CharsetSelectorGenerator - request - - - - - Bean that generates a languages selector component - - LanguageSelectorGenerator - org.alfresco.web.bean.generator.LanguageSelectorGenerator - request - - userPreferencesBean - #{UserPreferencesBean} - - - - - - - Bean that generates a languages selector component for ML container - - MlContainerLanguageSelectorGenerator - org.alfresco.web.bean.generator.MlContainerLanguageSelectorGenerator - request - - multilingualContentService - #{MultilingualContentService} - - - contentFilterLanguagesService - #{ContentFilterLanguagesService} - - - nodeService - #{NodeService} - - - - - - Bean that generates an image picker component - - SpaceIconPickerGenerator - org.alfresco.web.bean.generator.SpaceIconPickerGenerator - request - - - - - Bean that generates a category selector component - - CategorySelectorGenerator - org.alfresco.web.bean.generator.CategorySelectorGenerator - request - - + + + 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 Verify Broken Links Task Dialog + + ManageLinkValidationTaskDialog + org.alfresco.web.bean.wcm.ManageLinkValidationTaskDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + workflowService + #{WorkflowService} + + + avmService + #{AVMLockingAwareService} + + + avmSyncService + #{AVMSyncService} + + + avmBrowseBean + #{AVMBrowseBean} + + + + + + The bean that backs up the View Completed Task Dialog + + ViewCompletedTaskDialog + org.alfresco.web.bean.workflow.ViewCompletedTaskDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + workflowService + #{WorkflowService} + + + + + StartWorkflowWizard + org.alfresco.web.bean.workflow.StartWorkflowWizard + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + workflowService + #{WorkflowService} + + + unprotectedNodeService + #{nodeService} + + + + + + The bean that backs up the New Edition Wizard + + NewEditionWizard + org.alfresco.web.bean.ml.NewEditionWizard + session + + editionService + #{EditionService} + + + multilingualContentService + #{MultilingualContentService} + + + nodeService + #{NodeService} + + + contentFilterLanguagesService + #{ContentFilterLanguagesService} + + + versionService + #{VersionService} + + + lockService + #{LockService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + + + + The bean that backs up the Cancel Workflow Dialog + + CancelWorkflowDialog + org.alfresco.web.bean.workflow.CancelWorkflowDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + workflowService + #{WorkflowService} + + + + + + The bean that backs up the Reassign Task Dialog + + ReassignTaskDialog + org.alfresco.web.bean.workflow.ReassignTaskDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + workflowService + #{WorkflowService} + + + personService + #{PersonService} + + + + + WorkflowBean + org.alfresco.web.bean.workflow.WorkflowBean + request + + navigationBean + #{NavigationBean} + + + nodeService + #{NodeService} + + + workflowService + #{WorkflowService} + + + + + + Backing bean used for the Workflow Console + WorkflowConsoleBean + org.alfresco.web.bean.workflow.WorkflowConsoleBean + session + + workflowInterpreter + #{workflowInterpreter} + + + + + Backing bean used for the Web Client Config Admin Console + ConfigAdminConsoleBean + org.alfresco.web.bean.admin.ConfigAdminConsoleBean + session + + configAdminInterpreter + #{webClientConfigAdminInterpreter} + + + + + Backing bean used for the Repository Admin Console + RepoAdminConsoleBean + org.alfresco.web.bean.repository.admin.RepoAdminConsoleBean + session + + repoAdminInterpreter + #{repoAdminInterpreter} + + + + + Backing bean used for the Tenant Admin Console + TenantAdminConsoleBean + org.alfresco.web.bean.repository.tenant.TenantAdminConsoleBean + session + + tenantInterpreter + #{tenantInterpreter} + + + + + + The bean that backs up the Email Space Users Dialog + + EmailSpaceUsersDialog + org.alfresco.web.bean.users.EmailSpaceUsersDialog + session + + browseBean + #{BrowseBean} + + + nodeService + #{NodeService} + + + permissionService + #{PermissionService} + + + personService + #{PersonService} + + + authorityService + #{AuthorityService} + + + mailSender + #{mailService} + + + + + + The bean that backs up the Getting Started Dashlet page + + GettingStartedBean + org.alfresco.web.bean.dashboard.GettingStartedBean + session + + navigationBean + #{NavigationBean} + + + + + + The bean that backs up the User Preferences page + + UserPreferencesBean + org.alfresco.web.bean.users.UserPreferencesBean + session + + multilingualContentService + #{MultilingualContentService} + + + contentFilterLanguagesService + #{ContentFilterLanguagesService} + + + nodeService + #{NodeService} + + + + + + The bean that backs up the Sidebar component + + SidebarBean + org.alfresco.web.bean.SidebarBean + 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} + + + avmService + #{AVMLockingAwareService} + + + avmLockingService + #{AVMLockingService} + + + avmSyncService + #{AVMSyncService} + + + formsService + #{FormsService} + + + + + + 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} + + + avmService + #{AVMLockingAwareService} + + + workflowService + #{WorkflowService} + + + personService + #{PersonService} + + + avmLockingService + #{AVMLockingService} + + + formsService + #{FormsService} + + + + + + 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} + + + avmService + #{AVMLockingAwareService} + + + workflowService + #{WorkflowService} + + + personService + #{PersonService} + + + formsService + #{FormsService} + + + + + + The bean that backs up the Import Website Dialog + + ImportWebsiteDialog + org.alfresco.web.bean.wcm.ImportWebsiteDialog + session + + nodeService + #{nodeService} + + + fileFolderService + #{FileFolderService} + + + contentService + #{ContentService} + + + avmService + #{AVMLockingAwareService} + + + 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} + + + avmBrowseBean + #{AVMBrowseBean} + + + + + + The bean that backs up the website file/folder browsing screens + + AVMBrowseBean + org.alfresco.web.bean.wcm.AVMBrowseBean + session + + avmService + #{AVMLockingAwareService} + + + avmSyncService + #{AVMSyncService} + + + navigationBean + #{NavigationBean} + + + nodeService + #{NodeService} + + + actionService + #{ActionService} + + + workflowService + #{WorkflowService} + + + formsService + #{FormsService} + + + searchService + #{SearchService} + + + + + + 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 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 User Sandbox Dialog + + DeleteSandboxDialog + org.alfresco.web.bean.wcm.DeleteSandboxDialog + session + + avmService + #{AVMLockingAwareService} + + + avmLockingService + #{AVMLockingService} + + + avmBrowseBean + #{AVMBrowseBean} + + + nodeService + #{NodeService} + + + + + + The bean that backs up the Create AVM Folder Dialog + + CreateFolderDialog + org.alfresco.web.bean.wcm.CreateFolderDialog + session + + 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 + + avmService + #{AVMLockingAwareService} + + + avmBrowseBean + #{AVMBrowseBean} + + + nodeService + #{NodeService} + + + + + + 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 + + avmService + #{AVMLockingAwareService} + + + 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} + + + avmLockingService + #{AVMLockingService} + + + avmBrowseBean + #{AVMBrowseBean} + + + workflowService + #{WorkflowService} + + + nodeService + #{NodeService} + + + nameMatcher + #{globalPathExcluder} + + + formsService + #{FormsService} + + + + + + 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} + + + actionService + #{ActionService} + + + + + + The bean that backs up the Revert all items Dialog + + RevertAllDialog + org.alfresco.web.bean.wcm.RevertAllDialog + session + + avmService + #{AVMLockingAwareService} + + + avmBrowseBean + #{AVMBrowseBean} + + + actionService + #{ActionService} + + + avmSyncService + #{AVMSyncService} + + + nameMatcher + #{globalPathExcluder} + + + + + + The bean that backs up the Deploy Snapshot Dialog + + DeploySnapshotDialog + org.alfresco.web.bean.wcm.DeploySnapshotDialog + session + + avmBrowseBean + #{AVMBrowseBean} + + + avmService + #{AVMLockingAwareService} + + + actionService + #{ActionService} + + + nodeService + #{NodeService} + + + + + + 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 + + avmBrowseBean + #{AVMBrowseBean} + + + nodeService + #{NodeService} + + + + + + The bean that backs up the Link Validation Dialog + + LinkValidationDialog + org.alfresco.web.bean.wcm.LinkValidationDialog + session + + avmBrowseBean + #{AVMBrowseBean} + + + actionService + #{ActionService} + + + avmService + #{AVMLockingAwareService} + + + + + + + Bean that generates a text field component + + TextFieldGenerator + org.alfresco.web.bean.generator.TextFieldGenerator + request + + + + + + Bean that generates a mutlilingual text field component + + MultilingualTextFieldGenerator + org.alfresco.web.bean.generator.MultilingualTextFieldGenerator + request + + + + + + Bean that generates a link component + + LinkGenerator + org.alfresco.web.bean.generator.LinkGenerator + request + + + + + Bean that generates a text area component + + TextAreaGenerator + org.alfresco.web.bean.generator.TextAreaGenerator + request + + + + + + Bean that generates a multilingual text area component + + MultilingualTextAreaGenerator + org.alfresco.web.bean.generator.MultilingualTextAreaGenerator + request + + + + + + Bean that generates a checkbox component + + CheckboxGenerator + org.alfresco.web.bean.generator.CheckboxGenerator + request + + + + + Bean that generates a date picker component + + DatePickerGenerator + org.alfresco.web.bean.generator.DatePickerGenerator + request + + + + + + Bean that generates a datetime picker component + + DateTimePickerGenerator + org.alfresco.web.bean.generator.DateTimePickerGenerator + request + + + + + + Bean that generates a label component + + LabelGenerator + org.alfresco.web.bean.generator.LabelGenerator + request + + + + + Bean that generates a mime type selector component + + MimeTypeSelectorGenerator + org.alfresco.web.bean.generator.MimeTypeSelectorGenerator + request + + + + + Bean that generates a charset selector component + + CharsetSelectorGenerator + org.alfresco.web.bean.generator.CharsetSelectorGenerator + request + + + + + Bean that generates a languages selector component + + LanguageSelectorGenerator + org.alfresco.web.bean.generator.LanguageSelectorGenerator + request + + userPreferencesBean + #{UserPreferencesBean} + + + + + + + Bean that generates a languages selector component for ML container + + MlContainerLanguageSelectorGenerator + org.alfresco.web.bean.generator.MlContainerLanguageSelectorGenerator + request + + multilingualContentService + #{MultilingualContentService} + + + contentFilterLanguagesService + #{ContentFilterLanguagesService} + + + nodeService + #{NodeService} + + + + + + Bean that generates an image picker component + + SpaceIconPickerGenerator + org.alfresco.web.bean.generator.SpaceIconPickerGenerator + request + + + + + Bean that generates a category selector component + + CategorySelectorGenerator + org.alfresco.web.bean.generator.CategorySelectorGenerator + request + + Bean that generates an ajax tag picker component @@ -4344,1247 +4328,1243 @@ request - - - Bean that generates an association component - - AssociationGenerator - org.alfresco.web.bean.generator.AssociationGenerator - request - - - - - Bean that generates a child association component - - ChildAssociationGenerator - org.alfresco.web.bean.generator.ChildAssociationGenerator - request - - - - - Bean that generates a separator component - - SeparatorGenerator - org.alfresco.web.bean.generator.SeparatorGenerator - request - - - - - Bean that generates a label separator component - - LabelSeparatorGenerator - org.alfresco.web.bean.generator.LabelSeparatorGenerator - request - - - - - Bean that generates a label separator component rendered as a heading - - HeaderSeparatorGenerator - org.alfresco.web.bean.generator.LabelSeparatorGenerator - request - - styleClass - wizardSectionHeading mainSubTitle - - - - - - - - - - Bean that returns information on a node - - NodeInfoBean - org.alfresco.web.bean.ajax.NodeInfoBean - request - - nodeService - #{NodeService} - - - - - - Bean that returns information on a workflow task - - TaskInfoBean - org.alfresco.web.bean.ajax.TaskInfoBean - request - - workflowService - #{WorkflowService} - - - - - - Bean that accepts File uploads for the repository - - FileUploadBean - org.alfresco.web.bean.ajax.FileUploadBean - request - - - - - Bean that accepts Content updates for the repository - - ContentUpdateBean - org.alfresco.web.bean.ajax.ContentUpdateBean - request - - - - - Bean backing ajax calls for the MySpaces portlet - - MySpacesBean - org.alfresco.web.bean.ajax.MySpacesBean - request - - - - - Bean backing the ajax requests from various Portlet webscripts - - PortletActionsBean - org.alfresco.web.bean.ajax.PortletActionsBean - request - - - - - Bean proxying ajax calls for the online Presence webscript - - PresenceProxyBean - org.alfresco.web.bean.ajax.PresenceProxyBean - request - - - - - Bean backing the ajax requests for the ajax based picker components - - PickerBean - org.alfresco.web.bean.ajax.PickerBean - request - - categoryService - #{CategoryService} - - - nodeService - #{NodeService} - - - internalNodeService - #{nodeService} - - - fileFolderService - #{FileFolderService} - - - - - - Bean that returns manages the tree data for the navigator component - - NavigatorPluginBean - org.alfresco.web.bean.ajax.NavigatorPluginBean - session - - nodeService - #{NodeService} - - - internalNodeService - #{nodeService} - - - dictionaryService - #{DictionaryService} - - - - - - Bean that returns information on a node - - XFormsBean - org.alfresco.web.forms.xforms.XFormsBean - session - - avmService - #{AVMLockingAwareService} - - - 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} - - - - - - Bean that returns deployment progress status - - DeploymentProgressBean - org.alfresco.web.bean.wcm.DeploymentProgressBean - request - - - - - Bean that returns link validation progress status - - LinkValidationProgressBean - org.alfresco.web.bean.wcm.LinkValidationProgressBean - session - - avmBrowseBean - #{AVMBrowseBean} - - - - - - - The bean that backs up the view of the Versioned Properties - - VersionedDocumentDetailsDialog - - org.alfresco.web.bean.content.VersionedDocumentDetailsDialog - - session - - versionService - #{VersionService} - - - editionService - #{EditionService} - - - nodeService - #{NodeService} - - - multilingualContentService - #{MultilingualContentService} - - - contentFilterLanguagesService - #{ContentFilterLanguagesService} - - - - - - The bean that backs up the New User Wizard - - CreateUserWizard - - org.alfresco.web.bean.users.CreateUserWizard - - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - authenticationService - #{authenticationService} - - - permissionService - #{PermissionService} - - - namespaceService - #{NamespaceService} - - - personService - #{PersonService} + + + Bean that generates an association component + + AssociationGenerator + org.alfresco.web.bean.generator.AssociationGenerator + request + + + + + Bean that generates a child association component + + ChildAssociationGenerator + org.alfresco.web.bean.generator.ChildAssociationGenerator + request + + + + + Bean that generates a separator component + + SeparatorGenerator + org.alfresco.web.bean.generator.SeparatorGenerator + request + + + + + Bean that generates a label separator component + + LabelSeparatorGenerator + org.alfresco.web.bean.generator.LabelSeparatorGenerator + request + + + + + Bean that generates a label separator component rendered as a heading + + HeaderSeparatorGenerator + org.alfresco.web.bean.generator.LabelSeparatorGenerator + request + + styleClass + wizardSectionHeading mainSubTitle + + + + + + + + + + Bean that returns information on a node + + NodeInfoBean + org.alfresco.web.bean.ajax.NodeInfoBean + request + + nodeService + #{NodeService} + + + + + + Bean that returns information on a workflow task + + TaskInfoBean + org.alfresco.web.bean.ajax.TaskInfoBean + request + + workflowService + #{WorkflowService} + + + + + + Bean that accepts File uploads for the repository + + FileUploadBean + org.alfresco.web.bean.ajax.FileUploadBean + request + + + + + Bean that accepts Content updates for the repository + + ContentUpdateBean + org.alfresco.web.bean.ajax.ContentUpdateBean + request + + + + + Bean backing ajax calls for the MySpaces portlet + + MySpacesBean + org.alfresco.web.bean.ajax.MySpacesBean + request + + + + + Bean backing the ajax requests from various Portlet webscripts + + PortletActionsBean + org.alfresco.web.bean.ajax.PortletActionsBean + request + + + + + Bean proxying ajax calls for the online Presence webscript + + PresenceProxyBean + org.alfresco.web.bean.ajax.PresenceProxyBean + request + + + + + Bean backing the ajax requests for the ajax based picker components + + PickerBean + org.alfresco.web.bean.ajax.PickerBean + request + + categoryService + #{CategoryService} + + + nodeService + #{NodeService} + + + internalNodeService + #{nodeService} + + + fileFolderService + #{FileFolderService} + + + + + + Bean that returns manages the tree data for the navigator component + + NavigatorPluginBean + org.alfresco.web.bean.ajax.NavigatorPluginBean + session + + nodeService + #{NodeService} + + + internalNodeService + #{nodeService} + + + dictionaryService + #{DictionaryService} + + + + + + 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} + + + + + + Bean that returns deployment progress status + + DeploymentProgressBean + org.alfresco.web.bean.wcm.DeploymentProgressBean + request + + + + + Bean that returns link validation progress status + + LinkValidationProgressBean + org.alfresco.web.bean.wcm.LinkValidationProgressBean + session + + avmBrowseBean + #{AVMBrowseBean} + + + + + + + The bean that backs up the view of the Versioned Properties + + VersionedDocumentDetailsDialog + + org.alfresco.web.bean.content.VersionedDocumentDetailsDialog + + session + + versionService + #{VersionService} + + + editionService + #{EditionService} + + + nodeService + #{NodeService} + + + multilingualContentService + #{MultilingualContentService} + + + contentFilterLanguagesService + #{ContentFilterLanguagesService} + + + + + + The bean that backs up the New User Wizard + + CreateUserWizard + + org.alfresco.web.bean.users.CreateUserWizard + + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + authenticationService + #{authenticationService} + + + permissionService + #{PermissionService} + + + namespaceService + #{NamespaceService} + + + personService + #{PersonService} tenantService #{tenantService} - - - ownableService - #{OwnableService} - - - contentUsageService - #{ContentUsageService} - - - - - - The bean that backs up the Edit User Wizard - - EditUserWizard - - org.alfresco.web.bean.users.EditUserWizard - - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - authenticationService - #{authenticationService} - - - permissionService - #{PermissionService} - - - namespaceService - #{NamespaceService} - - - personService - #{PersonService} + + + ownableService + #{OwnableService} + + + contentUsageService + #{ContentUsageService} + + + + + + The bean that backs up the Edit User Wizard + + EditUserWizard + + org.alfresco.web.bean.users.EditUserWizard + + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + authenticationService + #{authenticationService} + + + permissionService + #{PermissionService} + + + namespaceService + #{NamespaceService} + + + personService + #{PersonService} tenantService #{tenantService} - - - ownableService - #{OwnableService} - - - properties - #{UsersBeanProperties} - - - contentUsageService - #{ContentUsageService} - - - - - - The bean that holds state for the Users Edit Details screen. - - EditUserDetailsDialog - - org.alfresco.web.bean.users.EditUserDetailsDialog - - session - - properties - #{UsersBeanProperties} - - - nodeService - #{NodeService} - - - - - - The bean for the Remove Invited User screen. - - RemoveInvitedUserDialog - - org.alfresco.web.bean.users.RemoveInvitedUserDialog - - session - - spaceUsersBean - #{SpaceUsersBean} - - - - - - The bean for the Edit User Roles screen. - - EditUserRolesDialog - - org.alfresco.web.bean.users.EditUserRolesDialog - - session - - spaceUsersBean - #{SpaceUsersBean} - - - - - The bean for the Delete User screen. - DeleteUserDialog - - org.alfresco.web.bean.users.DeleteUserDialog - - session - - authenticationService - #{AuthenticationService} - - - personService - #{PersonService} - - - - - - The bean for the Delete Content User screen. - - RemoveContentUserDialog - - org.alfresco.web.bean.users.RemoveContentUserDialog - - session - - browseBean - #{BrowseBean} - - - contentUsersBean - #{ContentUsersBean} - - - - - - The bean for add users to group dialog. - - AddUsersDialog - - org.alfresco.web.bean.groups.AddUsersDialog - - session - - nodeService - #{NodeService} - - - authService - #{AuthorityService} - - - personService - #{PersonService} - - - - - The bean for delete group dialog. - DeleteGroupDialog - - org.alfresco.web.bean.groups.DeleteGroupDialog - - session - - authService - #{AuthorityService} - - - - - The bean for create group dialog. - CreateGroupDialog - - org.alfresco.web.bean.groups.CreateGroupDialog - - session - - authService - #{AuthorityService} - - - - - - The bean that holds state for the Edit File screens. - - EditFileDialog - - org.alfresco.web.bean.users.EditFileDialog - - session - - - - - The bean for the Edit Content User Roles screen. - - EditContentUserRolesDialog - - org.alfresco.web.bean.users.EditContentUserRolesDialog - - session - - contentUsersBean - #{ContentUsersBean} - - - - - - The bean for the Admin Console screen. - - AdminConsoleDialog - - org.alfresco.web.bean.admin.AdminConsoleDialog - - session - - - - - The bean for the Edit Node Categories screen. - - EditNodeCategoriesDialog - - org.alfresco.web.bean.categories.EditNodeCategoriesDialog - - session - - nodeService - #{NodeService} - - - dictionaryService - #{DictionaryService} - - - - - - The bean for the Edit Category screen. - - EditCategoryDialog - - org.alfresco.web.bean.categories.EditCategoryDialog - - session - - nodeService - #{NodeService} - - - categoryService - #{CategoryService} - - - - - - The bean for the Delete Category screen. - - DeleteCategoryDialog - - org.alfresco.web.bean.categories.DeleteCategoryDialog - - session - - nodeService - #{NodeService} - - - categoryService - #{CategoryService} - - - - - The bean for the New Category screen. - CreateCategoryDialog - - org.alfresco.web.bean.categories.CreateCategoryDialog - - session - - nodeService - #{NodeService} - - - categoryService - #{CategoryService} - - - - - The bean for Apply Doc Template Screen. - ApplyDocTemplateDialog - - org.alfresco.web.bean.spaces.ApplyDocTemplateDialog - - session - - nodeService - #{NodeService} - - - browseBean - #{BrowseBean} - - - - - The bean for Apply RSS Template Screen. - ApplyRssTemplateDialog - - org.alfresco.web.bean.spaces.ApplyRssTemplateDialog - - session - - nodeService - #{NodeService} - - - browseBean - #{BrowseBean} - - - - - The bean for Apply Space Template Screen. - ApplySpaceTemplateDialog - - org.alfresco.web.bean.spaces.ApplySpaceTemplateDialog - - session - - nodeService - #{NodeService} - - - browseBean - #{BrowseBean} - - - - - The bean for Edit Simple Workflow Screen. - EditSimpleWorkflowDialog - - org.alfresco.web.bean.content.EditSimpleWorkflowDialog - - session - - browseBean - #{BrowseBean} - - - nodeService - #{NodeService} - - - - - The bean for Edit Simple Space Workflow Screen. - EditSimpleWorkflowDialog - - org.alfresco.web.bean.spaces.EditSimpleWorkflowDialog - - session - - browseBean - #{BrowseBean} - - - nodeService - #{NodeService} - - - - - The bean for Change Current User Password Screen. - ChangeMyPasswordDialog - - org.alfresco.web.bean.users.ChangeMyPasswordDialog - - session - - properties - #{UsersBeanProperties} - - - - - The bean for Change Users Password Screen. - ChangePasswordDialog - - org.alfresco.web.bean.users.ChangePasswordDialog - - session - - properties - #{UsersBeanProperties} - - - - - - Bean that manages the deleting of trashitem. - - TrashcanDeleteItemDialog - org.alfresco.web.bean.trashcan.TrashcanDeleteItemDialog - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - dictionaryService - #{DictionaryService} - - - property - #{TrashcanDialogProperty} - - - - - - Bean that manages the deleting of all trashitems. - - TrashcanDeleteAllItemsDialog - org.alfresco.web.bean.trashcan.TrashcanDeleteAllItemsDialog - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - dictionaryService - #{DictionaryService} - - - property - #{TrashcanDialogProperty} - - - - - - Bean that manages the deleting of listed trashitems. - - TrashcanDeleteListedItemsDialog - org.alfresco.web.bean.trashcan.TrashcanDeleteListedItemsDialog - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - dictionaryService - #{DictionaryService} - - - property - #{TrashcanDialogProperty} - - - - - The bean for the Item Details Screen. - TrashcanItemDetailsDialog - - org.alfresco.web.bean.trashcan.TrashcanItemDetailsDialog - - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - dictionaryService - #{DictionaryService} - - - permissionService - #{PermissionService} - - - property - #{TrashcanDialogProperty} - - - - - The bean for the Recover Item Screen. - TrashcanRecoverItemDialog - - org.alfresco.web.bean.trashcan.TrashcanRecoverItemDialog - - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - dictionaryService - #{DictionaryService} - - - property - #{TrashcanDialogProperty} - - - - - The bean for the Recover All Items Screen. - TrashcanRecoverAllItemsDialog - - org.alfresco.web.bean.trashcan.TrashcanRecoverAllItemsDialog - - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - dictionaryService - #{DictionaryService} - - - property - #{TrashcanDialogProperty} - - - - - The bean for the Recover Listed Items Screen. - TrashcanRecoverListedItemsDialog - - org.alfresco.web.bean.trashcan.TrashcanRecoverListedItemsDialog - - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - dictionaryService - #{DictionaryService} - - - property - #{TrashcanDialogProperty} - - - - - The bean for Users Profile and Settings screen. - UserConsoleDialog - - org.alfresco.web.bean.users.UserConsoleDialog - - session - - - - The bean for a User Profile. - UserProfileDialog - - org.alfresco.web.bean.users.UserProfileDialog - - session - - properties - #{UsersBeanProperties} - - - - - The bean for the Recovery Report Screen. - TrashcanRecoveryReportDialog - - org.alfresco.web.bean.trashcan.TrashcanRecoveryReportDialog - - session - - nodeService - #{NodeService} - - - searchService - #{SearchService} - - - dictionaryService - #{DictionaryService} - - - property - #{TrashcanDialogProperty} - - - - - The bean for the Edit Html Inline Screen. - CCEditHtmlInlineDialog - - org.alfresco.web.bean.coci.CCEditHtmlInlineDialog - - session - - property - #{CCProperties} - - - - - The bean for the Edit Text Inline Screen. - CCEditTextInlineDialog - - org.alfresco.web.bean.coci.CCEditTextInlineDialog - - session - - property - #{CCProperties} - - - - - The bean for the Checkout File Screen. - CCCheckoutFileDialog - - org.alfresco.web.bean.coci.CCCheckoutFileDialog - - session - - property - #{CCProperties} - - - browseBean - #{BrowseBean} - - - navigator - #{NavigationBean} - - - nodeService - #{NodeService} - - - - - The bean for the Checkout File Link Screen. - CCCheckoutFileLinkDialog - - org.alfresco.web.bean.coci.CCCheckoutFileLinkDialog - - session - - browseBean - #{BrowseBean} - - - navigator - #{NavigationBean} - - - nodeService - #{NodeService} - - - property - #{CCProperties} - - - - - The bean for the Edit File Screen. - CCEditFileDialog - - org.alfresco.web.bean.coci.CCEditFileDialog - - session - - property - #{CCProperties} - - - - - The bean for the Undo Checkout File Screen. - CCUndoCheckoutFileDialog - - org.alfresco.web.bean.coci.CCUndoCheckoutFileDialog - - session - - property - #{CCProperties} - - - - - The bean for the Working Copy Missing Screen. - CCWorkingCopyMissingDialog - - org.alfresco.web.bean.coci.CCWorkingCopyMissingDialog - - session - - property - #{CCProperties} - - - - - The bean for the Checkin File Screen. - CCCheckinFileDialog - - org.alfresco.web.bean.coci.CCCheckinFileDialog - - session - - property - #{CCProperties} - - - - - The bean for the Edit Search Screen. - EditSearchDialog - - org.alfresco.web.bean.search.EditSearchDialog - - session - - navigator - #{NavigationBean} - - - nodeService - #{NodeService} - - - namespaceService - #{NamespaceService} - - - searchService - #{SearchService} - - - properties - #{SearchProperties} - - - - - The bean for the Save Search Screen. - SaveSearchDialog - - org.alfresco.web.bean.search.SaveSearchDialog - - session - - navigator - #{NavigationBean} - - - nodeService - #{NodeService} - - - namespaceService - #{NamespaceService} - - - searchService - #{SearchService} - - - properties - #{SearchProperties} - - - - - - The bean that backs up the Create Project Dialog - - CreateProjectDialog - org.alfresco.web.bean.projects.CreateProjectDialog - session - - nodeService - #{NodeService} - - - fileFolderService - #{FileFolderService} - - - searchService - #{SearchService} - - - navigator - #{NavigationBean} - - - browseBean - #{BrowseBean} - - - namespaceService - #{NamespaceService} - - - dictionaryService - #{DictionaryService} - - - - - The bean for the Save Search Screen. - ShowSystemInfoDialog - - org.alfresco.web.bean.admin.ShowSystemInfoDialog - - session - - navigator - #{NavigationBean} - - - aboutBean - #{AboutBean} - - - - - CategoryBrowserPluginBean - org.alfresco.web.bean.ajax.CategoryBrowserPluginBean - session - - nodeService - #{NodeService} - - - categoryService - #{CategoryService} - - - - - CategoryBrowserBean - org.alfresco.web.bean.CategoryBrowserBean - session - - nodeService - #{NodeService} - - - - + + + ownableService + #{OwnableService} + + + properties + #{UsersBeanProperties} + + + contentUsageService + #{ContentUsageService} + + + + + + The bean that holds state for the Users Edit Details screen. + + EditUserDetailsDialog + + org.alfresco.web.bean.users.EditUserDetailsDialog + + session + + properties + #{UsersBeanProperties} + + + nodeService + #{NodeService} + + + + + + The bean for the Remove Invited User screen. + + RemoveInvitedUserDialog + + org.alfresco.web.bean.users.RemoveInvitedUserDialog + + session + + spaceUsersBean + #{SpaceUsersBean} + + + + + + The bean for the Edit User Roles screen. + + EditUserRolesDialog + + org.alfresco.web.bean.users.EditUserRolesDialog + + session + + spaceUsersBean + #{SpaceUsersBean} + + + + + The bean for the Delete User screen. + DeleteUserDialog + + org.alfresco.web.bean.users.DeleteUserDialog + + session + + authenticationService + #{AuthenticationService} + + + personService + #{PersonService} + + + + + + The bean for the Delete Content User screen. + + RemoveContentUserDialog + + org.alfresco.web.bean.users.RemoveContentUserDialog + + session + + browseBean + #{BrowseBean} + + + contentUsersBean + #{ContentUsersBean} + + + + + + The bean for add users to group dialog. + + AddUsersDialog + + org.alfresco.web.bean.groups.AddUsersDialog + + session + + nodeService + #{NodeService} + + + authService + #{AuthorityService} + + + personService + #{PersonService} + + + + + The bean for delete group dialog. + DeleteGroupDialog + + org.alfresco.web.bean.groups.DeleteGroupDialog + + session + + authService + #{AuthorityService} + + + + + The bean for create group dialog. + CreateGroupDialog + + org.alfresco.web.bean.groups.CreateGroupDialog + + session + + authService + #{AuthorityService} + + + + + + The bean that holds state for the Edit File screens. + + EditFileDialog + + org.alfresco.web.bean.users.EditFileDialog + + session + + + + + The bean for the Edit Content User Roles screen. + + EditContentUserRolesDialog + + org.alfresco.web.bean.users.EditContentUserRolesDialog + + session + + contentUsersBean + #{ContentUsersBean} + + + + + + The bean for the Admin Console screen. + + AdminConsoleDialog + + org.alfresco.web.bean.admin.AdminConsoleDialog + + session + + + + + The bean for the Edit Node Categories screen. + + EditNodeCategoriesDialog + + org.alfresco.web.bean.categories.EditNodeCategoriesDialog + + session + + nodeService + #{NodeService} + + + dictionaryService + #{DictionaryService} + + + + + + The bean for the Edit Category screen. + + EditCategoryDialog + + org.alfresco.web.bean.categories.EditCategoryDialog + + session + + nodeService + #{NodeService} + + + categoryService + #{CategoryService} + + + + + + The bean for the Delete Category screen. + + DeleteCategoryDialog + + org.alfresco.web.bean.categories.DeleteCategoryDialog + + session + + nodeService + #{NodeService} + + + categoryService + #{CategoryService} + + + + + The bean for the New Category screen. + CreateCategoryDialog + + org.alfresco.web.bean.categories.CreateCategoryDialog + + session + + nodeService + #{NodeService} + + + categoryService + #{CategoryService} + + + + + The bean for Apply Doc Template Screen. + ApplyDocTemplateDialog + + org.alfresco.web.bean.spaces.ApplyDocTemplateDialog + + session + + nodeService + #{NodeService} + + + browseBean + #{BrowseBean} + + + + + The bean for Apply RSS Template Screen. + ApplyRssTemplateDialog + + org.alfresco.web.bean.spaces.ApplyRssTemplateDialog + + session + + nodeService + #{NodeService} + + + browseBean + #{BrowseBean} + + + + + The bean for Apply Space Template Screen. + ApplySpaceTemplateDialog + + org.alfresco.web.bean.spaces.ApplySpaceTemplateDialog + + session + + nodeService + #{NodeService} + + + browseBean + #{BrowseBean} + + + + + The bean for Edit Simple Workflow Screen. + EditSimpleWorkflowDialog + + org.alfresco.web.bean.content.EditSimpleWorkflowDialog + + session + + browseBean + #{BrowseBean} + + + nodeService + #{NodeService} + + + + + The bean for Edit Simple Space Workflow Screen. + EditSimpleWorkflowDialog + + org.alfresco.web.bean.spaces.EditSimpleWorkflowDialog + + session + + browseBean + #{BrowseBean} + + + nodeService + #{NodeService} + + + + + The bean for Change Current User Password Screen. + ChangeMyPasswordDialog + + org.alfresco.web.bean.users.ChangeMyPasswordDialog + + session + + properties + #{UsersBeanProperties} + + + + + The bean for Change Users Password Screen. + ChangePasswordDialog + + org.alfresco.web.bean.users.ChangePasswordDialog + + session + + properties + #{UsersBeanProperties} + + + + + + Bean that manages the deleting of trashitem. + + TrashcanDeleteItemDialog + org.alfresco.web.bean.trashcan.TrashcanDeleteItemDialog + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + dictionaryService + #{DictionaryService} + + + property + #{TrashcanDialogProperty} + + + + + + Bean that manages the deleting of all trashitems. + + TrashcanDeleteAllItemsDialog + org.alfresco.web.bean.trashcan.TrashcanDeleteAllItemsDialog + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + dictionaryService + #{DictionaryService} + + + property + #{TrashcanDialogProperty} + + + + + + Bean that manages the deleting of listed trashitems. + + TrashcanDeleteListedItemsDialog + org.alfresco.web.bean.trashcan.TrashcanDeleteListedItemsDialog + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + dictionaryService + #{DictionaryService} + + + property + #{TrashcanDialogProperty} + + + + + The bean for the Item Details Screen. + TrashcanItemDetailsDialog + + org.alfresco.web.bean.trashcan.TrashcanItemDetailsDialog + + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + dictionaryService + #{DictionaryService} + + + permissionService + #{PermissionService} + + + property + #{TrashcanDialogProperty} + + + + + The bean for the Recover Item Screen. + TrashcanRecoverItemDialog + + org.alfresco.web.bean.trashcan.TrashcanRecoverItemDialog + + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + dictionaryService + #{DictionaryService} + + + property + #{TrashcanDialogProperty} + + + + + The bean for the Recover All Items Screen. + TrashcanRecoverAllItemsDialog + + org.alfresco.web.bean.trashcan.TrashcanRecoverAllItemsDialog + + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + dictionaryService + #{DictionaryService} + + + property + #{TrashcanDialogProperty} + + + + + The bean for the Recover Listed Items Screen. + TrashcanRecoverListedItemsDialog + + org.alfresco.web.bean.trashcan.TrashcanRecoverListedItemsDialog + + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + dictionaryService + #{DictionaryService} + + + property + #{TrashcanDialogProperty} + + + + + The bean for Users Profile and Settings screen. + UserConsoleDialog + + org.alfresco.web.bean.users.UserConsoleDialog + + session + + + + The bean for a User Profile. + UserProfileDialog + + org.alfresco.web.bean.users.UserProfileDialog + + session + + properties + #{UsersBeanProperties} + + + + + The bean for the Recovery Report Screen. + TrashcanRecoveryReportDialog + + org.alfresco.web.bean.trashcan.TrashcanRecoveryReportDialog + + session + + nodeService + #{NodeService} + + + searchService + #{SearchService} + + + dictionaryService + #{DictionaryService} + + + property + #{TrashcanDialogProperty} + + + + + The bean for the Edit Html Inline Screen. + CCEditHtmlInlineDialog + + org.alfresco.web.bean.coci.CCEditHtmlInlineDialog + + session + + property + #{CCProperties} + + + + + The bean for the Edit Text Inline Screen. + CCEditTextInlineDialog + + org.alfresco.web.bean.coci.CCEditTextInlineDialog + + session + + property + #{CCProperties} + + + + + The bean for the Checkout File Screen. + CCCheckoutFileDialog + + org.alfresco.web.bean.coci.CCCheckoutFileDialog + + session + + property + #{CCProperties} + + + browseBean + #{BrowseBean} + + + navigator + #{NavigationBean} + + + nodeService + #{NodeService} + + + + + The bean for the Checkout File Link Screen. + CCCheckoutFileLinkDialog + + org.alfresco.web.bean.coci.CCCheckoutFileLinkDialog + + session + + browseBean + #{BrowseBean} + + + navigator + #{NavigationBean} + + + nodeService + #{NodeService} + + + property + #{CCProperties} + + + + + The bean for the Edit File Screen. + CCEditFileDialog + + org.alfresco.web.bean.coci.CCEditFileDialog + + session + + property + #{CCProperties} + + + + + The bean for the Undo Checkout File Screen. + CCUndoCheckoutFileDialog + + org.alfresco.web.bean.coci.CCUndoCheckoutFileDialog + + session + + property + #{CCProperties} + + + + + The bean for the Working Copy Missing Screen. + CCWorkingCopyMissingDialog + + org.alfresco.web.bean.coci.CCWorkingCopyMissingDialog + + session + + property + #{CCProperties} + + + + + The bean for the Checkin File Screen. + CCCheckinFileDialog + + org.alfresco.web.bean.coci.CCCheckinFileDialog + + session + + property + #{CCProperties} + + + + + The bean for the Edit Search Screen. + EditSearchDialog + + org.alfresco.web.bean.search.EditSearchDialog + + session + + navigator + #{NavigationBean} + + + nodeService + #{NodeService} + + + namespaceService + #{NamespaceService} + + + searchService + #{SearchService} + + + properties + #{SearchProperties} + + + + + The bean for the Save Search Screen. + SaveSearchDialog + + org.alfresco.web.bean.search.SaveSearchDialog + + session + + navigator + #{NavigationBean} + + + nodeService + #{NodeService} + + + namespaceService + #{NamespaceService} + + + searchService + #{SearchService} + + + properties + #{SearchProperties} + + + + + + The bean that backs up the Create Project Dialog + + CreateProjectDialog + org.alfresco.web.bean.projects.CreateProjectDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + namespaceService + #{NamespaceService} + + + dictionaryService + #{DictionaryService} + + + + + The bean for the Save Search Screen. + ShowSystemInfoDialog + + org.alfresco.web.bean.admin.ShowSystemInfoDialog + + session + + navigator + #{NavigationBean} + + + aboutBean + #{AboutBean} + + + + + CategoryBrowserPluginBean + org.alfresco.web.bean.ajax.CategoryBrowserPluginBean + session + + nodeService + #{NodeService} + + + categoryService + #{CategoryService} + + + + + CategoryBrowserBean + org.alfresco.web.bean.CategoryBrowserBean + session + + nodeService + #{NodeService} + + + +