Package com.im.df.impl.db.persist
Class IJCUserLoginServiceImpl
- java.lang.Object
-
- com.im.df.impl.db.persist.IJCUserLoginServiceImpl
-
- All Implemented Interfaces:
com.im.df.api.capabilities.IJCUserLoginService
,com.im.df.api.capabilities.SchemaServiceCapability
,com.im.df.api.ddl.DFCapability
,IJCUserLoginServiceEx
- Direct Known Subclasses:
IJCUserLoginServiceAdminImpl
public class IJCUserLoginServiceImpl extends Object implements com.im.df.api.capabilities.IJCUserLoginService, IJCUserLoginServiceEx
- Author:
- Tim Dudgeon
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
SCHEMA_EDITING_LOCK_KEY
-
Constructor Summary
Constructors Constructor Description IJCUserLoginServiceImpl(String schemaId, com.im.commons.db.DatabasePlatform platform)
Creates a new instance of IJCUserLoginServiceImpl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
findCurrentDDLLockOwner()
List<com.im.df.api.support.DFUserLoginInfo>
getAllLogins()
protected com.im.ijcs.api.ddl.DDLService
getDdlService()
protected com.chemaxon.ijc.db.dao.schema.api.IjcItemInventoryDao
getItemInventoryDao()
com.im.df.api.support.DFUserLoginInfo
getLogin(String username)
com.im.ijcs.api.util.DFUser
getMe()
org.springframework.security.core.GrantedAuthority[]
getMyRoles()
protected String
getSchemaId()
protected com.chemaxon.ijc.db.dao.schema.api.IjcUserLoginDao
getUserLoginDao()
void
injectWhoAmI(String username, org.springframework.security.core.GrantedAuthority[] roles)
TODO P4 - This is internal implementation method and TEMPORARY solution only - it should be passed to constructor.void
invalidate()
This method should be called when schema is beeing deleted.void
lockSchemaDDL()
void
loginMe()
Mark the user as logged in.void
logoutMe()
void
setDdlService(com.im.ijcs.api.ddl.DDLService ddlService)
void
unlockSchemaDDL()
String
whoAmI()
-
-
-
Field Detail
-
SCHEMA_EDITING_LOCK_KEY
protected static final String SCHEMA_EDITING_LOCK_KEY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
IJCUserLoginServiceImpl
public IJCUserLoginServiceImpl(String schemaId, com.im.commons.db.DatabasePlatform platform)
Creates a new instance of IJCUserLoginServiceImpl.
-
-
Method Detail
-
getDdlService
protected final com.im.ijcs.api.ddl.DDLService getDdlService()
-
getSchemaId
protected final String getSchemaId()
-
getAllLogins
@Transactional(readOnly=true) public final List<com.im.df.api.support.DFUserLoginInfo> getAllLogins()
- Specified by:
getAllLogins
in interfacecom.im.df.api.capabilities.IJCUserLoginService
-
getLogin
@Transactional(readOnly=true) public final com.im.df.api.support.DFUserLoginInfo getLogin(String username)
- Specified by:
getLogin
in interfacecom.im.df.api.capabilities.IJCUserLoginService
-
whoAmI
public final String whoAmI()
- Specified by:
whoAmI
in interfacecom.im.df.api.capabilities.IJCUserLoginService
-
getMyRoles
public final org.springframework.security.core.GrantedAuthority[] getMyRoles()
- Specified by:
getMyRoles
in interfacecom.im.df.api.capabilities.IJCUserLoginService
-
getMe
public final com.im.ijcs.api.util.DFUser getMe()
- Specified by:
getMe
in interfacecom.im.df.api.capabilities.IJCUserLoginService
-
injectWhoAmI
public final void injectWhoAmI(String username, org.springframework.security.core.GrantedAuthority[] roles)
TODO P4 - This is internal implementation method and TEMPORARY solution only - it should be passed to constructor. Tim, is it possible to do it? We would probably need to update application context after user specifies username? [Petr H.] No, not a good solution, as this assumes username is known at the start and is constant throughout life cycle, which would be a bad assumption. This information should not be obtained from the service [Tim].- Specified by:
injectWhoAmI
in interfaceIJCUserLoginServiceEx
-
invalidate
public void invalidate()
This method should be called when schema is beeing deleted. Once this flag is set then it's impossible to change it back to valid again. This validity flag is used during logout - invalid schema doesn't clean its DDL lock, because this is happening when the IJC metadata DB table is already deleted from database. See FS#6739- Specified by:
invalidate
in interfaceIJCUserLoginServiceEx
-
getUserLoginDao
protected final com.chemaxon.ijc.db.dao.schema.api.IjcUserLoginDao getUserLoginDao()
-
getItemInventoryDao
protected final com.chemaxon.ijc.db.dao.schema.api.IjcItemInventoryDao getItemInventoryDao()
-
loginMe
public final void loginMe()
Mark the user as logged in. If the user does not have an entry in IJC_USER table then one will be created.- Specified by:
loginMe
in interfaceIJCUserLoginServiceEx
- Throws:
AlreadyLoggedException
-
logoutMe
public final void logoutMe()
- Specified by:
logoutMe
in interfaceIJCUserLoginServiceEx
-
findCurrentDDLLockOwner
public final String findCurrentDDLLockOwner()
- Specified by:
findCurrentDDLLockOwner
in interfacecom.im.df.api.capabilities.IJCUserLoginService
-
lockSchemaDDL
public final void lockSchemaDDL()
- Specified by:
lockSchemaDDL
in interfaceIJCUserLoginServiceEx
-
unlockSchemaDDL
public final void unlockSchemaDDL()
- Specified by:
unlockSchemaDDL
in interfaceIJCUserLoginServiceEx
-
setDdlService
public final void setDdlService(com.im.ijcs.api.ddl.DDLService ddlService)
-
-