Class WeblinkHandler

java.lang.Object
com.saperion.ngc.portal.builder.weblink.WeblinkHandler
All Implemented Interfaces:
ElementBuilder, LinkBuilder, NamedBuilder, OptionsBuilder, WithBuilder

public class WeblinkHandler extends Object implements WithBuilder, ElementBuilder, NamedBuilder, OptionsBuilder
The Class WeblinkHandler. Fluent API to create Weblink URL.
  • Constructor Details

    • WeblinkHandler

      public WeblinkHandler()
  • Method Details

    • from

      public static WithBuilder from(String archive)
      Static Weblink constructor.
      Parameters:
      archive - the archive / DDC of document
      Returns:
      the with builder
    • with

      public static ElementBuilder with(ResultProperties document) throws com.saperion.util.LinkCreationException
      Static Weblink constructor. Uses the given ResultProperties to set the parameters filename, archive, id and field. Field is set to SYSROWID.
      Parameters:
      document - the document properties see ResultProperties.
      Returns:
      the element builder to add options see ElementBuilder
      Throws:
      com.saperion.util.LinkCreationException - the link creation exception if link creation fails
    • with

      public static ElementBuilder with(DocumentId documentId, jakarta.servlet.http.HttpServletRequest request) throws com.saperion.util.LinkCreationException
      Static Weblink constructor used by SAP Viewer. Field is set to SYSROWID.
      Parameters:
      documentId - the id of the document to send
      request - current request to get session
      Returns:
      the element builder to add options see ElementBuilder
      Throws:
      com.saperion.util.LinkCreationException - the link creation exception if link creation fails
    • with

      public NamedBuilder with(String field, String value)
      With. Option to add value of field.
      Specified by:
      with in interface WithBuilder
      Parameters:
      field - the field
      value - the value
      Returns:
      the element builder
      See Also:
    • only

      public OptionsBuilder only(int element)
      Only. Option to add if only one specific element of document should be downloaded.
      Specified by:
      only in interface ElementBuilder
      Parameters:
      element - the element
      Returns:
      the named builder
      See Also:
    • all

      public OptionsBuilder all()
      All. Option to add if all elements of document should be downloaded as a zip file.
      Specified by:
      all in interface ElementBuilder
      Returns:
      the named builder
      See Also:
    • named

      public ElementBuilder named(String filename)
      Named. To add if Weblink download should have a filename.
      Specified by:
      named in interface NamedBuilder
      Parameters:
      filename - the filename of downloaded file
      Returns:
      the options builder
      See Also:
    • mandant

      public OptionsBuilder mandant(String mandant)
      Mandant.
      Specified by:
      mandant in interface OptionsBuilder
      Parameters:
      mandant - the mandant
      Returns:
      the options builder
    • published

      public OptionsBuilder published()
      Published. Option to add if last released document should be shown.
      Specified by:
      published in interface OptionsBuilder
      Returns:
      the options builder
      See Also:
    • latest

      public OptionsBuilder latest()
      Latest. Option to add current revision of document should be shown.
      Specified by:
      latest in interface OptionsBuilder
      Returns:
      the options builder
      See Also:
    • external

      public OptionsBuilder external()
      External. Option to add if link should be usable for extern users.
      Specified by:
      external in interface OptionsBuilder
      Returns:
      the options builder
      See Also:
    • timeout

      public OptionsBuilder timeout(long timeout)
      Timeout. Option to add if link should have a timeout. After timeout milliseconds the link is no more valid.
      Specified by:
      timeout in interface OptionsBuilder
      Parameters:
      timeout - the timeout in milliseconds after the link is invalid
      Returns:
      the options builder
      See Also:
    • toLink

      public String toLink(String baseURL) throws com.saperion.util.LinkCreationException
      To link. Builds the weblink url with given baseURL.
      Specified by:
      toLink in interface LinkBuilder
      Parameters:
      baseURL - the base url
      Returns:
      the string
      Throws:
      com.saperion.util.LinkCreationException - the link creation exception
      See Also:
    • open

      public void open(String baseURL)
      Open.
      Specified by:
      open in interface LinkBuilder
      Parameters:
      baseURL - the base url
      See Also:
    • copy

      public void copy(String baseURL)
      Copy.
      Specified by:
      copy in interface LinkBuilder
      Parameters:
      baseURL - the base url
      See Also:
    • main

      public static void main(String[] args) throws com.saperion.util.LinkCreationException
      The main method.
      Parameters:
      args - the arguments
      Throws:
      com.saperion.util.LinkCreationException - the link creation exception