1 /* 2 * Copyright (C) 2005 Alfresco, Inc. 3 * 4 * Licensed under the Mozilla Public License version 1.1 5 * with a permitted attribution clause. You may obtain a 6 * copy of the License at 7 * 8 * http://www.alfresco.org/legal/license.txt 9 * 10 * Unless required by applicable law or agreed to in writing, 11 * software distributed under the License is distributed on an 12 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 13 * either express or implied. See the License for the specific 14 * language governing permissions and limitations under the 15 * License. 16 */ 17 package org.alfresco.repo.dictionary; 18 19 import java.util.Collection; 20 21 import org.alfresco.service.cmr.dictionary.AspectDefinition; 22 import org.alfresco.service.cmr.dictionary.ModelDefinition; 23 import org.alfresco.service.cmr.dictionary.DataTypeDefinition; 24 import org.alfresco.service.cmr.dictionary.TypeDefinition; 25 import org.alfresco.service.namespace.QName; 26 27 28 /** 29 * Dictionary Data Access 30 * 31 * @author David Caruana 32 */ 33 public interface DictionaryDAO extends ModelQuery 34 { 35 36 /** 37 * @return the models known by the dictionary 38 */ 39 public Collection<QName> getModels(); 40 41 /** 42 * @param name the model to retrieve 43 * @return the named model definition 44 */ 45 public ModelDefinition getModel(QName name); 46 47 /** 48 * @param model the model to retrieve property types for 49 * @return the property types of the model 50 */ 51 public Collection<DataTypeDefinition> getDataTypes(QName model); 52 53 /** 54 * @param model the model to retrieve types for 55 * @return the types of the model 56 */ 57 public Collection<TypeDefinition> getTypes(QName model); 58 59 /** 60 * @param model the model to retrieve aspects for 61 * @return the aspects of the model 62 */ 63 public Collection<AspectDefinition> getAspects(QName model); 64 65 /** 66 * Construct an anonymous type that combines a primary type definition and 67 * and one or more aspects 68 * 69 * @param type the primary type 70 * @param aspects the aspects to combine 71 * @return the anonymous type definition 72 */ 73 public TypeDefinition getAnonymousType(QName type, Collection<QName> aspects); 74 75 /** 76 * Adds a model to the dictionary. The model is compiled and validated. 77 * 78 * @param model the model to add 79 */ 80 public void putModel(M2Model model); 81 82 /** 83 * Removes a model from the dictionary. The types and aspect in the model will no longer be 84 * available. 85 * 86 * @param model the qname of the model to remove 87 */ 88 public void removeModel(QName model); 89 90 } 91