Klasse PsaRstApiUti

java.lang.Object
de.pisa.psa.rst.uti.PsaRstApiUti

public final class PsaRstApiUti extends Object
REST API: utilities
Seit:
20.06.2023
Autor:
weiland
  • Felddetails

  • Methodendetails

    • isIsoDate

      public static boolean isIsoDate(String string)
      check if a string is an ISO date
      Parameter:
      string - string to check
      Gibt zurück:
      true if ISO date format
    • booleanToCubes

      public static String booleanToCubes(String string)
      convert a string into a PisaCubes boolean
      Parameter:
      string - string to convert
      Gibt zurück:
      y, n or an empty string
    • dateFromCubes

      public static String dateFromCubes(String string) throws ParseException
      Convert a PisaCubes date to a string that can be used for the JSON
      Parameter:
      string - PisaCubes date
      Gibt zurück:
      UTC date as string in the format yyyy-MM-ddTHH:mm:ssZ
      Löst aus:
      ParseException
    • dateFromCubes

      public static String dateFromCubes(String string, boolean timezone) throws ParseException
      Convert a PisaCubes date to a string that can be used for the JSON
      Parameter:
      string - PisaCubes date
      timezone - add the timezone Z to the string?
      Gibt zurück:
      UTC date as string in the format yyyy-MM-ddTHH:mm:ssZ
      Löst aus:
      ParseException
    • dateToCubes

      public static String dateToCubes(String string)
      Convert a JSON date to a PisaCubes date
      Parameter:
      string - JSON date
      Gibt zurück:
      PisaCubes date
    • getConfig

      public static Optional<de.pisa.psa.ifc.PsaDtoDat> getConfig(de.pisa.psc.srv.glb.PscSsn ssn, String cnf_gid) throws Exception
      Get a configuration record
      Parameter:
      ssn - session
      cnf_gid - PSC_GID of the configuration record
      Gibt zurück:
      data
      Löst aus:
      Exception
    • getKey

      public static Optional<de.pisa.psa.ifc.PsaDtoDat> getKey(de.pisa.psc.srv.glb.PscSsn ssn, String key_gid) throws Exception
      get a key record
      Parameter:
      ssn - session
      key_gid - PSC_GID of the key record
      Gibt zurück:
      data
      Löst aus:
      Exception
    • getEvent

      public static Optional<de.pisa.psa.ifc.PsaDtoDat> getEvent(de.pisa.psc.srv.glb.PscSsn ssn, String evt_gid) throws Exception
      Get an event record
      Parameter:
      ssn - session
      evt_gid - PSC_GID of the event record
      Gibt zurück:
      data
      Löst aus:
      Exception
    • getSourceBlob

      public static String getSourceBlob(de.pisa.psc.srv.glb.PscSsn ssn, String blob) throws Exception
      get source code from a BLOB
      Parameter:
      ssn - session
      blob - name of the BLOB
      Gibt zurück:
      source code
      Löst aus:
      Exception
    • generateImplementation

      public static String generateImplementation(de.pisa.psc.srv.glb.PscSsn ssn, String blob, PsaRstApiUti.ImplementationParameter parameter) throws Exception
      generate an implementation
      Parameter:
      ssn - session
      blob - name of the BLOB
      parameter - implementation parameter
      Gibt zurück:
      source code
      Löst aus:
      Exception
    • getUrlQueryParameter

      public static de.pisa.psc.srv.svc.MapToList<String,String> getUrlQueryParameter(String url)
      get the query parameter from an URL
      Parameter:
      url - URL to parse
      Gibt zurück:
      map with keys and values
    • getMultivaluedStringMap

      public static HeaderMap getMultivaluedStringMap(String json) throws com.fasterxml.jackson.core.JsonProcessingException
      convert a JSON into a multi valued string map (String to a list of strings)
      Parameter:
      json - JSON to parse
      Gibt zurück:
      map (never null)
      Löst aus:
      com.fasterxml.jackson.core.JsonProcessingException
    • validUrlPath

      public static String validUrlPath(String path)
      Make sure only valid characters are in an URL path. Invalid characters will be replaced by a -
      Parameter:
      path - path to check
      Gibt zurück:
      the path with only the valid characters
    • getDtoTitle

      public static String getDtoTitle(de.pisa.psc.srv.glb.PscSsn ssn, String dto) throws Exception
      get the English title for a data object
      Parameter:
      ssn - session
      dto - data object descriptor
      Gibt zurück:
      title
      Löst aus:
      Exception
    • createCheckFailedError

      public static PsaRstApiErrFac createCheckFailedError(de.pisa.psc.srv.glb.PscExc pex)
      Create a "PsaRstApiErrCod.CHECK_FAILED" error
      Parameter:
      pex - PisaCubes exception
      Gibt zurück:
      error factory
    • removeQuotes

      public static String removeQuotes(String value)
      Remove leading and trailing single quotes from a string
      Parameter:
      value - value to change
      Gibt zurück:
      new string without quotes
    • string2integer

      public static Optional<Integer> string2integer(String string)
      Convert a String to an Integer. In case of an invalid string Optional.empty is returned
      Parameter:
      string - string to convert
      Gibt zurück:
      parsed value
    • string2long

      public static Optional<Long> string2long(String string)
      Convert a String to an Long. In case of an invalid string Optional.empty is returned
      Parameter:
      string - string to convert
      Gibt zurück:
      parsed value
    • string2double

      public static Optional<Double> string2double(String string)
      Convert a String to an Double. In case of an invalid string Optional.empty is returned
      Parameter:
      string - string to convert
      Gibt zurück:
      parsed value
    • string2float

      public static Optional<Float> string2float(String string)
      Convert a String to an Float. In case of an invalid string Optional.empty is returned
      Parameter:
      string - string to convert
      Gibt zurück:
      parsed value
    • string2boolean

      public static Optional<Boolean> string2boolean(String string)
      Convert a String to an Boolean. In case of an invalid string Optional.empty is returned
      Parameter:
      string - string to convert
      Gibt zurück:
      parsed value