Class CNSaveRequest

  • All Implemented Interfaces:
    NSObject

    public class CNSaveRequest
    extends NSObject
    Specifies the changes to save. Create a new save request for each save execution on the contact store. Can have many changes batched into one save request. Do not access objects in the save request when it is executing. A save request only applies the changes to the objects. If there are overlapping changes with multiple, concurrent CNSaveRequests then the last saved change wins. If adding an object (contact, group, container) and it is already in the contact store then the executing save request will fail to add that object and will return the error CNErrorCodeInsertedRecordAlreadyExists with CNErrorUserInfoAffectedRecordsKey value as an array containing that object. If updating/deleting an object (contact, group, container) and it is not in the contact store then the executing save request will fail to update/delete that object and will return the error CNErrorCodeRecordDoesNotExist with CNErrorUserInfoAffectedRecordsKey value as an array containing that object. API-Since: 9.0
    • Constructor Detail

      • CNSaveRequest

        protected CNSaveRequest​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static CNSaveRequest allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • addContactToContainerWithIdentifier

        public void addContactToContainerWithIdentifier​(@NotNull
                                                        @NotNull CNMutableContact contact,
                                                        @Nullable
                                                        @Nullable java.lang.String identifier)
        Add a new contact to the contact store. The contact may be modified by the executing save request. If the contact was previously specified to be deleted in the save request that will no longer occur.
        Parameters:
        contact - The new contact to add.
        identifier - The container identifier to add the new contact to. Set to nil for the default container.
      • addGroupToContainerWithIdentifier

        public void addGroupToContainerWithIdentifier​(@NotNull
                                                      @NotNull CNMutableGroup group,
                                                      @Nullable
                                                      @Nullable java.lang.String identifier)
        Add a new group to the contact store. If the group was previously specified to be deleted in the save request that will no longer occur.
        Parameters:
        group - The new group to add.
        identifier - The container identifier to add the new group to. Set to nil for the default container.
      • addMemberToGroup

        public void addMemberToGroup​(@NotNull
                                     @NotNull CNContact contact,
                                     @NotNull
                                     @NotNull CNGroup group)
        Add a new member to a group. If the membership was previously specified to be deleted in the save request that will no longer occur.
        Parameters:
        contact - The new member to add to the group.
        group - The group to add the member to.
      • deleteContact

        public void deleteContact​(@NotNull
                                  @NotNull CNMutableContact contact)
        Delete a contact from the contact store. If the contact was previously specified to be added in the save request that will no longer occur.
      • deleteGroup

        public void deleteGroup​(@NotNull
                                @NotNull CNMutableGroup group)
        Delete a group from the contact store. The contacts in the group are not deleted. If the group was previously specified to be added in the save request that will no longer occur.
      • removeMemberFromGroup

        public void removeMemberFromGroup​(@NotNull
                                          @NotNull CNContact contact,
                                          @NotNull
                                          @NotNull CNGroup group)
        Remove a member from a group. The contact is not deleted. It is only removed as a member of the group. If the membership was previously specified to be added in the save request that will no longer occur.
        Parameters:
        contact - The member to remove from the group.
        group - The group to remove the member from.
      • updateContact

        public void updateContact​(@NotNull
                                  @NotNull CNMutableContact contact)
        Update an existing contact in the contact store. The contact must already exist in the contact store. The contact may be modified by the executing save request.
      • updateGroup

        public void updateGroup​(@NotNull
                                @NotNull CNMutableGroup group)
        Update an existing group in the contact store. The group must already exist in the contact store.
      • setTransactionAuthor

        public void setTransactionAuthor​(@Nullable
                                         @Nullable java.lang.String value)
        The author of this transaction. Use this, in conjunction with @c CNChangeHistoryFetchRequest.excludedTransactionAuthors, to suppress fetching of changes the author already knows about. API-Since: 15.0
      • transactionAuthor

        @Nullable
        public @Nullable java.lang.String transactionAuthor()
        The author of this transaction. Use this, in conjunction with @c CNChangeHistoryFetchRequest.excludedTransactionAuthors, to suppress fetching of changes the author already knows about. API-Since: 15.0
      • setShouldRefetchContacts

        public void setShouldRefetchContacts​(boolean value)
        Should the contacts be refetched as part of executing the save request. Default is `YES` where added and updated contacts are refetched by the executing save request. Set to `NO` to suppress this refetch behavior and reduce the execution time of the save request. [@note] If set to `NO` do not use the contacts after the executed save request as they may not be in a current state. API-Since: 15.4
      • shouldRefetchContacts

        public boolean shouldRefetchContacts()
        Should the contacts be refetched as part of executing the save request. Default is `YES` where added and updated contacts are refetched by the executing save request. Set to `NO` to suppress this refetch behavior and reduce the execution time of the save request. [@note] If set to `NO` do not use the contacts after the executed save request as they may not be in a current state. API-Since: 15.4
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.