001/* 002 * (C) Copyright 2016 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Antoine Taillefer <[email protected]> 018 */ 019package org.nuxeo.drive.adapter.impl; 020 021import org.nuxeo.drive.adapter.FolderItem; 022import org.nuxeo.ecm.core.api.DocumentModelList; 023import org.nuxeo.ecm.core.api.impl.DocumentModelListImpl; 024 025/** 026 * Wrapper for the intermediate results of {@link FolderItem#scrollDescendants(String, int, long)} including a list of 027 * documents and a scroll id. 028 * 029 * @since 8.3 030 */ 031public class ScrollDocumentModelList extends DocumentModelListImpl { 032 033 private static final long serialVersionUID = 3073313975471664139L; 034 035 protected String scrollId; 036 037 public ScrollDocumentModelList(String scrollId, int size) { 038 super(size); 039 this.scrollId = scrollId; 040 } 041 042 public ScrollDocumentModelList(String scrollId, DocumentModelList docs) { 043 super(docs); 044 this.scrollId = scrollId; 045 } 046 047 public String getScrollId() { 048 return scrollId; 049 } 050 051 public void setScrollId(String scrollId) { 052 this.scrollId = scrollId; 053 } 054 055 // Override equals and hashCode to explicitly show that their implementation rely on the parent class and doesn't 056 // depend on the fields added to this class. 057 @Override 058 public boolean equals(Object obj) { 059 return super.equals(obj); 060 } 061 062 @Override 063 public int hashCode() { 064 return super.hashCode(); 065 } 066 067 @Override 068 public String toString() { 069 return String.format("scrollId = %s, documents = %s", scrollId, super.toString()); 070 } 071 072}