From 640195064a5005d8e8d0010a4ed5aadbb0c39fe2 Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Wed, 16 Aug 2006 15:41:49 +0000 Subject: [PATCH] . Added RSS Feed panel to Space Details page - Selectable template for RSS feed for a folder - RSS feed link for drag/drop into RSS reader . Added new folder "RSS Templates" in Data Dictionary in bootstrap . Example RSS Template for new folder (docs in last 7 days) . Created patch to add above folder+example to current schema . Added 'app:feedsource' aspect to application data model . Cleaned up some obsolete code in Apply/Remove Template actions . Simplified Apply/Remove Template dialog navigation to use dialog framework git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3527 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/bootstrap-context.xml | 4 + config/alfresco/bootstrap/spaces.xml | 13 + config/alfresco/import-export-context.xml | 1 + .../messages/bootstrap-spaces.properties | 5 +- .../messages/patch-service.properties | 6 +- config/alfresco/mimetype/mimetype-map.xml | 3 + .../model-specific-services-context.xml | 1 + config/alfresco/model/applicationModel.xml | 11 + .../alfresco/patch/patch-services-context.xml | 18 ++ config/alfresco/repository.properties | 3 +- config/alfresco/templates/rss_templates.acp | Bin 0 -> 1782 bytes config/alfresco/version.properties | 2 +- .../java/org/alfresco/model/ContentModel.java | 6 +- .../patch/impl/RSSTemplatesFolderPatch.java | 292 ++++++++++++++++++ .../admin/patch/impl/ScriptsFolderPatch.java | 26 +- 15 files changed, 372 insertions(+), 19 deletions(-) create mode 100644 config/alfresco/templates/rss_templates.acp create mode 100644 source/java/org/alfresco/repo/admin/patch/impl/RSSTemplatesFolderPatch.java diff --git a/config/alfresco/bootstrap-context.xml b/config/alfresco/bootstrap-context.xml index 142ec70343..a5edf79c22 100644 --- a/config/alfresco/bootstrap-context.xml +++ b/config/alfresco/bootstrap-context.xml @@ -112,6 +112,10 @@ /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.email.childname} alfresco/templates/email_templates.acp + + /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.rss.childname} + alfresco/templates/rss_templates.acp + /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.scripts.childname} alfresco/bootstrap/example_javascripts.acp diff --git a/config/alfresco/bootstrap/spaces.xml b/config/alfresco/bootstrap/spaces.xml index d8a593e6b5..25edba6c30 100644 --- a/config/alfresco/bootstrap/spaces.xml +++ b/config/alfresco/bootstrap/spaces.xml @@ -45,6 +45,19 @@ ${spaces.templates.email.name} ${spaces.templates.email.description} + + + + guest + Consumer + + + + ${spaces.templates.rss.name} + space-icon-default + ${spaces.templates.rss.name} + ${spaces.templates.rss.description} + diff --git a/config/alfresco/import-export-context.xml b/config/alfresco/import-export-context.xml index e5b10d42ee..6d6d0c9d3f 100644 --- a/config/alfresco/import-export-context.xml +++ b/config/alfresco/import-export-context.xml @@ -260,6 +260,7 @@ ${spaces.templates.childname} ${spaces.templates.content.childname} ${spaces.templates.email.childname} + ${spaces.templates.rss.childname} ${spaces.savedsearches.childname} ${spaces.scripts.childname} diff --git a/config/alfresco/messages/bootstrap-spaces.properties b/config/alfresco/messages/bootstrap-spaces.properties index c0d7937436..660be1d85e 100644 --- a/config/alfresco/messages/bootstrap-spaces.properties +++ b/config/alfresco/messages/bootstrap-spaces.properties @@ -7,7 +7,7 @@ spaces.dictionary.name=Data Dictionary spaces.dictionary.description=User managed definitions spaces.templates.name=Space Templates -spaces.templates.description=Space templates +spaces.templates.description=Space folder templates spaces.templates.content.name=Presentation Templates spaces.templates.content.description=Presentation templates @@ -15,6 +15,9 @@ spaces.templates.content.description=Presentation templates spaces.templates.email.name=Email Templates spaces.templates.email.description=Email templates +spaces.templates.rss.name=RSS Templates +spaces.templates.rss.description=RSS templates + spaces.savedsearches.name=Saved Searches spaces.savedsearches.description=Saved Searches diff --git a/config/alfresco/messages/patch-service.properties b/config/alfresco/messages/patch-service.properties index 402fba27b9..bf73490d1b 100644 --- a/config/alfresco/messages/patch-service.properties +++ b/config/alfresco/messages/patch-service.properties @@ -77,4 +77,8 @@ patch.actionRuleDecouplingPatch.description=Migrate existing rules to the update patch.actionRuleDecouplingPatch.result=Updated {0} rules. patch.systemWorkflowFolder.description=Ensures the existence of the system workflow container. -patch.systemWorkflowFolder.result.created=Created system workflow container {0}. \ No newline at end of file +patch.systemWorkflowFolder.result.created=Created system workflow container {0}. + +patch.rssTemplatesFolder.description=Ensures the existence of the 'RSS Templates' folder. +patch.rssTemplatesFolder.result.exists=The RSS Templates folder already exists: {0} +patch.rssTemplatesFolder.result.created=The RSS Templates folder was successfully created: {0} diff --git a/config/alfresco/mimetype/mimetype-map.xml b/config/alfresco/mimetype/mimetype-map.xml index 17340ab60e..da308c86f2 100644 --- a/config/alfresco/mimetype/mimetype-map.xml +++ b/config/alfresco/mimetype/mimetype-map.xml @@ -138,6 +138,9 @@ jpeg jpe + + svg + js diff --git a/config/alfresco/model-specific-services-context.xml b/config/alfresco/model-specific-services-context.xml index bd6bc7fcbc..287b666e72 100644 --- a/config/alfresco/model-specific-services-context.xml +++ b/config/alfresco/model-specific-services-context.xml @@ -19,6 +19,7 @@ /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.childname} /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.content.childname} /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.email.childname} + /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.rss.childname} /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.scripts.childname} diff --git a/config/alfresco/model/applicationModel.xml b/config/alfresco/model/applicationModel.xml index f11cc2ef2b..078a7d17a1 100644 --- a/config/alfresco/model/applicationModel.xml +++ b/config/alfresco/model/applicationModel.xml @@ -123,6 +123,17 @@ + + + Feed Source + + + Feed Template + d:noderef + false + + + diff --git a/config/alfresco/patch/patch-services-context.xml b/config/alfresco/patch/patch-services-context.xml index 5674a986cf..0b535459fa 100644 --- a/config/alfresco/patch/patch-services-context.xml +++ b/config/alfresco/patch/patch-services-context.xml @@ -388,5 +388,23 @@ + + patch.rssFolder + patch.rssTemplatesFolder.description + 0 + 16 + 17 + alfresco/templates/rss_templates.acp + + + + + + + + + + + diff --git a/config/alfresco/repository.properties b/config/alfresco/repository.properties index bcfedefc8a..221f37747f 100644 --- a/config/alfresco/repository.properties +++ b/config/alfresco/repository.properties @@ -97,6 +97,7 @@ spaces.dictionary.childname=app:dictionary spaces.templates.childname=app:space_templates spaces.templates.content.childname=app:content_templates spaces.templates.email.childname=app:email_templates +spaces.templates.rss.childname=app:rss_templates spaces.savedsearches.childname=app:saved_searches spaces.scripts.childname=app:scripts @@ -116,7 +117,7 @@ system.workflow_container.childname=sys:workflow # # You can do this when creating the alfresco database at the start # CREATE DATABASE alfresco CHARACTER SET utf8 COLLATION utf8_bin; -# If you want to do this later this is a dump and load fix as it is dome when the database, tables and columns are created. +# If you want to do this later this is a dump and load fix as it is done when the database, tables and columns are created. # # Must other databases are case sensitive by default. # diff --git a/config/alfresco/templates/rss_templates.acp b/config/alfresco/templates/rss_templates.acp new file mode 100644 index 0000000000000000000000000000000000000000..6a9fcd3e4e07258cfdbff5408d26b3bb95c2234d GIT binary patch literal 1782 zcmZ{lc{J2r7{`B&HDqR(R5T(qjIoV%Xwg^_N|GgO#Zb198KMToyt2j!NfMe$N)6t| zQrXA8(|D&LC9;g{*($xG-ao4IcJDd&``mlJ&vTwX?&mzmEO>Zf000OAK_rNFZZmO5 z9|!dqFNcf$$Ty5$$K9APh+S^Z~1;agxKydRw!X-}8y~1d6ah5WL zx<}9LshRE+C6|+(qCaof;MuTsv3X`Uu`8P*RIqvN;6Cg~h_8`tNyMmQJXPjl-~G3k z6)o-iJ2ldqlf9Vw`h-sB277_-(%gy>S;d&Ji?hY|Ptqa}#F3>=Et_{}(V}h$jls~7 zQZaBpYJtSP6w_$5)6~@%K_R&_n+%9F~aFcqTRLO@tyTk-bQ5 zj;!fom}(^+J(2@3tSLuIMYF_{{HC-|jI?{34SpzOv!)5cw_=;9HFI6=t+u^4u&>IP z<&HWpXU08cZPNG>`CSll*poZK8r5qYF^A{T6;C|@aQTwJ6OQz4yKnEByO;S@#b2Wk zwVQ4Fj1SHc)@L$rEnd@4fDcYgyu5j1R(CqMmPEcP<(qdDk42Dujx)5zjV+PQ9XQuv z;sxa@_)W1?XwHmc$_To+4%&UV%KOVYvR!&E3_VWi?*}K7g&@UAcV(YkAw8h8AAiQV z#=c5Evm;(;O3c3>q7osX*7sii8Q#hZ?1so$N_3rS?L4kt33|qQ#2yN@PfQs15V6WH z-*ffqF5tS_{#@dtgo2c1_tIYX3^z_*@P1wDC)kVL1G^#=P=4sGQ0ST@WKqC&;ar>M z7Gf1$ClBM%?&{qiWnf_5x-YzZ68xZX_Pyj6fn!`2gt)&R0OYwWd=LIRM7jDa3me`a z+(?ii+P(_{^>i*bZ@An*fA^|}`1#(pwZIR^Kq|-VWrlnZA9Fu?e;h#CdJ~$ACUbk@ z{yLuy;{m;JwO^fsyT7P$Do?*S=e|;jmu{8zSdB}#EmIDtqX;cFAl?6ETrDyZ!r$^CRSe%54MvWkz6 zr82nX5PZ}Nsn*7OWt*q)D32P*I-+}s{H_(Mof(BHJ0-n9)u4Xsz{SO`YA0#wSsoq? zl&18a`}`=q;#N7@^HrM0arKK6PlJLJS^Bh+$ZDiQa6(;*p*gNyQgb@OJg||mC!i7b z&mxYw7z)v6*Po*#`Y6GV#CK_By(v_<0s*(9&bJuK;7LicA2j;+*0AhqGuJL3e#Uu~ z$9zpM30U$>i%KS2d+yk5)FFzUH+X$2Rj+Uv41T`6`l$m{XB_OTd86Mo`dmY(sK}&< z`i!Z#WD!)iFuw?Lc0i(J2qu>b6S^#HwJf%KzE-b7X?;nvLdQ;u=34C>niH`Fn^vll z&=PxIg3rIlBf}%<1YJGdsO-623tEa;j5HNvb|M+~+5+0nKc;W>%xIXDhBb!Drpj0c zM4B)%Q+5qiK~ZPfB8|BQ z$!9I8B9hKlt7?mNM};e6SaL3p9QT$=oOBh>`dVGTla_ABi*m@qW49tqos#6I)VAlW z(#x7u4znhh=zJ_D!(YVq>vWEkVD!j1yuZ$4>i&vz(SUD_7tCtFBo%gP(WiFYHy#)6+F>+y>C{X?XXeQu%e8iYj=tMzxcNjr(%m3JrCnU(|6 z_G0<9n+n#`tN`j@7^|h%7t?O6*XI(H9aXP0P*4)^K!S1T6Bme0AQiik4ANdfji17Sg=jR^&54DZlA3f;(p1T3wF$+Ha4GRx<*Krm8{q`?# C9|u$b literal 0 HcmV?d00001 diff --git a/config/alfresco/version.properties b/config/alfresco/version.properties index d309203a47..bf3631ebc5 100644 --- a/config/alfresco/version.properties +++ b/config/alfresco/version.properties @@ -19,4 +19,4 @@ version.build=@build-number@ # Schema number -version.schema=16 +version.schema=17 diff --git a/source/java/org/alfresco/model/ContentModel.java b/source/java/org/alfresco/model/ContentModel.java index 1513509af7..6c3e4c6731 100644 --- a/source/java/org/alfresco/model/ContentModel.java +++ b/source/java/org/alfresco/model/ContentModel.java @@ -205,7 +205,7 @@ public interface ContentModel static final QName ASPECT_INLINEEDITABLE = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "inlineeditable"); static final QName PROP_EDITINLINE = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "editInline"); - // configurable + // configurable aspect static final QName ASPECT_CONFIGURABLE = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "configurable"); static final QName TYPE_CONFIGURATIONS = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "configurations"); static final QName ASSOC_CONFIGURATIONS = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "configurations"); @@ -214,6 +214,10 @@ public interface ContentModel static final QName TYPE_FILELINK = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "filelink"); static final QName TYPE_FOLDERLINK = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "folderlink"); + // feed source aspect + static final QName ASPECT_FEEDSOURCE = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "feedsource"); + static final QName PROP_FEEDTEMPLATE = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "template"); + // // User Model Definitions diff --git a/source/java/org/alfresco/repo/admin/patch/impl/RSSTemplatesFolderPatch.java b/source/java/org/alfresco/repo/admin/patch/impl/RSSTemplatesFolderPatch.java new file mode 100644 index 0000000000..2292bfd091 --- /dev/null +++ b/source/java/org/alfresco/repo/admin/patch/impl/RSSTemplatesFolderPatch.java @@ -0,0 +1,292 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.repo.admin.patch.impl; + +import java.io.IOException; +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.alfresco.i18n.I18NUtil; +import org.alfresco.model.ContentModel; +import org.alfresco.repo.admin.patch.AbstractPatch; +import org.alfresco.repo.importer.ACPImportPackageHandler; +import org.alfresco.repo.importer.ImporterBootstrap; +import org.alfresco.service.cmr.admin.PatchException; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.view.ImporterService; +import org.alfresco.service.cmr.view.Location; +import org.alfresco.service.namespace.QName; +import org.springframework.context.MessageSource; +import org.springframework.core.io.ClassPathResource; + +/** + * Ensures that the RSS Templates folder is present. + *

+ * This uses the bootstrap importer to get the paths to look for. If not present, + * the required structures are created. + *

+ * This class should be replaced with a more generic ImporterPatch + * that can do conditional importing into given locations. + *

+ * JIRA: {@link http://www.alfresco.org/jira/browse/AR-342 AR-342} + * + * @author Kevin Roast + */ +public class RSSTemplatesFolderPatch extends AbstractPatch +{ + private static final String MSG_EXISTS = "patch.rssTemplatesFolder.result.exists"; + private static final String MSG_CREATED = "patch.rssTemplatesFolder.result.created"; + + public static final String PROPERTY_COMPANY_HOME_CHILDNAME = "spaces.company_home.childname"; + public static final String PROPERTY_DICTIONARY_CHILDNAME = "spaces.dictionary.childname"; + public static final String PROPERTY_RSS_FOLDER_CHILDNAME = "spaces.templates.rss.childname"; + private static final String PROPERTY_RSS_FOLDER_NAME = "spaces.templates.rss.name"; + private static final String PROPERTY_RSS_FOLDER_DESCRIPTION = "spaces.templates.rss.description"; + private static final String PROPERTY_ICON = "space-icon-default"; + + private ImporterBootstrap importerBootstrap; + private ImporterService importerService; + private MessageSource messageSource; + + protected NodeRef dictionaryNodeRef; + protected Properties configuration; + protected NodeRef rssFolderNodeRef; + + private String rssTemplatesACP; + + public void setImporterBootstrap(ImporterBootstrap importerBootstrap) + { + this.importerBootstrap = importerBootstrap; + } + + public void setImporterService(ImporterService importerService) + { + this.importerService = importerService; + } + + public void setMessageSource(MessageSource messageSource) + { + this.messageSource = messageSource; + } + + public void setRssTemplatesACP(String rssTemplatesACP) + { + this.rssTemplatesACP = rssTemplatesACP; + } + + /** + * Ensure that required common properties have been set + */ + protected void checkCommonProperties() throws Exception + { + checkPropertyNotNull(importerBootstrap, "importerBootstrap"); + checkPropertyNotNull(importerService, "importerService"); + checkPropertyNotNull(messageSource, "messageSource"); + if (namespaceService == null) + { + throw new PatchException("'namespaceService' property has not been set"); + } + else if (searchService == null) + { + throw new PatchException("'searchService' property has not been set"); + } + else if (nodeService == null) + { + throw new PatchException("'nodeService' property has not been set"); + } + checkPropertyNotNull(rssTemplatesACP, "rssTemplatesACP"); + } + + /** + * Extracts pertinent references and properties that are common to execution + * of this and derived patches. + */ + protected void setUp() throws Exception + { + // get the node store that we must work against + StoreRef storeRef = importerBootstrap.getStoreRef(); + if (storeRef == null) + { + throw new PatchException("Bootstrap store has not been set"); + } + NodeRef storeRootNodeRef = nodeService.getRootNode(storeRef); + + this.configuration = importerBootstrap.getConfiguration(); + // get the association names that form the path + String companyHomeChildName = configuration.getProperty(PROPERTY_COMPANY_HOME_CHILDNAME); + if (companyHomeChildName == null || companyHomeChildName.length() == 0) + { + throw new PatchException("Bootstrap property '" + PROPERTY_COMPANY_HOME_CHILDNAME + "' is not present"); + } + String dictionaryChildName = configuration.getProperty(PROPERTY_DICTIONARY_CHILDNAME); + if (dictionaryChildName == null || dictionaryChildName.length() == 0) + { + throw new PatchException("Bootstrap property '" + PROPERTY_DICTIONARY_CHILDNAME + "' is not present"); + } + String rssChildName = configuration.getProperty(PROPERTY_RSS_FOLDER_CHILDNAME); + if (rssChildName == null || rssChildName.length() == 0) + { + throw new PatchException("Bootstrap property '" + PROPERTY_RSS_FOLDER_CHILDNAME + "' is not present"); + } + + // build the search string to get the dictionary node + StringBuilder sb = new StringBuilder(256); + sb.append("/").append(companyHomeChildName) + .append("/").append(dictionaryChildName); + String xpath = sb.toString(); + + // get the dictionary node + List nodeRefs = searchService.selectNodes(storeRootNodeRef, xpath, null, namespaceService, false); + if (nodeRefs.size() == 0) + { + throw new PatchException("XPath didn't return any results: \n" + + " root: " + storeRootNodeRef + "\n" + + " xpath: " + xpath); + } + else if (nodeRefs.size() > 1) + { + throw new PatchException("XPath returned too many results: \n" + + " root: " + storeRootNodeRef + "\n" + + " xpath: " + xpath + "\n" + + " results: " + nodeRefs); + } + this.dictionaryNodeRef = nodeRefs.get(0); + + // Now we have the optional part - check for the existence of the RSS Templates folder + xpath = rssChildName; + nodeRefs = searchService.selectNodes(dictionaryNodeRef, xpath, null, namespaceService, false); + if (nodeRefs.size() > 1) + { + throw new PatchException("XPath returned too many results: \n" + + " dictionary node: " + dictionaryNodeRef + "\n" + + " xpath: " + xpath + "\n" + + " results: " + nodeRefs); + } + else if (nodeRefs.size() == 0) + { + // the node does not exist + this.rssFolderNodeRef = null; + } + else + { + // we have the RSS Templates folder noderef + this.rssFolderNodeRef = nodeRefs.get(0); + } + } + + @Override + protected String applyInternal() throws Exception + { + // properties must be set + checkCommonProperties(); + if (messageSource == null) + { + throw new PatchException("'messageSource' property has not been set"); + } + + // get useful values + setUp(); + + String msg = null; + if (rssFolderNodeRef == null) + { + // create it + createFolder(); + + // import the content + try + { + authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName()); + + importContent(); + } + finally + { + authenticationComponent.clearCurrentSecurityContext(); + } + + msg = I18NUtil.getMessage(MSG_CREATED, rssFolderNodeRef); + } + else + { + // it already exists + msg = I18NUtil.getMessage(MSG_EXISTS, rssFolderNodeRef); + } + // done + return msg; + } + + private void createFolder() + { + // get required properties + String rssChildName = configuration.getProperty(PROPERTY_RSS_FOLDER_CHILDNAME); + if (rssChildName == null) + { + throw new PatchException("Bootstrap property '" + PROPERTY_RSS_FOLDER_CHILDNAME + "' is not present"); + } + + String folderName = messageSource.getMessage( + PROPERTY_RSS_FOLDER_NAME, + null, + I18NUtil.getLocale()); + if (folderName == null || folderName.length() == 0) + { + throw new PatchException("Bootstrap property '" + PROPERTY_RSS_FOLDER_NAME + "' is not present"); + } + + String folderDescription = messageSource.getMessage( + PROPERTY_RSS_FOLDER_DESCRIPTION, + null, + I18NUtil.getLocale()); + if (folderDescription == null || folderDescription.length() == 0) + { + throw new PatchException("Bootstrap property '" + PROPERTY_RSS_FOLDER_DESCRIPTION + "' is not present"); + } + + Map properties = new HashMap(7); + properties.put(ContentModel.PROP_NAME, folderName); + properties.put(ContentModel.PROP_TITLE, folderName); + properties.put(ContentModel.PROP_DESCRIPTION, folderDescription); + properties.put(ContentModel.PROP_ICON, PROPERTY_ICON); + + // create the node + ChildAssociationRef childAssocRef = nodeService.createNode( + dictionaryNodeRef, + ContentModel.ASSOC_CONTAINS, + QName.resolveToQName(namespaceService, rssChildName), + ContentModel.TYPE_FOLDER, + properties); + this.rssFolderNodeRef = childAssocRef.getChildRef(); + + // finally add the required aspects + nodeService.addAspect(rssFolderNodeRef, ContentModel.ASPECT_UIFACETS, null); + } + + private void importContent() throws IOException + { + // import the content + ClassPathResource acpResource = new ClassPathResource(this.rssTemplatesACP); + ACPImportPackageHandler acpHandler = new ACPImportPackageHandler(acpResource.getFile(), null); + Location importLocation = new Location(this.rssFolderNodeRef); + importerService.importView(acpHandler, importLocation, null, null); + } +} diff --git a/source/java/org/alfresco/repo/admin/patch/impl/ScriptsFolderPatch.java b/source/java/org/alfresco/repo/admin/patch/impl/ScriptsFolderPatch.java index 6fea10daa8..73b409ac96 100644 --- a/source/java/org/alfresco/repo/admin/patch/impl/ScriptsFolderPatch.java +++ b/source/java/org/alfresco/repo/admin/patch/impl/ScriptsFolderPatch.java @@ -188,7 +188,7 @@ public class ScriptsFolderPatch extends AbstractPatch } else { - // we have the saved searches folder noderef + // we have the scripts folder noderef this.scriptsFolderNodeRef = nodeRefs.get(0); } } @@ -238,49 +238,47 @@ public class ScriptsFolderPatch extends AbstractPatch private void createFolder() { // get required properties - String savedSearchesChildName = configuration.getProperty(PROPERTY_SCRIPTS_FOLDER_CHILDNAME); - if (savedSearchesChildName == null) + String scriptsChildName = configuration.getProperty(PROPERTY_SCRIPTS_FOLDER_CHILDNAME); + if (scriptsChildName == null) { throw new PatchException("Bootstrap property '" + PROPERTY_SCRIPTS_FOLDER_CHILDNAME + "' is not present"); } - String savedSearchesName = messageSource.getMessage( + String folderName = messageSource.getMessage( PROPERTY_SCRIPTS_FOLDER_NAME, null, I18NUtil.getLocale()); - if (savedSearchesName == null || savedSearchesName.length() == 0) + if (folderName == null || folderName.length() == 0) { throw new PatchException("Bootstrap property '" + PROPERTY_SCRIPTS_FOLDER_NAME + "' is not present"); } - String savedSearchesDescription = messageSource.getMessage( + String folderDescription = messageSource.getMessage( PROPERTY_SCRIPTS_FOLDER_DESCRIPTION, null, I18NUtil.getLocale()); - if (savedSearchesDescription == null || savedSearchesDescription.length() == 0) + if (folderDescription == null || folderDescription.length() == 0) { throw new PatchException("Bootstrap property '" + PROPERTY_SCRIPTS_FOLDER_DESCRIPTION + "' is not present"); } Map properties = new HashMap(7); - properties.put(ContentModel.PROP_NAME, savedSearchesName); - properties.put(ContentModel.PROP_TITLE, savedSearchesName); - properties.put(ContentModel.PROP_DESCRIPTION, savedSearchesDescription); + properties.put(ContentModel.PROP_NAME, folderName); + properties.put(ContentModel.PROP_TITLE, folderName); + properties.put(ContentModel.PROP_DESCRIPTION, folderDescription); properties.put(ContentModel.PROP_ICON, PROPERTY_ICON); // create the node ChildAssociationRef childAssocRef = nodeService.createNode( dictionaryNodeRef, ContentModel.ASSOC_CONTAINS, - QName.resolveToQName(namespaceService, savedSearchesChildName), + QName.resolveToQName(namespaceService, scriptsChildName), ContentModel.TYPE_FOLDER, properties); scriptsFolderNodeRef = childAssocRef.getChildRef(); - // add the required aspects + // finally add the required aspects nodeService.addAspect(scriptsFolderNodeRef, ContentModel.ASPECT_UIFACETS, null); - - // done } private void importContent() throws IOException