Class InternalAccountUpdate.Builder

  • Enclosing class:
    InternalAccountUpdate

    public abstract static class InternalAccountUpdate.Builder
    extends Object
    Class to build an account update.

    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 InternalAccountUpdate.Builder.WrapperThatConvertsNullStringArgsToEmptyStrings wrapper, see InternalAccountUpdate.builder()).

    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • setFullName

        public abstract InternalAccountUpdate.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 InternalAccountUpdate.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 InternalAccountUpdate.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 InternalAccountUpdate.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 InternalAccountUpdate.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 InternalAccountUpdate.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 InternalAccountUpdate.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 InternalAccountUpdate.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 InternalAccountUpdate.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 InternalAccountUpdate.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 InternalAccountUpdate.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 InternalAccountUpdate.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
      • updateProjectWatch

        public InternalAccountUpdate.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 InternalAccountUpdate.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
      • setGeneralPreferences

        public abstract InternalAccountUpdate.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 InternalAccountUpdate.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 InternalAccountUpdate.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 InternalAccountUpdate build()
        Builds the account update.
        Returns:
        the account update