Package de.mid.innovator.srv
Class Model
- java.lang.Object
-
- de.mid.innovator.srv.Model
-
- All Implemented Interfaces:
SrvContext
- Direct Known Subclasses:
ExcellenceModel
public abstract class Model extends java.lang.Object implements SrvContext
The class represents an Innovator UML 2 model. It supports basic functions like login and logout, keeps the association to its repository server and provides the entry point to the ADModel.
-
-
Field Summary
Fields Modifier and Type Field Description protected SrvLoginfLoginprotected java.lang.StringfModelNameprotected K_ADMODELfModelTypeprotected RepositoryServerfRepositoryServerprotected java.lang.StringversionName
-
Constructor Summary
Constructors Modifier Constructor Description protectedModel(RepositoryServer server, java.lang.String name, K_ADMODEL modelType)protected constructor for internal use only pleas useRepositoryServer.createModel(String, K_ADMODEL, String, String, String, List)to create a new Innovator model.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ExcellenceModelasExcellenceModel()Converts this model instance to an ExcellenceModel.voidbeginCommandSequence(java.lang.String commandName)abstract voiddelete(java.lang.String pwd)Deletes a model from a repository server.voidendCommandSequence()booleanequals(SrvContext obj)java.lang.StringgetCommandSequenceId()java.lang.StringgetCommandSequenceName()protected java.util.List<java.lang.String>getLicUserRoleList(InoUser inoUser)SrvLogingetLogin()java.lang.StringgetModelName()Gets the name of the model.K_ADMODELgetModelType()RepositoryServergetRepositoryServer()Gets the repository server instance which the model corresponds to.SrvConnectiongetSrvConnection()protected byte[]getSSOUserCookie(InoUser inoUser)protected java.util.List<InoUser>getSSOUsers()abstract java.util.List<java.lang.String>getUserRoleList(InoUser inoUser)Fetch the possible rolesabstract java.util.List<InoUser>getUsers()Gets the list of available users.java.lang.StringgetVersionName()Gets the version name of the model.booleanhasLogin()Checks if the model contains any kind of login.protected booleanisSingleSignOn()booleanisVersion()Checks if the model is a version model.abstract voidloginModelAdmin()Login as model administrator with name and password.abstract voidloginModelAdmin(java.lang.String aUserName, java.lang.String pwd)Login as model administrator with name and password.abstract voidloginModelGuest(java.lang.String pwd)Login as model guest with password.abstract voidloginSuperUser(java.lang.Boolean login, java.lang.String pwd)Switch superuser mode for login.abstract voidloginUser(java.lang.String aUserName, java.lang.String aCleartextPassword, java.lang.String role)Login as normal user with name and password.abstract voidlogout()Logout any user from the model.protected voidregisterModelAtLicServer()abstract booleantryReLogin(K_LOGINKIND loginKind, java.lang.String loginName)Checks if the given user has a login with the same display.abstract booleantryReLogin(java.lang.String aUserName)Checks if the given user has a login with the same display.protected voidunregisterModelAtLicServer()
-
-
-
Field Detail
-
fModelType
protected K_ADMODEL fModelType
-
fLogin
protected SrvLogin fLogin
-
fModelName
protected java.lang.String fModelName
-
fRepositoryServer
protected RepositoryServer fRepositoryServer
-
versionName
protected java.lang.String versionName
-
-
Constructor Detail
-
Model
protected Model(RepositoryServer server, java.lang.String name, K_ADMODEL modelType)
protected constructor for internal use only pleas useRepositoryServer.createModel(String, K_ADMODEL, String, String, String, List)to create a new Innovator model.- Parameters:
server- the repository servername- NamemodelType- type of model
-
-
Method Detail
-
getModelType
public K_ADMODEL getModelType()
- Returns:
- the type of the model
-
getSrvConnection
public SrvConnection getSrvConnection()
- Specified by:
getSrvConnectionin interfaceSrvContext- Returns:
- the server connection for the model
-
getLogin
public SrvLogin getLogin()
- Specified by:
getLoginin interfaceSrvContext- Returns:
- the login instance or null if not logged-in.
-
hasLogin
public boolean hasLogin()
Checks if the model contains any kind of login.- Returns:
- true, if the model contains an ADLogin, otherwise false.
-
getModelName
public java.lang.String getModelName()
Gets the name of the model.- Returns:
- a name as a string
-
getRepositoryServer
public RepositoryServer getRepositoryServer()
Gets the repository server instance which the model corresponds to.- Returns:
- the repository server
-
asExcellenceModel
public ExcellenceModel asExcellenceModel()
Converts this model instance to an ExcellenceModel.- Returns:
- this casted to
ExcellenceModelor null
-
getUsers
public abstract java.util.List<InoUser> getUsers() throws InoNetException, SrvErrorException
Gets the list of available users.- Returns:
- list of users
- Throws:
InoNetExceptionSrvErrorException
-
getSSOUsers
protected java.util.List<InoUser> getSSOUsers() throws InoNetException
- Throws:
InoNetException
-
isSingleSignOn
protected boolean isSingleSignOn() throws InoNetException- Throws:
InoNetException
-
getUserRoleList
public abstract java.util.List<java.lang.String> getUserRoleList(InoUser inoUser) throws InoNetException, SrvErrorException
Fetch the possible roles- Parameters:
inoUser- the Innovator user- Throws:
InoNetExceptionSrvErrorException
-
getLicUserRoleList
protected java.util.List<java.lang.String> getLicUserRoleList(InoUser inoUser) throws InoNetException, SrvErrorException
- Throws:
InoNetExceptionSrvErrorException
-
getSSOUserCookie
protected byte[] getSSOUserCookie(InoUser inoUser) throws InoNetException
- Throws:
InoNetException
-
loginUser
public abstract void loginUser(java.lang.String aUserName, java.lang.String aCleartextPassword, java.lang.String role) throws InoNetException, SrvErrorExceptionLogin as normal user with name and password. If name is omitted (equal to "" or is null), the system user is used by callingSystemUtils.getSystemUser();- Parameters:
aUserName- the user name or null. If no name is given, the system user name is used.aCleartextPassword- a clear text password for this user or nullrole- the user's role or null. If no role is given, the user's role of the last successful login is used.- Throws:
InoNetExceptionSrvErrorException
-
tryReLogin
public abstract boolean tryReLogin(java.lang.String aUserName) throws InoNetException, SrvErrorExceptionChecks if the given user has a login with the same display. If so, the login can be reused. In this case, the model stores the existing login and the ADModel instance and changes its state to "logged-in".- Parameters:
aUserName- the user name to search for If null, all existing user logins and also guest and admin logins are checked- Returns:
- true, if a re-login was performed, otherwise false (a login then needs to be carried out).
- Throws:
InoNetExceptionSrvErrorException
-
tryReLogin
public abstract boolean tryReLogin(K_LOGINKIND loginKind, java.lang.String loginName) throws InoNetException, SrvErrorException
Checks if the given user has a login with the same display. If so, the login can be reused. In this case, the model stores the existing login and the ADModel instance and changes its state to "logged-in".- Parameters:
loginKind- the kind of loginloginName- the user name to search for- Returns:
- true, if a re-login was performed, otherwise false (a login then needs to be carried out).
- Throws:
InoNetExceptionSrvErrorException
-
loginModelAdmin
public abstract void loginModelAdmin(java.lang.String aUserName, java.lang.String pwd) throws InoNetException, SrvErrorExceptionLogin as model administrator with name and password. If name is omitted (equal to "" or is null), the system user is used by callingSystemUtils.getSystemUser();- Parameters:
aUserName- a user name as string or nullpwd- the administrator's password- Throws:
InoNetExceptionSrvErrorException
-
loginModelAdmin
public abstract void loginModelAdmin() throws InoNetException, SrvErrorExceptionLogin as model administrator with name and password. If name is omitted (equal to "" or is null), the system user is used by callingSystemUtils.getSystemUser();- Throws:
InoNetExceptionSrvErrorException
-
loginModelGuest
public abstract void loginModelGuest(java.lang.String pwd) throws InoNetException, SrvErrorExceptionLogin as model guest with password.- Parameters:
pwd- the administrator's password- Throws:
InoNetExceptionSrvErrorException
-
loginSuperUser
public abstract void loginSuperUser(java.lang.Boolean login, java.lang.String pwd) throws InoNetException, SrvErrorExceptionSwitch superuser mode for login.- Parameters:
login- flag for log-in/outpwd- the administrator's password- Throws:
InoNetExceptionSrvErrorException
-
logout
public abstract void logout() throws InoNetException, SrvErrorExceptionLogout any user from the model. This means that the ADModel instance cannot be used in further calls.- Throws:
InoNetExceptionSrvErrorException
-
delete
public abstract void delete(java.lang.String pwd) throws InoNetException, SrvErrorExceptionDeletes a model from a repository server. The corresponding server must be prepared for administration withRepositoryServer.repositoryAdminLogin(String)- Parameters:
pwd- the model's administrator password- Throws:
InoNetExceptionSrvErrorException
-
equals
public boolean equals(SrvContext obj)
- Specified by:
equalsin interfaceSrvContext- Returns:
- true, if the given server context is equal to the model, otherwise false
-
registerModelAtLicServer
protected void registerModelAtLicServer() throws InoNetException- Throws:
InoNetException
-
unregisterModelAtLicServer
protected void unregisterModelAtLicServer() throws InoNetException- Throws:
InoNetException
-
beginCommandSequence
public final void beginCommandSequence(java.lang.String commandName) throws SrvErrorException- Throws:
SrvErrorException
-
endCommandSequence
public final void endCommandSequence()
-
getCommandSequenceId
public java.lang.String getCommandSequenceId()
- Specified by:
getCommandSequenceIdin interfaceSrvContext
-
getCommandSequenceName
public java.lang.String getCommandSequenceName()
- Specified by:
getCommandSequenceNamein interfaceSrvContext
-
getVersionName
public java.lang.String getVersionName()
Gets the version name of the model.- Returns:
- a name as a string
-
isVersion
public boolean isVersion()
Checks if the model is a version model.- Returns:
- true, if the model is a version model.
-
-