Version: 3.5.0

org.generationcp.core
Class AbstractDataComponent

java.lang.Object
  extended by org.generationcp.core.DefaultIdentification
      extended by org.generationcp.core.AbstractDataComponent
All Implemented Interfaces:
DataComponent, Identification
Direct Known Subclasses:
AbstractDataConsumer, AbstractDataSource, AbstractDataTransformer

public class AbstractDataComponent
extends DefaultIdentification
implements DataComponent

An implementation of a parent of all basic components (data sources, data consumers and data transformers) - providing metadata for them, and few basic utiliuties. In the class hierarchy, it sits between these components and the DefaultIdentification.

Version:
$Id: AbstractDataComponent.java 16157 2009-05-06 01:37:21Z msenger $
Author:
Martin Senger

Field Summary
 
Fields inherited from class org.generationcp.core.DefaultIdentification
OUR_MULTI_LINE_STYLE
 
Method Summary
 void addMetaData(java.lang.String key, java.lang.Object value)
          Add one name/value pair of metadata to this component.
static java.lang.String createObjectID(java.lang.Object value)
          Return a unique identifier.
static java.lang.String formatError(java.lang.Throwable e)
          Format given exception.
 java.util.Map<java.lang.String,java.lang.Object> getMetadata()
          Return any additional details about this data component.
 java.lang.Object[] getMetadataItemArray(java.lang.String key)
          Find and return metadata item (identified by its 'name') in this component metadata.
 void setMetaData(java.util.Map<java.lang.String,java.lang.Object> metadata)
          Replace all currently stored metadata with the given ones.
 
Methods inherited from class org.generationcp.core.DefaultIdentification
equals, getClassification, getDescription, getName, getUniqueIdentifier, hashCode, setClassification, setDescription, setName, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.generationcp.core.Identification
getClassification, getDescription, getName, getUniqueIdentifier
 

Method Detail

getMetadata

public java.util.Map<java.lang.String,java.lang.Object> getMetadata()
Description copied from interface: DataComponent
Return any additional details about this data component.

Specified by:
getMetadata in interface DataComponent
Returns:
name/value pairs where names are keys of additional properties describing this data component. Some of the more used keys (and their descriptions) are listed in the MetaData ontology.

Return an empty Map (not null) if there are no additional details available.


setMetaData

public void setMetaData(java.util.Map<java.lang.String,java.lang.Object> metadata)
Replace all currently stored metadata with the given ones.

Parameters:
metadata - for this component

addMetaData

public void addMetaData(java.lang.String key,
                        java.lang.Object value)
Add one name/value pair of metadata to this component.

Parameters:
key - is a name of the added metadata
value - is the metadata itself

getMetadataItemArray

public java.lang.Object[] getMetadataItemArray(java.lang.String key)
Find and return metadata item (identified by its 'name') in this component metadata.

Parameters:
key - is a metadata item name we are looking for
Returns:
an array of values defined by the parameter 'key'. If such particular item's value is not an array, it still returns an array but only with one element. If such item cannot be found, it returns an empty array (never null)

createObjectID

public static java.lang.String createObjectID(java.lang.Object value)
Return a unique identifier.

Parameters:
value - will become a part of the unique identifier, or it is ignored if it is null
Returns:
a unique identifier

formatError

public static java.lang.String formatError(java.lang.Throwable e)
Format given exception.

Parameters:
e - to be formatted
Returns:
an error message (taken from 'e'), possibly accompanied with the stack trace (for RuntimeException); if the trace stack is attached, it is prefixed with a warning text Information for developers

Version: 3.5.0

Submit a bug or feature
Generated: Fri Jul 23 18:24:48 CDT 2010