Class JaloConnection

java.lang.Object
de.hybris.platform.jalo.JaloConnection

public class JaloConnection extends Object
The JaloConnection represents a connection to the system.

  • Field Details

  • Constructor Details

  • Method Details

    • getInstance

      public static JaloConnection getInstance()
    • setTenant

      @Deprecated(since="5.0", forRemoval=false) public void setTenant(Tenant tenant)
      Deprecated.
      since 5.0 , You should not mutate the JaloConnection's tenant.
      do not call directly
    • getTenant

      public Tenant getTenant()
    • registerJaloSessionListener

      public void registerJaloSessionListener(JaloSessionListener jaloSessionListener)
      register a JaloSessionListener
    • unregisterJaloSessionListener

      public void unregisterJaloSessionListener(JaloSessionListener jaloSessionListener)
      unregister a JaloSessionListener
    • getJaloSessionListeners

      public List<JaloSessionListener> getJaloSessionListeners()
    • cleanExpiredSessions

      @Deprecated(since="5.5.1", forRemoval=false) public int cleanExpiredSessions()
      Deprecated.
      since 5.5.1 session management was changed and this method has no effect
      cleans old expired sessions from the session cache the cleaning will only occur every 'session.timeout.checkinterval' setting
      Returns:
      -1 if force was false and test did not run
    • cleanExpiredSessions

      @Deprecated(since="5.5.1", forRemoval=false) public int cleanExpiredSessions(boolean force)
      Deprecated.
      since 5.5.1 session management was changed and this method always returns -1
      cleans old expired sessions from the session cache
      Parameters:
      force - if true cleanup will happen immediately. each method call of cleanExpiredSessions will go through the complete session list to identify old sessions, this can take some time. if set to false, the cleaning will only occur every 'session.timeout.checkinterval' setting
      Returns:
      -1 if force was false and test did not run
    • guessSessionClass

      protected Class guessSessionClass(Map props)
    • createAnonymousCustomerSession

      public JaloSession createAnonymousCustomerSession() throws JaloSecurityException
      Creates a session to the hybris platform system using a anonymous account.

      If the system does not allow anonymous login, a JaloSecurityException is thrown.

      Returns:
      a new JaloSession object
      Throws:
      JaloSecurityException - if there was a security problem creating the session (e.g. there is no anonymous user allowed to login)
    • createAnonymousCustomerSession

      public JaloSession createAnonymousCustomerSession(Map initialAttributes) throws JaloSecurityException
      Throws:
      JaloSecurityException
    • createAnonymousCustomerSession

      public JaloSession createAnonymousCustomerSession(Class sessionClass) throws JaloSecurityException
      Creates a session to the hybris platform system using a anonymous account.

      If the system does not allow anonymous login, a JaloSecurityException is thrown.

      Parameters:
      sessionClass - the jalo class of the new session, if null JaloSession will be taken
      Returns:
      a new JaloSession object
      Throws:
      JaloSecurityException - if there was a security problem creating the session (e.g. there is no anonymous user allowed to login)
    • createSession

      public JaloSession createSession(Map loginProperties) throws JaloSecurityException, JaloInvalidParameterException
      Creates a session with the given login information.

      The login properties are given as a Map with the following key mappings:

      • user.principal: contains the principal, the Login of the user. This key is required, there is no default.
      • user.credentials: contains the password of the user. this field is required, there is no default. null as a password is not permitted.
      • session.type: the 'type' of the session. Valid types are: customer or employee. The user principal must be a user of the type provided in session.type. This key is required, there is no default.
      An example for a correct filled property map can be:
       Properties prop = new Properties();
       prop.setProperty(JaloSession.LoginProperties.LOGIN, "frank");
       prop.setProperty(JaloSession.LoginProperties.PASSWORD, "blurb");
       prop.setProperty(JaloSession.LoginProperties.SESSION_TYPE, JaloSession.LoginProperties.SessionTypes.CUSTOMER);
       

      if the provided login properties are wrong, a JaloSecurityException is thrown.
      if keys or values are missing in the provided map, a JaloInvalidParameterException is thrown.

      Parameters:
      loginProperties -
      Returns:
      a new JaloSession for the given user.
      Throws:
      JaloInvalidParameterException
      JaloSecurityException
      See Also:
    • createSession

      public JaloSession createSession(Map loginProperties, Class sessionClass) throws JaloSecurityException, JaloInvalidParameterException
      Creates a session with the given login information.

      The login properties are given as a Map with the following key mappings:

      • user.principal: contains the principal, the Login of the user. This key is required, there is no default.
      • user.credentials: contains the password of the user. this field is required, there is no default. null as a password is not permitted.
      • session.type: the 'type' of the session. Valid types are: customer or employee. The user principal must be a user of the type provided in session.type. This key is required, there is no default.
      An example for a correct filled property map can be:
       Properties prop = new Properties();
       prop.setProperty(JaloSession.LoginProperties.LOGIN, "frank");
       prop.setProperty(JaloSession.LoginProperties.PASSWORD, "blurb");
       prop.setProperty(JaloSession.LoginProperties.SESSION_TYPE, JaloSession.LoginProperties.SessionTypes.CUSTOMER);
       

      if the provided login properties are wrong, a JaloSecurityException is thrown.
      if keys or values are missing in the provided map, a JaloInvalidParameterException is thrown.

      Parameters:
      loginProperties -
      sessionClass - the jalo class of the new session, if null JaloSession is taken
      Returns:
      a new JaloSession for the given user.
      Throws:
      JaloInvalidParameterException - in case login, password or session type is missing
      JaloSecurityException - in case of a login failure or the system is not initialized
      See Also:
    • createSession

      public JaloSession createSession(Map loginProperties, Class sessionClass, Map initialAttributes) throws JaloSecurityException, JaloInvalidParameterException
      Creates a session with the given login information.

      The login properties are given as a Map with the following key mappings:

      • user.principal: contains the principal, the Login of the user. This key is required, there is no default.
      • user.credentials: contains the password of the user. this field is required, there is no default. null as a password is not permitted.
      • session.type: the 'type' of the session. Valid types are: customer or employee. The user principal must be a user of the type provided in session.type. This key is required, there is no default.
      An example for a correct filled property map can be:
       Properties prop = new Properties();
       prop.setProperty(JaloSession.LoginProperties.LOGIN, "frank");
       prop.setProperty(JaloSession.LoginProperties.PASSWORD, "blurb");
       prop.setProperty(JaloSession.LoginProperties.SESSION_TYPE, JaloSession.LoginProperties.SessionTypes.CUSTOMER);
       

      if the provided login properties are wrong, a JaloSecurityException is thrown.
      if keys or values are missing in the provided map, a JaloInvalidParameterException is thrown.

      Parameters:
      loginProperties -
      sessionClass - the jalo class of the new session, if null JaloSession is taken
      initialAttributes - initial attributes for the session
      Returns:
      a new JaloSession for the given user.
      Throws:
      JaloInvalidParameterException - in case login, password or session type is missing
      JaloSecurityException - in case of a login failure or the system is not initialized
      See Also:
    • createSession

      public JaloSession createSession(String user, String pwd) throws JaloSecurityException
      creates a session with the given username/pwd
      Parameters:
      user - the username
      pwd - the password
      Returns:
      the JaloSession
      Throws:
      JaloSecurityException - if the given combination was wrong
    • createSession

      public JaloSession createSession(User user) throws JaloSecurityException
      Creates a new session using a already known user. Please note that there is no password check done here!
      Parameters:
      user - the user to create a new session for
      Returns:
      the new session
      Throws:
      JaloSecurityException
    • getAllSessions

      @Deprecated(since="5.5.1", forRemoval=false) public Collection<JaloSession> getAllSessions()
      Deprecated.
      since 5.5.1 session management was changed and this method always returns empty collection
      returns all session that were made using this collection from this virtual machine.

      Attention: It will NOT return all sessions made to the server this connection is connected to.

    • getSession

      @Deprecated(since="5.5.1", forRemoval=false) public JaloSession getSession(String sessionID)
      Deprecated.
      since 5.5.1 session management was changed and this method always returns current session or null
      Returns session with the given sessionID.

      When advanced property "hybris.improvedsessionhandling" is set to true JaloSession is not added to cache on creation. Extensions that use getSession(String) should manually add session to cache after creation using checkAndAddToSessionCache(JaloSession). It really means that if before mentioned property is set to true, the method getSession(String) will only return session, which have been manually registered.

      Parameters:
      sessionID - session ID of the session to be found
      Returns:
      session with the given ID, or null if no session with such ID exists
      Since:
      2.20SP5
    • getExpiredSessions

      @Deprecated(since="5.5.1", forRemoval=false) public Collection<JaloSession> getExpiredSessions()
      Deprecated.
      since 5.5.1 session management was changed and this method always returns empty collection
      Returns all session that are expired and have not yet been closed.

      Since:
      2.20SP5
    • checkAndAddToSessionCache

      @Deprecated(since="5.5.1", forRemoval=false) public void checkAndAddToSessionCache(JaloSession session)
      Deprecated.
      since 5.5.1 session management was changed and this method has no effect
      Checks if JaloSession passed as parameter already exists in sessionCache. If not adds this JaloSession to the sessionCache. JaloSession that is not in sessionCache will never timeout. The purpose of this method is to add (or replace when already exists) JaloSession to sessionCache. PLA-8390
      Parameters:
      session - jaloSession
    • getSystemName

      public String getSystemName()
      Returns the SystemName.

      The System name is just a description of the system.

      Returns:
      the system name
    • isSystemInitialized

      public boolean isSystemInitialized()
      this method tells if you may open a connection.
      Returns:
      true if the system was initialized correctly
    • toString

      public String toString()
      Returns a String representation of this Connection.

      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object object)
      Test for equality.

      Because JaloConnection is a singleton, this will return true compared with itself, false otherwise

      Overrides:
      equals in class Object
      Parameters:
      object - the object to compare
    • hashCode

      public int hashCode()
      Object is singleton, so default hash code can be used.
      Overrides:
      hashCode in class Object
      See Also:
    • getUserManager

      public UserManager getUserManager()
      Returns the UserManager and sets it into instance property userManager, preventing it from mutation while creating via BeanFactory.getBean(String) or via UserManager constructor. Assures that returned instance hasn't been changed (or even set to null) in meantime - therefore access is thread safe.
      Returns:
      the UserManager object
    • getProductManager

      public ProductManager getProductManager()
      Returns the ProductManager and sets it into instance property productManager, preventing it from mutation while creating via BeanFactory.getBean(String) or via ProductManager constructor. Assures that returned instance hasn't been changed (or even set to null) in meantime - therefore access is thread safe.
      Returns:
      the ProductManager object
    • getNumberSeriesManager

      public NumberSeriesManager getNumberSeriesManager()
      Returns the NumberSeriesManager and sets it into instance property numberSeriesManager, preventing it from mutation while creating via BeanFactory.getBean(String) or via NumberSeriesManager constructor. Assures that returned instance hasn't been changed (or even set to null) in meantime - therefore access is thread safe.
      Returns:
      the NumberSeriesManager object
    • getFlexibleSearch

      public FlexibleSearch getFlexibleSearch()
      Returns the FlexibleSearch and sets it into instance property flexibleSearch, preventing it from mutation while creating via BeanFactory.getBean(String) or via FlexibleSearch constructor. Assures that returned instance hasn't been changed (or even set to null) in meantime - therefore access is thread safe.
      Returns:
      the FlexibleSearch object
    • getC2LManager

      public C2LManager getC2LManager()
      Returns the C2LManager and sets it into instance property c2lManager, preventing it from mutation while creating via BeanFactory.getBean(String) or via C2LManager constructor. Assures that returned instance hasn't been changed (or even set to null) in meantime - therefore access is thread safe.
      Returns:
      the C2LManager object
    • getMetaInformationManager

      public MetaInformationManager getMetaInformationManager()
      Returns the MetaInformationManager and sets it into instance property metaInformationManager, preventing it from mutation while creating via BeanFactory.getBean(String) or via MetaInformationManager constructor. Assures that returned instance hasn't been changed (or even set to null) in meantime - therefore access is thread safe.
      Returns:
      the MetaInformationManager object
    • getMediaManager

      public MediaManager getMediaManager()
      Returns the MediaManager and sets it into instance property mediaManager, preventing it from mutation while creating via BeanFactory.getBean(String) or via MediaManager constructor. Assures that returned instance hasn't been changed (or even set to null) in meantime - therefore access is thread safe.
      Returns:
      the MediaManager object
    • getOrderManager

      public OrderManager getOrderManager()
      Returns the OrderManager and sets it into instance property orderManager, preventing it from mutation while creating via BeanFactory.getBean(String) or via OrderManager constructor. Assures that returned instance hasn't been changed (or even set to null) in meantime - therefore access is thread safe.
      Returns:
      the OrderManager object
    • getPasswordEncoder

      public PasswordEncoder getPasswordEncoder(String encoding) throws PasswordEncoderNotFoundException
      Throws:
      PasswordEncoderNotFoundException
    • getPasswordEncoderFactory

      public PasswordEncoderFactory getPasswordEncoderFactory()
      Returns the PasswordEncoderFactory and sets it into instance property passwordEncoderFactory, preventing it from mutation while creating via BeanFactory.getBean(String) or via PasswordEncoderFactoryImpl constructor. Assures that returned instance hasn't been changed (or even set to null) in meantime - therefore access is thread safe.
    • getLinkManager

      public LinkManager getLinkManager()
      Returns the LinkManager and sets it into instance property linkManager, preventing it from mutation while creating via BeanFactory.getBean(String) or via LinkManager constructor. Assures that returned instance hasn't been changed (or even set to null) in meantime - therefore access is thread safe.
      Returns:
      the LinkManager object
    • getExtensionManager

      public ExtensionManager getExtensionManager()
      Returns the ExtensionManager and sets it into instance property extensionManager, preventing it from mutation while creating via BeanFactory.getBean(String) or via ExtensionManager constructor. Assures that returned instance hasn't been changed (or even set to null) in meantime - therefore access is thread safe.
      Returns:
      the ExtensionManager object
    • getTypeManager

      public TypeManager getTypeManager()
      Returns the TypeManager and sets it into instance property typeManager, preventing it from mutation while creating via BeanFactory.getBean(String) or via TypeManager constructor. Assures that returned instance hasn't been changed (or even set to null) in meantime - therefore access is thread safe.
      Returns:
      the TypeManager object
    • getEnumerationManager

      public EnumerationManager getEnumerationManager()
      Returns the EnumerationManager and sets it into instance property enumerationManager, preventing it from mutation while creating via BeanFactory.getBean(String) or via EnumerationManager constructor. Assures that returned instance hasn't been changed (or even set to null) in meantime - therefore access is thread safe.
      Returns:
      the EnumerationManager object
    • getAccessManager

      public AccessManager getAccessManager()
      Returns the AccessManager and sets it into instance property accessManager, preventing it from mutation while creating via BeanFactory.getBean(String) or via AccessManager constructor. Assures that returned instance hasn't been changed (or even set to null) in meantime - therefore access is thread safe.
      Returns:
      the AccessManager object
    • getJaloSessionListenersIncludingManagers

      public Collection<JaloSessionListener> getJaloSessionListenersIncludingManagers()
    • getManagers

      public List<Manager> getManagers()
    • logItemRemoval

      public SavedValues logItemRemoval(PK itemPk, boolean saveAttributes)
      Creates a new SavedValues marking a item removal.
      Parameters:
      itemPk - the removed item
      saveAttributes - TODO
      Since:
      2.20
    • logItemRemoval

      @Deprecated(since="ages", forRemoval=false) public SavedValues logItemRemoval(Item item, boolean saveAttributes)
      Deprecated.
      since ages - uselogItemRemoval(PK, boolean) instead
      Creates a new SavedValues marking a item removal.
      Parameters:
      item - the removed item
      saveAttributes - TODO
      Since:
      2.20
    • getRemovedItemAttributes

      protected Collection<ChangedItemAttributes> getRemovedItemAttributes(Item item)
    • getModifiedItemAttributes

      protected Collection<ChangedItemAttributes> getModifiedItemAttributes(Item item, Map<String,Object> previousValues, Map<String,Object> newValues)
    • isLoggingEnabled

      protected boolean isLoggingEnabled(Item toLog)
    • getSavedValues

      protected Collection<SavedValues> getSavedValues(SessionContext ctx, Item item, int start, int count)
    • isLogHMCChanges

      public Boolean isLogHMCChanges(SessionContext ctx, ComposedType item)
    • logItemModification

      public SavedValues logItemModification(PK itemPk, Map<String,Object> values, Map<String,Object> previousValues, boolean detectRemovedValues)
      Creates a new SavedValues marking a item modification.
      Parameters:
      itemPk - the created item
      values - its modified values
      previousValues - its previous values
      detectRemovedValues - TODO
    • logItemModification

      @Deprecated(since="ages", forRemoval=false) public SavedValues logItemModification(Item item, Map<String,Object> values, Map<String,Object> previousValues, boolean detectRemovedValues)
      Deprecated.
      Creates a new SavedValues marking a item modification.
      Parameters:
      item - the created item
      values - its modified values
      previousValues - its previous values
      detectRemovedValues - TODO
    • filterRemovedItems

      protected Collection filterRemovedItems(Object attributeValue)
      Parameters:
      attributeValue -
      Returns:
      a Collection with the removed items TODO: correct?
      Since:
      2.20
    • logItemCreation

      @Deprecated(since="ages", forRemoval=false) public SavedValues logItemCreation(Item item, Map values)
      Deprecated.
      since ages - uselogItemCreation(PK, Map)
      Creates a new SavedValues marking a item creation.
      Parameters:
      item - the created item
      values - its creation values
    • logItemCreation

      public SavedValues logItemCreation(PK itemPk, Map values)
      Creates a new SavedValues marking a item creation.
      Parameters:
      itemPk - the created item PK
      values - its creation values
    • getCreatedItemAttributes

      protected Collection<ChangedItemAttributes> getCreatedItemAttributes(Item item, Map<String,Object> values)