SCItem Class Reference
Inherits from | NSObject |
Declared in | SCItem.h |
Overview
The SCItem object identifies a Sitecore system item.
It provides getters for the parent and children items. And getters for the item’s fields.
Also it provides methods for asynchronous loading of children items and their fields.
Now you can load items using the only SCApiSession object, and all loaded items has a reference to his API session, which can be used to read a necessary data.
SCItem object will be automatically updated with a new data when you read the same item from the backend.
Tasks
-
apiSession
The SCApiSession object this item was created/loaded from.
property
Can be used to load the necessary data. -
itemId
The system item’s id.
property -
path
The system item’s path.
property -
displayName
The system item’s display name.
property -
hasChildren
If the item has a children items.
property -
itemTemplate
The system item’s full template name, example: “Nicam/Item Types/Site Section”.
property -
longID
The system item’s long id, example: “/{11111111-1111-1111-1111-111111111111}/{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}”
property -
language
The system item’s language
property -
parent
The system item’s parent
property -
allChildren
The system item’s children, it is nil if not all children was loaded for the item. If you want to get available children items - use readChildren property instead.
property -
readChildren
Only loaded item’s children.
property -
readFields
Only loaded item’s fields.
property -
allFields
All item’s fields.
property -
– fieldWithName:
Returns SCField object for the given field’s name if such field was loaded and the item has a field with such name
-
– fieldValueWithName:
Returns SCField object’s value( [SCField fieldValue] ) for the given field’s name if such field was loaded and the item has a field with such name
-
– readFieldValueOperationForFieldName:
Used to load the field’s value, see [SCField fieldValue] and [SCField readFieldValueOperation]
-
– readFieldsValuesOperationForFieldsNames:
Used to load the fields and the field’s values of the item, see [SCField fieldValue] and [SCField readFieldValueOperation] for details.
-
– readFieldsOperationForFieldsNames:
Used to load item’s fields. They can be later accessed using the [SCItem fieldWithName:] method.
-
– readChildrenOperation
Used to load all item’s children, see [SCItem allChildren]
-
– saveItemOperation
Used to save all item’s changed fields
-
– removeItemOperation
Used to remove given item
-
– isMediaItem
Checks whether the item is in the media folder.
-
– isMediaImage
Checks whether the item is a media image. Such items have image template and is stored in the media folder. See isMediaItem and isImage methods for details.
-
– isImage
Checks whether the item has an image template.
-
– isFolder
Checks whether the item has a folder template.
* “SYSTEM/MEDIA/MEDIA FOLDER"
* "COMMON/FOLDER” -
– mediaPath
Returns a media path of items that have it.
-
– downloadMediaExtendedOperationWithOptions:
Returns a media path of items that have it.
-
– recordItemSource
Item source if available. Default settings of the corresponding session otherwise.
Properties
allChildren
The system item’s children, it is nil if not all children was loaded for the item. If you want to get available children items - use readChildren property instead.
@property (nonatomic, readonly) NSArray *allChildren
Discussion
The system item’s children, it is nil if not all children was loaded for the item. If you want to get available children items - use readChildren property instead.
All item’s children can be loaded using [SCItem readChildrenOperation] method
Declared In
SCItem.h
allFields
All item’s fields.
@property (nonatomic, readonly) NSArray *allFields
Discussion
All item’s fields.
Declared In
SCItem.h
apiSession
The SCApiSession object this item was created/loaded from.
Can be used to load the necessary data.
@property (nonatomic, readonly) SCExtendedApiSession *apiSession
Discussion
The SCApiSession object this item was created/loaded from.
Can be used to load the necessary data.
Declared In
SCItem.h
displayName
The system item’s display name.
@property (nonatomic, readonly) NSString *displayName
Discussion
The system item’s display name.
Declared In
SCItem.h
hasChildren
If the item has a children items.
@property (nonatomic, readonly) BOOL hasChildren
Discussion
If the item has a children items.
Declared In
SCItem.h
itemId
The system item’s id.
@property (nonatomic, readonly) NSString *itemId
Discussion
The system item’s id.
Declared In
SCItem.h
itemTemplate
The system item’s full template name, example: “Nicam/Item Types/Site Section”.
@property (nonatomic, readonly) NSString *itemTemplate
Discussion
The system item’s full template name, example: “Nicam/Item Types/Site Section”.
Declared In
SCItem.h
language
The system item’s language
@property (nonatomic, readonly) NSString *language
Discussion
The system item’s language
Declared In
SCItem.h
longID
The system item’s long id, example: “/{11111111-1111-1111-1111-111111111111}/{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}”
@property (nonatomic, readonly) NSString *longID
Discussion
The system item’s long id, example: “/{11111111-1111-1111-1111-111111111111}/{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}”
Declared In
SCItem.h
parent
The system item’s parent
@property (nonatomic, weak, readonly) SCItem *parent
Discussion
The system item’s parent
Declared In
SCItem.h
path
The system item’s path.
@property (nonatomic, readonly) NSString *path
Discussion
The system item’s path.
Declared In
SCItem.h
Instance Methods
downloadMediaExtendedOperationWithOptions:
Returns a media path of items that have it.
- (SCExtendedAsyncOp)downloadMediaExtendedOperationWithOptions:(SCDownloadMediaOptions *)options
Parameters
- options
Resizing options for media files processing on the back end.
Discussion
Returns a media path of items that have it.
Declared In
SCItem.h
fieldValueWithName:
Returns SCField object’s value( [SCField fieldValue] ) for the given field’s name if such field was loaded and the item has a field with such name
- (id)fieldValueWithName:(NSString *)fieldName
Parameters
- fieldName
the name of the item’s field name, see [SCField name]
Return Value
SCField object’s value or nil if such field does not exists. See [SCField fieldValue]
Discussion
Returns SCField object’s value( [SCField fieldValue] ) for the given field’s name if such field was loaded and the item has a field with such name
Declared In
SCItem.h
fieldWithName:
Returns SCField object for the given field’s name if such field was loaded and the item has a field with such name
- (SCField *)fieldWithName:(NSString *)fieldName
Parameters
- fieldName
the name of the item’s field name, see [ SCField name ]
Return Value
SCField object or nil if such field does not exists.
Discussion
Returns SCField object for the given field’s name if such field was loaded and the item has a field with such name
Declared In
SCItem.h
isFolder
Checks whether the item has a folder template.
* “SYSTEM/MEDIA/MEDIA FOLDER"
* "COMMON/FOLDER”
- (BOOL)isFolder
Return Value
YES if item’s template is among those listed above.
Discussion
Checks whether the item has a folder template.
* “SYSTEM/MEDIA/MEDIA FOLDER"
* "COMMON/FOLDER”
Declared In
SCItem.h
isImage
Checks whether the item has an image template.
- (BOOL)isImage
Return Value
YES if item’s template is among those listed above.
Discussion
Checks whether the item has an image template.
- “SYSTEM/MEDIA/UNVERSIONED/IMAGE”
- “SYSTEM/MEDIA/UNVERSIONED/JPEG”
- “SYSTEM/MEDIA/VERSIONED/JPEG”
Declared In
SCItem.h
isMediaImage
Checks whether the item is a media image. Such items have image template and is stored in the media folder. See isMediaItem and isImage methods for details.
- (BOOL)isMediaImage
Return Value
YES if the item is a media image.
Discussion
Checks whether the item is a media image. Such items have image template and is stored in the media folder. See isMediaItem and isImage methods for details.
Declared In
SCItem.h
isMediaItem
Checks whether the item is in the media folder.
- (BOOL)isMediaItem
Return Value
YES if the item’s path is within the media folder. By default, it is “/sitecore/Media Library”.
Discussion
Checks whether the item is in the media folder.
Declared In
SCItem.h
mediaPath
Returns a media path of items that have it.
- (NSString *)mediaPath
Discussion
Returns a media path of items that have it.
Declared In
SCItem.h
readChildrenOperation
Used to load all item’s children, see [SCItem allChildren]
- (SCAsyncOp)readChildrenOperation
Return Value
SCAsyncOp block. Call it to get the expected result. The SCAsyncOpResult handler’s result is NSArray of SCItem objects or SCApiError if error happens.
Discussion
Used to load all item’s children, see [SCItem allChildren]
Declared In
SCItem.h
readFieldValueOperationForFieldName:
Used to load the field’s value, see [SCField fieldValue] and [SCField readFieldValueOperation]
- (SCAsyncOp)readFieldValueOperationForFieldName:(NSString *)fieldName
Parameters
- fieldName
the name of the item’s field name, see [SCField name]
Return Value
SCAsyncOp block. Call it to get the expected result. The SCAsyncOpResult handler’s result depends on type of SCField, see [SCField readFieldValueOperation] for details.
Discussion
Used to load the field’s value, see [SCField fieldValue] and [SCField readFieldValueOperation]
Declared In
SCItem.h
readFieldsOperationForFieldsNames:
Used to load item’s fields. They can be later accessed using the [SCItem fieldWithName:] method.
- (SCAsyncOp)readFieldsOperationForFieldsNames:(NSSet *)fieldNames
Parameters
- fieldNames
the set of the field’s names which will be read for the item. Each field’s name in the set should be a string.
To read all fields choose nil or the empty set if you don’t need to read any field
Return Value
SCAsyncOp block. Call it to get the expected result. The SCAsyncOpResult handler’s result is NSDictionary of SCField objects by field’s names or SCApiError if error happens.
Discussion
Used to load item’s fields. They can be later accessed using the [SCItem fieldWithName:] method.
Declared In
SCItem.h
readFieldsValuesOperationForFieldsNames:
Used to load the fields and the field’s values of the item, see [SCField fieldValue] and [SCField readFieldValueOperation] for details.
- (SCAsyncOp)readFieldsValuesOperationForFieldsNames:(NSSet *)fieldNames
Parameters
- fieldNames
the set of the field’s names which will be read with the field’s values. Each field’s name of the set should be a string.
To read all fields choose nil or the empty set if you don’t need to read any field
Return Value
SCAsyncOp block. Call it to get the expected result. The SCAsyncOpResult handler’s result is NSDictionary of field’s values by field’s names or SCApiError if error happens.
Discussion
Used to load the fields and the field’s values of the item, see [SCField fieldValue] and [SCField readFieldValueOperation] for details.
Declared In
SCItem.h
recordItemSource
Item source if available. Default settings of the corresponding session otherwise.
- (SCItemSourcePOD *)recordItemSource
Return Value
Item source if available. Default settings of the corresponding session otherwise.
Declared In
SCItem.h
removeItemOperation
Used to remove given item
- (SCAsyncOp)removeItemOperation
Return Value
SCAsyncOp block. Call it to remove item. The SCAsyncOpResult handler’s result is NSNumber object( always equal to “1” ) or SCApiError if error happens.
Discussion
Used to remove given item
Declared In
SCItem.h
saveItemOperation
Used to save all item’s changed fields
- (SCAsyncOp)saveItemOperation
Return Value
SCAsyncOp block. Call it to save item. The SCAsyncOpResult handler’s result is SCItem object or SCApiError if error happens.
Discussion
Used to save all item’s changed fields
Declared In
SCItem.h