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