public class Attachment extends Object
Attachment
implement the operations on attachment from Resource.
It provides the data, meta data, uri and so on.
This object can be created by AttachmentSet
.
The following code shows how to create Attachment
using AttachmentSet
Constructor
Attachment att = new Attachment();
att = new AttachmentSet().create("DOCLINKS", att);
The following examples demonstrate how to build a new Attachment
Attachment att = new Attachment();
Attachment att = new Attachment(attachmenturi,maximoconnector);
Attachment att = new Attachment(attachmentJsonObject,maximoconnector);
The following examples demonstrate how to set maximoconnector, name, description, data, metadata, wwwURI to Attachment
att.mc(maximoconnector).name(filename).description(description)
att.data(byte[] data).meta(type, storeas).wwwURI(wwwURI);
The following examples show how to load and reload data
att.load();
att.reload();
The following examples show how to get information from Attachment
For file data:
byte[] data = att.toDoc();
String uri = att.getURI();
String name = att.getName();
String description = att.getDescription();
String meta = att.getMeta();
For file metadata:
JsonObject jo = att.toDocMeta();
byte[] jodata = att.toDocMetaBytes();
The following example shows how to delete the Attachment
att.delete(); //if the attachment is deleted as ats.att.detele(), please reload attachmentset after.
Constructor and Description |
---|
Attachment() |
Attachment(javax.json.JsonObject obj,
MaximoConnector mc) |
Attachment(String uri,
MaximoConnector mc) |
Modifier and Type | Method and Description |
---|---|
Attachment |
data(byte[] data) |
void |
delete()
Delete the attachment
|
Attachment |
description(String description) |
javax.json.JsonObject |
fetchDocMeta() |
String |
getDescription() |
String |
getMeta() |
String |
getName() |
String |
getURI()
Get current URI
|
Attachment |
load()
load attachment data
|
Attachment |
load(Map<String,Object> headers)
load attachment data with headers
|
Attachment |
loadMeta()
load attachment meta data
|
Attachment |
loadMeta(Map<String,Object> headers) |
Attachment |
maximoConnector(MaximoConnector mc)
Attachment att = new Attachment().mc(params)
|
Attachment |
meta(String type,
String storeas) |
Attachment |
name(String name) |
Attachment |
reload() |
Attachment |
reloadMeta() |
byte[] |
toDoc() |
javax.json.JsonObject |
toDocMeta()
Get Attachment data in JSON
|
byte[] |
toDocMetaBytes()
Get Attachment data in JSONBytes
|
Attachment |
wwwURI(String uri) |
public Attachment()
public Attachment(String uri, MaximoConnector mc)
public Attachment(javax.json.JsonObject obj, MaximoConnector mc)
public Attachment maximoConnector(MaximoConnector mc)
mc
- public Attachment name(String name)
public Attachment description(String description)
public Attachment meta(String type, String storeas)
public Attachment wwwURI(String uri)
public Attachment data(byte[] data)
public String getName()
public String getDescription()
public String getMeta()
public byte[] toDoc() throws IOException, OslcException
IOException
OslcException
public String getURI()
public javax.json.JsonObject toDocMeta() throws IOException, OslcException
IOException
OslcException
public byte[] toDocMetaBytes() throws OslcException, IOException
IOException
OslcException
public Attachment load() throws IOException, OslcException
OslcException
IOException
public Attachment load(Map<String,Object> headers) throws IOException, OslcException
headers
- IOException
OslcException
public Attachment reload() throws IOException, OslcException
IOException
OslcException
public Attachment loadMeta() throws IOException, OslcException
IOException
OslcException
public Attachment loadMeta(Map<String,Object> headers) throws IOException, OslcException
IOException
OslcException
public Attachment reloadMeta() throws IOException, OslcException
IOException
OslcException
public javax.json.JsonObject fetchDocMeta() throws IOException, OslcException
IOException
OslcException
public void delete() throws IOException, OslcException
IOException
OslcException
Copyright © 2018. All rights reserved.