se.sj.stina.domain.provider
Class SjDictionary

java.lang.Object
  extended by se.sj.stina.domain.provider.SjDictionary
All Implemented Interfaces:
java.io.Serializable

public class SjDictionary
extends java.lang.Object
implements java.io.Serializable

Represents code / plaintext lists as a dictionary divided in sections.

Version:
$Revision: 1 $, $Date: 05-06-01 17:55 $
Author:
Per Lindberger
See Also:
Serialized Form

Constructor Summary
SjDictionary()
          Constructs an empty SjDictionary object.
SjDictionary(TiTransferPairsInterface aTPCodePlaintextData)
          Constructs a SjDictionary object.
SjDictionary(TiTransferPairsInterface aTPCodePlaintextData, TiCrossReference crossReference)
          Constructs a SjDictionary object.
 
Method Summary
 void addSection(java.lang.String sectionName, TiTransferValuesInterface aTVCodePlaintextList)
          Adds a section to the dictionary.
 void addSections(TiTransferPairsInterface aTPCodePlaintextData)
          Adds sections to the dictionary.
 boolean contains(java.lang.String sectionName)
          Tests if the dictionary contains a section with the specified name.
 java.lang.Object get(java.util.Vector keys, java.lang.Object codes)
          Looks up entries for codes in a specified section.
 java.lang.Object get(java.util.Vector keys, java.lang.Object codes, boolean useXRef)
           
 java.lang.String get(java.util.Vector keys, java.lang.String key)
          Looks up the entry for a key in a specified section.
 java.util.HashMap getEntries(java.lang.String sectionName, java.util.Vector keys)
          Looks up entries from a named section.
 java.util.Vector getKeys(java.lang.String sectionName)
          Looks up the keys of an entire section given its name.
 java.util.HashMap getSection(java.lang.String sectionName)
          Looks up an entire section by name.
 java.lang.String getText(java.lang.String sectionName, java.lang.String key)
          Looks up the entry for a key in a specified section.
 java.util.Vector getTexts(java.lang.String sectionName, java.util.Vector keys)
           
 java.util.Set sections()
          Table of contents for the dictionary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SjDictionary

public SjDictionary(TiTransferPairsInterface aTPCodePlaintextData)
Constructs a SjDictionary object. The sections in the dictionary will bear the same names as the CodePlaintextLists found in the input structure.

Parameters:
aTPCodePlaintextData - A transferpairs structure similar to the one resulting from a call to SJPSession::getCodePlaintextData().

SjDictionary

public SjDictionary(TiTransferPairsInterface aTPCodePlaintextData,
                    TiCrossReference crossReference)
Constructs a SjDictionary object. The sections in the dictionary will bear the same names as the CodePlaintextLists found in the input structure.

Parameters:
aTPCodePlaintextData - A transferpairs structure similar to the one resulting from a call to SJPSession::getCodePlaintextData().
crossReference - The cross reference object to use for translating long names into the short (transfer) variety.

SjDictionary

public SjDictionary()
Constructs an empty SjDictionary object.

Method Detail

addSections

public void addSections(TiTransferPairsInterface aTPCodePlaintextData)
Adds sections to the dictionary. The sections added to the dictionary will bear the same names as the CodePlaintextLists found in the input structure. If the dictionary already contains a section with the same name as one found in the input structure, it will be replaced.

Parameters:
aTPCodePlaintextData - A transferpairs structure similar to the one resulting from a call to SJPSession::getCodePlaintextData().

addSection

public void addSection(java.lang.String sectionName,
                       TiTransferValuesInterface aTVCodePlaintextList)
Adds a section to the dictionary. If the dictionary already contains a section with the specified name, it will be replaced.

Parameters:
sectionName - A String naming the section for later retrieval.
aTVCodePlaintextList - A transfervalues structure corresponding to the SJP business structure CodePlainTextList.

contains

public boolean contains(java.lang.String sectionName)
Tests if the dictionary contains a section with the specified name.

Parameters:
sectionName - A String to test for.
Returns:
true if the dictionary contains a section with the specified name, false otherwise.

sections

public java.util.Set sections()
Table of contents for the dictionary.

Returns:
An Enumeration of the names of the sections currently in the dictionary.

get

public java.lang.String get(java.util.Vector keys,
                            java.lang.String key)
Looks up the entry for a key in a specified section.

Parameters:
keys - A Vector of Strings naming the section in which to look for the entry as the second element
key - A String representing the code for the sought entry.
Returns:
The requested entry if found, otherwise an empty (non-null) String

getText

public java.lang.String getText(java.lang.String sectionName,
                                java.lang.String key)
Looks up the entry for a key in a specified section.

Parameters:
sectionName - A String naming the section in which to look for the entry.
key - A String representing the code for the sought entry.
Returns:
The requested entry if found, otherwise an empty (non-null) String

get

public java.lang.Object get(java.util.Vector keys,
                            java.lang.Object codes)
Looks up entries for codes in a specified section.

Parameters:
codes - A Vector of Strings where third string represents the section in which to look for the codes. Rest of elements representing the code to lookup corresponding string.
Returns:
The requested entries if found, otherwise an empty (non-null) String

getTexts

public java.util.Vector getTexts(java.lang.String sectionName,
                                 java.util.Vector keys)

get

public java.lang.Object get(java.util.Vector keys,
                            java.lang.Object codes,
                            boolean useXRef)

getSection

public java.util.HashMap getSection(java.lang.String sectionName)
Looks up an entire section by name.

Parameters:
sectionName - A String naming the section to look for.
Returns:
A copy of the requested section if found, null otherwise.

getEntries

public java.util.HashMap getEntries(java.lang.String sectionName,
                                    java.util.Vector keys)
Looks up entries from a named section.

Parameters:
sectionName - A String naming the section in which to look for entries.
keys - A Vector of Strings naming the keys of entries to look for.
Returns:
A Hashmap containg the entries that were found.

getKeys

public java.util.Vector getKeys(java.lang.String sectionName)
Looks up the keys of an entire section given its name.

Parameters:
sectionName - A String naming the section to look for.
Returns:
A Vector of the the keys of the named section if found, an empty Vector otherwise.


Copyright © 2012. All Rights Reserved.