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 MetacardType
public 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()
Metacard
Metacard
was created.
getAttribute
(Metacard.CREATED
)
getCreatedDate
in interface Metacard
Date
- when this Metacard
was created.Metacard.CREATED
public void setCreatedDate(Date created)
Metacard
was created.
setAttribute
(new AttributeImpl
(Metacard.CREATED
, created))
created
- Date
when this Metacard
was created.Metacard.CREATED
public Date getModifiedDate()
Metacard
Metacard
was last modifed.
getAttribute
(Metacard.MODIFIED
)
getModifiedDate
in interface Metacard
Date
- when this Metacard
was last modified.Metacard.MODIFIED
public void setModifiedDate(Date modified)
Metacard
was last modifed.
setAttribute
(new AttributeImpl
(Metacard.MODIFIED
, modified))
modified
- Date
when this Metacard
was last modified.Metacard.MODIFIED
public Date getExpirationDate()
Metacard
Metacard
is no longer valid and could be removed.
getAttribute
(Metacard.EXPIRATION
)
getExpirationDate
in interface Metacard
Date
- when this Metacard
expires and should be removed from any
stores.Metacard.EXPIRATION
public 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.EXPIRATION
public Date getEffectiveDate()
Metacard
Metacard
was last known to be valid.
getAttribute
(Metacard.EFFECTIVE
)
getEffectiveDate
in interface Metacard
Date
- when the information represented by this Metacard
was last known
to be valid.Metacard.EFFECTIVE
public 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.EFFECTIVE
public String getId()
Metacard
getId
in interface Metacard
Metacard.ID
public void setId(String id)
Metacard
.
setAttribute
(new AttributeImpl
(Metacard.ID
, id))
id
- unique identifier of the Metacard.Metacard.ID
public String getLocation()
Metacard
getAttribute
(Metacard.GEOGRAPHY
)
getLocation
in interface Metacard
String
- WKT-defined geospatial object, returns null if not applicableMetacard.GEOGRAPHY
public void setLocation(String wkt)
setAttribute
(new AttributeImpl
(Metacard.GEOGRAPHY
, wkt))
wkt
- WKT-defined geospatial String
, returns null if not applicableMetacard.GEOGRAPHY
public String getSourceId()
Metacard
getSourceId
in interface Metacard
public void setSourceId(String sourceId)
Metacard
setSourceId
in interface Metacard
sourceId
- unique name of source location of metacardpublic byte[] getThumbnail()
Metacard
Metacard
.
getAttribute
(Metacard.THUMBNAIL
)
getThumbnail
in interface Metacard
Metacard
Metacard.THUMBNAIL
public void setThumbnail(byte[] bytes)
Metacard
.
setAttribute
(new AttributeImpl
(Metacard.THUMBNAIL
, bytes))
bytes
- thumbnail for the Metacard
.Metacard.THUMBNAIL
public String getTitle()
Metacard
getTitle
in interface Metacard
Metacard
Metacard.TITLE
public void setTitle(String title)
Metacard
.
setAttribute
(new AttributeImpl
(Metacard.TITLE
, id))
title
- Title of the Metacard
Metacard.TITLE
public String getMetadata()
Metacard
Metacard
.
getAttribute
(Metacard.METADATA
)
getMetadata
in interface Metacard
Metacard.METADATA
public void setMetadata(String metadata)
Metacard
.
setAttribute
(new AttributeImpl
(Metacard.METADATA
, metadata))
metadata
- Associated metadata of the Metacard
Metacard.METADATA
public MetacardType getMetacardType()
Metacard
MetacardType
of this Metacard
.getMetacardType
in interface Metacard
MetacardType
- the type of this Metacard
, MetacardType is required and
must not be null
public void setType(MetacardType type)
MetacardType
of the Metacard
.type
- MetacardType
of the Metacard
MetacardType
public URI getContentTypeNamespace()
Metacard
URI
of the
content type.
getAttribute
(Metacard.TARGET_NAMESPACE
)
getContentTypeNamespace
in interface Metacard
URI
- the sub-type, null if unusedMetacard.TARGET_NAMESPACE
public 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_NAMESPACE
public String getContentTypeName()
Metacard
Metacard
.
getAttribute
(Metacard.CONTENT_TYPE
)
getContentTypeName
in interface Metacard
Metacard
Metacard.CONTENT_TYPE
public void setContentTypeName(String contentType)
Metacard
.
setAttribute
(new AttributeImpl
(Metacard.CONTENT_TYPE
, contentType))
contentType
- name of content type of the Metacard
Metacard.CONTENT_TYPE
public void setTags(Set<String> tags)
tags
- set of tagspublic String getPointOfContact()
Metacard
Metacard
.public void setPointOfContact(String pointOfContact)
Metacard
.
setAttribute
(new AttributeImpl
(Metacard.POINT_OF_CONTACT
, pointOfContact))
pointOfContact
- the point of contact for the Metacard
Metacard.POINT_OF_CONTACT
public String getDescription()
Metacard
Metacard
.public void setDescription(String description)
Metacard
.
setAttribute
(new AttributeImpl
(Metacard.DESCRIPTION
, description))
description
- the description of the Metacard
Metacard.DESCRIPTION
public String getContentTypeVersion()
Metacard
Metacard
.
getAttribute
(Metacard.CONTENT_TYPE_VERSION
)
getContentTypeVersion
in interface Metacard
Metacard
Metacard.CONTENT_TYPE_VERSION
public void setContentTypeVersion(String contentTypeVersion)
Metacard
.
setAttribute
(new AttributeImpl
(Metacard.CONTENT_TYPE_VERSION
, contentTypeVersion))
contentTypeVersion
- version of content type of the Metacard
Metacard.CONTENT_TYPE_VERSION
public URI getResourceURI()
Metacard
Metacard
s Resource URI and in the form of a URI
Object.
new URI(getAttribute
(Metacard.RESOURCE_URI
));
getResourceURI
in interface Metacard
URI
- a URI
representation of the Metacard
's Resource URI
which itself is stored as a String
ddf.catalog.data.AttributeType.AttributeFormat
public void setResourceURI(URI uri)
Metacard
s 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.AttributeFormat
Metacard.RESOURCE_URI
public String getResourceSize()
Metacard
getResourceSize
in interface Metacard
String
- String
representation of the sizepublic void setResourceSize(String dadSize)
setAttribute
(new AttributeImpl
(Metacard.RESOURCE_SIZE
, dadSize))
dadSize
- String
representation of the sizeMetacard.RESOURCE_SIZE
public 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)
Metacard
Attribute
for given attribute name.getAttribute
in interface Metacard
name
- name of attributeAttribute
for given name, or null
if not availablepublic void setAttribute(String name, Serializable value)
public void setAttribute(Attribute attribute)
Metacard
Attribute
with new attribute.setAttribute
in interface Metacard
attribute
- 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.