Class AccountDelta.Builder

  • Enclosing class:
    AccountDelta

    public abstract static class AccountDelta.Builder
    extends Object
    Class to build an AccountDelta.

    Account data is only updated if the corresponding setter is invoked. If a setter is not invoked the corresponding data stays unchanged. To unset string values the setter can be invoked with either null or an empty string (null is converted to an empty string by using the AccountDelta.Builder.WrapperThatConvertsNullStringArgsToEmptyStrings wrapper, see AccountDelta.builder()).

    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • setFullName

        public abstract AccountDelta.Builder setFullName​(String fullName)
        Sets a new full name for the account.
        Parameters:
        fullName - the new full name, if null or empty string the full name is unset
      • setDisplayName

        public abstract AccountDelta.Builder setDisplayName​(String displayName)
        Sets a new display name for the account.
        Parameters:
        displayName - the new display name, if null or empty string the display name is unset
      • setPreferredEmail

        public abstract AccountDelta.Builder setPreferredEmail​(String preferredEmail)
        Sets a new preferred email for the account.
        Parameters:
        preferredEmail - the new preferred email, if null or empty string the preferred email is unset
      • setActive

        public abstract AccountDelta.Builder setActive​(boolean active)
        Sets the active flag for the account.
        Parameters:
        active - true if the account should be set to active, false if the account should be set to inactive
      • setStatus

        public abstract AccountDelta.Builder setStatus​(String status)
        Sets a new status for the account.
        Parameters:
        status - the new status, if null or empty string the status is unset
      • addExternalId

        public AccountDelta.Builder addExternalId​(ExternalId extId)
        Adds a new external ID for the account.

        The account ID of the external ID must match the account ID of the account that is updated.

        If an external ID with the same ID already exists the account update will fail with DuplicateExternalIdKeyException.

        Parameters:
        extId - external ID that should be added
        Returns:
        the builder
      • addExternalIds

        public AccountDelta.Builder addExternalIds​(Collection<ExternalId> extIds)
        Adds new external IDs for the account.

        The account IDs of the external IDs must match the account ID of the account that is updated.

        If any of the external ID keys already exists, the insert fails with DuplicateExternalIdKeyException.

        Parameters:
        extIds - external IDs that should be added
        Returns:
        the builder
      • updateExternalId

        public AccountDelta.Builder updateExternalId​(ExternalId extId)
        Updates an external ID for the account.

        The account ID of the external ID must match the account ID of the account that is updated.

        If no external ID with the ID exists the external ID is created.

        Parameters:
        extId - external ID that should be updated
        Returns:
        the builder
      • updateExternalIds

        public AccountDelta.Builder updateExternalIds​(Collection<ExternalId> extIds)
        Updates external IDs for the account.

        The account IDs of the external IDs must match the account ID of the account that is updated.

        If any of the external IDs already exists, it is overwritten. New external IDs are inserted.

        Parameters:
        extIds - external IDs that should be updated
        Returns:
        the builder
      • deleteExternalId

        public AccountDelta.Builder deleteExternalId​(ExternalId extId)
        Deletes an external ID for the account.

        The account ID of the external ID must match the account ID of the account that is updated.

        If no external ID with the ID exists this is a no-op.

        Parameters:
        extId - external ID that should be deleted
        Returns:
        the builder
      • deleteExternalIds

        public AccountDelta.Builder deleteExternalIds​(Collection<ExternalId> extIds)
        Deletes external IDs for the account.

        The account IDs of the external IDs must match the account ID of the account that is updated.

        For non-existing external IDs this is a no-op.

        Parameters:
        extIds - external IDs that should be deleted
        Returns:
        the builder
      • replaceExternalId

        public AccountDelta.Builder replaceExternalId​(ExternalId extIdToDelete,
                                                      ExternalId extIdToAdd)
        Replaces an external ID.
        Parameters:
        extIdToDelete - external ID that should be deleted
        extIdToAdd - external ID that should be added
        Returns:
        the builder
      • replaceExternalIds

        public AccountDelta.Builder replaceExternalIds​(Collection<ExternalId> extIdsToDelete,
                                                       Collection<ExternalId> extIdsToAdd)
        Replaces an external IDs.
        Parameters:
        extIdsToDelete - external IDs that should be deleted
        extIdsToAdd - external IDs that should be added
        Returns:
        the builder
      • updateProjectWatch

        public AccountDelta.Builder updateProjectWatch​(ProjectWatches.ProjectWatchKey projectWatchKey,
                                                       Set<NotifyConfig.NotifyType> notifyTypes)
        Updates a project watch for the account.

        If no project watch with the key exists the project watch is created.

        Parameters:
        projectWatchKey - key of the project watch that should be updated
        notifyTypes - the notify types that should be set for the project watch
        Returns:
        the builder
      • deleteProjectWatch

        public AccountDelta.Builder deleteProjectWatch​(ProjectWatches.ProjectWatchKey projectWatch)
        Deletes a project watch for the account.

        If no project watch with the ID exists this is a no-op.

        Parameters:
        projectWatch - project watch that should be deleted
        Returns:
        the builder
      • deleteProjectWatches

        public AccountDelta.Builder deleteProjectWatches​(Collection<ProjectWatches.ProjectWatchKey> projectWatches)
        Deletes project watches for the account.

        For non-existing project watches this is a no-op.

        Parameters:
        projectWatches - project watches that should be deleted
        Returns:
        the builder
      • setGeneralPreferences

        public abstract AccountDelta.Builder setGeneralPreferences​(GeneralPreferencesInfo generalPreferences)
        Sets the general preferences for the account.

        Updates any preference that is non-null in the provided GeneralPreferencesInfo.

        Parameters:
        generalPreferences - the general preferences that should be set
        Returns:
        the builder
      • setDiffPreferences

        public abstract AccountDelta.Builder setDiffPreferences​(DiffPreferencesInfo diffPreferences)
        Sets the diff preferences for the account.

        Updates any preference that is non-null in the provided DiffPreferencesInfo.

        Parameters:
        diffPreferences - the diff preferences that should be set
        Returns:
        the builder
      • setEditPreferences

        public abstract AccountDelta.Builder setEditPreferences​(EditPreferencesInfo editPreferences)
        Sets the edit preferences for the account.

        Updates any preference that is non-null in the provided EditPreferencesInfo.

        Parameters:
        editPreferences - the edit preferences that should be set
        Returns:
        the builder
      • build

        public abstract AccountDelta build()
        Builds the instance.