ru.onego.industrial.catalog.meta
Interface Catalog

All Known Implementing Classes:
CatalogImpl

public interface Catalog

Catalog is the core metaobject of this framework. This interface specifies methods of adding and removing data from catalog.

Version:
1.0
Author:
Lev Levin

Method Summary
 void add(Catalog catalog)
          Adds data from another catalog.
 CatalogLine createCatalogLine(java.lang.String identificator)
          Creates new catalog line with the given identificator.
 void deleteLine(CatalogLine line)
          Removes given line from the catalog.
 CatalogLine get(int index)
          Returns catalog line with the given index.
 CatalogLine get(java.lang.String identificator)
          Returns catalog line with the given identificator.
 java.util.List<java.lang.String> getColumns()
          Returns column names of this catalog.
 java.lang.String getIdentificator(int index)
          Returns identificator of the line with the given index.
 java.util.List<CatalogLine> getLines()
          Returns list of all line in the catalog.
 int size()
          Returns number of lines in this catalog.
 void updateLine(java.lang.String identificator, CatalogLine catalogLine)
          Updates line with the given identificator with data stored in the given catalog line.
 

Method Detail

add

void add(Catalog catalog)
         throws MetaException
Adds data from another catalog. Catalogs should have the same structure (the same number of columns of the same type). Existing data is not removed. If two lines in both catalogs have the same identifier, data from the adding catalog is added to the data of this catalog according to data types rules for adding. If no value was specified for this catalog and adding catalog has value - new value is set.

Parameters:
catalog - Source catalog
Throws:
MetaException - Should be thrown if catalogs have different metadata

createCatalogLine

CatalogLine createCatalogLine(java.lang.String identificator)
                              throws MetaException
Creates new catalog line with the given identificator. Identificator should not point to existing line.

Parameters:
identificator - Unique identificator of the line
Returns:
Object implemented CatalogLine interface
Throws:
MetaException - Thrown if any error occurs while creating the line

get

CatalogLine get(int index)
                throws MetaException
Returns catalog line with the given index. Index should not be less than 0 or bigger than size of the catalog.

Parameters:
index - Index of the line
Returns:
CatalogLine object
Throws:
MetaException - Thrown if index is out of bounds

get

CatalogLine get(java.lang.String identificator)
                throws MetaException
Returns catalog line with the given identificator. Identificator should point to existing line.

Parameters:
identificator - Identificator of the line
Returns:
CatalogLine object
Throws:
MetaException - Thrown if line with the given identificator is not found

getIdentificator

java.lang.String getIdentificator(int index)
                                  throws MetaException
Returns identificator of the line with the given index. Index should not be less than 0 or bigger than size of the catalog.

Parameters:
index - Index of the line
Returns:
String holding the identificator
Throws:
MetaException - Thrown if index is out of bounds

getColumns

java.util.List<java.lang.String> getColumns()
Returns column names of this catalog.

Returns:
List of columns names

getLines

java.util.List<CatalogLine> getLines()
Returns list of all line in the catalog. Lines are sorted by key fields.

Returns:
List of lines.

size

int size()
Returns number of lines in this catalog.

Returns:
Number of lines

updateLine

void updateLine(java.lang.String identificator,
                CatalogLine catalogLine)
                throws MetaException
Updates line with the given identificator with data stored in the given catalog line. Catalog lines should have the same structure. Existing data is not removed. Data from the given catalog line is added to the data of this catalog line according to data types rules for adding. If no value was specified for this catalog line and adding catalog line has value - new value is set.

Parameters:
identificator - Identificator of the line
catalogLine - Source catalog line
Throws:
MetaException - Thrown if metadata differs or error occur while setting values

deleteLine

void deleteLine(CatalogLine line)
                throws MetaException
Removes given line from the catalog.

Parameters:
line - Line to be removed
Throws:
MetaException - Thrown if line is not part of this catalog