001/* 002 * (C) Copyright 2012 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.service; 020 021import java.util.Collections; 022import java.util.Set; 023 024import org.nuxeo.ecm.core.api.IdRef; 025 026/** 027 * Data transfer object to fetch the list of references of synchronization roots for a given repo and user. 028 */ 029public class SynchronizationRoots { 030 031 protected final String repositoryName; 032 033 protected final Set<String> paths; 034 035 protected final Set<IdRef> refs; 036 037 public SynchronizationRoots(String repositoryName, Set<String> paths, Set<IdRef> refs) { 038 this.repositoryName = repositoryName; 039 this.paths = paths; 040 this.refs = refs; 041 } 042 043 public static final SynchronizationRoots getEmptyRoots(String repositoryName) { 044 Set<String> emptyPaths = Collections.emptySet(); 045 Set<IdRef> emptyRefs = Collections.emptySet(); 046 return new SynchronizationRoots(repositoryName, emptyPaths, emptyRefs); 047 } 048 049 public String getRepositoryName() { 050 return repositoryName; 051 } 052 053 public Set<String> getPaths() { 054 return paths; 055 } 056 057 public Set<IdRef> getRefs() { 058 return refs; 059 } 060 061 /** 062 * @since 9.1 063 */ 064 @Override 065 public String toString() { 066 return new StringBuilder(getClass().getSimpleName()).append("(repo = ") 067 .append(repositoryName) 068 .append(", paths = ") 069 .append(paths) 070 .append(", refs = ") 071 .append(refs) 072 .append(")") 073 .toString(); 074 } 075 076}