1 /* 2 * Copyright 2008-2010 smartics, Kronseder & Reiner GmbH 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package de.smartics.maven.issues.cache; 18 19 import java.util.Map; 20 21 import org.eclipse.mylyn.tasks.core.data.TaskAttribute; 22 import org.eclipse.mylyn.tasks.core.data.TaskData; 23 24 /** 25 * Interface to write a task. 26 * 27 * @author <a href="mailto:robert.reiner@smartics.de">Robert Reiner</a> 28 * @version $Revision:591 $ 29 */ 30 public interface TaskWriter 31 { 32 // ********************************* Fields ********************************* 33 34 // --- constants ------------------------------------------------------------ 35 36 // ****************************** Initializer ******************************* 37 38 // ****************************** Inner Classes ***************************** 39 40 // ********************************* Methods ******************************** 41 42 // --- get&set -------------------------------------------------------------- 43 44 // --- business ------------------------------------------------------------- 45 46 /** 47 * Writes the given task to the stream referenced by this instance. 48 * 49 * @param task the task to write. 50 * @throws Exception if the information cannot be written. 51 */ 52 void writeTask(TaskData task) throws Exception; 53 54 /** 55 * Writes the attribute. 56 * 57 * @param attribute the attribute to write. 58 * @throws Exception if the information cannot be written. 59 */ 60 void writeAttribute(TaskAttribute attribute) throws Exception; 61 62 /** 63 * Writes the set of attributes. 64 * 65 * @param attributes the attributes to write. 66 * @throws Exception if the information cannot be written. 67 */ 68 void writeAttributes(Map<String, TaskAttribute> attributes) throws Exception; 69 70 /** 71 * Writes the attribute values. 72 * 73 * @param attribute whose values are to be written. 74 * @throws Exception if the information cannot be written. 75 */ 76 void writeAttributeValues(TaskAttribute attribute) throws Exception; 77 78 /** 79 * Writes the key and values of the map. The key is the generic identifier 80 * (GI), the value the content of the XML element. 81 * 82 * @param gi the generic identifier of the element within the key-value pairs 83 * are written. 84 * @param map the information to be written inside the element specified by 85 * <code>gi</code>. 86 * @throws Exception if the information cannot be written. 87 */ 88 void writeMap(String gi, Map<String, String> map) throws Exception; 89 90 /** 91 * Writes a simple element containing no attributes and only text content. 92 * 93 * @param gi the generic identifier of the XML element to be written. 94 * @param content the content of the XML element to be written. 95 * @throws Exception if the information cannot be written. 96 */ 97 void writeSimpleElement(String gi, String content) throws Exception; 98 99 // --- object basics -------------------------------------------------------- 100 101 }