001 package com.sptci.rwt;
002
003 import java.util.ArrayList;
004 import java.util.Collection;
005 import java.util.Collections;
006
007 /**
008 * A value object that represents database catalogues.
009 *
010 * <p>© Copyright 2007 <a href='http://sptci.com/' target='_new'>Sans Pareil Technologies, Inc.</a></p>
011 * @author Rakesh Vidyadharan 2007-10-23
012 * @version $Id: CatalogueMetaData.java 4123 2008-05-25 21:49:01Z rakesh $
013 * @since Version 1.1
014 */
015 public class CatalogueMetaData extends RootMetaData
016 {
017 /**
018 * The collection of schema objects that belong to this catalogue.
019 */
020 private Collection<SchemaMetaData> schemas = new ArrayList<SchemaMetaData>();
021
022 /**
023 * Returns {@link #schemas}.
024 *
025 * @return The value/reference of/to schemas.
026 */
027 public Collection<SchemaMetaData> getSchemas()
028 {
029 return Collections.unmodifiableCollection( schemas );
030 }
031
032 /**
033 * Set {@link #schemas}.
034 *
035 * @param schemas The value to set.
036 */
037 protected void setSchemas( final Collection<SchemaMetaData> schemas )
038 {
039 this.schemas.clear();
040 this.schemas.addAll( schemas );
041 }
042
043 /**
044 * Add the specified schema to {@link #schemas}.
045 *
046 * @param schema The meta data object to add.
047 */
048 protected void addSchema( final SchemaMetaData schema )
049 {
050 boolean exists = false;
051 for ( SchemaMetaData smd : schemas )
052 {
053 if ( schema.getName().equals( smd.getName() ) )
054 {
055 exists = true;
056 break;
057 }
058 }
059
060 if ( ! exists ) schemas.add( schema );
061 }
062 }