use of org.alfresco.service.cmr.model.FileInfo in project records-management by Alfresco.
the class FilePlanChildrenRelation method readAll.
@Override
@WebApiDescription(title = "Return a paged list of file plan children (record categories) for the container identified by 'filePlanId'")
public CollectionWithPagingInfo<RecordCategory> readAll(String filePlanId, Parameters parameters) {
// validate parameters
checkNotBlank("filePlanId", filePlanId);
mandatory("parameters", parameters);
QName filePlanType = apiUtils.getFilePlanType();
if (// rm site not created
filePlanType == null) {
throw new EntityNotFoundException(filePlanId);
}
NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(filePlanId, filePlanType);
// list record categories
Set<QName> searchTypeQNames = searchTypesFactory.buildSearchTypesForFilePlanEndpoint();
// FIXME this param null
List<FilterProp> filterProps = apiUtils.getListChildrenFilterProps(parameters, null);
final PagingResults<FileInfo> pagingResults = fileFolderService.list(parentNodeRef, null, searchTypeQNames, null, apiUtils.getSortProperties(parameters), filterProps, Util.getPagingRequest(parameters.getPaging()));
final List<FileInfo> page = pagingResults.getPage();
Map<String, UserInfo> mapUserInfo = new HashMap<>();
List<RecordCategory> nodes = new AbstractList<RecordCategory>() {
@Override
public RecordCategory get(int index) {
FileInfo info = page.get(index);
return nodesModelFactory.createRecordCategory(info, parameters, mapUserInfo, true);
}
@Override
public int size() {
return page.size();
}
};
FilePlan sourceEntity = null;
if (parameters.includeSource()) {
FileInfo info = fileFolderService.getFileInfo(parentNodeRef);
sourceEntity = nodesModelFactory.createFilePlan(info, parameters, mapUserInfo, true);
}
return CollectionWithPagingInfo.asPaged(parameters.getPaging(), nodes, pagingResults.hasMoreItems(), pagingResults.getTotalResultCount().getFirst(), sourceEntity);
}
use of org.alfresco.service.cmr.model.FileInfo in project records-management by Alfresco.
the class RecordsManagementSearchServiceImpl method getSavedSearches.
/**
* @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#getSavedSearches(java.lang.String)
*/
@Override
public List<SavedSearchDetails> getSavedSearches(String siteId) {
List<SavedSearchDetails> result = new ArrayList<SavedSearchDetails>(17);
NodeRef container = siteService.getContainer(siteId, SEARCH_CONTAINER);
if (container != null) {
// add the details of all the public saved searches
List<FileInfo> searches = fileFolderService.listFiles(container);
for (FileInfo search : searches) {
addSearchDetailsToList(result, search.getNodeRef());
}
// add the details of any "private" searches for the current user
String userName = AuthenticationUtil.getFullyAuthenticatedUser();
NodeRef userContainer = fileFolderService.searchSimple(container, userName);
if (userContainer != null) {
List<FileInfo> userSearches = fileFolderService.listFiles(userContainer);
for (FileInfo userSearch : userSearches) {
addSearchDetailsToList(result, userSearch.getNodeRef());
}
}
}
return result;
}
use of org.alfresco.service.cmr.model.FileInfo in project records-management by Alfresco.
the class UnfiledContainerChildrenRelation method create.
@Override
@WebApiDescription(title = "Create one (or more) nodes as children of a unfiled container identified by 'unfiledContainerId'")
public List<UnfiledContainerChild> create(String unfiledContainerId, final List<UnfiledContainerChild> nodeInfos, Parameters parameters) {
checkNotBlank("unfiledContainerId", unfiledContainerId);
mandatory("nodeInfos", nodeInfos);
mandatory("parameters", parameters);
final NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(unfiledContainerId, RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER);
// Create the nodes
RetryingTransactionCallback<List<NodeRef>> callback = new RetryingTransactionCallback<List<NodeRef>>() {
public List<NodeRef> execute() {
List<NodeRef> createdNodes = new LinkedList<>();
for (UnfiledContainerChild nodeInfo : nodeInfos) {
NodeRef newNodeRef = apiUtils.createRMNode(parentNodeRef, nodeInfo, parameters);
createdNodes.add(newNodeRef);
}
return createdNodes;
}
};
List<NodeRef> createdNodes = transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
// Get the nodes info
List<UnfiledContainerChild> result = new LinkedList<>();
Map<String, UserInfo> mapUserInfo = new HashMap<>();
for (NodeRef newNodeRef : createdNodes) {
FileInfo info = fileFolderService.getFileInfo(newNodeRef);
apiUtils.postActivity(info, parentNodeRef, ActivityType.FILE_ADDED);
result.add(nodesModelFactory.createUnfiledContainerChild(info, parameters, mapUserInfo, false));
}
return result;
}
use of org.alfresco.service.cmr.model.FileInfo in project records-management by Alfresco.
the class UnfiledRecordFolderEntityResource method readById.
@WebApiDescription(title = "Get unfiled record folder information", description = "Gets information for an unfiled record folder with id 'unfiledRecordFolderId'")
@WebApiParam(name = "unfiledRecordFolderId", title = "The unfiled record folder id")
public UnfiledRecordFolder readById(String unfiledRecordFolderId, Parameters parameters) {
checkNotBlank("unfiledRecordFolderId", unfiledRecordFolderId);
mandatory("parameters", parameters);
String relativePath = parameters.getParameter(Nodes.PARAM_RELATIVE_PATH);
NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(unfiledRecordFolderId, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER, relativePath, true);
FileInfo info = fileFolderService.getFileInfo(nodeRef);
return nodesModelFactory.createUnfiledRecordFolder(info, parameters, null, false);
}
use of org.alfresco.service.cmr.model.FileInfo in project records-management by Alfresco.
the class RecordCategoriesEntityResource method readById.
@WebApiDescription(title = "Get record category information", description = "Gets information for a record category with id 'recordCategoryId'")
@WebApiParam(name = "recordCategoryId", title = "The record category id")
public RecordCategory readById(String recordCategoryId, Parameters parameters) {
checkNotBlank("recordCategoryId", recordCategoryId);
mandatory("parameters", parameters);
String relativePath = parameters.getParameter(Nodes.PARAM_RELATIVE_PATH);
NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(recordCategoryId, RecordsManagementModel.TYPE_RECORD_CATEGORY, relativePath, true);
FileInfo info = fileFolderService.getFileInfo(nodeRef);
return nodesModelFactory.createRecordCategory(info, parameters, null, false);
}
Aggregations