com.cbse.jeasy
Class JEStore

java.lang.Object
  extended by com.cbse.jeasy.JEObject
      extended by com.cbse.jeasy.JEStore

public class JEStore
extends JEObject

An store is like a table where each row is an JEMessage.

You can read and write rows in stores by using a unique key, an index or none. The store and its rows are stored in a file defined by url. Write means save the message and its components in the store.

Read will fill the message from the store. Often a message is the serialisation of a form. Then it is very easy to store all datafields of this form in a store.

Properties
namevaluescomment
id*Id of the object. Let it begin with ST_
url*The url or filename where the store is hold
message*The id of the JEMessage
key This entry has to be unique for each message. So each write will overwrite a complete message with the same key.
JEObject The key is an entry of a JEObject for example an JEDatafield.
modeREADONLYWhen set to READONLY the entrys of this store can`t be changed.
* = property you have to set; bold = default value

Version:
%I%, %G%
Author:
H.Pfohl

Field Summary
static int INSIDE
          Specifies that brackets should not be set.
static int ONLY_FILLED
          Specifies that empty elements should not be get.
 
Fields inherited from class com.cbse.jeasy.JEObject
DEVELOPPING, INPUT_ERROR_DATE, INPUT_ERROR_LENGTH, INPUT_ERROR_MANDATORY, INPUT_ERROR_PARSE, INPUT_ERROR_RANGE, INPUT_ERROR_TIME, INPUT_ERRORS, NO_INPUT_ERROR, RUNNING
 
Constructor Summary
JEStore()
           
JEStore(java.lang.String s)
          Reads the properties from a string.
 
Method Summary
 void closeStore()
          Close the file.
 int deleteStore()
          Deletes the message in the store.
 int deleteStore(int number)
          It will delete the entry of this number in the url.
 void disableKey()
          Read and Write will not use the key definied in the store.
 void enableKey()
          Read and Write will use the key definied in the store.
 int getLastRead()
          Gets the number of the last read entry.
 int openStore()
          Opens the file defined by url.
 java.lang.String readStore()
          Reads the message in the store.
 java.lang.String readStore(int number)
          Looks for the section in the file.
 java.lang.String readStoreLast()
          Reads the last message in the store.
 java.lang.String readStoreNext()
          Reads the next message in the store.
 java.lang.String readStorePrevious()
          Reads the previous message in the store.
 java.lang.String searchStore()
          It will fill the message defined in store and searches matching entrys in the url.
 java.lang.String searchStoreNext()
          It will fill the message defined in store and searches matching entrys in the url.
 void setKey(java.lang.String k)
          Sets the unique key.
 void setUrl(java.lang.String u)
          Sets the url.
 int updateStore()
          It will fill the message defined in store and updates it in the url.
 int writeStore()
          It will fill the message defined in store and write it to the url.
 
Methods inherited from class com.cbse.jeasy.JEObject
backupEntry, clear, deserializeValue, getApplet, getApplLocale, getCenter, getComponent, getEast, getElementAt, getElementSize, getId, getJCallBack, getJClass, getLabel, getMode, getName, getNorth, getObjLocale, getParentId, getPreview, getProjectDirectory, getProperty, getRegisterText, getSouth, getStarted, getTitle, getType, getWest, getXMLtag, isEditable, isEnabled, isEnterprise, isProfessional, isStandard, isVisible, JEadd, JEadd, JEadd, JEadd, JEadd, JEadd, JEadd, JEadd, JEadd, JEadd, JEadd, JEaddTab, removeProperties, removeProperty, restoreEntry, serializeValue, setApplet, setApplLocale, setEditable, setEditable, setEnabled, setEnabled, setFocus, setJCallBack, setMarkable, setMarkable, setMode, setObjLocale, setParentId, setPreview, setProjectDirectory, setProperty, setStarted, setVisible, setVisible, start, wasEntryChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSIDE

public static final int INSIDE
Specifies that brackets should not be set.

See Also:
Constant Field Values

ONLY_FILLED

public static final int ONLY_FILLED
Specifies that empty elements should not be get.

See Also:
Constant Field Values
Constructor Detail

JEStore

public JEStore(java.lang.String s)
Reads the properties from a string.

Parameters:
s - contains properties and values
See Also:
JE#PropertyString

JEStore

public JEStore()
Method Detail

getLastRead

public int getLastRead()
Gets the number of the last read entry.

Returns:
entry number

setKey

public void setKey(java.lang.String k)
Sets the unique key.


enableKey

public void enableKey()
Read and Write will use the key definied in the store.


disableKey

public void disableKey()
Read and Write will not use the key definied in the store.


setUrl

public void setUrl(java.lang.String u)
Sets the url.


openStore

public int openStore()
              throws java.io.IOException
Opens the file defined by url.

Throws:
java.io.IOException - when opening is not possible

closeStore

public void closeStore()
Close the file.


readStore

public java.lang.String readStore()
                           throws java.io.IOException
Reads the message in the store.

If a key is defined, it will use this key to find the exact entry

Returns:
messagestring
Throws:
java.io.IOException

readStoreNext

public java.lang.String readStoreNext()
                               throws java.io.IOException
Reads the next message in the store.

Returns:
Throws:
java.io.IOException

readStorePrevious

public java.lang.String readStorePrevious()
                                   throws java.io.IOException
Reads the previous message in the store.

Returns:
Throws:
java.io.IOException

readStoreLast

public java.lang.String readStoreLast()
                               throws java.io.IOException
Reads the last message in the store.

Returns:
Throws:
java.io.IOException

readStore

public java.lang.String readStore(int number)
                           throws java.io.IOException
Looks for the section in the file. If the entry which map the keyvalue is the number number, it will be stored in the message. If the given number is higher than the found entrys null will be returned. If number == -1 the last entry will be stored.

Throws:
java.io.IOException - when reading in file is not possible

writeStore

public int writeStore()
               throws java.io.IOException
It will fill the message defined in store and write it to the url. If the key matches with an existing message it will be overwritten.

Returns:
-1 could not write
Throws:
java.io.IOException

updateStore

public int updateStore()
                throws java.io.IOException
It will fill the message defined in store and updates it in the url.

Returns:
-1 could not write
Throws:
java.io.IOException

searchStore

public java.lang.String searchStore()
                             throws java.io.IOException
It will fill the message defined in store and searches matching entrys in the url. Matching means finding the entrys in the message as substrings in the store

Returns:
Throws:
java.io.IOException

searchStoreNext

public java.lang.String searchStoreNext()
                                 throws java.io.IOException
It will fill the message defined in store and searches matching entrys in the url. Matching means finding the entrys in the message as substrings in the store

Returns:
Throws:
java.io.IOException

deleteStore

public int deleteStore()
                throws java.io.IOException
Deletes the message in the store.

If a key is defined, it will use this key to find the exact entry

Returns:
messagestring
Throws:
java.io.IOException

deleteStore

public int deleteStore(int number)
                throws java.io.IOException
It will delete the entry of this number in the url.

Returns:
-1 could not delete
Throws:
java.io.IOException