RM-5878 mnt changes added to a 2.4 branch

This commit is contained in:
Ross Gale
2017-12-05 16:21:07 +00:00
parent 928235c72e
commit c8932192f9
8 changed files with 216 additions and 8 deletions

View File

@@ -277,4 +277,6 @@ public interface RecordsManagementModel extends RecordsManagementCustomModel
// Countable aspect
QName ASPECT_COUNTABLE = QName.createQName(RM_URI, "countable");
QName PROP_COUNT = QName.createQName(RM_URI, "count");
QName ASPECT_SAVED_SEARCH = QName.createQName(RM_URI, "savedSearch");
}

View File

@@ -27,6 +27,8 @@
package org.alfresco.module.org_alfresco_module_rm.patch.v20;
import static org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType.DEFAULT_SITE_NAME;
import java.util.List;
import org.alfresco.model.ContentModel;
@@ -51,9 +53,6 @@ import org.springframework.beans.factory.BeanNameAware;
public class RMv2SavedSearchPatch extends ModulePatchComponent
implements BeanNameAware, RecordsManagementModel, DOD5015Model
{
/** RM site id */
private static final String RM_SITE_ID = "rm";
/** Records management search service */
private RecordsManagementSearchService recordsManagementSearchService;
@@ -93,10 +92,10 @@ public class RMv2SavedSearchPatch extends ModulePatchComponent
@Override
protected void executePatch()
{
if (siteService.getSite(RM_SITE_ID) != null)
if (siteService.getSite(DEFAULT_SITE_NAME) != null)
{
// get the saved searches
List<SavedSearchDetails> savedSearches = recordsManagementSearchService.getSavedSearches(RM_SITE_ID);
List<SavedSearchDetails> savedSearches = recordsManagementSearchService.getSavedSearches(DEFAULT_SITE_NAME);
if (LOGGER.isDebugEnabled())
{

View File

@@ -0,0 +1,84 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
* -
* 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/>.
* #L%
*/
package org.alfresco.module.org_alfresco_module_rm.patch.v23;
import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_SAVED_SEARCH;
import static org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType.DEFAULT_SITE_NAME;
import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch;
import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService;
import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails;
import org.alfresco.service.cmr.repository.NodeService;
/**
* RM v2.3 patch that adds the saved search aspect.
*
* @author Ross Gale
* @since 2.3
*/
public class RMv23SavedSearchesPatch extends AbstractModulePatch
{
/**
* records management search service
*/
private RecordsManagementSearchService recordsManagementSearchService;
/**
* node service
*/
private NodeService nodeService;
/**
* @param recordsManagementSearchService records management search service
*/
public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService)
{
this.recordsManagementSearchService = recordsManagementSearchService;
}
/**
* @param nodeService node service
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/**
* Retrieves all saved searches for the records management site and adds ASPECT_SAVED_SEARCH
*/
@Override
public void applyInternal()
{
for (SavedSearchDetails savedSearchDetails : recordsManagementSearchService.getSavedSearches(DEFAULT_SITE_NAME))
{
nodeService.addAspect(savedSearchDetails.getNodeRef(), ASPECT_SAVED_SEARCH, null);
}
}
}

View File

@@ -43,6 +43,7 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchParameters;
@@ -58,6 +59,8 @@ import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.extensions.surf.util.I18NUtil;
import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_SAVED_SEARCH;
/**
* Records management search service implementation
*
@@ -82,7 +85,12 @@ public class RecordsManagementSearchServiceImpl implements RecordsManagementSear
/** Namespace service */
private NamespaceService namespaceService;
/** List of report details */
/**
* Node service
*/
private NodeService nodeService;
/** List of report details */
private List<ReportDetails> reports = new ArrayList<ReportDetails>(13);
/**
@@ -117,7 +125,15 @@ public class RecordsManagementSearchServiceImpl implements RecordsManagementSear
this.namespaceService = namespaceService;
}
/**
/**
* @param nodeService Node service
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/**
* @param reportsJSON
*/
public void setReportsJSON(String reportsJSON)
@@ -526,7 +542,7 @@ public class RecordsManagementSearchServiceImpl implements RecordsManagementSear
}
}, AuthenticationUtil.getSystemUserName());
}
nodeService.addAspect(searchNode, ASPECT_SAVED_SEARCH, null);
// Write the JSON content to search node
final NodeRef writableSearchNode = searchNode;
AuthenticationUtil.runAs(new RunAsWork<Void>()