Class DatabaseTorgDataSource
java.lang.Object
neqsim.process.mechanicaldesign.torg.DatabaseTorgDataSource
- All Implemented Interfaces:
TorgDataSource
Database-based data source for loading Technical Requirements Documents (TORG).
This implementation loads TORG data from the NeqSim process design database. It expects the following tables:
TORG_Projects table
CREATE TABLE TORG_Projects ( PROJECT_ID VARCHAR(50) PRIMARY KEY, PROJECT_NAME VARCHAR(200), COMPANY VARCHAR(100), REVISION VARCHAR(20), ISSUE_DATE DATE, MIN_AMBIENT_TEMP DOUBLE, MAX_AMBIENT_TEMP DOUBLE, SEAWATER_TEMP DOUBLE, SEISMIC_ZONE VARCHAR(10), CORROSION_ALLOWANCE DOUBLE, PRESSURE_SAFETY_FACTOR DOUBLE, DEFAULT_PLATE_MATERIAL VARCHAR(50), DEFAULT_PIPE_MATERIAL VARCHAR(50) );
TORG_Standards table
CREATE TABLE TORG_Standards ( PROJECT_ID VARCHAR(50), DESIGN_CATEGORY VARCHAR(100), STANDARD_CODE VARCHAR(50), VERSION VARCHAR(20), PRIORITY INT, FOREIGN KEY (PROJECT_ID) REFERENCES TORG_Projects(PROJECT_ID) );
Alternatively, this data source can also read from the existing TechnicalRequirements_Process table for backward compatibility.
- Version:
- 1.0
- Author:
- esol
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classHelper class for legacy data loading. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a DatabaseTorgDataSource using the new TORG tables.DatabaseTorgDataSource(boolean useLegacyTable) Create a DatabaseTorgDataSource. -
Method Summary
Modifier and TypeMethodDescriptionGet a list of available companies.Get a list of available project identifiers.loadByCompanyAndProject(String companyIdentifier, String projectName) Load a TORG document by company and project name.loadByProjectId(String projectId) Load a TORG document by project identifier.private Optional<TechnicalRequirementsDocument> loadFromLegacyTable(String companyIdentifier) Load from the legacy TechnicalRequirements_Process table.private doubleparseDouble(String value) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface TorgDataSource
hasProject, isWritable, store, update
-
Field Details
-
logger
private static final org.apache.logging.log4j.Logger logger -
QUERY_PROJECT
- See Also:
-
QUERY_PROJECT_BY_COMPANY
- See Also:
-
QUERY_STANDARDS
- See Also:
-
QUERY_ALL_PROJECTS
- See Also:
-
QUERY_ALL_COMPANIES
- See Also:
-
LEGACY_QUERY
- See Also:
-
useLegacyTable
private boolean useLegacyTable
-
-
Constructor Details
-
DatabaseTorgDataSource
public DatabaseTorgDataSource()Create a DatabaseTorgDataSource using the new TORG tables. -
DatabaseTorgDataSource
public DatabaseTorgDataSource(boolean useLegacyTable) Create a DatabaseTorgDataSource.- Parameters:
useLegacyTable- if true, use the legacy TechnicalRequirements_Process table
-
-
Method Details
-
loadByProjectId
Description copied from interface:TorgDataSourceLoad a TORG document by project identifier.- Specified by:
loadByProjectIdin interfaceTorgDataSource- Parameters:
projectId- the project identifier- Returns:
- optional containing the TORG if found
-
loadByCompanyAndProject
public Optional<TechnicalRequirementsDocument> loadByCompanyAndProject(String companyIdentifier, String projectName) Description copied from interface:TorgDataSourceLoad a TORG document by company and project name.- Specified by:
loadByCompanyAndProjectin interfaceTorgDataSource- Parameters:
companyIdentifier- the company identifierprojectName- the project name- Returns:
- optional containing the TORG if found
-
getAvailableProjectIds
Description copied from interface:TorgDataSourceGet a list of available project identifiers.- Specified by:
getAvailableProjectIdsin interfaceTorgDataSource- Returns:
- list of project IDs available in this data source
-
getAvailableCompanies
Description copied from interface:TorgDataSourceGet a list of available companies.- Specified by:
getAvailableCompaniesin interfaceTorgDataSource- Returns:
- list of company identifiers
-
loadFromLegacyTable
Load from the legacy TechnicalRequirements_Process table. -
buildFromProjectResultSet
private TechnicalRequirementsDocument.Builder buildFromProjectResultSet(ResultSet rs) throws SQLException - Throws:
SQLException
-
parseDouble
-