public class MetacardImpl extends Object implements Metacard
Metacard's required attributes.
Serialization Note
This class is Serializable and care should be taken with compatibility if changes are
made.
For backward and forward compatibility, ObjectOutputStream.defaultWriteObject() is
invoked when this object is serialized because it provides "enhanced flexibility" (Joshua Block
Effective Java, Second Edition Item 75). Invoking ObjectOutputStream.defaultWriteObject() allows the flexibility to add nontransient instance
fields in later versions if necessary. If earlier versions do not have the newly added fields,
those fields will be ignored and the deserialization will still take place. In addition, ObjectInputStream.defaultReadObject() is necessary to facilitate any of the written fields.
For what constitutes a compatible change in serialization, see Sun's Guidelines.
ANY_DATE, ANY_GEO, ANY_TEXT, CHECKSUM, CHECKSUM_ALGORITHM, CONTENT_TYPE, CONTENT_TYPE_VERSION, CREATED, DEFAULT_TAG, DERIVED, DERIVED_RESOURCE_DOWNLOAD_URL, DERIVED_RESOURCE_URI, DESCRIPTION, EFFECTIVE, EXPIRATION, GEOGRAPHY, ID, METADATA, MODIFIED, POINT_OF_CONTACT, RELATED, RESOURCE_DOWNLOAD_URL, RESOURCE_SIZE, RESOURCE_URI, SECURITY, SECURITY_MATCH_ALL, SECURITY_MATCH_ONE, SOURCE_ID, TAGS, TARGET_NAMESPACE, THUMBNAIL, TITLE| Constructor and Description |
|---|
MetacardImpl()
|
MetacardImpl(Metacard metacard)
|
MetacardImpl(Metacard metacard,
MetacardType type)
|
MetacardImpl(MetacardType type)
|
| Modifier and Type | Method and Description |
|---|---|
Attribute |
getAttribute(String name)
Returns
Attribute for given attribute name. |
String |
getContentTypeName()
Returns the name of the content type of the
Metacard. |
URI |
getContentTypeNamespace()
Some types of metadata use different content types.
|
String |
getContentTypeVersion()
Returns the version of the content type of the
Metacard. |
Date |
getCreatedDate()
Returns the date/time this
Metacard was created. |
String |
getDescription()
Returns the description for the
Metacard |
Date |
getEffectiveDate()
Returns the date/time this
Metacard was last known to be valid. |
Date |
getExpirationDate()
Returns the date/time this
Metacard is no longer valid and could be removed. |
String |
getId()
Returns the ID of this
Metacard. |
String |
getLocation()
Returns the WKT representation of the geometry.
|
MetacardType |
getMetacardType()
Return the
MetacardType of this Metacard. |
String |
getMetadata()
Returns the metadata associated with this
Metacard. |
Date |
getModifiedDate()
Returns the date/time this
Metacard was last modifed. |
String |
getPointOfContact()
Returns the Point of Contact for the
Metacard |
String |
getResourceSize()
This is the size of the resource which may or may not contain a unit.
|
URI |
getResourceURI()
|
Map<String,List<String>> |
getSecurity()
Returns the security relevant markings on the
Metacard. |
String |
getSourceId()
Returns the source ID of the source the metacard is located.
|
byte[] |
getThumbnail()
Returns the thumbnail associated with this
Metacard. |
String |
getTitle()
Returns the title of this
Metacard. |
int |
hashCode() |
protected byte[] |
requestBytes(String key)
Get
byte[] data from the map or wrapped metacard. |
protected <T> T |
requestData(String attributeName,
Class<T> returnType)
The brains of the operation -- does the interaction with the map or the wrapped metacard.
|
protected Date |
requestDate(String key)
Get
Date data from the map or wrapped metacard. |
protected Double |
requestDouble(String key)
Get
Double data from the map or wrapped metacard. |
protected InputStream |
requestInputStream(String key)
Get
BinaryContent data from the map or wrapped metacard. |
protected Integer |
requestInteger(String key)
Get
Integer data from the map or wrapped metacard. |
protected Long |
requestLong(String key)
Get
Long data from the map or wrapped metacard. |
protected String |
requestString(String key)
Get
String data from the map or wrapped metacard. |
void |
setAttribute(Attribute attribute)
Sets
Attribute with new attribute. |
void |
setAttribute(String name,
Serializable value)
Set an attribute via a name/value pair.
|
void |
setContentTypeName(String contentType)
Sets the name of the content type of the
Metacard. |
void |
setContentTypeVersion(String contentTypeVersion)
Sets the version of the content type of the
Metacard. |
void |
setCreatedDate(Date created)
Sets the date/time the
Metacard was created. |
void |
setDescription(String description)
Sets the description of the
Metacard. |
void |
setEffectiveDate(Date effective)
Sets the date/time the
Metacard was last known to be valid. |
void |
setExpirationDate(Date expiration)
Sets the date/time this
Metacard is no longer valid and could be removed. |
void |
setId(String id)
Sets the ID of the
Metacard. |
void |
setLocation(String wkt)
Sets the WKT representation of the geometry.
|
void |
setMetadata(String metadata)
Sets the metadata associated with this
Metacard. |
void |
setModifiedDate(Date modified)
Sets the date/time the
Metacard was last modifed. |
void |
setPointOfContact(String pointOfContact)
Sets the point of contact for the
Metacard. |
void |
setResourceSize(String dadSize)
Sets the size of the resource which may or may not contain a unit.
|
void |
setResourceURI(URI uri)
|
void |
setSecurity(HashMap<String,List<String>> security)
Sets the security markings on this
Metacard. |
void |
setSourceId(String sourceId)
Sets the source ID of the source the metacard is located.
|
void |
setTags(Set<String> tags)
Sets the tags associated with this metacard
|
void |
setTargetNamespace(URI targetNamespace)
Some types of metadata use different content types.
|
void |
setThumbnail(byte[] bytes)
Sets the thumbnail associated with this
Metacard. |
void |
setTitle(String title)
Sets the title of this
Metacard. |
void |
setType(MetacardType type)
Sets the
MetacardType of the Metacard. |
public MetacardImpl()
public MetacardImpl(MetacardType type)
type - the MetacardTypepublic MetacardImpl(Metacard metacard)
metacard - the Metacard to create this new Metacard frompublic MetacardImpl(Metacard metacard, MetacardType type)
Metacard with the provided Metacard and MetacardType. This
method does not simply wrap the metacard and keep its type, but will create a new metacard and
clone any attributes defined by the MetacardType that exist on the given Metacard. Note, this means any attributes with null values will not be copied over.metacard - the Metacard to create this new Metacard fromtype - the MetacardType of metacard to createpublic Date getCreatedDate()
MetacardMetacard was created.
getAttribute(Metacard.CREATED)
getCreatedDate in interface MetacardDate - when this Metacard was created.Metacard.CREATEDpublic void setCreatedDate(Date created)
Metacard was created.
setAttribute(new AttributeImpl(Metacard.CREATED, created))
created - Date when this Metacard was created.Metacard.CREATEDpublic Date getModifiedDate()
MetacardMetacard was last modifed.
getAttribute(Metacard.MODIFIED)
getModifiedDate in interface MetacardDate - when this Metacard was last modified.Metacard.MODIFIEDpublic void setModifiedDate(Date modified)
Metacard was last modifed.
setAttribute(new AttributeImpl(Metacard.MODIFIED, modified))
modified - Date when this Metacard was last modified.Metacard.MODIFIEDpublic Date getExpirationDate()
MetacardMetacard is no longer valid and could be removed.
getAttribute(Metacard.EXPIRATION)
getExpirationDate in interface MetacardDate - when this Metacard expires and should be removed from any
stores.Metacard.EXPIRATIONpublic void setExpirationDate(Date expiration)
Metacard is no longer valid and could be removed.
setAttribute(new AttributeImpl(Metacard.EXPIRATION, expiration))
expiration - Date when the Metacard expires and should be removed from any
stores.Metacard.EXPIRATIONpublic Date getEffectiveDate()
MetacardMetacard was last known to be valid.
getAttribute(Metacard.EFFECTIVE)
getEffectiveDate in interface MetacardDate - when the information represented by this Metacard was last known
to be valid.Metacard.EFFECTIVEpublic void setEffectiveDate(Date effective)
Metacard was last known to be valid.
setAttribute(new AttributeImpl(Metacard.EFFECTIVE, effective))
effective - Date when the information represented by the Metacard was last
known to be valid.Metacard.EFFECTIVEpublic String getId()
MetacardgetId in interface MetacardMetacard.IDpublic void setId(String id)
Metacard.
setAttribute(new AttributeImpl(Metacard.ID, id))
id - unique identifier of the Metacard.Metacard.IDpublic String getLocation()
Metacard
getAttribute(Metacard.GEOGRAPHY)
getLocation in interface MetacardString - WKT-defined geospatial object, returns null if not applicableMetacard.GEOGRAPHYpublic void setLocation(String wkt)
setAttribute(new AttributeImpl(Metacard.GEOGRAPHY, wkt))
wkt - WKT-defined geospatial String, returns null if not applicableMetacard.GEOGRAPHYpublic String getSourceId()
MetacardgetSourceId in interface Metacardpublic void setSourceId(String sourceId)
MetacardsetSourceId in interface MetacardsourceId - unique name of source location of metacardpublic byte[] getThumbnail()
MetacardMetacard.
getAttribute(Metacard.THUMBNAIL)
getThumbnail in interface MetacardMetacardMetacard.THUMBNAILpublic void setThumbnail(byte[] bytes)
Metacard.
setAttribute(new AttributeImpl(Metacard.THUMBNAIL, bytes))
bytes - thumbnail for the Metacard.Metacard.THUMBNAILpublic String getTitle()
MetacardgetTitle in interface MetacardMetacardMetacard.TITLEpublic void setTitle(String title)
Metacard.
setAttribute(new AttributeImpl(Metacard.TITLE, id))
title - Title of the MetacardMetacard.TITLEpublic String getMetadata()
MetacardMetacard.
getAttribute(Metacard.METADATA)
getMetadata in interface MetacardMetacard.METADATApublic void setMetadata(String metadata)
Metacard.
setAttribute(new AttributeImpl(Metacard.METADATA, metadata))
metadata - Associated metadata of the MetacardMetacard.METADATApublic MetacardType getMetacardType()
MetacardMetacardType of this Metacard.getMetacardType in interface MetacardMetacardType - the type of this Metacard, MetacardType is required and
must not be nullpublic void setType(MetacardType type)
MetacardType of the Metacard.type - MetacardType of the MetacardMetacardTypepublic URI getContentTypeNamespace()
MetacardURI of the
content type.
getAttribute(Metacard.TARGET_NAMESPACE)
getContentTypeNamespace in interface MetacardURI - the sub-type, null if unusedMetacard.TARGET_NAMESPACEpublic void setTargetNamespace(URI targetNamespace)
URI of the
content type.
setAttribute(new AttributeImpl(Metacard.TARGET_NAMESPACE, targetNamespace))
targetNamespace - URI of the sub-type, null if unusedMetacard.TARGET_NAMESPACEpublic String getContentTypeName()
MetacardMetacard.
getAttribute(Metacard.CONTENT_TYPE)
getContentTypeName in interface MetacardMetacardMetacard.CONTENT_TYPEpublic void setContentTypeName(String contentType)
Metacard.
setAttribute(new AttributeImpl(Metacard.CONTENT_TYPE, contentType))
contentType - name of content type of the MetacardMetacard.CONTENT_TYPEpublic void setTags(Set<String> tags)
tags - set of tagspublic String getPointOfContact()
MetacardMetacard.public void setPointOfContact(String pointOfContact)
Metacard.
setAttribute(new AttributeImpl(Metacard.POINT_OF_CONTACT, pointOfContact))
pointOfContact - the point of contact for the MetacardMetacard.POINT_OF_CONTACTpublic String getDescription()
MetacardMetacard.public void setDescription(String description)
Metacard.
setAttribute(new AttributeImpl(Metacard.DESCRIPTION, description))
description - the description of the MetacardMetacard.DESCRIPTIONpublic String getContentTypeVersion()
MetacardMetacard.
getAttribute(Metacard.CONTENT_TYPE_VERSION)
getContentTypeVersion in interface MetacardMetacardMetacard.CONTENT_TYPE_VERSIONpublic void setContentTypeVersion(String contentTypeVersion)
Metacard.
setAttribute(new AttributeImpl(Metacard.CONTENT_TYPE_VERSION, contentTypeVersion))
contentTypeVersion - version of content type of the MetacardMetacard.CONTENT_TYPE_VERSIONpublic URI getResourceURI()
MetacardMetacards Resource URI and in the form of a URI Object.
new URI(getAttribute(Metacard.RESOURCE_URI));
getResourceURI in interface MetacardURI - a URI representation of the Metacard's Resource URI which itself is stored as a String
ddf.catalog.data.AttributeType.AttributeFormatpublic void setResourceURI(URI uri)
Metacards Resource URI and in the form of a URI Object.
setAttribute(new AttributeImpl(Metacard.RESOURCE_URI, uri))
uri - a URI representation of the Metacard's Resource URI which itself is stored as a String
ddf.catalog.data.AttributeType.AttributeFormatMetacard.RESOURCE_URIpublic String getResourceSize()
MetacardgetResourceSize in interface MetacardString - String representation of the sizepublic void setResourceSize(String dadSize)
setAttribute(new AttributeImpl(Metacard.RESOURCE_SIZE, dadSize))
dadSize - String representation of the sizeMetacard.RESOURCE_SIZEpublic Map<String,List<String>> getSecurity()
Metacard.public void setSecurity(HashMap<String,List<String>> security)
Metacard.
setAttribute(new AttributeImpl(Metacard.SECURITY, security))
security - protected <T> T requestData(String attributeName, Class<T> returnType)
T - the type of the Attribute value expectedattributeName - the name of the Attribute to retrievereturnType - the class that the value of the AttributeType is
expected to be bound toAttribute nameprotected Date requestDate(String key)
Date data from the map or wrapped metacard.
requestData(key, Date.class))
key - the name of the Attribute to retrieveAttribute namerequestData(String, Class)protected Double requestDouble(String key)
Double data from the map or wrapped metacard.
requestData(key, Double.class))
key - the name of the Attribute to retrieveAttribute namerequestData(String, Class)protected InputStream requestInputStream(String key)
BinaryContent data from the map or wrapped metacard.
requestData(key, BinaryContent.class))
key - the name of the Attribute to retrieveAttribute namerequestData(String, Class)protected Integer requestInteger(String key)
Integer data from the map or wrapped metacard.
requestData(key, Integer.class))
key - the name of the Attribute to retrieveAttribute namerequestData(String, Class)protected Long requestLong(String key)
Long data from the map or wrapped metacard.
requestData(key, Long.class))
key - the name of the Attribute to retrieveAttribute namerequestData(String, Class)protected String requestString(String key)
String data from the map or wrapped metacard.
requestData(key, String.class))
key - the name of the Attribute to retrieveAttribute namerequestData(String, Class)protected byte[] requestBytes(String key)
byte[] data from the map or wrapped metacard.
requestData(key, byte[].class))
key - the name of the Attribute to retrieveAttribute namerequestData(String, Class)public Attribute getAttribute(String name)
MetacardAttribute for given attribute name.getAttribute in interface Metacardname - name of attributeAttribute for given name, or null if not availablepublic void setAttribute(String name, Serializable value)
public void setAttribute(Attribute attribute)
MetacardAttribute with new attribute.setAttribute in interface Metacardattribute - new Attribute to set. If the getValue() call on the passed in
attribute returns null, the attribute will be removed from this Metacard.This work is licensed under a Creative Commons Attribution 4.0 International License.