001/* 002 * (C) Copyright 2006-2007 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 * ${user} 018 * 019 * $$Id: Summary.java 28482 2008-01-04 15:33:39Z sfermigier $$ 020 */ 021package org.nuxeo.ecm.webapp.clipboard; 022 023import java.util.List; 024import java.util.Map; 025 026/** 027 * This class is used to build the summary file in a Zip export. It can displays a summary in two ways: 028 * <ul> 029 * <li>Flat with for all entries the full path to document 030 * <li>Hierarchical. 031 * </ul> 032 * This class extends Map<String,SummaryEntry> to store all entries and to allows to store the same document many 033 * times, at different level in the workingList. That's why the key is a String : the full path to the item in the 034 * workingList, using documents UUID. 035 * 036 * @author <a href="mailto:bchaffangeon@nuxeo.com">Brice Chaffangeon</a> 037 */ 038public interface Summary extends Map<String, SummaryEntry> { 039 040 /** 041 * Tests if the given entry has at least one child in the map. 042 * 043 * @param parentEntry is the entry to test 044 * @return true if there is at least one child 045 */ 046 boolean hasChild(SummaryEntry parentEntry); 047 048 /** 049 * @param parentEntry is parent of children you want to get 050 * @return all the children of the parentEntry in the List 051 */ 052 List<SummaryEntry> getChildren(SummaryEntry parentEntry); 053 054 /** 055 * Displays recursively on entry. 056 * 057 * @param sb is the String to display. 058 * @param parentEntry is the entry to display 059 * @return the String to display 060 */ 061 String displayEntry(StringBuffer sb, SummaryEntry parentEntry); 062 063 /** 064 * Display all the map in a flat way. The display is ordered by path. 065 * 066 * @return the string to display 067 */ 068 069 String toFlatList(); 070 071 /** 072 * Displays all the map hierarchically. 073 * 074 * @return the string to display 075 */ 076 077 String toTreeString(); 078 079 /** 080 * Gets the root SummaryEntry in the map. 081 * 082 * @return the root SummaryEntry in the map 083 */ 084 SummaryEntry getSummaryRoot(); 085 086}