1 /* 2 * This file is part of *** M y C o R e *** 3 * See http://www.mycore.de/ for details. 4 * 5 * MyCoRe is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * MyCoRe is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with MyCoRe. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 package org.mycore.datamodel.metadata; 20 21 import org.jdom2.Element; 22 import org.mycore.common.MCRException; 23 24 import com.google.gson.JsonObject; 25 26 /** 27 * This interface is designed to to have a general description of the common 28 * method set of all metadata classes. 29 * 30 * @author Jens Kupferschmidt 31 * @version $Revision$ $Date$ 32 */ 33 public interface MCRMetaInterface extends Cloneable { 34 35 /** 36 * This method get the inherited element. 37 * 38 * @return the inherited flag as int 39 */ 40 int getInherited(); 41 42 /** 43 * This method get the language element. 44 * 45 * @return the language 46 */ 47 String getLang(); 48 49 /** 50 * This method get the subtag element. 51 * 52 * @return the subtag 53 */ 54 String getSubTag(); 55 56 /** 57 * This method get the type element. 58 * 59 * @return the type 60 */ 61 String getType(); 62 63 /** 64 * This method set the inherited level. This can be 0 or an integer higher 65 * 0. 66 * 67 * @param value 68 * the inherited level value, if it is < 0, 0 is set 69 */ 70 void setInherited(int value); 71 72 /** 73 * This method increments the inherited value with 1. 74 */ 75 void incrementInherited(); 76 77 /** 78 * This method decrements the inherited value with 1. 79 */ 80 void decrementInherited(); 81 82 /** 83 * This methode set the default language to the class. 84 * 85 * @param lang 86 * the language 87 */ 88 void setLang(String lang); 89 90 /** 91 * This method set the subtag element. If the value of <em>subtag</em> 92 * is null or empty an exception is throwed. 93 * 94 * @param subtag 95 * the subtag 96 * @exception MCRException 97 * if the subtag value is null or empty 98 */ 99 void setSubTag(String subtag) throws MCRException; 100 101 /** 102 * This method set the type element. If the value of <em>type</em> is 103 * null or empty nothing was changed. 104 * 105 * @param type 106 * the optional type 107 */ 108 void setType(String type); 109 110 /** 111 * This method read the XML input stream part from a DOM part for the 112 * metadata of the document. 113 * 114 * @param element 115 * a relevant JDOM element for the metadata 116 */ 117 void setFromDOM(Element element); 118 119 /** 120 * This method create a XML stream for a metadata part. 121 * 122 * @exception MCRException 123 * if the content of this class is not valid 124 * @return a JDOM Element with the XML data of the metadata part 125 */ 126 Element createXML() throws MCRException; 127 128 /** 129 * This method creates a JSON representation of the metadata part. 130 * 131 * @return a GSON object containing the json data of the metadata part 132 */ 133 JsonObject createJSON(); 134 135 /** 136 * This method check the validation of the content of this class. 137 * 138 * @return a boolean value 139 */ 140 boolean isValid(); 141 142 /** 143 * Validates the content of this class. 144 * 145 * @throws MCRException the content is invalid 146 */ 147 void validate() throws MCRException; 148 149 /** 150 * This method make a clone of this class. 151 */ 152 MCRMetaInterface clone(); 153 154 /** 155 * This method put debug data to the logger (for the debug mode). 156 */ 157 void debug(); 158 159 }