diff options
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java')
-rw-r--r-- | plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java index c0a54647490..063b999f10b 100644 --- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java +++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java @@ -29,61 +29,61 @@ import org.eclipse.osee.framework.jdk.core.util.Strings; * @author Roberto E. Escobar */ public final class SessionFactory implements IOseeTypeFactory { - private final BuildTypeIdentifier typeIdentifier; + private final BuildTypeIdentifier typeIdentifier; - public SessionFactory(BuildTypeIdentifier typeIdentifier) { - this.typeIdentifier = typeIdentifier; - } + public SessionFactory(BuildTypeIdentifier typeIdentifier) { + this.typeIdentifier = typeIdentifier; + } - public Session createOrUpdate(IOseeCache<Session> cache, int uniqueId, StorageState storageState, String guid, String userId, Date creationDate, String managedByServerId, String clientVersion, String clientMachineName, String clientAddress, int clientPort, Date lastInteractionDate, String lastInteractionDetails) throws OseeCoreException { - Session session = cache.getById(uniqueId); - if (session == null) { - session = - create(guid, userId, creationDate, managedByServerId, clientVersion, clientMachineName, - clientAddress, clientPort, lastInteractionDate, lastInteractionDetails); - session.setId(uniqueId); - session.setStorageState(storageState); - } else { - cache.decache(session); - session.setClientMachineName(clientMachineName); - session.setClientAddress(clientAddress); - session.setClientPort(clientPort); - session.setLastInteractionDate(lastInteractionDate); - session.setLastInteractionDetails(lastInteractionDetails); - } - cache.cache(session); - return session; - } + public Session createOrUpdate(IOseeCache<Session> cache, int uniqueId, StorageState storageState, String guid, String userId, Date creationDate, String managedByServerId, String clientVersion, String clientMachineName, String clientAddress, int clientPort, Date lastInteractionDate, String lastInteractionDetails) throws OseeCoreException { + Session session = cache.getById(uniqueId); + if (session == null) { + session = + create(guid, userId, creationDate, managedByServerId, clientVersion, clientMachineName, clientAddress, + clientPort, lastInteractionDate, lastInteractionDetails); + session.setId(uniqueId); + session.setStorageState(storageState); + } else { + cache.decache(session); + session.setClientMachineName(clientMachineName); + session.setClientAddress(clientAddress); + session.setClientPort(clientPort); + session.setLastInteractionDate(lastInteractionDate); + session.setLastInteractionDetails(lastInteractionDetails); + } + cache.cache(session); + return session; + } - public Session create(String guid, String userId, Date creationDate, String managedByServerId, String clientVersion, String clientMachineName, String clientAddress, int clientPort, Date lastInteractionDate, String lastInteractionDetails) { - return new Session(guid, guid, userId, creationDate, managedByServerId, clientVersion, clientMachineName, - clientAddress, clientPort, lastInteractionDate, lastInteractionDetails); - } + public Session create(String guid, String userId, Date creationDate, String managedByServerId, String clientVersion, String clientMachineName, String clientAddress, int clientPort, Date lastInteractionDate, String lastInteractionDetails) { + return new Session(guid, guid, userId, creationDate, managedByServerId, clientVersion, clientMachineName, + clientAddress, clientPort, lastInteractionDate, lastInteractionDetails); + } - public OseeSessionGrant createSessionGrant(Session session, IOseeUserInfo oseeUserInfo) throws OseeCoreException { - OseeSessionGrant sessionGrant = new OseeSessionGrant(session.getGuid()); - sessionGrant.setCreationRequired(oseeUserInfo.isCreationRequired()); - sessionGrant.setOseeUserInfo(oseeUserInfo); - sessionGrant.setDatabaseInfo(DatabaseInfoManager.getDefault()); - if (is_0_9_2_Compatible(session.getClientVersion())) { - sessionGrant.setSqlProperties(OseeSql.getSqlProperties(ConnectionHandler.getMetaData())); - } else { - sessionGrant.setSqlProperties(OseeSql_0_9_1.getSqlProperties(ConnectionHandler.getMetaData())); - } - sessionGrant.setDataStorePath(OseeServerProperties.getOseeApplicationServerData()); + public OseeSessionGrant createSessionGrant(Session session, IOseeUserInfo oseeUserInfo) throws OseeCoreException { + OseeSessionGrant sessionGrant = new OseeSessionGrant(session.getGuid()); + sessionGrant.setCreationRequired(oseeUserInfo.isCreationRequired()); + sessionGrant.setOseeUserInfo(oseeUserInfo); + sessionGrant.setDatabaseInfo(DatabaseInfoManager.getDefault()); + if (is_0_9_2_Compatible(session.getClientVersion())) { + sessionGrant.setSqlProperties(OseeSql.getSqlProperties(ConnectionHandler.getMetaData())); + } else { + sessionGrant.setSqlProperties(OseeSql_0_9_1.getSqlProperties(ConnectionHandler.getMetaData())); + } + sessionGrant.setDataStorePath(OseeServerProperties.getOseeApplicationServerData()); - sessionGrant.setClientBuildDesination(typeIdentifier.getBuildDesignation(session.getClientVersion())); - return sessionGrant; - } + sessionGrant.setClientBuildDesination(typeIdentifier.getBuildDesignation(session.getClientVersion())); + return sessionGrant; + } - private static boolean is_0_9_2_Compatible(String clientVersion) { - boolean result = false; - if (Strings.isValid(clientVersion)) { - String toCheck = clientVersion.toLowerCase(); - if (!toCheck.startsWith("0.9.0") && !toCheck.startsWith("0.9.1")) { - result = true; - } - } - return result; - } + private static boolean is_0_9_2_Compatible(String clientVersion) { + boolean result = false; + if (Strings.isValid(clientVersion)) { + String toCheck = clientVersion.toLowerCase(); + if (!toCheck.startsWith("0.9.0") && !toCheck.startsWith("0.9.1")) { + result = true; + } + } + return result; + } } |