public class Resource extends Entity
Modifier and Type | Field and Description |
---|---|
static String |
KIND_IDENTIFIER_DEFAULT |
static URI |
SCHEME_DEFAULT |
static String |
SUMMARY_ATTRIBUTE_NAME |
static String |
TERM_DEFAULT |
ID_ATTRIBUTE_NAME, TITLE_ATTRIBUTE_NAME
Constructor and Description |
---|
Resource(String id,
Kind kind)
Constructor.
|
Resource(String id,
Kind kind,
String title,
Model model,
String summary)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addAction(Action action)
Adds action to the resource.
|
boolean |
addActions(Collection<Action> actions)
Adds actions to the resource.
|
boolean |
addLink(Link link)
Adds link to the resource and automatically sets link's source to
resource.
|
boolean |
addLinks(Collection<Link> links)
Adds links to the resource and automatically sets all links' sources to
resource.
|
void |
clearActions()
Removes all actions from resource.
|
void |
clearLinks()
Removes all links from resource.
|
boolean |
containsAction(Action action)
Checks whether resource contains given action.
|
boolean |
containsAction(String actionIdentifier)
Checks whether resource contains given action.
|
boolean |
containsLink(Link link)
Checks whether resource contains given link.
|
boolean |
containsLink(String term)
Checks whether resource contains link which kind has given term.
|
boolean |
containsLink(URI identifier)
Checks whether resource contains link which kind has given identifier.
|
Action |
getAction(String actionIdentifier)
Returns resource's action.
|
Set<Action> |
getActions()
Returns all resource's actions in form of set.
|
static List<Attribute> |
getDefaultAttributes() |
static Kind |
getDefaultKind() |
String |
getDefaultKindIdentifier()
Returns resource's default identifier
'http://schemas.ogf.org/occi/core#resource'
|
Set<Link> |
getLinks()
Returns all resource's links in form of set.
|
Set<Link> |
getLinks(String term)
Returns resources' links which kind has given term.
|
Set<Link> |
getLinks(URI identifier)
Returns resources' links which kind has given identifier.
|
String |
getLocation()
Returns resource's location.
|
String |
getSummary()
Returns resource's summary.
|
boolean |
removeAction(Action action)
Removes action from resource.
|
boolean |
removeLink(Link link)
Removes link from resource.
|
void |
setSummary(String summary)
Sets resource's summary.
|
com.sun.net.httpserver.Headers |
toHeaders()
Returns a occi text representation of resource instance as described in
OCCI standard in form of headers.
|
String |
toJSON()
Returns a JSON representation of resource instance as described in OCCI
standard.
|
String |
toString()
Resturns string representation of resource
|
String |
toText()
Returns a plain text representation of resource instance as described in
OCCI standard.
|
addAttribute, addAttributes, addMixin, addMixins, attributesToHeaders, attributesToOneLineText, attributesToPrefixText, clearAttributes, clearMixins, compareTo, containsAttribute, containsAttribute, containsMixin, containsMixin, equals, getAttributes, getId, getIdentifier, getKind, getMixin, getMixins, getModel, getTitle, getValue, getValue, hashCode, removeAttribute, removeMixin, setId, setKind, setModel, setTitle
public static final String SUMMARY_ATTRIBUTE_NAME
public static final URI SCHEME_DEFAULT
public static final String TERM_DEFAULT
public static final String KIND_IDENTIFIER_DEFAULT
public Resource(String id, Kind kind, String title, Model model, String summary) throws InvalidAttributeValueException
id
- occi.core.id attribute. Cannot be null.kind
- resource's kind. Cannot be null.title
- occi.core.title attributemodel
- resource's modelsummary
- resource's summaryInvalidAttributeValueException
- in case of invalid id, title or
summary valuepublic Resource(String id, Kind kind) throws InvalidAttributeValueException
id
- occi.core.id attribute. Cannot be null.kind
- resource's kind. Cannot be null.InvalidAttributeValueException
- in case of invalid id valuepublic String getSummary()
public void setSummary(String summary) throws InvalidAttributeValueException
summary
- resource's summaryInvalidAttributeValueException
- in case of invalid summary valuepublic boolean containsLink(Link link)
link
- link to be looked uppublic boolean containsLink(String term)
term
- term of link's kindpublic boolean containsLink(URI identifier)
identifier
- identifier of link's kindpublic boolean addLink(Link link)
link
- to be addedpublic boolean addLinks(Collection<Link> links)
links
- collections of links to be addedpublic Set<Link> getLinks(String term)
term
- term of link's kindpublic Set<Link> getLinks(URI identifier)
identifier
- identifier of link's kindpublic boolean removeLink(Link link)
link
- link to be removedpublic void clearLinks()
public Set<Link> getLinks()
public boolean containsAction(Action action)
action
- action to be looked uppublic boolean containsAction(String actionIdentifier)
actionIdentifier
- identifier of action to be looked uppublic boolean addAction(Action action)
action
- to be addedpublic boolean addActions(Collection<Action> actions)
actions
- collections of actions to be addedpublic Action getAction(String actionIdentifier)
actionIdentifier
- identifier of requested actionpublic boolean removeAction(Action action)
action
- action to be removedpublic void clearActions()
public Set<Action> getActions()
public String getLocation()
public String getDefaultKindIdentifier()
getDefaultKindIdentifier
in class Entity
public static Kind getDefaultKind()
public String toString()
toString
in class Entity
Object.toString()
public String toText() throws RenderingException
toText
in class Entity
RenderingException
public com.sun.net.httpserver.Headers toHeaders() throws RenderingException
toHeaders
in class Entity
RenderingException
Copyright © 2016. All Rights Reserved.