Class UserGroup

Object
DomainObject
PersistedObject
PartitionedObject
NamedObject
UserGroup
All Implemented Interfaces:
JobNameProvider

@Entity public class UserGroup extends NamedObject
A User Group (type code UG) is a named group that Users and Business Roles can be assigned to. Find it with api.find("UG", Filter.equal("uniqueName", "Sales")). A User belongs to a group directly (see User.getGroups()) or through a Business Role (see User.getAllGroups()).

Objects such as Price Lists and Company Parameters tables store a User Group's unique name as plain text in their userGroupEdit and userGroupViewDetails fields. These fields restrict edit and view-details access to members of the group. A field can hold several group names separated by commas, so a unique name cannot contain a comma.

  • Nested Class Summary

    Nested classes/interfaces inherited from class PersistedObject

    PersistedObject.BatchDelete, PersistedObject.BulkloadFilterCheckCallback, PersistedObject.ComputedFieldMapping, PersistedObject.ComputedFields, PersistedObject.HardDelete, PersistedObject.ImportManagerEnabled, PersistedObject.PersistedObjectMeta, PersistedObject.VirtualField, PersistedObject.VirtualFieldMapping, PersistedObject.VirtualFields, PersistedObject.VirtualSearchFields, PersistedObject.VirtualSortFields
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     

    Fields inherited from class NamedObject

    FIELD_LABEL, FIELD_UNIQUENAME, MAX_NAMED_FIELD_LENGTH

    Fields inherited from class PartitionedObject

    FIELD_PARTITION, FIELD_PARTITIONID, PARTITION_FILTER_NAME, PARTITION_FILTER_PARAM

    Fields inherited from class PersistedObject

    FIELD_CREATEDATE, FIELD_CREATEDBY, FIELD_DELETEDATE, FIELD_DELETEDBY, FIELD_ID, FIELD_ISDELETED, FIELD_LASTUPDATEBY, FIELD_LASTUPDATEDATE, FIELD_VERSION
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an empty User Group.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    auditOperation(AuditOperation operation, User byUser, CommandContext context, PersistedObjectService objService, String details)
    Records a security-relevant operation performed on this User Group (for example CREATE, UPDATE or DELETE) as a SecurityAuditTrail entry.
    Returns the first of four general-purpose extension fields on this User Group, with no built-in meaning.
    Returns the second of four general-purpose extension fields on this User Group, with no built-in meaning.
    Returns the third of four general-purpose extension fields on this User Group, with no built-in meaning.
    Returns the fourth of four general-purpose extension fields on this User Group, with no built-in meaning.
    boolean
    Returns true, so the server records a security audit entry when a User Group is created, updated or deleted through the standard data commands (see auditOperation(AuditOperation, User, CommandContext, PersistedObjectService, String)).
    void
    onDelete(PersistedObjectService pos, boolean hardDelete)
    Removes references to this User Group when it is deleted.
    void
    setAdditionalInfo1(BigDecimal additionalInfo1)
    Sets the first of four general-purpose extension fields on this User Group.
    void
    setAdditionalInfo2(BigDecimal additionalInfo2)
    Sets the second of four general-purpose extension fields on this User Group.
    void
    setAdditionalInfo3(String additionalInfo3)
    Sets the third of four general-purpose extension fields on this User Group.
    void
    setAdditionalInfo4(String additionalInfo4)
    Sets the fourth of four general-purpose extension fields on this User Group.
    boolean
    validate(ValidationVisitor validationVisitor, PersistedObjectService objService)
    Validates that this User Group's unique name does not contain a comma (its unique name is also used as a plain string, sometimes in a comma-separated list, on UserGroupRestrictedObject entities), and that getAdditionalInfo3() and getAdditionalInfo4() are at most 255 characters, in addition to the superclass's own validation.

    Methods inherited from class NamedObject

    equals, getJobName, getLabel, getLabelOrUniqueName, getSignificantFields, getUniqueName, hashCode, labelValid, setLabel, setUniqueName, toString, truncateToMaxLength, uniqueNameValid

    Methods inherited from class PartitionedObject

    addUniqueConstraint, getLoginNameByUserId, getPartition, setPartition

    Methods inherited from class PersistedObject

    bumpVersion, canAdd, canDelete, canEdit, canEdit, canRead, canReadElements, createDate, entityIsHardDeleted, entityIsMassDeletable, entityIsSafeInserted, entityIsSafeInserted, getBulkloadMap, getBusinessKey, getCreateDate, getCreatedBy, getDbColumnNameForField, getDeleteDate, getDeletedBy, getId, getLastUpdateBy, getLastUpdateDate, getSensitiveFields, getTypeCode, getTypedId, getVersion, getVirtualSearchFieldMappings, getVirtualSortFieldMappings, isDeleted, isHardDeleted, isVirtualSearchField, lastUpdateDate, notifyOnBusinessKeyChange, onBusinessKeyChange, onRefreshed, onSavedOrUpdated, onSaveOrUpdate, setCreateDate, setCreateDateShouldBeIgnored, setCreateDateTime, setCreatedBy, setDeleted, setDeleteDate, setDeletedBy, setId, setLastUpdateBy, setLastUpdateDate, setLastUpdateDateTime, setTypedId, setVersion, userGroupEditBulkloadFilter, userGroupEditBulkloadFilter

    Methods inherited from class DomainObject

    deepCopy, getNewMidnightDate, getNewMidnightDateTime, isMidnight, isMidnight, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonSerialize, jsonSerialize, jsonSerialize, jsonSerialize, jsonSerialize, jsonSerialize, jsonSerializedSizeOK, jsonSerializeToBytes, jsonSerializeToBytes, setToDayEnd, setToDayEnd, setToMidnight, setToMidnight, setToMidnightAsLocalDateTime, toPropertyMap, truncatedToString

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • UserGroup

      public UserGroup()
      Creates an empty User Group.
  • Method Details

    • getAdditionalInfo1

      public BigDecimal getAdditionalInfo1()
      Returns the first of four general-purpose extension fields on this User Group, with no built-in meaning.
      Returns:
      the first extension field's value
    • setAdditionalInfo1

      public void setAdditionalInfo1(BigDecimal additionalInfo1)
      Sets the first of four general-purpose extension fields on this User Group.
      Parameters:
      additionalInfo1 - the first extension field's value
    • getAdditionalInfo2

      public BigDecimal getAdditionalInfo2()
      Returns the second of four general-purpose extension fields on this User Group, with no built-in meaning.
      Returns:
      the second extension field's value
    • setAdditionalInfo2

      public void setAdditionalInfo2(BigDecimal additionalInfo2)
      Sets the second of four general-purpose extension fields on this User Group.
      Parameters:
      additionalInfo2 - the second extension field's value
    • getAdditionalInfo3

      public String getAdditionalInfo3()
      Returns the third of four general-purpose extension fields on this User Group, with no built-in meaning. Limited to 255 characters (see validate(ValidationVisitor, PersistedObjectService)).
      Returns:
      the third extension field's value
    • setAdditionalInfo3

      public void setAdditionalInfo3(String additionalInfo3)
      Sets the third of four general-purpose extension fields on this User Group.
      Parameters:
      additionalInfo3 - the third extension field's value
    • getAdditionalInfo4

      public String getAdditionalInfo4()
      Returns the fourth of four general-purpose extension fields on this User Group, with no built-in meaning. Limited to 255 characters (see validate(ValidationVisitor, PersistedObjectService)).
      Returns:
      the fourth extension field's value
    • setAdditionalInfo4

      public void setAdditionalInfo4(String additionalInfo4)
      Sets the fourth of four general-purpose extension fields on this User Group.
      Parameters:
      additionalInfo4 - the fourth extension field's value
    • auditOperation

      public void auditOperation(AuditOperation operation, User byUser, CommandContext context, PersistedObjectService objService, String details)
      Records a security-relevant operation performed on this User Group (for example CREATE, UPDATE or DELETE) as a SecurityAuditTrail entry.
      Overrides:
      auditOperation in class PersistedObject
      Parameters:
      operation - the operation performed
      byUser - the user who performed it
      context - the request context the operation was performed in
      objService - used to persist the audit trail entry
      details - additional details about the operation
    • isAudited

      public boolean isAudited()
      Returns true, so the server records a security audit entry when a User Group is created, updated or deleted through the standard data commands (see auditOperation(AuditOperation, User, CommandContext, PersistedObjectService, String)).
      Overrides:
      isAudited in class PersistedObject
      Returns:
      always true
    • validate

      public boolean validate(ValidationVisitor validationVisitor, PersistedObjectService objService)
      Validates that this User Group's unique name does not contain a comma (its unique name is also used as a plain string, sometimes in a comma-separated list, on UserGroupRestrictedObject entities), and that getAdditionalInfo3() and getAdditionalInfo4() are at most 255 characters, in addition to the superclass's own validation. Records a validation error for the first problem found.
      Overrides:
      validate in class NamedObject
      Parameters:
      validationVisitor - collects validation errors; may be null
      objService - used by the superclass's own validation
      Returns:
      true if the unique name and extension fields are valid and the superclass validation also passed; false otherwise
    • onDelete

      public void onDelete(PersistedObjectService pos, boolean hardDelete)
      Removes references to this User Group when it is deleted. It removes the group from every User and Business Role and clears its unique name from the userGroupEdit and userGroupViewDetails fields of restricted objects in the current partition. It also deletes the Datamart data entitlements that reference the group. Fields that hold several comma-separated group names are not cleared, and read-only database views are skipped.

      When an already soft-deleted User Group is hard-deleted, only its Datamart data entitlements are removed.

      Overrides:
      onDelete in class PersistedObject
      Parameters:
      pos - used to perform the cleanup
      hardDelete - whether this is a hard (permanent) delete rather than a soft delete