001/* 002 * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * ${user} 016 * 017 * $$Id: Summary.java 28482 2008-01-04 15:33:39Z sfermigier $$ 018 */ 019package org.nuxeo.ecm.webapp.clipboard; 020 021import java.util.List; 022import java.util.Map; 023 024/** 025 * This class is used to build the summary file in a Zip export. It can displays a summary in two ways: 026 * <ul> 027 * <li>Flat with for all entries the full path to document 028 * <li>Hierarchical. 029 * </ul> 030 * This class extends Map<String,SummaryEntry> to store all entries and to allows to store the same document many 031 * times, at different level in the workingList. That's why the key is a String : the full path to the item in the 032 * workingList, using documents UUID. 033 * 034 * @author <a href="mailto:bchaffangeon@nuxeo.com">Brice Chaffangeon</a> 035 */ 036public interface Summary extends Map<String, SummaryEntry> { 037 038 /** 039 * Tests if the given entry has at least one child in the map. 040 * 041 * @param parentEntry is the entry to test 042 * @return true if there is at least one child 043 */ 044 boolean hasChild(SummaryEntry parentEntry); 045 046 /** 047 * @param parentEntry is parent of children you want to get 048 * @return all the children of the parentEntry in the List 049 */ 050 List<SummaryEntry> getChildren(SummaryEntry parentEntry); 051 052 /** 053 * Displays recursively on entry. 054 * 055 * @param sb is the String to display. 056 * @param parentEntry is the entry to display 057 * @return the String to display 058 */ 059 String displayEntry(StringBuffer sb, SummaryEntry parentEntry); 060 061 /** 062 * Display all the map in a flat way. The display is ordered by path. 063 * 064 * @return the string to display 065 */ 066 067 String toFlatList(); 068 069 /** 070 * Displays all the map hierarchically. 071 * 072 * @return the string to display 073 */ 074 075 String toTreeString(); 076 077 /** 078 * Gets the root SummaryEntry in the map. 079 * 080 * @return the root SummaryEntry in the map 081 */ 082 SummaryEntry getSummaryRoot(); 083 084}