Initial commit from SVN.
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
package com.foundation.web.model;
|
||||
|
||||
import java.util.Date;
|
||||
import com.foundation.application.IApplication;
|
||||
import com.foundation.model.Model;
|
||||
import com.foundation.metadata.Attribute;
|
||||
|
||||
/**
|
||||
* Used to store the session data in the repository for the application.
|
||||
* Sample SQL to setup the table:
|
||||
<pre>CREATE TABLE `doyd`.`session_store` (
|
||||
`server_id` INTEGER UNSIGNED NOT NULL,
|
||||
`session_id` BIGINT UNSIGNED NOT NULL,
|
||||
`sequence_id` SMALLINT UNSIGNED NOT NULL,
|
||||
`session_data` BLOB,
|
||||
`update_timestamp` TIMESTAMP,
|
||||
PRIMARY KEY (`server_id`, `session_id`, `sequence_id`)
|
||||
)
|
||||
ENGINE = InnoDB;</pre>
|
||||
* Sample repository metadata:
|
||||
<pre><class name='com.foundation.web.model.SessionStore' repository-name='SESSION_STORE'>
|
||||
<attribute name='serverId' type='Integer' repository-name='SERVER_ID' repository-type='INT' is-key='true' is-auto-generated='false'/>
|
||||
<attribute name='sessionId' type='Long' repository-name='SESSION_ID' repository-type='BIGINT' is-key='true' is-auto-generated='false'/>
|
||||
<attribute name='sequenceId' type='Short' repository-name='SEQUENCE_ID' repository-type='SMALLINT' is-key='true' is-auto-generated='false'/>
|
||||
<attribute name='sessionData' type='byte[]' repository-name='SESSION_DATA' repository-type='BLOB'/>
|
||||
<attribute name='updateTimestamp' type='java.util.Date' repository-name='UPDATE_TIMESTAMP' repository-type='TIMESTAMP'/>
|
||||
<properties/>
|
||||
</class></pre>
|
||||
*/
|
||||
public class SessionStore extends Model {
|
||||
public static final Attribute SERVER_ID = registerAttribute(SessionStore.class, "serverId");
|
||||
public static final Attribute SESSION_ID = registerAttribute(SessionStore.class, "sessionId");
|
||||
public static final Attribute SEQUENCE_ID = registerAttribute(SessionStore.class, "sequenceId");
|
||||
public static final Attribute SESSION_DATA = registerAttribute(SessionStore.class, "sessionData");
|
||||
public static final Attribute UPDATE_TIMESTAMP = registerAttribute(SessionStore.class, "updateTimestamp");
|
||||
private IApplication application = null;
|
||||
/**
|
||||
* SessionStore constructor.
|
||||
*/
|
||||
public SessionStore() {
|
||||
}//SessionStore()//
|
||||
/**
|
||||
* SessionStore constructor.
|
||||
*/
|
||||
public SessionStore(IApplication application) {
|
||||
this.application = application;
|
||||
}//SessionStore()//
|
||||
/**
|
||||
* SessionStore constructor.
|
||||
*/
|
||||
public SessionStore(IApplication application, Integer serverId, Long sessionId, Short sequenceId) {
|
||||
this.application = application;
|
||||
setServerId(serverId);
|
||||
setSessionId(sessionId);
|
||||
setSequenceId(sequenceId);
|
||||
}//SessionStore()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#getApplication()
|
||||
*/
|
||||
public IApplication getApplication() {
|
||||
return application;
|
||||
}//getApplication()//
|
||||
/**
|
||||
* Sets the application providing services to this model.
|
||||
* @param application The application providing services.
|
||||
*/
|
||||
public void setApplication(IApplication application) {
|
||||
this.application = application;
|
||||
}//setApplication()//
|
||||
/**
|
||||
* Gets the serverId value.
|
||||
* @return The serverId value.
|
||||
*/
|
||||
public Integer getServerId() {
|
||||
return (Integer) getAttributeValue(SERVER_ID);
|
||||
}//getServerId()//
|
||||
/**
|
||||
* Sets the serverId value.
|
||||
* @param serverId The serverId value.
|
||||
*/
|
||||
public void setServerId(Integer serverId) {
|
||||
setAttributeValue(SERVER_ID, serverId);
|
||||
}//setServerId()//
|
||||
/**
|
||||
* Gets the sessionId value.
|
||||
* @return The sessionId value.
|
||||
*/
|
||||
public Long getSessionId() {
|
||||
return (Long) getAttributeValue(SESSION_ID);
|
||||
}//getSessionId()//
|
||||
/**
|
||||
* Sets the sessionId value.
|
||||
* @param sessionId The sessionId value.
|
||||
*/
|
||||
public void setSessionId(Long sessionId) {
|
||||
setAttributeValue(SESSION_ID, sessionId);
|
||||
}//setSessionId()//
|
||||
/**
|
||||
* Gets the sequenceId value.
|
||||
* @return The sequenceId value.
|
||||
*/
|
||||
public Short getSequenceId() {
|
||||
return (Short) getAttributeValue(SEQUENCE_ID);
|
||||
}//getSequenceId()//
|
||||
/**
|
||||
* Sets the sequenceId value.
|
||||
* @param sequenceId The sequenceId value.
|
||||
*/
|
||||
public void setSequenceId(Short sequenceId) {
|
||||
setAttributeValue(SEQUENCE_ID, sequenceId);
|
||||
}//setSequenceId()//
|
||||
/**
|
||||
* Gets the sessionData value.
|
||||
* @return The sessionData value.
|
||||
*/
|
||||
public byte[] getSessionData() {
|
||||
return (byte[]) getAttributeValue(SESSION_DATA);
|
||||
}//getSessionData()//
|
||||
/**
|
||||
* Sets the sessionData value.
|
||||
* @param sessionData The sessionData value.
|
||||
*/
|
||||
public void setSessionData(byte[] sessionData) {
|
||||
setAttributeValue(SESSION_DATA, sessionData);
|
||||
}//setSessionData()//
|
||||
/**
|
||||
* Gets the updateTimestamp value.
|
||||
* @return The updateTimestamp value.
|
||||
*/
|
||||
public Date getUpdateTimestamp() {
|
||||
return (Date) getAttributeValue(UPDATE_TIMESTAMP);
|
||||
}//getUpdateTimestamp()//
|
||||
/**
|
||||
* Sets the updateTimestamp value.
|
||||
* @param updateTimestamp The updateTimestamp value.
|
||||
*/
|
||||
public void setUpdateTimestamp(Date updateTimestamp) {
|
||||
setAttributeValue(UPDATE_TIMESTAMP, updateTimestamp);
|
||||
}//setUpdateTimestamp()//
|
||||
}//SessionStore//
|
||||
Reference in New Issue
Block a user