AGSAttachmentManager Class Reference


Description

Instances of this class represent a light-weight and coarse-grained object for managing attachments of a particular feature in a feature layer. This object allows the user to make changes on the client regarding the attachments collection for a feature and then later on either cancel these edits or sync (post) the changes to the server. You can get a handle to an attachment manager for a feature using the attachmentManagerForFeature: (AGSFeatureLayer) method.

See also:
Conceptual Doc: Working with the Attachment Manager
Sample: Feature Layer Editing
Since:
2.0
Inheritance diagram for AGSAttachmentManager:
<AGSFeatureLayerEditingDelegate>

List of all members.

Public Member Functions

(AGSAttachment *) - addAttachmentAsJpgWithImage:name:
(AGSAttachment *) - addAttachmentWithData:name:contentType:
(AGSAttachment *) - addAttachmentWithUIImagePickerControllerInfoDictionary:
(AGSAttachment *) - attachmentForId:
(void) - cancelAllDownloadDataOperations
(void) - cancelDownloadAttachmentInfos
(void) - cancelDownloadDataForId:
(void) - cancelLocalEdits
(void) - cancelPostLocalEditsToServer
(void) - downloadAttachmentDataForId:
(void) - downloadAttachmentInfos
(void) - featureLayer:operation:didAttachmentEditsWithResults:
(void) - featureLayer:operation:didFailAttachmentEditsWithError:
(void) - featureLayer:operation:didFailFeatureEditsWithError:
(void) - featureLayer:operation:didFailQueryAttachmentInfosWithError:
(void) - featureLayer:operation:didFailRetrieveAttachmentWithError:
(void) - featureLayer:operation:didFeatureEditsWithResults:
(void) - featureLayer:operation:didQueryAttachmentInfosWithResults:
(void) - featureLayer:operation:didRetrieveAttachmentWithData:
(BOOL) - hasLocalEdits
(void) - markAttachment:forDeletion:
(void) - postLocalEditsToServer

Properties

NSArray * attachments
id< AGSAttachmentManagerDelegatedelegate
NSError * downloadAttachmentInfosError
AGSFeatureLayerfeatureLayer
NSInteger featureObjectId
BOOL postingLocalEdits

Member Function Documentation

- (AGSAttachment*) addAttachmentAsJpgWithImage: (UIImage *)  image
name: (NSString *)  name 

Adds an attachment. Does not upload it to the server until postLocalEditsToServer is called. The image will be converted to jpg. If you want to preserve your image type then use addAttachmentWithData:name:contentType:

Parameters:
image to add as an attachment
name of the attachment
Since:
2.0
- (AGSAttachment*) addAttachmentWithData: (NSData *)  data
name: (NSString *)  name
contentType: (NSString *)  contentType 

Adds an attachment. Does not upload it to the server until postLocalEditsToServer is called.

Parameters:
data The raw binary data of the attachment
name The name to be given to the attachment
contentType The MIME type of the data. For eg image/png
Since:
2.0
- (AGSAttachment*) addAttachmentWithUIImagePickerControllerInfoDictionary: (NSDictionary *)  info  

Adds an attachment. Does not upload it to the server until postLocalEditsToServer is called.

Parameters:
info The dictionary provided by UIImagePickerController
Since:
2.0
- (AGSAttachment*) attachmentForId: (NSInteger)  attachmentId  

Finds the attachment for a particular attachment id.

Since:
2.0
- (void) cancelAllDownloadDataOperations  

Cancels all download data operations that may be in progress or outstanding.

Since:
2.0
- (void) cancelDownloadAttachmentInfos  

Cancels the operation that is downloading the attachment metadata.

Since:
2.0
- (void) cancelDownloadDataForId: (NSInteger)  attachmentId  

Cancels downloading data for a particular attachment.

Since:
2.0
- (void) cancelLocalEdits  

Cancels all local edits.

Since:
2.0
- (void) cancelPostLocalEditsToServer  

Cancels the operations that are posting local edits to the server. It is possible that some operations may already be done, only the outstanding ones will be cancelled.

Since:
2.0
- (void) downloadAttachmentDataForId: (NSInteger)  attachmentId  

Kicks off an asynchronous operation to download the attachment data for an attachment with a particular id. This operation can be cancelled with the cancelDownloadDataForId: method. The delegate will be informed when this operation is completed.

Parameters:
attachmentId ID of the attachment for which to download the data
Since:
2.0
- (void) downloadAttachmentInfos  

Kicks off an asynchronous operation to download the attachment metadata for the feature that this attachment manager is associated with. This operation can be cancelled with the cancelDownloadAttachmentInfos method. The delegate will be informed when this operation is completed.

Since:
2.0
- (void) featureLayer: (AGSFeatureLayer *)  featureLayer
operation: (NSOperation *)  op
didAttachmentEditsWithResults: (AGSFeatureLayerAttachmentResults *)  attachmentResults 
[optional, inherited]

Tells the delegate that AGSFeatureLayer successfully completed making the attachment edits (adds, updates, or deletes). It is possible that a subset of the edits failed. You should inspect the provided AGSFeatureLayerAttachmentResults object to find out which edits (if any) failed.

Parameters:
featureLayer Feature Layer on which the attachment edit operation was executed.
op The operation that is performing the server request.
attachmentResults Results returned by the attachment edit operation.
Since:
1.0
- (void) featureLayer: (AGSFeatureLayer *)  featureLayer
operation: (NSOperation *)  op
didFailAttachmentEditsWithError: (NSError *)  error 
[optional, inherited]

Tells the delegate that AGSFeatureLayer encountered an error while making the attachment edits (adds, updates, or deletes).

Parameters:
featureLayer Feature Layer on which the attachment edit operation was executed.
op The operation that is performing the server request.
error Information returned by the attachment edit operation.
Since:
1.0
- (void) featureLayer: (AGSFeatureLayer *)  featureLayer
operation: (NSOperation *)  op
didFailFeatureEditsWithError: (NSError *)  error 
[optional, inherited]

Tells the delegate that AGSFeatureLayer encountered an error while making the feature edits (adds, updates, or deletes).

Parameters:
featureLayer Feature Layer on which the feature edit operation was executed.
op The operation that is performing the server request.
error Information returned by the feature edit operation.
Since:
1.0
- (void) featureLayer: (AGSFeatureLayer *)  featureLayer
operation: (NSOperation *)  op
didFailQueryAttachmentInfosWithError: (NSError *)  error 
[optional, inherited]

Tells the delegate that AGSFeatureLayer encountered an error while querying attachment metadata.

Parameters:
featureLayer Feature Layer on which the query attachment infos operation was executed.
op The operation that is performing the server request.
error Information returned by the query attachment infos operation.
Since:
1.0
- (void) featureLayer: (AGSFeatureLayer *)  featureLayer
operation: (NSOperation *)  op
didFailRetrieveAttachmentWithError: (NSError *)  error 
[optional, inherited]

Tells the delegate that AGSFeatureLayer encountered an error while querying the actual attachment data.

Parameters:
featureLayer Feature Layer on which the retrieve attachment operation was executed.
op The operation that is performing the server request.
error Information returned by the retrieve attachment operation.
Since:
1.0
- (void) featureLayer: (AGSFeatureLayer *)  featureLayer
operation: (NSOperation *)  op
didFeatureEditsWithResults: (AGSFeatureLayerEditResults *)  editResults 
[optional, inherited]

Tells the delegate that AGSFeatureLayer successfully completed making the feature edits (adds, updates, or deletes). It is possible that a subset of the edits failed. You should inspect the provided AGSFeatureLayerEditResults object to find out which edits (if any) failed.

Parameters:
featureLayer Feature Layer on which the feature edit operation was executed.
op The operation that is performing the server request.
editResults Results returned by the feature edit operation.
Since:
1.0
- (void) featureLayer: (AGSFeatureLayer *)  featureLayer
operation: (NSOperation *)  op
didQueryAttachmentInfosWithResults: (NSArray *)  attachmentInfos 
[optional, inherited]

Tells the delegate that AGSFeatureLayer successfully completed querying attachment metadata.

Parameters:
featureLayer Feature Layer on which the query attachment infos operation was executed.
op The operation that is performing the server request.
attachmentInfos Array of AGSAttachmentInfo objects returned by the query.
Since:
1.0
- (void) featureLayer: (AGSFeatureLayer *)  featureLayer
operation: (NSOperation *)  op
didRetrieveAttachmentWithData: (NSData *)  attachmentData 
[optional, inherited]

Tells the delegate that AGSFeatureLayer successfully completed querying the actual attachment data.

Parameters:
featureLayer Feature Layer on which the retrieve attachment operation was executed.
op The operation that is performing the server request.
attachmentData The raw NSData object associated with the attachment.
Since:
1.0
- (BOOL) hasLocalEdits  

Indidcates whether the attachment manager contain any local edits on the client (i.e if any attachments have been added, or deleted).

Since:
2.0
- (void) markAttachment: (AGSAttachment *)  attachment
forDeletion: (BOOL)  del 

Marks an attachment for deletion. Does not actually delete it from the server until postLocalEditsToServer is called.

Parameters:
attachment which must be marked for deletion
del whether to mark or unmark the attachment for deletion
Since:
2.0
- (void) postLocalEditsToServer  

Kicks off the asynchronous operations required to sync local edits contained in this attachment manager with the server. This operation can be cancelled with the cancelPostLocalEditsToServer method. The delegate will be informed when this operation is completed.

Since:
2.0

Property Documentation

- (NSArray*) attachments [read, retain]

The attachments belonging to the feature that this attachment manager is associated with.

Since:
2.0
- (id<AGSAttachmentManagerDelegate>) delegate [read, write, assign]

The delegate that is notified when operations complete.

Since:
2.0
- (NSError*) downloadAttachmentInfosError [read, retain]

The error, if any, that occurred when attempting to download attachment metadata.

Since:
2.0
- (AGSFeatureLayer*) featureLayer [read, assign]

The feature layer that this attachment manager is associated with.

Since:
2.0
- (NSInteger) featureObjectId [read, assign]

The object id of the feature that this attachment manager is associated with.

Since:
2.0
- (BOOL) postingLocalEdits [read, assign]

Indicates whether or not the attachment manager is currently posting local edits to the remote server.

Since:
2.0