|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Read-write interface for Item object.
Field Summary | |
---|---|
static java.lang.String |
copyright
|
Method Summary | |
---|---|
void |
addAttributeOccurrence(Category location,
java.lang.String path)
Add an occurrence to a multi-occurrence or grouping attribute. |
void |
addAttributeOccurrence(java.lang.String path)
Add an occurrence to a multi-occurrence or grouping attribute. |
void |
addToCategory(Category category)
Add an item to a category. |
void |
clearAttribute(Category location,
java.lang.String path)
Clear an attribute such that it still exists but contains no value. |
void |
clearAttribute(java.lang.String path)
Clear an attribute such that it still exists but contains no value. |
void |
delete()
Deletes the item from the Product Information Manager. |
void |
deleteAttributeOccurrence(Category location,
java.lang.String path)
Delete an occurrence from an attribute. |
void |
deleteAttributeOccurrence(java.lang.String path)
Delete an occurrence from an attribute. |
java.lang.Object |
getAttribute(Category location,
java.lang.String path)
Get an attribute from a location. |
java.lang.Object |
getAttribute(java.lang.String path)
Get an attribute value. |
int |
getAttributeOccurrenceCount(Category location,
java.lang.String path)
Get the number of occurrences in a multi-occurrence attribute or the number of child attributes in a grouping node. |
int |
getAttributeOccurrenceCount(java.lang.String path)
Get the number of occurrences in a multi-occurrence attribute or the number of child attributes in a grouping node. |
Catalog |
getCatalog()
Returns the catalog to which this item belongs. |
PIMCollection |
getCategories()
Returns the categories to which this item belongs. |
java.lang.String |
getDisplayName()
Returns the display name. |
PIMCollection |
getLocationHierarchies()
Returns all the location hierarchies which are available on this catalog for this item, regardless of whether it has stored any data in them. |
java.lang.String |
getPrimaryKey()
Returns the primary key. |
PIMCollection |
getSpecs()
Returns the specs in which this item participates. |
ValidationErrors |
getValidationErrors()
Returns the validation errors from the last isValid() ,
delete() or save() call. |
boolean |
hasLocationData(Category location)
Returns true if the location contains any data. |
boolean |
isAttributeInherited(Category location,
java.lang.String path)
Returns true if the attribute is
set to inherit a value. |
boolean |
isLocationAvailable(Category location)
Returns true if the given location is available in this item. |
boolean |
isValid()
Returns true if the item has no validation errors. |
void |
removeFromCategory(Category category)
Remove an item from a category. |
void |
resetAttribute(Category location,
java.lang.String path)
Reset the attribute to its default value. |
void |
resetAttribute(java.lang.String path)
Reset the attribute to its default value. |
void |
save()
Saves the item. |
void |
setAttribute(Category location,
java.lang.String path,
java.lang.Object value)
Set an attribute at a location. |
void |
setAttribute(java.lang.String path,
java.lang.Object value)
Set an attribute value on an item. |
void |
setAttributeInherited(Category location,
java.lang.String path,
boolean inherit)
Set the inheritence state of a location attribute. |
void |
setLocationAvailable(Category location,
boolean isAvailable,
boolean recursive)
Set the availability of a location. |
Field Detail |
public static final java.lang.String copyright
Method Detail |
public void addToCategory(Category category) throws PIMInternalException, PIMAuthorizationException, java.lang.IllegalArgumentException
category
- Must be one which belongs to a hierarchy
contained by the catalog which contains the item.
If the item was already mapped to the category then no change will take place.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic void removeFromCategory(Category category) throws PIMInternalException, PIMAuthorizationException
category
- There will be no effect if the item does not
belong to the given category.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic void setLocationAvailable(Category location, boolean isAvailable, boolean recursive) throws PIMInternalException, PIMAuthorizationException
location
- A Category which belongs to one of this
item's location hierarchies. Location hierarchies are explicitly
attached in the item's Catalog.
The root Category is a valid location - it can be used to recursively set the entire set of locations for a Hierarchy as available or unavailable.
isAvailable
- recursive
- If true
, then availability is set on all
descendent locations. If false
, availability is only set
on the given location.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic boolean hasLocationData(Category location) throws PIMInternalException, PIMAuthorizationException
true
if the location contains any data.
location
- A category which belongs to one of this
item's location hierarchies. Location hierarchies are explicitly
attached in the item's catalog.
true
if the location contains any data.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic void setAttribute(java.lang.String path, java.lang.Object value) throws PIMInternalException, PIMAuthorizationException
Individual Occurrences on a multi-Occurrence node have to be set
seperately using paths which point to those particular Occurrences.
For instance, the second Occurrence on a multi-Occurrence attribute
which already has one Occurrence can be set by the command sequence.
item.addAttributeOccurrence("exampleSpec/MultiOccSpecNode"); item.setAttribute("exampleSpec/MultiOccSpecNode#1", "myValue");
Values which are valid in the conversion table but do not
conform to the correct format (for example, a string beginning with
"xml://" for an Image URL) will
cause a validation error on delete()
, isValid()
or save()
path
- A path to an existing attribute.value
- The value to set.
A null
argument will unset the attribute.
Java input types corresponding to WPC types are in the table below.
Attribute type | Java type | Notes |
Binary | String | This is the file name as stored in the PIM. It cannot contain any of the characters !@$%^&()=+ |
Currency | Number
| The method Number.doubleValue() will be called to transform
the Number into a double. The value will not be rounded in storage.
|
Date | Date | |
Flag | Boolean | |
Image | String
|
This is the file name as stored in the PIM.
The String must end with the character sequence ".gif" or ".jpg", ignoring case.
|
Image URL | String
| The String must start with the character sequence "http://", "https://" or "ftp://", ignoring case.
|
Integer | Number
|
The method Number.intValue() will be called to transform
the Number into an integer. This may mean that a
floating point value is truncated rather than rounded (e.g. passing
Double(43.56) as an argument will set 43 as the attribute value rather
than 44.
|
Lookup Table | String
| The key given must be a valid key in the lookup table used by this attribute. |
Number | Number
| The method Number.doubleValue() will be called to transform
the Number into a double.
|
Number Enumeration | Number
| The number set must match one of the possible enumerations or be null .
The method Number.doubleValue() will be called to transform
the Number into a double.
|
Password | String | |
Relationship | Item | The Item to which this relationship points.
|
Sequence | N/A | Cannot be set. |
String | String | |
String Enumeration | String | |
Thumbnail Image | String
|
This is the file name as stored in the PIM.
The String must end with the character sequence ".gif" or ".jpg", ignoring case.
|
Thumbnail Image URL | String
|
The String must start with the character sequence "http://", "https://" or "ftp://", ignoring case.
|
Timezone | String
|
The timezone String given must match one of the timezone enumerations.
XXX See yet to be written Timezone factory code
|
URL | String
|
The String must start with the character sequence "http://", "https://" or "ftp://", ignoring case.
|
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic void setAttribute(Category location, java.lang.String path, java.lang.Object value) throws PIMInternalException, PIMAuthorizationException
See setAttribute(String, Object)
for value types and
formats.
location
- A category which belongs to one of this
item's location hierarchies. Location hierarchies are explicitly
attached in the item's catalog.path
- A path to an existing attribute.value
- The value to set.
A null
argument will unset the attribute.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic void resetAttribute(java.lang.String path) throws PIMInternalException, PIMAuthorizationException
clearAttribute(String)
).
path
- A path to an existing attribute.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic void resetAttribute(Category location, java.lang.String path) throws PIMInternalException, PIMAuthorizationException
clearAttribute(Category, String)
.
location
- A category which belongs to one of this
item's location hierarchies. Location hierarchies are explicitly
attached in the item's catalog.path
- A path to an existing attribute.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic void clearAttribute(java.lang.String path) throws PIMInternalException, PIMAuthorizationException
path
- A path to an attribute to clear.
It is possible to clear attributes which do not yet have an Occurrence (a single instance attribute which does not yet have a value or a multi-Occurrence attribute where the Occurrence named is not yet instantiated). In these cases, the attribute will be instantiated with an empty value.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic void clearAttribute(Category location, java.lang.String path) throws PIMInternalException, PIMAuthorizationException
location
- A category which belongs to one of this
item's location hierarchies. Location hierarchies are explicitly
attached in the item's catalog.path
- A path to an attribute to clear.
It is possible to clear attributes which do not yet have an Occurrence (a single instance attribute which does not yet have a value or a multi-Occurrence attribute where the Occurrence named is not yet instantiated). In these cases, the attribute will be instantiated with an empty value.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic void setAttributeInherited(Category location, java.lang.String path, boolean inherit) throws PIMInternalException, PIMAuthorizationException
location
- A category which belongs to one of this
item's location hierarchies. Location hierarchies are explicitly
attached in the item's catalog.path
- A path which points to an attribute at the given
location which is capable of
inheriting values.inherit
- true
will cause the attribute at the given
location to always inherit from its parent location; false
will set this attribute to never inherit a value.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic java.lang.Object getAttribute(java.lang.String path) throws PIMInternalException, PIMAuthorizationException
Multi-Occurrence
attributes will be returned as a java.util.List
of
Occurrences. You can
determine whether a particular attribute is single or multi-Occurrence by
calling getAttributeOccurrenceCount(String)
.
path
- A path to an existing attribute or a multi-Occurrence
parent attribute.
Object
. The type of that
Object
corresponds to the attribute types as followsAttribute type | Java type | Notes |
Binary | String | This is the file name |
Currency | Double | The currency symbol needs to be retrieved from the SpecNode |
Date | Date
| |
Flag | Boolean
| |
Image | String | This is the file name |
Image URL | String
| |
Integer | Integer
| |
Lookup Table | String | This is the lookup table entry key. It is left to the caller to retrieve values from the appropriate lookup table |
Number | Double
| |
Number Enumeration | Double
| |
Password | String | Password is returned in the clear |
Relationship | Item | The Item which this relationship points to
|
Sequence | Integer
| |
String | String
| |
String Enumeration | String
| |
Thumbnail Image | String | This is the file name |
Thumbnail Image URL | String
| |
Timezone | String | Timezone is returned in WPC native form |
URL | String
|
It is left to the caller to cast the returned Object
to the appropriate type.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic java.lang.Object getAttribute(Category location, java.lang.String path) throws PIMInternalException, PIMAuthorizationException
getAttribute(String)
for return types.
location
- A category which belongs to one of this
item's location hierarchies. Location hierarchies are explicitly
attached in the item's catalog.path
- A path to an existing attribute or a multi-occurrence
parent attribute.
Object
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic void addAttributeOccurrence(java.lang.String path) throws PIMInternalException, PIMAuthorizationException
setAttribute(String, Object)
.
path
- A path to a multi-occurrence or grouping attribute which does
not already contain the maximum number of possible occurrences as
specified in the spec.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic void addAttributeOccurrence(Category location, java.lang.String path) throws PIMInternalException, PIMAuthorizationException
setAttribute(Category, String, Object)
.
location
- A category which belongs to one of this
item's location hierarchies. Location hierarchies are explicitly
attached in the item's catalog.path
- A path to a multi-occurrence or grouping attribute which does
not already contain the maximum number of possible occurrences as
specified in the spec.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic void deleteAttributeOccurrence(java.lang.String path) throws PIMInternalException, PIMAuthorizationException
path
- A path to the specific occurrence to be deleted.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic void deleteAttributeOccurrence(Category location, java.lang.String path) throws PIMInternalException, PIMAuthorizationException
location
- A category which belongs to one of this
item's location hierarchies. Location hierarchies are explicitly
attached in the item's catalog.path
- A path to the specific occurrence to be deleted.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic int getAttributeOccurrenceCount(java.lang.String path) throws PIMInternalException, PIMAuthorizationException
path
- A path to a multi-occurrence attribute, a grouping attribute
or a single occurrence attribute.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic int getAttributeOccurrenceCount(Category location, java.lang.String path) throws PIMInternalException, PIMAuthorizationException
location
- A category which belongs to one of this
item's location hierarchies. Location hierarchies are explicitly
attached in the item's catalog.path
- A path to a multi-occurrence attribute, a grouping attribute
or a single occurrence attribute.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic boolean isLocationAvailable(Category location) throws PIMInternalException, java.lang.IllegalArgumentException
true
if the given location is available in this item.
location
- Any category.
true
if the location is available for this item,
false
if the
location is currently unavailable or is in a hierarchy which is not
attached as a location hierarchy to this item's containing catalog.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs.
java.lang.IllegalArgumentException
- If the user is not allowed to perform
this operationpublic boolean isAttributeInherited(Category location, java.lang.String path) throws PIMInternalException, PIMAuthorizationException, java.lang.IllegalArgumentException
true
if the attribute is
set to inherit a value.
location
- A category which belongs to one of this
item's location hierarchies. Location hierarchies are explicitly
attached in the item's catalog.path
- A path to an existing attribute.
true
if the location attribute is set to inherit a
value.
java.lang.IllegalArgumentException
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic Catalog getCatalog() throws PIMInternalException, PIMAuthorizationException
PIMInternalException
PIMAuthorizationException
public PIMCollection getCategories() throws PIMInternalException, PIMAuthorizationException
Collection
of Category
to which
this item belongs. If the
item does not belong to any categories (in other words, it is
unassigned), then an empty Collection
is returned.
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic java.lang.String getPrimaryKey() throws PIMInternalException, PIMAuthorizationException
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic java.lang.String getDisplayName() throws PIMInternalException, PIMAuthorizationException
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic PIMCollection getLocationHierarchies() throws PIMInternalException, PIMAuthorizationException
Collection
of Hierarchy
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic PIMCollection getSpecs() throws PIMInternalException, PIMAuthorizationException
Collection
of Spec
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic boolean isValid() throws PIMInternalException, PIMAuthorizationException
true
if the item has no validation errors. If
there are validation errors, detailed results can be retrieved by
the getValidationErrors()
method.
true
if the item has no validation errors,
false
if there
are validation errors.
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic void save() throws PIMValidationException, PIMInternalException, PIMAuthorizationException
PIMValidationException
- If there are any validation errors. The
detailed results can be retrieved by the getValidationErrors()
method.
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic void delete() throws PIMValidationException, PIMInternalException, PIMAuthorizationException
getValidationErrors()
.
PIMValidationException
- If there are any validation errors. The
detailed results can be retrieved by the getValidationErrors()
method.
PIMInternalException
- If an internal error occurs.
PIMAuthorizationException
- If the user is not allowed to perform
this operationpublic ValidationErrors getValidationErrors() throws PIMAuthorizationException
isValid()
,
delete()
or save()
call.
Any particular
ValidationErrors
object retrieved by this method is a snapshot of the validation errors
at the last isValid()
,
delete()
or save()
call. Therefore, subsequent changes to the Item
will not affect existing
ValidationErrors
objects. Only
freshly retrieved
ValidationErrors
objects will
reflect the
latest attribute changes.
ValidationErrors
object containing the validation
errors from the last isValid()
,
delete()
or save()
call. If there are no validation errors,
a ValidationErrors
object will still be returned but ValidationErrors.hasErrors()
will
return false.
PIMAuthorizationException
- If the user is not allowed to perform
this operation
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |