com.marklogic.xcc

## Class ContentPermission

- java.lang.Object
- - com.marklogic.xcc.ContentPermission

-     public class ContentPermission
      extends java.lang.Object

  An individual `Content` (document) permission, a capability/role pair. Instances of ContentPermission are immutable and may be shared.
  See Also:
    `ContentCapability`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static ContentCapability` | `EXECUTE` Convenience reference to `ContentCapability.EXECUTE`
    `static ContentCapability` | `INSERT` Convenience reference to `ContentCapability.INSERT`
    `static ContentCapability` | `NODE_UPDATE` Convenience reference to `ContentCapability.NODE_UPDATE`
    `static ContentCapability` | `READ` Convenience reference to `ContentCapability.READ`
    `static ContentCapability` | `UPDATE` Convenience reference to `ContentCapability.UPDATE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ContentPermission(ContentCapability capability, java.lang.String role)` Instantiate a new permission object with the given capability and role.
    `ContentPermission(ContentCapability capability, java.lang.String role, java.lang.String roleId)` Instantiate a new permission object with the given capability, role and roleId.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object obj)`
    `ContentCapability` | `getCapability()` Get this permission's capability.
    `java.lang.String` | `getId()` Get the roleId of the role associated with this permission.
    `java.lang.String` | `getRole()` Get the name of the role associated with this permission.
    `int` | `hashCode()`
    `static ContentPermission` | `newExecutePermission(java.lang.String role)` Convenience factory method to create a permission object with execute capability and the given role.
    `static ContentPermission` | `newInsertPermission(java.lang.String role)` Convenience factory method to create a permission object with insert capability and the given role.
    `static ContentPermission` | `newNodeUpdatePermission(java.lang.String role)` Convenience factory method to create a permission object with node-update capability and the given role.
    `static ContentPermission` | `newReadPermission(java.lang.String role)` Convenience factory method to create a permission object with read capability and the given role.
    `static ContentPermission` | `newUpdatePermission(java.lang.String role)` Convenience factory method to create a permission object with update capability and the given role.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### READ

          public static final ContentCapability READ

      Convenience reference to `ContentCapability.READ`

    - #### INSERT

          public static final ContentCapability INSERT

      Convenience reference to `ContentCapability.INSERT`

    - #### UPDATE

          public static final ContentCapability UPDATE

      Convenience reference to `ContentCapability.UPDATE`

    - #### EXECUTE

          public static final ContentCapability EXECUTE

      Convenience reference to `ContentCapability.EXECUTE`

    - #### NODE_UPDATE

          public static final ContentCapability NODE_UPDATE

      Convenience reference to `ContentCapability.NODE_UPDATE`

  - ### Constructor Detail

    - #### ContentPermission

          public ContentPermission(ContentCapability capability,
                                   java.lang.String role)

      Instantiate a new permission object with the given capability and role.
      Parameters:
        `capability` - One of the capabilities defined in the typesafe enumeration class `ContentCapability`
        `role` - A Role name.

    - #### ContentPermission

          public ContentPermission(ContentCapability capability,
                                   java.lang.String role,
                                   java.lang.String roleId)

      Instantiate a new permission object with the given capability, role and roleId.
      Parameters:
        `capability` - One of the capabilities defined in the typesafe enumeration class `ContentCapability`
        `role` - A Role name.
        `roleId` - A Role Id.

  - ### Method Detail

    - #### newReadPermission

          public static ContentPermission newReadPermission(java.lang.String role)

      Convenience factory method to create a permission object with read capability and the given role.
      Parameters:
        `role` - A Role name
      Returns:
        A new, immutable ContentPermission instance.

    - #### newInsertPermission

          public static ContentPermission newInsertPermission(java.lang.String role)

      Convenience factory method to create a permission object with insert capability and the given role.
      Parameters:
        `role` - A Role name
      Returns:
        A new, immutable ContentPermission instance.

    - #### newUpdatePermission

          public static ContentPermission newUpdatePermission(java.lang.String role)

      Convenience factory method to create a permission object with update capability and the given role.
      Parameters:
        `role` - A Role name
      Returns:
        A new, immutable ContentPermission instance.

    - #### newExecutePermission

          public static ContentPermission newExecutePermission(java.lang.String role)

      Convenience factory method to create a permission object with execute capability and the given role.
      Parameters:
        `role` - A Role name
      Returns:
        A new, immutable ContentPermission instance.

    - #### newNodeUpdatePermission

          public static ContentPermission newNodeUpdatePermission(java.lang.String role)

      Convenience factory method to create a permission object with node-update capability and the given role.
      Parameters:
        `role` - A Role name
      Returns:
        A new, immutable ContentPermission instance.

    - #### getCapability

          public ContentCapability getCapability()

      Get this permission's capability.
      Returns:
        A member of the `ContentCapability` enumeration.

    - #### getRole

          public java.lang.String getRole()

      Get the name of the role associated with this permission.
      Returns:
        The role name as a String.

    - #### getId

          public java.lang.String getId()

      Get the roleId of the role associated with this permission.
      Returns:
        The role id as a String.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

Copyright © 2025 MarkLogic Corporation

Complete online documentation for MarkLogic Server, XQuery and related components may be found at docs.progress.com