Class AbstractServiceContext

java.lang.Object
com.appiancorp.services.AbstractServiceContext
All Implemented Interfaces:
com.appiancorp.asl3.servicefw.connect.ServiceContext, com.appiancorp.security.auth.SecurityContext, com.appiancorp.services.AuthorizationInterceptorProvider, KougarServiceContext, ServiceContext, Principal
Direct Known Subclasses:
UserServiceContext, WebServiceContext

public abstract class AbstractServiceContext extends Object implements KougarServiceContext, com.appiancorp.security.auth.SecurityContext, com.appiancorp.services.AuthorizationInterceptorProvider
Represents a service context for use with the service framework. This class defines the common methods that all service contexts would otherwise have to implement, but that don't vary much from service context to service context.
  • Constructor Details

    • AbstractServiceContext

      protected AbstractServiceContext()
    • AbstractServiceContext

      protected AbstractServiceContext(String username, String grantorUsername)
    • AbstractServiceContext

      protected AbstractServiceContext(ServiceContext sc, String grantorUsername)
  • Method Details

    • getAuthorizationProvider

      public com.appiancorp.security.authz.AuthorizationProvider getAuthorizationProvider()
    • setAuthorizationProvider

      public void setAuthorizationProvider(com.appiancorp.security.authz.AuthorizationProvider authzProvider)
    • getAuthorizationInterceptor

      public org.aopalliance.intercept.MethodInterceptor getAuthorizationInterceptor(String actionTargetName, Class<?> targetInterface)
      Specified by:
      getAuthorizationInterceptor in interface com.appiancorp.services.AuthorizationInterceptorProvider
    • getName

      public String getName()
      Description copied from interface: ServiceContext
      Returns the username of the user represented by this context.
      Specified by:
      getName in interface Principal
      Specified by:
      getName in interface ServiceContext
      Returns:
      the username for this context
    • getUserRef

      public com.appiancorp.type.refs.UserRef getUserRef()
      Specified by:
      getUserRef in interface com.appiancorp.security.auth.SecurityContext
    • isUserRefNull

      public boolean isUserRefNull()
      Specified by:
      isUserRefNull in interface com.appiancorp.security.auth.SecurityContext
    • getUserUuid

      public String getUserUuid()
      Specified by:
      getUserUuid in interface com.appiancorp.security.auth.SecurityContext
    • getMemberGroupUuids

      public Set<String> getMemberGroupUuids()
      Specified by:
      getMemberGroupUuids in interface com.appiancorp.security.auth.SecurityContext
    • getMemberGroupRefs

      public Set<com.appiancorp.type.refs.GroupRef> getMemberGroupRefs()
      Specified by:
      getMemberGroupRefs in interface com.appiancorp.security.auth.SecurityContext
    • getRoles

      public Set<String> getRoles()
      Specified by:
      getRoles in interface com.appiancorp.security.auth.SecurityContext
    • isAuthenticatedByAppianInternalProvider

      public boolean isAuthenticatedByAppianInternalProvider()
      Specified by:
      isAuthenticatedByAppianInternalProvider in interface com.appiancorp.security.auth.SecurityContext
    • isLoggedInThroughSaml

      public boolean isLoggedInThroughSaml()
      Specified by:
      isLoggedInThroughSaml in interface com.appiancorp.security.auth.SecurityContext
    • getAppianLoginContext

      public com.appiancorp.security.auth.AppianLoginContext getAppianLoginContext()
      Specified by:
      getAppianLoginContext in interface com.appiancorp.security.auth.SecurityContext
    • isSysAdmin

      public boolean isSysAdmin()
      Specified by:
      isSysAdmin in interface com.appiancorp.security.auth.SecurityContext
    • getGrantorName

      public String getGrantorName()
      Specified by:
      getGrantorName in interface com.appiancorp.security.auth.SecurityContext
    • getGrantorRoles

      public Set<String> getGrantorRoles()
      Specified by:
      getGrantorRoles in interface com.appiancorp.security.auth.SecurityContext
    • addService

      public void addService(String serviceName, Object service)
      Description copied from interface: ServiceContext
      Adds the specified Service to the service cache under the serviceName_ key specified. If the key already exists, then it is overwritten with the new value.
      Specified by:
      addService in interface com.appiancorp.asl3.servicefw.connect.ServiceContext
      Specified by:
      addService in interface ServiceContext
      Parameters:
      serviceName - the name of the service
      service - the service
      See Also:
    • getService

      public Object getService(String serviceName)
      Description copied from interface: ServiceContext
      Retrieves Service specified by the given service name from cache.
      Specified by:
      getService in interface com.appiancorp.asl3.servicefw.connect.ServiceContext
      Specified by:
      getService in interface ServiceContext
      Parameters:
      serviceName - the service name
      Returns:
      the service
      See Also:
    • removeService

      public void removeService(String serviceName)
      Description copied from interface: ServiceContext
      Removes the specified service from the service cache.
      Specified by:
      removeService in interface com.appiancorp.asl3.servicefw.connect.ServiceContext
      Specified by:
      removeService in interface ServiceContext
      Parameters:
      serviceName - the name of the service
      See Also:
    • setAttribute

      public void setAttribute(String key, Object o)
      Description copied from interface: ServiceContext
      Sets the attribute at the specified key to the specified value.
      Specified by:
      setAttribute in interface com.appiancorp.asl3.servicefw.connect.ServiceContext
      Specified by:
      setAttribute in interface ServiceContext
      Parameters:
      key - the key
      o - the value
      See Also:
    • getAttribute

      public Object getAttribute(String key)
      Description copied from interface: ServiceContext
      Gets the attribute at the specified key.
      Specified by:
      getAttribute in interface com.appiancorp.asl3.servicefw.connect.ServiceContext
      Specified by:
      getAttribute in interface ServiceContext
      Parameters:
      key - the key
      Returns:
      the attribute value
      See Also:
    • removeAttribute

      public Object removeAttribute(String key)
      Description copied from interface: ServiceContext
      Removes the attribute at the specified key from the attribute map.
      Specified by:
      removeAttribute in interface com.appiancorp.asl3.servicefw.connect.ServiceContext
      Specified by:
      removeAttribute in interface ServiceContext
      Parameters:
      key - the key
      Returns:
      the attribute value before it was removed
      See Also:
    • getLocale

      public Locale getLocale()
      Description copied from interface: ServiceContext
      Gets the locale, which affects which language the database will return for multilingual strings.
      Specified by:
      getLocale in interface com.appiancorp.asl3.servicefw.connect.ServiceContext
      Specified by:
      getLocale in interface ServiceContext
      Returns:
      the locale
      See Also:
    • setLocale

      public void setLocale(Locale locale)
      Description copied from interface: ServiceContext
      Sets the locale, which affects which language the database will return for multilingual strings.
      Specified by:
      setLocale in interface com.appiancorp.asl3.servicefw.connect.ServiceContext
      Specified by:
      setLocale in interface ServiceContext
      Parameters:
      locale - the locale
      See Also:
    • isRtl

      public boolean isRtl()
      Specified by:
      isRtl in interface ServiceContext
    • getOverrideLocale

      public Locale getOverrideLocale()
      Necessary since this class implements SecurityContext. In this case, since this is derived from the original SecurityContext, just return the same locale as getLocale()
      Specified by:
      getOverrideLocale in interface com.appiancorp.security.auth.SecurityContext
      Returns:
      the locale already stored in this class derived from the original SecurityContext
    • isAllowOverrideForDisabledLocale

      public boolean isAllowOverrideForDisabledLocale()
      Specified by:
      isAllowOverrideForDisabledLocale in interface com.appiancorp.security.auth.SecurityContext
    • isAdsSuperUser

      public boolean isAdsSuperUser()
      Specified by:
      isAdsSuperUser in interface com.appiancorp.security.auth.SecurityContext
    • getTimeZone

      public TimeZone getTimeZone()
      Description copied from interface: ServiceContext
      Gets the timezone, which the database uses for time conversions to and from GMT.
      Specified by:
      getTimeZone in interface com.appiancorp.asl3.servicefw.connect.ServiceContext
      Specified by:
      getTimeZone in interface ServiceContext
      Returns:
      the timezone
      See Also:
    • setTimeZone

      public void setTimeZone(TimeZone timeZone)
      Description copied from interface: ServiceContext
      Sets the timezone, which the database uses for time conversions to and from GMT.
      Specified by:
      setTimeZone in interface com.appiancorp.asl3.servicefw.connect.ServiceContext
      Specified by:
      setTimeZone in interface ServiceContext
      Parameters:
      timeZone - the timezone
      See Also:
    • getCalendarID

      public String getCalendarID()
      Description copied from interface: ServiceContext
      Gets the calendar ID, which is used to calculate date in that calendar.
      Specified by:
      getCalendarID in interface ServiceContext
      Returns:
      the Calendar ID
      See Also:
      • #setCalendar(String)
    • setCalendarID

      public void setCalendarID(String calendarID)
      Description copied from interface: ServiceContext
      Sets the ID of the calendar, which is used to calculate date in that calendar.
      Specified by:
      setCalendarID in interface ServiceContext
      See Also:
      • #getCalendar()
    • getEngineCredentials

      public com.appian.komodo.api.EngineCredentials getEngineCredentials(com.appiancorp.kougar.services.ServiceConnection svcConn)
      Returns the credentials to be used for calls with the specified KougarConnection. The connection may be configured to pass full credentials, or not.
      Specified by:
      getEngineCredentials in interface KougarServiceContext
      Parameters:
      svcConn - the connection for which we need the credentials
      Returns:
      an Object representing the credentials.
    • getAppianSession

      public com.appiancorp.core.expr.portable.common.Session getAppianSession()
    • toString

      public String toString()
      Specified by:
      toString in interface Principal
      Overrides:
      toString in class Object