/*
* This software and supporting documentation were developed by
*
* Siemens Corporate Technology
* Competence Center Knowledge Management and Business Transformation
* D-81730 Munich, Germany
*
* Authors (representing a really great team ;-) )
* Stefan B. Augustin, Thorbj�rn Hansen, Manfred Langen
*
* This software is Open Source under GNU General Public License (GPL).
* Read the text of this license in LICENSE.TXT
* or look at www.opensource.org/licenses/
*
* Once more we emphasize, that:
* THIS SOFTWARE IS MADE AVAILABLE, AS IS, WITHOUT ANY WARRANTY
* REGARDING THE SOFTWARE, ITS PERFORMANCE OR
* FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR
* ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND
* PERFORMANCE OF THE SOFTWARE IS WITH THE USER.
*
*/
// Attribute
// Package
package appl.Portal.DB;
// Imports
// This application/module packages
// Other application/module packages
// KFM packages
import KFM.Exceptions.ProgrammerException;
// Java packages
/** Store the scheme-data for a generic attribute.
*
* <P>Will be extended to contain type and cardinality information.</P>
*
*
* <H2>Usage</H2>
*
* <P>Usage.</P>
*
*
* <H2>Related classes</H2>
*
* <P>No cut&paste-source.</P>
*
* @author ThH
* @version 0.1 (99.10.13)
*/
public class Attribute
{
// ************************************************************
// Constants
// ************************************************************
/**
* Enumeration for possible storage types.
* Public, because AttributesContainer needs convenience access (package access better ?)
*/
public static final byte /*enum Storage*/
inlined = 1,
dedicated = 2,
hashed = 3;
// ************************************************************
// Variables
// ************************************************************
/** Storage type, contains one of the storage type enums above. */
protected byte mStorageType;
/** Internal name, e.g. `SourceAuthor�. */
protected String mId;
/** Name displayed in the GUI, e.g. `Name des Autors�. */
protected String mGuiName;
/** Required or optional?
*
* Later on, we might have cardinality information here, but accessor `required� will always exist.
*/
protected boolean mRequired;
// Later:
// Type, permitted values (Wertebereich), help text.
// ************************************************************
// Methods
// ************************************************************
/**
* @param aStorage One of the 3 storage enums `inlined�, `dedicated�, `hashed�.
*/
public Attribute (
byte /*enum Storage*/ aStorageType,
String aId,
String aGuiName,
boolean aRequired) // Might change to cardinality later.
{
if(aStorageType != inlined && aStorageType != dedicated && aStorageType != hashed) {
throw new ProgrammerException("Attribute::Attribute: Illegal storage type.");
}
mStorageType = aStorageType;
mId = aId;
mGuiName = aGuiName;
mRequired = aRequired;
}
// ************************************************************
// Access methods
// ************************************************************
/** Inlined storage? */
public boolean isInlined () { return mStorageType == inlined; }
/** Dedicated storage? */
public boolean isDedicated () { return mStorageType == dedicated; }
/** Hashed storage? */
public boolean isHashed () { return mStorageType == hashed; }
/**
* @deprecated
* @see isInlined
*/
public boolean inlined () { return isInlined(); }
/**
* @deprecated
* @see isDedicated
*/
public boolean dedicated () { return isDedicated(); }
/**
* @deprecated
* @see isHashed
*/
public boolean hashed () { return isHashed(); }
/** Get Id. */
public String getId () { return mId; }
/** Get GUI Name. */
public String getGuiName () { return mGuiName; }
/** Required?
* If we change this class to have cardinality info, this method should remain.
*/
public boolean isRequired () { return mRequired; }
}