Class ServicesImpl

java.lang.Object
com.ebasetech.xi.api.ServicesImpl
All Implemented Interfaces:
com.ebasetech.ufs.runtime.events.rhinojavascript.debugging.DebuggerSubstitution, Services, java.io.Serializable

public class ServicesImpl
extends java.lang.Object
implements Services, java.io.Serializable, com.ebasetech.ufs.runtime.events.rhinojavascript.debugging.DebuggerSubstitution
See Also:
Serialized Form
  • Constructor Summary

    Constructors
    Constructor Description
    ServicesImpl()  
  • Method Summary

    Modifier and Type Method Description
    DatabaseServices getDatabase()
    Returns the database services containing methods associated with databases.
    DateServices getDate()
    Returns the date services containing methods associated with dates.
    EncryptionServices getEncryption()
    Returns the encryption services containing methods associated with Ebase encryption.
    Errors getErrors()
    The Errors is a server side JavaScript object that contains functions that allows the creation of customizable error handling functionality specifically returned from the server, for example a 404 HTTP Not Found error.
    FileServices getFile()
    Returns the file services containing methods associated with system files.
    LdapServices getLdap()
    Returns the LDAP services containing methods that provide authentication and search methods against an LDAP Registry.
    PostcodeAnywhereServices getPostcodeAnywhere()
    Returns the postcode anywhere services containing methods to access the PostcodeAnywhere service.
    PushNotification getPushNotification()  
    RestServices getRest()
    Returns the REST services that supports REST based operations.
    SchedulerServices getScheduler()
    Returns the scheduler services containing methods that enable Scheduled Tasks to be started from a form, workflow job or Integration Service.
    ServicesSecurity getSecurity()
    Returns the services security containing any security implementations required by Services.
    VelocityServices getVelocity()
    Returns the Velocity services containing methods to invoke a Velocity template.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ServicesImpl

      public ServicesImpl()
  • Method Details

    • getRest

      public RestServices getRest()
      Description copied from interface: Services
      Returns the REST services that supports REST based operations.
      Specified by:
      getRest in interface Services
    • getPushNotification

      public PushNotification getPushNotification()
      Specified by:
      getPushNotification in interface Services
    • getDate

      public DateServices getDate()
      Description copied from interface: Services
      Returns the date services containing methods associated with dates.
      Specified by:
      getDate in interface Services
    • getEncryption

      public EncryptionServices getEncryption()
      Description copied from interface: Services
      Returns the encryption services containing methods associated with Ebase encryption.
      Specified by:
      getEncryption in interface Services
    • getFile

      public FileServices getFile()
      Description copied from interface: Services
      Returns the file services containing methods associated with system files.
      Specified by:
      getFile in interface Services
    • getLdap

      public LdapServices getLdap()
      Description copied from interface: Services
      Returns the LDAP services containing methods that provide authentication and search methods against an LDAP Registry.
      Specified by:
      getLdap in interface Services
    • getPostcodeAnywhere

      public PostcodeAnywhereServices getPostcodeAnywhere()
      Description copied from interface: Services
      Returns the postcode anywhere services containing methods to access the PostcodeAnywhere service.
      Specified by:
      getPostcodeAnywhere in interface Services
    • getScheduler

      public SchedulerServices getScheduler()
      Description copied from interface: Services
      Returns the scheduler services containing methods that enable Scheduled Tasks to be started from a form, workflow job or Integration Service.
      Specified by:
      getScheduler in interface Services
    • getVelocity

      public VelocityServices getVelocity()
      Description copied from interface: Services
      Returns the Velocity services containing methods to invoke a Velocity template.
      Specified by:
      getVelocity in interface Services
    • getSecurity

      public ServicesSecurity getSecurity()
      Description copied from interface: Services
      Returns the services security containing any security implementations required by Services.
      Specified by:
      getSecurity in interface Services
    • getDatabase

      public DatabaseServices getDatabase()
      Description copied from interface: Services
      Returns the database services containing methods associated with databases.
      Specified by:
      getDatabase in interface Services
    • getErrors

      public Errors getErrors()
      Description copied from interface: Services
      The Errors is a server side JavaScript object that contains functions that allows the creation of customizable error handling functionality specifically returned from the server, for example a 404 HTTP Not Found error. The error handlers are created using a description string and an error code. The errors are as follows:
      • HttpRequestError - This is typically used to create HTTP response failure errors, for example the server responds with a 400 Bad Request code
      • HttpAuthorisationError - This should be used when generating Authentication errors, for example the server responds with a 401 Unauthorized code
      • HttpNotFoundError - This should be used when generating not found errors, for example the server responds with a 404 Not Found code
      • HttpServerError - This should be used when generating generic server errors, for example the server responds with a 500 Server Error code
      • HttpUnknownError - This should be used when generating an unknown or unrecognized error, for example the HTTP code is not recognized

      Further documentation.

      JavaScript example:

       // call Users REST API
       function callUsersAPI()
       {
         var response = services.rest.get("http://example.com/rest/users");
         if(!response.isSuccess()) {
           switch(response.code) {
             case 401:
                // Send an email stating that the service is authorized
                fields.unauthorizedError.value = response.body;
                resources.sysAdmin.sendMail();
                throw services.errors.createAuthorisationError("Unauthorized", response.code);
             
             default:
                throw services.errors.createRequestError("Request error", response.code);
         }
         //process result
       }
      
       

      Specified by:
      getErrors in interface Services
      Returns:
      Errors an interface containing functions to create a specific HttpError errors