Class WeblinkUtil

java.lang.Object
com.saperion.util.WeblinkUtil

public class WeblinkUtil extends Object
The Class WeblinkUtil.
  • Field Details

  • Constructor Details

    • WeblinkUtil

      public WeblinkUtil()
  • Method Details

    • validate

      public static boolean validate(String url, String hash, long timestamp)
      Validates the given URL.
      Parameters:
      url - the url for validation
      hash - the hash for validation
      timestamp - the timestamp for validation
      Returns:
      true, if validation was successful
    • weblink

      public static String weblink(String archive, String field, String id, int element, String filename, boolean published)
      generates a Weblink with the given paramters. Format is "/weblink/{archive}/{field}/{id}/{element}/{filename}?released={published}"
      Parameters:
      archive - the archive
      field - the field
      id - the id
      element - the element
      filename - the filename
      published - the published
      Returns:
      the string
    • secureWeblink

      public static String secureWeblink(String archive, String field, String id, int element, String filename, boolean published) throws LinkCreationException
      Generates Secure weblink. Format is "/weblink/{archive}/{field}/{id}/{element}/{filename}?released={published}&secure=[hash]"
      Parameters:
      archive - the archive
      field - the field
      id - the id
      element - the element
      filename - the filename
      published - the published
      Returns:
      the Weblink as string
      Throws:
      LinkCreationException - the link creation exception
    • secureWeblink

      public static String secureWeblink(String archive, String field, String id, int element, String filename, boolean published, boolean currentRevision, String mandant, boolean extern, Long timeout) throws LinkCreationException
      Generates Secure weblink. Format is "/weblink/{archive}/{field}/{id}/{element}/{filename}?released={published}&mandant={mandant}&currentRevision={currentRevision}&released={released}&extern={extern}&timeout={timeout}&secure=[hash]"
      Parameter mandant, currentRevision, released, extern, timeout or only set in the URL when parameter is set or true.
      Parameters:
      archive - the archive/DDC
      field - the DDC field
      id - the searched id of DDC field
      element - the element of the document
      filename - the filename
      published - true if only released version should be provided
      currentRevision - set to true for current revision
      mandant - the mandant
      extern - link for external user
      timeout - the expiration time in milliseconds.
      Returns:
      the Weblink as string
      Throws:
      LinkCreationException - the link creation exception
    • secureURL

      public static String secureURL(List<String> pathSegments, Map<String,String> queryParameter) throws LinkCreationException
      Generates a secure URL. Adds secure hash as parameter at the end of the URL.
      Parameters:
      pathSegments - the path segments
      queryParameter - the query parameter
      Returns:
      the URL as string
      Throws:
      LinkCreationException - if link creation failed
    • url

      public static String url(List<String> pathSegments, Map<String,String> queryParameter)
      Creates the URL for the given pathSegments and queryParameters.
      Parameters:
      pathSegments - the path segments
      queryParameter - the query parameter
      Returns:
      the created URL as string
    • secureBookmark

      public static String secureBookmark(List<String> pathSegments, Map<String,String> queryParameter) throws LinkCreationException
      Generates a secure Bookmark. Adds secure hash as parameter at the end of the Bookmark.
      Parameters:
      pathSegments - the path segments
      queryParameter - the query parameter
      Returns:
      the bookmark as string
      Throws:
      LinkCreationException - if link creation failed
    • bookmark

      public static String bookmark(List<String> pathSegments, Map<String,String> queryParameter)
      Creates the Bookmark for the given pathSegments and queryParameters.
      Parameters:
      pathSegments - the path segments
      queryParameter - the query parameter
      Returns:
      the created Bookmark as string
    • hash

      public static String hash(String url) throws LinkCreationException
      Generates Hash. Computes the crypted hash for given url with internal .
      Parameters:
      url - the url to generate hash.
      Returns:
      the computed hash as string
      Throws:
      LinkCreationException - the link creation exception