mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM: Saved searches where not being upgraded correctly
* searches resaved on upgrade (to account for updated model) * searches are public by defalut * relates to RM-758 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.0@52340 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -49,5 +49,16 @@
|
|||||||
<property name="permissionService" ref="PermissionService"/>
|
<property name="permissionService" ref="PermissionService"/>
|
||||||
<property name="recordsManagementSecurityService" ref="RecordsManagementSecurityService" />
|
<property name="recordsManagementSecurityService" ref="RecordsManagementSecurityService" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="org_alfresco_module_rm_RMv2SavedSearchPatch"
|
||||||
|
parent="module.baseComponent"
|
||||||
|
class="org.alfresco.module.org_alfresco_module_rm.patch.RMv2SavedSearchPatch">
|
||||||
|
<property name="moduleId" value="org_alfresco_module_rm"/>
|
||||||
|
<property name="name" value="org_alfresco_module_rm_RMv2SavedSearchPatch"/>
|
||||||
|
<property name="description" value="Patches the existing saved seaches."/>
|
||||||
|
<property name="sinceVersion" value="2.0"/>
|
||||||
|
<property name="appliesFromVersion" value="2.0"/>
|
||||||
|
<property name="recordsManagementSearchService" ref="RecordsManagementSearchService" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
@@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.patch;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails;
|
||||||
|
import org.alfresco.repo.module.AbstractModuleComponent;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.beans.factory.BeanNameAware;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RM v2.0 Saved Search Patch
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
*/
|
||||||
|
public class RMv2SavedSearchPatch extends AbstractModuleComponent
|
||||||
|
implements BeanNameAware, RecordsManagementModel, DOD5015Model
|
||||||
|
{
|
||||||
|
/** Logger */
|
||||||
|
private static Log logger = LogFactory.getLog(RMv2SavedSearchPatch.class);
|
||||||
|
|
||||||
|
/** RM site id */
|
||||||
|
private static final String RM_SITE_ID = "rm";
|
||||||
|
|
||||||
|
/** Records management search service */
|
||||||
|
private RecordsManagementSearchService recordsManagementSearchService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param recordsManagementSearchService records management search service
|
||||||
|
*/
|
||||||
|
public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService)
|
||||||
|
{
|
||||||
|
this.recordsManagementSearchService = recordsManagementSearchService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void executeInternal() throws Throwable
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled() == true)
|
||||||
|
{
|
||||||
|
logger.debug("RM Module RMv2SavedSearchPatch ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the saved searches
|
||||||
|
List<SavedSearchDetails> savedSearches = recordsManagementSearchService.getSavedSearches(RM_SITE_ID);
|
||||||
|
|
||||||
|
if (logger.isDebugEnabled() == true)
|
||||||
|
{
|
||||||
|
logger.debug(" ... updating " + savedSearches.size() + " saved searches");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (SavedSearchDetails savedSearchDetails : savedSearches)
|
||||||
|
{
|
||||||
|
// re-save each search so that the query is regenerated correctly
|
||||||
|
recordsManagementSearchService.deleteSavedSearch(RM_SITE_ID, savedSearchDetails.getName());
|
||||||
|
recordsManagementSearchService.saveSearch(RM_SITE_ID,
|
||||||
|
savedSearchDetails.getName(),
|
||||||
|
savedSearchDetails.getDescription(),
|
||||||
|
savedSearchDetails.getSearch(),
|
||||||
|
savedSearchDetails.getSearchParameters(),
|
||||||
|
savedSearchDetails.isPublic());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (logger.isDebugEnabled() == true)
|
||||||
|
{
|
||||||
|
logger.debug(" ... complete");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@@ -95,7 +95,7 @@ public class SavedSearchDetails extends ReportDetails
|
|||||||
private String siteId;
|
private String siteId;
|
||||||
|
|
||||||
/** Indicates whether the saved search is public or not */
|
/** Indicates whether the saved search is public or not */
|
||||||
private boolean isPublic;
|
private boolean isPublic = true;
|
||||||
|
|
||||||
/** Indicates whether the saved search is a report */
|
/** Indicates whether the saved search is a report */
|
||||||
private boolean isReport = false;
|
private boolean isReport = false;
|
||||||
@@ -103,8 +103,10 @@ public class SavedSearchDetails extends ReportDetails
|
|||||||
/** Namespace service */
|
/** Namespace service */
|
||||||
NamespaceService namespaceService;
|
NamespaceService namespaceService;
|
||||||
|
|
||||||
|
/** Records management search service */
|
||||||
RecordsManagementSearchServiceImpl searchService;
|
RecordsManagementSearchServiceImpl searchService;
|
||||||
|
|
||||||
|
/** Saves search details compatibility */
|
||||||
private SavedSearchDetailsCompatibility compatibility;
|
private SavedSearchDetailsCompatibility compatibility;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -178,7 +180,7 @@ public class SavedSearchDetails extends ReportDetails
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Determine whether the saved query is public or not
|
// Determine whether the saved query is public or not
|
||||||
boolean isPublic = false;
|
boolean isPublic = true;
|
||||||
if (search.has(PUBLIC) == true)
|
if (search.has(PUBLIC) == true)
|
||||||
{
|
{
|
||||||
isPublic = search.getBoolean(PUBLIC);
|
isPublic = search.getBoolean(PUBLIC);
|
||||||
|
Reference in New Issue
Block a user