Search in sources :

Example 56 with AbstractList

use of java.util.AbstractList in project j2objc by google.

the class AbstractListTest method test_indexOfLjava_lang_Object.

public void test_indexOfLjava_lang_Object() {
    AbstractList al = new ArrayList();
    al.add(0);
    al.add(1);
    al.add(2);
    al.add(3);
    al.add(4);
    assertEquals(-1, al.indexOf(5));
    assertEquals(2, al.indexOf(2));
}
Also used : AbstractList(java.util.AbstractList) ArrayList(java.util.ArrayList)

Example 57 with AbstractList

use of java.util.AbstractList in project dagger by square.

the class InjectionTest method noProvideBindingsForAbstractClasses.

@Test
public void noProvideBindingsForAbstractClasses() {
    class TestEntryPoint {

        @Inject
        AbstractList abstractList;
    }
    @Module(injects = TestEntryPoint.class)
    class TestModule {
    }
    ObjectGraph graph = ObjectGraph.createWith(new TestingLoader(), new TestModule());
    try {
        graph.validate();
        fail();
    } catch (IllegalStateException expected) {
    }
}
Also used : AbstractList(java.util.AbstractList) TestingLoader(dagger.internal.TestingLoader) Test(org.junit.Test)

Example 58 with AbstractList

use of java.util.AbstractList in project records-management by Alfresco.

the class UnfiledRecordFolderChildrenRelation method readAll.

@Override
@WebApiDescription(title = "Return a paged list of unfiled container children for the container identified by 'unfiledContainerId'")
public CollectionWithPagingInfo<UnfiledRecordFolderChild> readAll(String unfileRecordFolderId, Parameters parameters) {
    checkNotBlank("unfileRecordFolderId", unfileRecordFolderId);
    mandatory("parameters", parameters);
    String relativePath = parameters.getParameter(Nodes.PARAM_RELATIVE_PATH);
    NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(unfileRecordFolderId, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER, relativePath, true);
    // list unfiled record folders and records
    Set<QName> searchTypeQNames = searchTypesFactory.buildSearchTypesForUnfiledEndpoint(parameters, LIST_UNFILED_RECORD_FOLDER_CHILDREN_EQUALS_QUERY_PROPERTIES);
    final PagingResults<FileInfo> pagingResults = fileFolderService.list(parentNodeRef, null, searchTypeQNames, null, apiUtils.getSortProperties(parameters), null, Util.getPagingRequest(parameters.getPaging()));
    final List<FileInfo> page = pagingResults.getPage();
    Map<String, UserInfo> mapUserInfo = new HashMap<>();
    List<UnfiledRecordFolderChild> nodes = new AbstractList<UnfiledRecordFolderChild>() {

        @Override
        public UnfiledRecordFolderChild get(int index) {
            FileInfo info = page.get(index);
            return nodesModelFactory.createUnfiledRecordFolderChild(info, parameters, mapUserInfo, true);
        }

        @Override
        public int size() {
            return page.size();
        }
    };
    UnfiledRecordFolder sourceEntity = null;
    if (parameters.includeSource()) {
        FileInfo info = fileFolderService.getFileInfo(parentNodeRef);
        sourceEntity = nodesModelFactory.createUnfiledRecordFolder(info, parameters, mapUserInfo, true);
    }
    return CollectionWithPagingInfo.asPaged(parameters.getPaging(), nodes, pagingResults.hasMoreItems(), pagingResults.getTotalResultCount().getFirst(), sourceEntity);
}
Also used : AbstractList(java.util.AbstractList) UnfiledRecordFolder(org.alfresco.rm.rest.api.model.UnfiledRecordFolder) HashMap(java.util.HashMap) QName(org.alfresco.service.namespace.QName) UserInfo(org.alfresco.rest.api.model.UserInfo) UnfiledRecordFolderChild(org.alfresco.rm.rest.api.model.UnfiledRecordFolderChild) NodeRef(org.alfresco.service.cmr.repository.NodeRef) FileInfo(org.alfresco.service.cmr.model.FileInfo) WebApiDescription(org.alfresco.rest.framework.WebApiDescription)

Example 59 with AbstractList

use of java.util.AbstractList in project records-management by Alfresco.

the class RecordFolderChildrenRelation method readAll.

@Override
@WebApiDescription(title = "Return a paged list of records for the record folder identified by 'recordFolderId'")
public CollectionWithPagingInfo<Record> readAll(String recordFolderId, Parameters parameters) {
    checkNotBlank("recordFolderId", recordFolderId);
    mandatory("parameters", parameters);
    NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(recordFolderId, RecordsManagementModel.TYPE_RECORD_FOLDER);
    // list record folders
    // FIXME searchParam
    Set<QName> searchTypeQNames = searchTypesFactory.buildSearchTypesForUnfiledEndpoint(parameters, null);
    final PagingResults<FileInfo> pagingResults = fileFolderService.list(parentNodeRef, null, searchTypeQNames, null, apiUtils.getSortProperties(parameters), null, Util.getPagingRequest(parameters.getPaging()));
    final List<FileInfo> page = pagingResults.getPage();
    Map<String, UserInfo> mapUserInfo = new HashMap<>();
    List<Record> nodes = new AbstractList<Record>() {

        @Override
        public Record get(int index) {
            FileInfo info = page.get(index);
            return nodesModelFactory.createRecord(info, parameters, mapUserInfo, true);
        }

        @Override
        public int size() {
            return page.size();
        }
    };
    RecordFolder sourceEntity = null;
    if (parameters.includeSource()) {
        FileInfo info = fileFolderService.getFileInfo(parentNodeRef);
        sourceEntity = nodesModelFactory.createRecordFolder(info, parameters, mapUserInfo, true);
    }
    return CollectionWithPagingInfo.asPaged(parameters.getPaging(), nodes, pagingResults.hasMoreItems(), pagingResults.getTotalResultCount().getFirst(), sourceEntity);
}
Also used : AbstractList(java.util.AbstractList) HashMap(java.util.HashMap) QName(org.alfresco.service.namespace.QName) UserInfo(org.alfresco.rest.api.model.UserInfo) NodeRef(org.alfresco.service.cmr.repository.NodeRef) FileInfo(org.alfresco.service.cmr.model.FileInfo) RecordFolder(org.alfresco.rm.rest.api.model.RecordFolder) Record(org.alfresco.rm.rest.api.model.Record) WebApiDescription(org.alfresco.rest.framework.WebApiDescription)

Example 60 with AbstractList

use of java.util.AbstractList 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

AbstractList (java.util.AbstractList)76 ArrayList (java.util.ArrayList)30 List (java.util.List)17 HashMap (java.util.HashMap)10 NodeRef (org.alfresco.service.cmr.repository.NodeRef)10 QName (org.alfresco.service.namespace.QName)9 UserInfo (org.alfresco.rest.api.model.UserInfo)8 FileInfo (org.alfresco.service.cmr.model.FileInfo)8 WebApiDescription (org.alfresco.rest.framework.WebApiDescription)7 RexNode (org.apache.calcite.rex.RexNode)7 Collection (java.util.Collection)6 ConcurrentModificationException (java.util.ConcurrentModificationException)6 Iterator (java.util.Iterator)6 Paging (org.alfresco.rest.framework.resource.parameters.Paging)6 IOException (java.io.IOException)5 Set (java.util.Set)5 FilterProp (org.alfresco.repo.node.getchildren.FilterProp)5 Test (org.junit.Test)5 ListIterator (java.util.ListIterator)4 RandomAccess (java.util.RandomAccess)4