public class AddAttributeAction extends LibrarySessionAction
The attributes of the new attribute are specified by properties. As a result, upgrade actions can often use this class as is, without needing to introduce an action-specific subclass.
Modifier and Type | Field and Description |
---|---|
protected static String |
PROPERTY_CLASS
The property whose string value is name of the CLASS value.
|
protected static String |
PROPERTY_CLASSDOMAIN
The property whose string value is name of the CLASSDOMAIN value.
|
protected static String |
PROPERTY_DATABASEOBJECTNAME
The property whose string value is the DATABASEOBJECTNAME value.
|
protected static String |
PROPERTY_DATALENGTH
The property whose integer value is the DATALENGTH value.
|
protected static String |
PROPERTY_DATASCALE
The property whose integer value is the DATASCALE value.
|
protected static String |
PROPERTY_DATATYPE
The property whose string value is the
label of the DATATYPE value. |
protected static String |
PROPERTY_DESCRIPTION
The property whose string value is DESCRIPTION value.
|
protected static String |
PROPERTY_INDEXED
The property whose boolean value is the INDEXED value.
|
protected static String |
PROPERTY_NAME
The property whose string value is the NAME value.
|
protected static String |
PROPERTY_REFERENTIALINTEGRITYRULE
The property whose string value is the
label of the REFERENTIALINTEGRITYRULE value. |
protected static String |
PROPERTY_REQUIRED
The property whose boolean value is the REQUIRED value.
|
protected static String |
PROPERTY_SETTABLE
The property whose boolean value is the SETTABLE value.
|
protected static String |
PROPERTY_UNIQUE
The property whose boolean value is the UNIQUE value.
|
protected static String |
PROPERTY_UPDATEABLE
The property whose boolean value is the UPDATEABLE value.
|
protected static String |
PROPERTY_VALUEDEFAULT
The property whose string value is name of the VALUEDEFAULT value.
|
protected static String |
PROPERTY_VALUEDOMAIN
The property whose string value is name of the VALUEDOMAIN value.
|
protected static String |
PROPERTY_VALUEDOMAINVALIDATED
The property whose boolean value is VALUEDOMAINVALIDATED value.
|
PROPERTY_PREVENTSESSIONTIMEOUTS
Constructor and Description |
---|
AddAttributeAction() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
addColumnDuringPreUpgrade()
Gets whether to add the attribute's column to the "
odm_ " table
during the pre-upgrade phase. |
protected void |
analyze(LibrarySession session)
Called by
analyze . |
protected AttributeDefinition |
getAttributeDefinition(LibrarySession session)
Gets the AttributeDefinition for the attribute to be added.
|
protected String |
getPreUpgradeAddColumnStatement(LibrarySession session)
Gets the "
ALTER TABLE " statement executed to add the
attribute's column to the "odm_ " table during pre-upgrade,
if addColumnDuringPreUpgrade returns
true. |
protected void |
preUpgrade(LibrarySession session)
Called by
preUpgrade . |
protected void |
rollback(LibrarySession session,
boolean downgrade)
Called by
rollback . |
protected void |
upgrade(LibrarySession session)
Called by
upgrade . |
abortTransaction, analyze, postUpgrade, postUpgrade, preUpgrade, rollback, upgrade
getName, getProperties, getProperty, getUpgradeActionContext, initialize
protected static final String PROPERTY_NAME
protected static final String PROPERTY_CLASS
protected static final String PROPERTY_DATATYPE
label
of the DATATYPE value.protected static final String PROPERTY_DATALENGTH
protected static final String PROPERTY_DATASCALE
protected static final String PROPERTY_UNIQUE
protected static final String PROPERTY_REQUIRED
protected static final String PROPERTY_INDEXED
protected static final String PROPERTY_SETTABLE
protected static final String PROPERTY_UPDATEABLE
protected static final String PROPERTY_DATABASEOBJECTNAME
protected static final String PROPERTY_CLASSDOMAIN
protected static final String PROPERTY_VALUEDOMAIN
protected static final String PROPERTY_VALUEDEFAULT
protected static final String PROPERTY_VALUEDOMAINVALIDATED
protected static final String PROPERTY_REFERENTIALINTEGRITYRULE
label
of the REFERENTIALINTEGRITYRULE value.protected static final String PROPERTY_DESCRIPTION
protected void analyze(LibrarySession session) throws IfsException
analyze
.
Subclasses should override this method to perform the analysis phase of the upgrade action.
analyze
in class LibrarySessionAction
session
- the sessionIfsException
- if the operation failsprotected void preUpgrade(LibrarySession session) throws IfsException
preUpgrade
.
Subclasses should override this method to perform the pre-upgrade phase of the upgrade action.
preUpgrade
in class LibrarySessionAction
session
- the sessionIfsException
- if the operation failsprotected void upgrade(LibrarySession session) throws IfsException
upgrade
.
Subclasses should override this method to perform the upgrade phase of the upgrade action.
upgrade
in class LibrarySessionAction
session
- the sessionIfsException
- if the operation failsprotected void rollback(LibrarySession session, boolean downgrade) throws IfsException
rollback
.
Subclasses should override this method to rollback the analysis and pre-upgrade phases of the upgrade action.
rollback
in class LibrarySessionAction
session
- the sessiondowngrade
- whether the rollback is being performed as part of
a downgradeIfsException
- if the operation failsprotected boolean addColumnDuringPreUpgrade() throws IfsException
odm_
" table
during the pre-upgrade phase.
A subclass that overrides this method to add the column during pre-upgrade
is responsible for setting the column's initial values. For both
object-type
attributes
and array-type attributes
, the subclass must set the column to 0, not null, to
indicate the attribute has a null value.
IfsException
- if the operation failsprotected String getPreUpgradeAddColumnStatement(LibrarySession session) throws IfsException
ALTER TABLE
" statement executed to add the
attribute's column to the "odm_
" table during pre-upgrade,
if addColumnDuringPreUpgrade
returns
true.
This class returns a string of form:
ALTER TABLE tableName ADD (columnName dataType)where:
odm_
" table for the
ClassObject specified by PROPERTY_CLASS
,PROPERTY_DATABASEOBJECTNAME
,
or if that property is unset or null, the value of PROPERTY_NAME
, andRDBMS data type
computed from the PROPERTY_DATATYPE
, PROPERTY_DATALENGTH
, and PROPERTY_DATASCALE
properties.
Subclasses can override this method to change the ALTER TABLE
statement executed.
If addColumnDuringPreUpgrade
returns
false, the value returned by this method is ignored and may be arbitrary.
session
- the sessionALTER TABLE
statementIfsException
- if the operation failsprotected AttributeDefinition getAttributeDefinition(LibrarySession session) throws IfsException
The AttributeDefinition is initialized from the properties defined by this class. Subclasses can override this method to refine the definition.
session
- the sessionIfsException
- if the operation failsCopyright © 2023. All rights reserved.