Class SpaceResourceBuilder

java.lang.Object
com.avoka.tm.svc.SpaceResourceBuilder

public class SpaceResourceBuilder extends Object

Provides a SpaceResource value object builder class.

Examples

Please find the SpaceResource builder examples below.

Create a SpaceResource with space id and path

This example shows how to create a SpaceResource object.

 import com.avoka.tm.svc.*
 import com.avoka.tm.vo.*

 SpaceResource spaceResource = new SpaceResourceBuilder()
                  .setSpaceId(1)
                  .setResourcePath("/resources/css/test.css")
                  .setFileData(new byte[] {123})
                  .create()
 

Update a SpaceResource with space name and path

This example shows how to Update a SpaceResource object.

 import com.avoka.tm.svc.*
 import com.avoka.tm.vo.*

 SpaceResource spaceResource= new SpaceResource()
                  .setSpaceName("workspaces")
                  .setResourcePath("/resources/css/test.css")
                  .setFileData(new byte[] {152})
                  .update()
 

Create or Update a SpaceResource with space id and path

The example below shows how to create or update a SpaceResource object.

 import com.avoka.tm.svc.*
 import com.avoka.tm.vo.*

 SpaceResource spaceResource= new SpaceResource()
                  .setSpaceId(2)
                  .setResourcePath("/resources/css/test.css")
                  .setFileData(new byte[] {156})
                  .createOrUpdate()
 
Since:
24.10.0
  • Constructor Details

    • SpaceResourceBuilder

      @FluentSecurityPermission(permissions={"portal-edit","portal-content-edit","portal-style-edit"}) public SpaceResourceBuilder()
      Create a SpaceResource service object
  • Method Details

    • setSpaceId

      public SpaceResourceBuilder setSpaceId(Long spaceId)
      Set the space id parameter.
      Parameters:
      spaceId - space id
      Returns:
      the Space resource builder
    • setSpaceName

      public SpaceResourceBuilder setSpaceName(String spaceName)
      Set the space name parameter.
      Parameters:
      spaceName - space name
      Returns:
      the Space resource builder
    • setResourcePath

      public SpaceResourceBuilder setResourcePath(String resourcePath)
      Set the resource path parameter.
      Parameters:
      resourcePath - resource path
      Returns:
      the Space resource builder
    • setFileData

      public SpaceResourceBuilder setFileData(byte[] fileData)
      Set the file Data parameter.
      Parameters:
      fileData - file Data
      Returns:
      the Space resource builder
    • create

      public SpaceResource create() throws IllegalAccessException
      Create a new space resource based on the specified parameters and return the new space resource value object.
      Returns:
      the newly created space resource value object
      Throws:
      IllegalAccessException
    • update

      public SpaceResource update() throws IllegalAccessException
      Update the space resource specified by the resource path and space parameter and return the updated space resource value object. This method will throw a IllegalArgumentException if the space resource specified by specified parameters was not found.
      Returns:
      the updated space resource value object
      Throws:
      IllegalAccessException
    • createOrUpdate

      public SpaceResource createOrUpdate() throws IllegalAccessException
      Create or update the space resource specified by the given parameters, and return current space resource value object. If the space resource specified by the resource path and space is not found then a new space resource will be created.
      Returns:
      create or update the space resource specified by the given parameters, and return current space resource value object
      Throws:
      IllegalAccessException