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 SrvLogin
fLogin
protected java.lang.String
fModelName
protected K_ADMODEL
fModelType
protected RepositoryServer
fRepositoryServer
protected java.lang.String
versionName
-
Constructor Summary
Constructors Modifier Constructor Description 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.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ExcellenceModel
asExcellenceModel()
Converts this model instance to an ExcellenceModel.void
beginCommandSequence(java.lang.String commandName)
abstract void
delete(java.lang.String pwd)
Deletes a model from a repository server.void
endCommandSequence()
boolean
equals(SrvContext obj)
java.lang.String
getCommandSequenceId()
java.lang.String
getCommandSequenceName()
protected java.util.List<java.lang.String>
getLicUserRoleList(InoUser inoUser)
SrvLogin
getLogin()
java.lang.String
getModelName()
Gets the name of the model.K_ADMODEL
getModelType()
RepositoryServer
getRepositoryServer()
Gets the repository server instance which the model corresponds to.SrvConnection
getSrvConnection()
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.String
getVersionName()
Gets the version name of the model.boolean
hasLogin()
Checks if the model contains any kind of login.protected boolean
isSingleSignOn()
boolean
isVersion()
Checks if the model is a version model.abstract void
loginModelAdmin()
Login as model administrator with name and password.abstract void
loginModelAdmin(java.lang.String aUserName, java.lang.String pwd)
Login as model administrator with name and password.abstract void
loginModelGuest(java.lang.String pwd)
Login as model guest with password.abstract void
loginSuperUser(java.lang.Boolean login, java.lang.String pwd)
Switch superuser mode for login.abstract void
loginUser(java.lang.String aUserName, java.lang.String aCleartextPassword, java.lang.String role)
Login as normal user with name and password.abstract void
logout()
Logout any user from the model.protected void
registerModelAtLicServer()
abstract boolean
tryReLogin(K_LOGINKIND loginKind, java.lang.String loginName)
Checks if the given user has a login with the same display.abstract boolean
tryReLogin(java.lang.String aUserName)
Checks if the given user has a login with the same display.protected void
unregisterModelAtLicServer()
-
-
-
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:
getSrvConnection
in interfaceSrvContext
- Returns:
- the server connection for the model
-
getLogin
public SrvLogin getLogin()
- Specified by:
getLogin
in 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
ExcellenceModel
or null
-
getUsers
public abstract java.util.List<InoUser> getUsers() throws InoNetException, SrvErrorException
Gets the list of available users.- Returns:
- list of users
- Throws:
InoNetException
SrvErrorException
-
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:
InoNetException
SrvErrorException
-
getLicUserRoleList
protected java.util.List<java.lang.String> getLicUserRoleList(InoUser inoUser) throws InoNetException, SrvErrorException
- Throws:
InoNetException
SrvErrorException
-
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, SrvErrorException
Login 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:
InoNetException
SrvErrorException
-
tryReLogin
public abstract boolean tryReLogin(java.lang.String aUserName) 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:
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:
InoNetException
SrvErrorException
-
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:
InoNetException
SrvErrorException
-
loginModelAdmin
public abstract void loginModelAdmin(java.lang.String aUserName, java.lang.String pwd) throws InoNetException, SrvErrorException
Login 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:
InoNetException
SrvErrorException
-
loginModelAdmin
public abstract void loginModelAdmin() throws InoNetException, SrvErrorException
Login 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:
InoNetException
SrvErrorException
-
loginModelGuest
public abstract void loginModelGuest(java.lang.String pwd) throws InoNetException, SrvErrorException
Login as model guest with password.- Parameters:
pwd
- the administrator's password- Throws:
InoNetException
SrvErrorException
-
loginSuperUser
public abstract void loginSuperUser(java.lang.Boolean login, java.lang.String pwd) throws InoNetException, SrvErrorException
Switch superuser mode for login.- Parameters:
login
- flag for log-in/outpwd
- the administrator's password- Throws:
InoNetException
SrvErrorException
-
logout
public abstract void logout() throws InoNetException, SrvErrorException
Logout any user from the model. This means that the ADModel instance cannot be used in further calls.- Throws:
InoNetException
SrvErrorException
-
delete
public abstract void delete(java.lang.String pwd) throws InoNetException, SrvErrorException
Deletes 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:
InoNetException
SrvErrorException
-
equals
public boolean equals(SrvContext obj)
- Specified by:
equals
in 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:
getCommandSequenceId
in interfaceSrvContext
-
getCommandSequenceName
public java.lang.String getCommandSequenceName()
- Specified by:
getCommandSequenceName
in 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.
-
-