Class JaloConnection
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Propertiesstatic final Stringstatic final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.since agesJaloConnection(Tenant tenant) Used byAbstractTenant.doStartUp()exclusively - do not call directly! -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckAndAddToSessionCache(JaloSession session) Deprecated.since 5.5.1 session management was changed and this method has no effectintDeprecated.since 5.5.1 session management was changed and this method has no effectintcleanExpiredSessions(boolean force) Deprecated.since 5.5.1 session management was changed and this method always returns -1Creates a session to the hybris platform system using a anonymous account.createAnonymousCustomerSession(Class sessionClass) Creates a session to the hybris platform system using a anonymous account.createAnonymousCustomerSession(Map initialAttributes) createSession(User user) Creates a new session using a already known user.createSession(String user, String pwd) creates a session with the given username/pwdcreateSession(Map loginProperties) Creates a session with the given login information.createSession(Map loginProperties, Class sessionClass) Creates a session with the given login information.createSession(Map loginProperties, Class sessionClass, Map initialAttributes) Creates a session with the given login information.booleanTest for equality.protected CollectionfilterRemovedItems(Object attributeValue) Returns theAccessManagerand sets it into instance propertyaccessManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaAccessManagerconstructor.Deprecated.since 5.5.1 session management was changed and this method always returns empty collectionReturns theC2LManagerand sets it into instance propertyc2lManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaC2LManagerconstructor.protected Collection<ChangedItemAttributes>getCreatedItemAttributes(Item item, Map<String, Object> values) Returns theEnumerationManagerand sets it into instance propertyenumerationManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaEnumerationManagerconstructor.Deprecated.since 5.5.1 session management was changed and this method always returns empty collectionReturns theExtensionManagerand sets it into instance propertyextensionManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaExtensionManagerconstructor.Returns theFlexibleSearchand sets it into instance propertyflexibleSearch, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaFlexibleSearchconstructor.static JaloConnectionReturns theLinkManagerand sets it into instance propertylinkManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaLinkManagerconstructor.Returns theMediaManagerand sets it into instance propertymediaManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaMediaManagerconstructor.Returns theMetaInformationManagerand sets it into instance propertymetaInformationManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaMetaInformationManagerconstructor.protected Collection<ChangedItemAttributes>getModifiedItemAttributes(Item item, Map<String, Object> previousValues, Map<String, Object> newValues) Returns theNumberSeriesManagerand sets it into instance propertynumberSeriesManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaNumberSeriesManagerconstructor.Returns theOrderManagerand sets it into instance propertyorderManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaOrderManagerconstructor.getPasswordEncoder(String encoding) Returns thePasswordEncoderFactoryand sets it into instance propertypasswordEncoderFactory, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaPasswordEncoderFactoryImplconstructor.Returns theProductManagerand sets it into instance propertyproductManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaProductManagerconstructor.protected Collection<ChangedItemAttributes>getRemovedItemAttributes(Item item) protected Collection<SavedValues>getSavedValues(SessionContext ctx, Item item, int start, int count) getSession(String sessionID) Deprecated.since 5.5.1 session management was changed and this method always returns current session or nullReturns the SystemName.Returns theTypeManagerand sets it into instance propertytypeManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaTypeManagerconstructor.Returns theUserManagerand sets it into instance propertyuserManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaUserManagerconstructor.protected ClassguessSessionClass(Map props) inthashCode()Object is singleton, so default hash code can be used.protected booleanisLoggingEnabled(Item toLog) isLogHMCChanges(SessionContext ctx, ComposedType item) booleanthis method tells if you may open a connection.logItemCreation(PK itemPk, Map values) Creates a newSavedValuesmarking a item creation.logItemCreation(Item item, Map values) Deprecated.since ages - uselogItemCreation(PK, Map)logItemModification(PK itemPk, Map<String, Object> values, Map<String, Object> previousValues, boolean detectRemovedValues) Creates a newSavedValuesmarking a item modification.logItemModification(Item item, Map<String, Object> values, Map<String, Object> previousValues, boolean detectRemovedValues) Deprecated.since ages - uselogItemModification(PK, Map, Map, boolean)insteadlogItemRemoval(PK itemPk, boolean saveAttributes) Creates a newSavedValuesmarking a item removal.logItemRemoval(Item item, boolean saveAttributes) Deprecated.since ages - uselogItemRemoval(PK, boolean)insteadvoidregisterJaloSessionListener(JaloSessionListener jaloSessionListener) register a JaloSessionListenervoidDeprecated.since 5.0 , You should not mutate theJaloConnection's tenant.toString()Returns a String representation of this Connection.voidunregisterJaloSessionListener(JaloSessionListener jaloSessionListener) unregister a JaloSessionListener
-
Field Details
-
SESSION_CLASS
- See Also:
-
DEFAULT_SESSION_CLASS
- See Also:
-
LOGHMCCHANGES
-
ANONYMOUS_LOGIN_PROPERTIES
-
-
Constructor Details
-
JaloConnection
Used byAbstractTenant.doStartUp()exclusively - do not call directly! -
JaloConnection
Deprecated.since agesdo not call directly
-
-
Method Details
-
getInstance
-
setTenant
Deprecated.since 5.0 , You should not mutate theJaloConnection's tenant.do not call directly -
getTenant
-
registerJaloSessionListener
register a JaloSessionListener -
unregisterJaloSessionListener
unregister a JaloSessionListener -
getJaloSessionListeners
-
cleanExpiredSessions
Deprecated.since 5.5.1 session management was changed and this method has no effectcleans 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 session management was changed and this method always returns -1cleans 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
-
createAnonymousCustomerSession
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
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 nullJaloSessionwill 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.nullas a password is not permitted.session.type: the 'type' of the session. Valid types are:customeroremployee. The user principal must be a user of the type provided insession.type. This key is required, there is no default.
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:
JaloInvalidParameterExceptionJaloSecurityException- 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.nullas a password is not permitted.session.type: the 'type' of the session. Valid types are:customeroremployee. The user principal must be a user of the type provided insession.type. This key is required, there is no default.
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 nullJaloSessionis taken- Returns:
- a new JaloSession for the given user.
- Throws:
JaloInvalidParameterException- in case login, password or session type is missingJaloSecurityException- 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.nullas a password is not permitted.session.type: the 'type' of the session. Valid types are:customeroremployee. The user principal must be a user of the type provided insession.type. This key is required, there is no default.
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 nullJaloSessionis takeninitialAttributes- initial attributes for the session- Returns:
- a new JaloSession for the given user.
- Throws:
JaloInvalidParameterException- in case login, password or session type is missingJaloSecurityException- in case of a login failure or the system is not initialized- See Also:
-
createSession
creates a session with the given username/pwd- Parameters:
user- the usernamepwd- the password- Returns:
- the JaloSession
- Throws:
JaloSecurityException- if the given combination was wrong
-
createSession
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 session management was changed and this method always returns empty collectionreturns 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 session management was changed and this method always returns current session or nullReturns session with the given sessionID.When advanced property "hybris.improvedsessionhandling" is set to true
JaloSessionis not added to cache on creation. Extensions that usegetSession(String)should manually add session to cache after creation usingcheckAndAddToSessionCache(JaloSession). It really means that if before mentioned property is set to true, the methodgetSession(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
nullif no session with such ID exists - Since:
- 2.20SP5
-
getExpiredSessions
Deprecated.since 5.5.1 session management was changed and this method always returns empty collectionReturns 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 effectChecks ifJaloSessionpassed as parameter already exists in sessionCache. If not adds thisJaloSessionto the sessionCache. JaloSession that is not in sessionCache will never timeout. The purpose of this method is to add (or replace when already exists)JaloSessionto sessionCache. PLA-8390- Parameters:
session- jaloSession
-
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
Returns a String representation of this Connection. -
equals
Test for equality.Because JaloConnection is a singleton, this will return true compared with itself, false otherwise
-
hashCode
public int hashCode()Object is singleton, so default hash code can be used. -
getUserManager
Returns theUserManagerand sets it into instance propertyuserManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaUserManagerconstructor. 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
Returns theProductManagerand sets it into instance propertyproductManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaProductManagerconstructor. 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
Returns theNumberSeriesManagerand sets it into instance propertynumberSeriesManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaNumberSeriesManagerconstructor. 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
Returns theFlexibleSearchand sets it into instance propertyflexibleSearch, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaFlexibleSearchconstructor. 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
Returns theC2LManagerand sets it into instance propertyc2lManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaC2LManagerconstructor. 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
Returns theMetaInformationManagerand sets it into instance propertymetaInformationManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaMetaInformationManagerconstructor. 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
Returns theMediaManagerand sets it into instance propertymediaManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaMediaManagerconstructor. 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
Returns theOrderManagerand sets it into instance propertyorderManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaOrderManagerconstructor. 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
- Throws:
PasswordEncoderNotFoundException
-
getPasswordEncoderFactory
Returns thePasswordEncoderFactoryand sets it into instance propertypasswordEncoderFactory, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaPasswordEncoderFactoryImplconstructor. Assures that returned instance hasn't been changed (or even set to null) in meantime - therefore access is thread safe. -
getLinkManager
Returns theLinkManagerand sets it into instance propertylinkManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaLinkManagerconstructor. 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
Returns theExtensionManagerand sets it into instance propertyextensionManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaExtensionManagerconstructor. 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
Returns theTypeManagerand sets it into instance propertytypeManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaTypeManagerconstructor. 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
Returns theEnumerationManagerand sets it into instance propertyenumerationManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaEnumerationManagerconstructor. 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
Returns theAccessManagerand sets it into instance propertyaccessManager, preventing it from mutation while creating viaBeanFactory.getBean(String)or viaAccessManagerconstructor. 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
-
getManagers
-
logItemRemoval
Creates a newSavedValuesmarking a item removal.- Parameters:
itemPk- the removed itemsaveAttributes- TODO- Since:
- 2.20
-
logItemRemoval
@Deprecated(since="ages", forRemoval=false) public SavedValues logItemRemoval(Item item, boolean saveAttributes) Deprecated.since ages - uselogItemRemoval(PK, boolean)insteadCreates a newSavedValuesmarking a item removal.- Parameters:
item- the removed itemsaveAttributes- TODO- Since:
- 2.20
-
getRemovedItemAttributes
-
getModifiedItemAttributes
protected Collection<ChangedItemAttributes> getModifiedItemAttributes(Item item, Map<String, Object> previousValues, Map<String, Object> newValues) -
isLoggingEnabled
-
getSavedValues
protected Collection<SavedValues> getSavedValues(SessionContext ctx, Item item, int start, int count) -
isLogHMCChanges
-
logItemModification
public SavedValues logItemModification(PK itemPk, Map<String, Object> values, Map<String, Object> previousValues, boolean detectRemovedValues) Creates a newSavedValuesmarking a item modification.- Parameters:
itemPk- the created itemvalues- its modified valuespreviousValues- its previous valuesdetectRemovedValues- TODO
-
logItemModification
@Deprecated(since="ages", forRemoval=false) public SavedValues logItemModification(Item item, Map<String, Object> values, Map<String, Object> previousValues, boolean detectRemovedValues) Deprecated.since ages - uselogItemModification(PK, Map, Map, boolean)insteadCreates a newSavedValuesmarking a item modification.- Parameters:
item- the created itemvalues- its modified valuespreviousValues- its previous valuesdetectRemovedValues- TODO
-
filterRemovedItems
- 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 newSavedValuesmarking a item creation.- Parameters:
item- the created itemvalues- its creation values
-
logItemCreation
Creates a newSavedValuesmarking a item creation.- Parameters:
itemPk- the created itemPKvalues- its creation values
-
getCreatedItemAttributes
protected Collection<ChangedItemAttributes> getCreatedItemAttributes(Item item, Map<String, Object> values)
-