Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | package org.mozilla.gecko.sync.repositories; |
michael@0 | 6 | |
michael@0 | 7 | import java.net.URISyntaxException; |
michael@0 | 8 | |
michael@0 | 9 | import org.mozilla.gecko.sync.InfoCollections; |
michael@0 | 10 | import org.mozilla.gecko.sync.net.AuthHeaderProvider; |
michael@0 | 11 | |
michael@0 | 12 | /** |
michael@0 | 13 | * A kind of Server11Repository that supports explicit setting of limit and sort on operations. |
michael@0 | 14 | * |
michael@0 | 15 | * @author rnewman |
michael@0 | 16 | * |
michael@0 | 17 | */ |
michael@0 | 18 | public class ConstrainedServer11Repository extends Server11Repository { |
michael@0 | 19 | |
michael@0 | 20 | private String sort = null; |
michael@0 | 21 | private long limit = -1; |
michael@0 | 22 | |
michael@0 | 23 | public ConstrainedServer11Repository(String collection, String storageURL, AuthHeaderProvider authHeaderProvider, InfoCollections infoCollections, long limit, String sort) throws URISyntaxException { |
michael@0 | 24 | super(collection, storageURL, authHeaderProvider, infoCollections); |
michael@0 | 25 | this.limit = limit; |
michael@0 | 26 | this.sort = sort; |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | @Override |
michael@0 | 30 | protected String getDefaultSort() { |
michael@0 | 31 | return sort; |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | @Override |
michael@0 | 35 | protected long getDefaultFetchLimit() { |
michael@0 | 36 | return limit; |
michael@0 | 37 | } |
michael@0 | 38 | } |