Class MetacardImpl
- All Implemented Interfaces:
ddf.catalog.data.Metacard,Serializable
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.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ddf.catalog.data.MetacardTypeA Constant for aMetacardTypewith the requireds.invalid reference
AttributeTypeFields inherited from interface ddf.catalog.data.Metacard
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 Summary
ConstructorsConstructorDescriptionCreates aMetacardwith a type of BASIC_METACARD and emptyAttributes.MetacardImpl(ddf.catalog.data.Metacard metacard) Creates aMetacardwith the providedMetacard.MetacardImpl(ddf.catalog.data.Metacard metacard, ddf.catalog.data.MetacardType type) Creates aMetacardwith the providedMetacardandMetacardType.MetacardImpl(ddf.catalog.data.MetacardType type) Creates aMetacardwith the providedMetacardTypeand emptyAttributes. -
Method Summary
Modifier and TypeMethodDescriptionbooleanddf.catalog.data.AttributegetAttribute(String name) Returns the description for theMetacardgetId()ddf.catalog.data.MetacardTypeReturns the Point of Contact for theMetacardReturns the security relevant markings on theMetacard.byte[]getTitle()inthashCode()protected byte[]requestBytes(String key) Getdata from the map or wrapped metacard.invalid reference
byte[]protected <T> TrequestData(String attributeName, Class<T> returnType) The brains of the operation -- does the interaction with the map or the wrapped metacard.protected DaterequestDate(String key) GetDatedata from the map or wrapped metacard.protected DoublerequestDouble(String key) GetDoubledata from the map or wrapped metacard.protected InputStreamrequestInputStream(String key) GetBinaryContentdata from the map or wrapped metacard.protected IntegerrequestInteger(String key) GetIntegerdata from the map or wrapped metacard.protected LongrequestLong(String key) GetLongdata from the map or wrapped metacard.protected StringrequestString(String key) GetStringdata from the map or wrapped metacard.voidsetAttribute(ddf.catalog.data.Attribute attribute) voidsetAttribute(String name, Serializable value) Set an attribute via a name/value pair.voidsetContentTypeName(String contentType) Sets the name of the content type of theMetacard.voidsetContentTypeVersion(String contentTypeVersion) Sets the version of the content type of theMetacard.voidsetCreatedDate(Date created) Sets the date/time theMetacardwas created.voidsetDescription(String description) Sets the description of theMetacard.voidsetEffectiveDate(Date effective) Sets the date/time theMetacardwas last known to be valid.voidsetExpirationDate(Date expiration) Sets the date/time thisMetacardis no longer valid and could be removed.voidSets the ID of theMetacard.voidsetLocation(String wkt) Sets the WKT representation of the geometry.voidsetMetadata(String metadata) Sets the metadata associated with thisMetacard.voidsetModifiedDate(Date modified) Sets the date/time theMetacardwas last modifed.voidsetPointOfContact(String pointOfContact) Sets the point of contact for theMetacard.voidsetResourceSize(String dadSize) Sets the size of the resource which may or may not contain a unit.voidsetResourceURI(URI uri) Sets the value of thisMetacards Resource URI and in the form of aURIObject.voidsetSecurity(HashMap<String, List<String>> security) Sets the security markings on thisMetacard.voidsetSourceId(String sourceId) voidSets the tags associated with this metacardvoidsetTargetNamespace(URI targetNamespace) Some types of metadata use different content types.voidsetThumbnail(byte[] bytes) Sets the thumbnail associated with thisMetacard.voidSets the title of thisMetacard.voidsetType(ddf.catalog.data.MetacardType type) Sets theMetacardTypeof theMetacard.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ddf.catalog.data.Metacard
getTags
-
Field Details
-
BASIC_METACARD
public static final ddf.catalog.data.MetacardType BASIC_METACARDA Constant for aMetacardTypewith the requireds.invalid reference
AttributeType
-
-
Constructor Details
-
MetacardImpl
public MetacardImpl()Creates aMetacardwith a type of BASIC_METACARD and emptyAttributes. -
MetacardImpl
public MetacardImpl(ddf.catalog.data.MetacardType type) Creates aMetacardwith the providedMetacardTypeand emptyAttributes.- Parameters:
type- theMetacardType
-
MetacardImpl
public MetacardImpl(ddf.catalog.data.Metacard metacard) Creates aMetacardwith the providedMetacard.- Parameters:
metacard- theMetacardto create this newMetacardfrom
-
MetacardImpl
public MetacardImpl(ddf.catalog.data.Metacard metacard, ddf.catalog.data.MetacardType type) Creates aMetacardwith the providedMetacardandMetacardType. This method does not simply wrap the metacard and keep its type, but will create a new metacard and clone any attributes defined by theMetacardTypethat exist on the givenMetacard. Note, this means any attributes with null values will not be copied over.- Parameters:
metacard- theMetacardto create this newMetacardfromtype- theMetacardTypeof metacard to create
-
-
Method Details
-
getCreatedDate
- Specified by:
getCreatedDatein interfaceddf.catalog.data.Metacard
-
setCreatedDate
Sets the date/time theMetacardwas created.
Convenience method forsetAttribute(newAttributeImpl(Metacard.CREATED, created))- Parameters:
created-Datewhen thisMetacardwas created.- See Also:
-
getModifiedDate
- Specified by:
getModifiedDatein interfaceddf.catalog.data.Metacard
-
setModifiedDate
Sets the date/time theMetacardwas last modifed.
Convenience method forsetAttribute(newAttributeImpl(Metacard.MODIFIED, modified))- Parameters:
modified-Datewhen thisMetacardwas last modified.- See Also:
-
getExpirationDate
- Specified by:
getExpirationDatein interfaceddf.catalog.data.Metacard
-
setExpirationDate
Sets the date/time thisMetacardis no longer valid and could be removed.
Convenience method forsetAttribute(newAttributeImpl(Metacard.EXPIRATION, expiration))- Parameters:
expiration-Datewhen theMetacardexpires and should be removed from any stores.- See Also:
-
getEffectiveDate
- Specified by:
getEffectiveDatein interfaceddf.catalog.data.Metacard
-
setEffectiveDate
Sets the date/time theMetacardwas last known to be valid.
Convenience method forsetAttribute(newAttributeImpl(Metacard.EFFECTIVE, effective))- Parameters:
effective-Datewhen the information represented by theMetacardwas last known to be valid.- See Also:
-
getId
- Specified by:
getIdin interfaceddf.catalog.data.Metacard
-
setId
Sets the ID of theMetacard.
Convenience method forsetAttribute(newAttributeImpl(Metacard.ID, id))- Parameters:
id- unique identifier of the Metacard.- See Also:
-
getLocation
- Specified by:
getLocationin interfaceddf.catalog.data.Metacard
-
setLocation
Sets the WKT representation of the geometry.
Convenience method forsetAttribute(newAttributeImpl(Metacard.GEOGRAPHY, wkt))- Parameters:
wkt- WKT-defined geospatialString, returns null if not applicable- See Also:
-
getSourceId
- Specified by:
getSourceIdin interfaceddf.catalog.data.Metacard
-
setSourceId
- Specified by:
setSourceIdin interfaceddf.catalog.data.Metacard
-
getThumbnail
public byte[] getThumbnail()- Specified by:
getThumbnailin interfaceddf.catalog.data.Metacard
-
setThumbnail
public void setThumbnail(byte[] bytes) Sets the thumbnail associated with thisMetacard.
Convenience method forsetAttribute(newAttributeImpl(Metacard.THUMBNAIL, bytes))- Parameters:
bytes- thumbnail for theMetacard.- See Also:
-
getTitle
- Specified by:
getTitlein interfaceddf.catalog.data.Metacard
-
setTitle
Sets the title of thisMetacard.
Convenience method forsetAttribute(newAttributeImpl(Metacard.TITLE, id))- Parameters:
title- Title of theMetacard- See Also:
-
getMetadata
- Specified by:
getMetadatain interfaceddf.catalog.data.Metacard
-
setMetadata
Sets the metadata associated with thisMetacard.
Convenience method forsetAttribute(newAttributeImpl(Metacard.METADATA, metadata))- Parameters:
metadata- Associated metadata of theMetacard- See Also:
-
getMetacardType
public ddf.catalog.data.MetacardType getMetacardType()- Specified by:
getMetacardTypein interfaceddf.catalog.data.Metacard
-
setType
public void setType(ddf.catalog.data.MetacardType type) Sets theMetacardTypeof theMetacard.- Parameters:
type-MetacardTypeof theMetacard- See Also:
-
getContentTypeNamespace
- Specified by:
getContentTypeNamespacein interfaceddf.catalog.data.Metacard
-
setTargetNamespace
Some types of metadata use different content types. If utilized, sets theURIof the content type.
Convenience method forsetAttribute(newAttributeImpl(Metacard.TARGET_NAMESPACE, targetNamespace))- Parameters:
targetNamespace-URIof the sub-type, null if unused- See Also:
-
getContentTypeName
- Specified by:
getContentTypeNamein interfaceddf.catalog.data.Metacard
-
setContentTypeName
Sets the name of the content type of theMetacard.
Convenience method forsetAttribute(newAttributeImpl(Metacard.CONTENT_TYPE, contentType))- Parameters:
contentType- name of content type of theMetacard- See Also:
-
setTags
Sets the tags associated with this metacard- Parameters:
tags- set of tags
-
getPointOfContact
Returns the Point of Contact for theMetacard- Returns:
- A String representing the Point of Contact for the
Metacard.
-
setPointOfContact
Sets the point of contact for theMetacard.
Convenience method forsetAttribute(newAttributeImpl(Metacard.POINT_OF_CONTACT, pointOfContact))- Parameters:
pointOfContact- the point of contact for theMetacard- See Also:
-
getDescription
Returns the description for theMetacard- Returns:
- A String representing the description for the
Metacard.
-
setDescription
Sets the description of theMetacard.
Convenience method forsetAttribute(newAttributeImpl(Metacard.DESCRIPTION, description))- Parameters:
description- the description of theMetacard- See Also:
-
getContentTypeVersion
- Specified by:
getContentTypeVersionin interfaceddf.catalog.data.Metacard
-
setContentTypeVersion
Sets the version of the content type of theMetacard.
Convenience method forsetAttribute(newAttributeImpl(Metacard.CONTENT_TYPE_VERSION, contentTypeVersion))- Parameters:
contentTypeVersion- version of content type of theMetacard- See Also:
-
getResourceURI
- Specified by:
getResourceURIin interfaceddf.catalog.data.Metacard
-
setResourceURI
Sets the value of thisMetacards Resource URI and in the form of aURIObject.
Convenience method forsetAttribute(newAttributeImpl(Metacard.RESOURCE_URI, uri))- Parameters:
uri- aURIrepresentation of theMetacard'sResource URIwhich itself is stored as aString ddf.catalog.data.AttributeType.AttributeFormat- See Also:
-
getResourceSize
- Specified by:
getResourceSizein interfaceddf.catalog.data.Metacard
-
setResourceSize
Sets the size of the resource which may or may not contain a unit.
Convenience method forsetAttribute(newAttributeImpl(Metacard.RESOURCE_SIZE, dadSize))- Parameters:
dadSize-Stringrepresentation of the size- See Also:
-
getSecurity
Returns the security relevant markings on theMetacard.- Returns:
- security markings
-
setSecurity
Sets the security markings on thisMetacard.
Convenience method forsetAttribute(newAttributeImpl(Metacard.SECURITY, security))- Parameters:
security-
-
requestData
The brains of the operation -- does the interaction with the map or the wrapped metacard.- Type Parameters:
T- the type of the Attribute value expected- Parameters:
attributeName- the name of theAttributeto retrievereturnType- the class that the value of theAttributeTypeis expected to be bound to- Returns:
- the value of the requested
Attributename
-
requestDate
GetDatedata from the map or wrapped metacard.
Convenience method forrequestData(key, Date.class))- Parameters:
key- the name of theAttributeto retrieve- Returns:
- the value of the requested
Attributename - See Also:
-
requestDouble
GetDoubledata from the map or wrapped metacard.
Convenience method forrequestData(key, Double.class))- Parameters:
key- the name of theAttributeto retrieve- Returns:
- the value of the requested
Attributename - See Also:
-
requestInputStream
GetBinaryContentdata from the map or wrapped metacard.
Convenience method forrequestData(key, BinaryContent.class))- Parameters:
key- the name of theAttributeto retrieve- Returns:
- the value of the requested
Attributename - See Also:
-
requestInteger
GetIntegerdata from the map or wrapped metacard.
Convenience method forrequestData(key, Integer.class))- Parameters:
key- the name of theAttributeto retrieve- Returns:
- the value of the requested
Attributename - See Also:
-
requestLong
GetLongdata from the map or wrapped metacard.
Convenience method forrequestData(key, Long.class))- Parameters:
key- the name of theAttributeto retrieve- Returns:
- the value of the requested
Attributename - See Also:
-
requestString
GetStringdata from the map or wrapped metacard.
Convenience method forrequestData(key, String.class))- Parameters:
key- the name of theAttributeto retrieve- Returns:
- the value of the requested
Attributename - See Also:
-
requestBytes
Getdata from the map or wrapped metacard.invalid reference
byte[]
Convenience method forrequestData(key, byte[].class))- Parameters:
key- the name of theAttributeto retrieve- Returns:
- the value of the requested
Attributename - See Also:
-
getAttribute
- Specified by:
getAttributein interfaceddf.catalog.data.Metacard
-
setAttribute
Set an attribute via a name/value pair.- Parameters:
name- the name of theAttributevalue- the value of theAttribute
-
setAttribute
public void setAttribute(ddf.catalog.data.Attribute attribute) - Specified by:
setAttributein interfaceddf.catalog.data.Metacard
-
hashCode
public int hashCode() -
equals
-