public class Item extends Object implements Serializable
ItemType
.
An Item always contains three attributes:
NamedValue
,
AttributeRequest
,
ItemTypes
,
Serialized FormConstructor and Description |
---|
Item()
Default constructor in other to be a Java Bean.
|
Item(FdkSession session,
LibraryObject reposObject,
AttributeRequest[] attributes)
Constructor that converts a repository object into an Item.
|
Modifier and Type | Method and Description |
---|---|
Map |
attributesMap()
Returns all the attributes as a map.
|
static Item[] |
convertToItems(FdkSession session,
LibraryObject[] reposObjects,
AttributeRequest[] attributes)
Converts a list of repository objects to the corresponding Items.
|
long |
getId()
Returns the ID of the item.
|
String |
getName()
Returns the name of the item.
|
NamedValue[] |
getRequestedAttributes()
Returns the optionally requested attributes of the item or
null if no optional attributes are present. |
String |
getType()
Returns the type of the item.
|
void |
setId(long id)
Always throws a RuntimeException.
|
void |
setName(String name)
Always throws a RuntimeException.
|
void |
setRequestedAttributes(NamedValue[] attrs)
Always throws a RuntimeException.
|
void |
setType(String type)
Always throws a RuntimeException.
|
String |
toString()
Returns a string representation of an item.
|
public Item()
Do NOT use this constructor, it will thorw a RuntimeException
public Item(FdkSession session, LibraryObject reposObject, AttributeRequest[] attributes) throws FdkException
session
- The user session to use.reposObject
- The repository object to convert.attributes
- The optional attributes to be filled in. Can be
null
. It is legal to request attributes
that are not applicable to the repository object, they
will not be filled in.FdkException
- if the conversion fails.public long getId()
public void setId(long id)
RuntimeException
- Always.public String getName()
public void setName(String name)
RuntimeException
- Always.public String getType()
ItemTypes
, hence when running in-process it
is recommended that the return value is compared against one of the
constants using the double-equal "==" operator rather than
equals()
.public void setType(String type)
RuntimeException
- Always.public NamedValue[] getRequestedAttributes()
null
if no optional attributes are present. Note that the
return value does not include the ID, NAME and TYPE attributes.
NOTE: When running the client code in-process, the method
attributesMap()
MUST be used instead. It will be
more efficient to retrieve the attributes from a map than from
an array.
public void setRequestedAttributes(NamedValue[] attrs)
RuntimeException
- Always.public Map attributesMap()
NOTES:
This method is not available for remote clients, it is a
convenience method for in-process clients only. Remote clients should
call getRequestedAttributes()
and use
ClientUtils.namedValuesToMap()
to do the conversion.
For performance reasons, in-process callers should use this method
rather than getRequestedAttributes()
.
The returned map is unmodifiable.
public String toString()
NOTE: Calling this method is not cheap, protect debugging code so that the string is not computed unnecessarily when not in debug mode.
public static Item[] convertToItems(FdkSession session, LibraryObject[] reposObjects, AttributeRequest[] attributes) throws FdkException
session
- The user session to use.reposObjects
- The repository objects to convert.attributes
- The optional attributes to fill in for each Item.
Can be null
. It is legal to request
attributes that are not applicable to the repository
object, they will not be filled in.FdkException
- If the conversion for any of the Items fails.Copyright © 2023. All rights reserved.