Search in sources :

Example 1 with FilePlan

use of org.alfresco.rm.rest.api.model.FilePlan in project records-management by Alfresco.

the class ApiNodesModelFactory method createFilePlan.

/**
 * Creates an object of type FilePlan
 *
 * @param info info of the file plan
 * @param propertyFilter
 * @param includeParam
 * @param mapUserInfo
 * @param isMinimalInfo
 * @return FilePlan object
 */
public FilePlan createFilePlan(FileInfo info, Parameters parameters, Map<String, UserInfo> mapUserInfo, boolean isMinimalInfo) {
    FilePlan filePlan = new FilePlan();
    mapBasicInfo(filePlan, info, parameters.getFilter(), mapUserInfo, isMinimalInfo);
    mapOptionalInfo(filePlan, info, parameters.getInclude(), isMinimalInfo);
    return filePlan;
}
Also used : FilePlan(org.alfresco.rm.rest.api.model.FilePlan)

Example 2 with FilePlan

use of org.alfresco.rm.rest.api.model.FilePlan 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);
}
Also used : AbstractList(java.util.AbstractList) FilePlan(org.alfresco.rm.rest.api.model.FilePlan) FilterProp(org.alfresco.repo.node.getchildren.FilterProp) HashMap(java.util.HashMap) QName(org.alfresco.service.namespace.QName) UserInfo(org.alfresco.rest.api.model.UserInfo) RecordCategory(org.alfresco.rm.rest.api.model.RecordCategory) EntityNotFoundException(org.alfresco.rest.framework.core.exceptions.EntityNotFoundException) NodeRef(org.alfresco.service.cmr.repository.NodeRef) FileInfo(org.alfresco.service.cmr.model.FileInfo) WebApiDescription(org.alfresco.rest.framework.WebApiDescription)

Aggregations

FilePlan (org.alfresco.rm.rest.api.model.FilePlan)2 AbstractList (java.util.AbstractList)1 HashMap (java.util.HashMap)1 FilterProp (org.alfresco.repo.node.getchildren.FilterProp)1 UserInfo (org.alfresco.rest.api.model.UserInfo)1 WebApiDescription (org.alfresco.rest.framework.WebApiDescription)1 EntityNotFoundException (org.alfresco.rest.framework.core.exceptions.EntityNotFoundException)1 RecordCategory (org.alfresco.rm.rest.api.model.RecordCategory)1 FileInfo (org.alfresco.service.cmr.model.FileInfo)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1 QName (org.alfresco.service.namespace.QName)1