org.opensubsystems.patterns.mappeddata.persist.db
Class MappingDatabaseFactory

java.lang.Object
  extended by org.opensubsystems.core.persist.db.DatabaseFactoryImpl
      extended by org.opensubsystems.patterns.mappeddata.persist.db.MappingDatabaseFactory
All Implemented Interfaces:
org.opensubsystems.core.persist.BasicDataFactory, org.opensubsystems.core.persist.DataFactory, org.opensubsystems.core.persist.db.DatabaseFactory, org.opensubsystems.core.persist.ModifiableDataFactory, MappingFactory

public class MappingDatabaseFactory
extends org.opensubsystems.core.persist.db.DatabaseFactoryImpl
implements MappingFactory

Data factory to retrieve and manipulate mapping records in persistence store. Subsystems that want to create mappings should derive database factory class from this class. The only thing which is required is to implement constructor that provides database schema, that is able to provide database queries to this factory.

Version:
$Id: MappingDatabaseFactory.java,v 1.18 2007/01/28 06:54:53 bastafidli Exp $
Author:
Julian Legeny
Code reviewer:
Miro Halas
Code reviewed:
1.13 2006/08/11 00:33:16 jlegeny

Field Summary
protected  MappingDatabaseSchema m_schema
          Schema to use to execute database dependent operations.
 
Fields inherited from class org.opensubsystems.core.persist.db.DatabaseFactoryImpl
m_connectionFactory, m_iConcurrencySelectListResultSet, m_iDataType, m_iTypeSelectListResultSet, m_transactionFactory
 
Constructor Summary
MappingDatabaseFactory(MappingDatabaseSchema schema)
          Default constructor.
 
Method Summary
 int create(java.util.Collection colDataObject)
          
 org.opensubsystems.core.data.DataObject create(org.opensubsystems.core.data.DataObject data)
          
 void create(org.opensubsystems.core.util.ThreeIntStruct tisIDs)
          Create mapping record.
 void delete(int iId, int iDomainId)
          
 void delete(org.opensubsystems.core.util.ThreeIntStruct tisIDs)
          Delete mapping record.
 org.opensubsystems.core.data.DataObject get(int iId, int iDomainId)
          
 int[] getMappedData(int iId, int iMappingType)
          Get array of mapped records for particular ID.
 int[] getMappedData(java.lang.String strColumnIDs, int iMappingType)
          Get array of mapped records for particular set of IDs.
 org.opensubsystems.core.data.DataObject load(java.sql.ResultSet rsQueryResults, int initialIndex)
          
 org.opensubsystems.core.data.ModifiableDataObject save(org.opensubsystems.core.data.ModifiableDataObject data)
          
 
Methods inherited from class org.opensubsystems.core.persist.db.DatabaseFactoryImpl
getConcurrencySelectListResultSet, getDataType, getTypeSelectListResultSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensubsystems.core.persist.DataFactory
getDataType
 

Field Detail

m_schema

protected MappingDatabaseSchema m_schema
Schema to use to execute database dependent operations.

Constructor Detail

MappingDatabaseFactory

public MappingDatabaseFactory(MappingDatabaseSchema schema)
                       throws org.opensubsystems.core.error.OSSException
Default constructor.

Parameters:
schema - - schema to use by this factory to execute database dependent operations
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured
Method Detail

create

public void create(org.opensubsystems.core.util.ThreeIntStruct tisIDs)
            throws org.opensubsystems.core.error.OSSException
Create mapping record.

Specified by:
create in interface MappingFactory
Parameters:
tisIDs - - IDs and mapping type that has to be added into mapping table 1st value = mapped ID from one table 2nd value = mapped ID from second table 3rd value = mapping type
Throws:
org.opensubsystems.core.error.OSSException - - error during create

delete

public void delete(org.opensubsystems.core.util.ThreeIntStruct tisIDs)
            throws org.opensubsystems.core.error.OSSException
Delete mapping record.

Specified by:
delete in interface MappingFactory
Parameters:
tisIDs - - IDs and mapping type that has to be deleted from mapping table 1st value = mapped ID from one table 2nd value = mapped ID from second table 3rd value = mapping type
Throws:
org.opensubsystems.core.error.OSSException - - error during delete

getMappedData

public int[] getMappedData(int iId,
                           int iMappingType)
                    throws org.opensubsystems.core.error.OSSException
Get array of mapped records for particular ID.

Specified by:
getMappedData in interface MappingFactory
Parameters:
iId - - Id of the first data object in relation for which we want to retrieve Ids of the second objects in relation. This is id1 specified during creation.
iMappingType - - mapping type the retrieved data belongs to
Returns:
int[] - array of ids of mapped data objects, these are id2 specified during creation.
Throws:
org.opensubsystems.core.error.OSSException - - error during getting mapped data

getMappedData

public int[] getMappedData(java.lang.String strColumnIDs,
                           int iMappingType)
                    throws org.opensubsystems.core.error.OSSException
Get array of mapped records for particular set of IDs.

Specified by:
getMappedData in interface MappingFactory
Parameters:
strColumnIDs - - string representation of IDs separated by ',' of the first data objects in relations for which we want to retrieve Ids of the second objects in relations. These are id1 specified during creation.
iMappingType - - mapping type the retrieved data belongs to
Returns:
int[] - array of ids of mapped data objects, these are id2 specified during creation.
Throws:
org.opensubsystems.core.error.OSSException - - error during getting mapped data

load

public org.opensubsystems.core.data.DataObject load(java.sql.ResultSet rsQueryResults,
                                                    int initialIndex)
                                             throws org.opensubsystems.core.error.OSSDatabaseAccessException

Specified by:
load in interface org.opensubsystems.core.persist.db.DatabaseFactory
Throws:
org.opensubsystems.core.error.OSSDatabaseAccessException

get

public org.opensubsystems.core.data.DataObject get(int iId,
                                                   int iDomainId)
                                            throws org.opensubsystems.core.error.OSSException

Specified by:
get in interface org.opensubsystems.core.persist.DataFactory
Throws:
org.opensubsystems.core.error.OSSException

create

public org.opensubsystems.core.data.DataObject create(org.opensubsystems.core.data.DataObject data)
                                               throws org.opensubsystems.core.error.OSSException

Specified by:
create in interface org.opensubsystems.core.persist.BasicDataFactory
Throws:
org.opensubsystems.core.error.OSSException

create

public int create(java.util.Collection colDataObject)
           throws org.opensubsystems.core.error.OSSException

Specified by:
create in interface org.opensubsystems.core.persist.BasicDataFactory
Throws:
org.opensubsystems.core.error.OSSException

delete

public void delete(int iId,
                   int iDomainId)
            throws org.opensubsystems.core.error.OSSException

Specified by:
delete in interface org.opensubsystems.core.persist.BasicDataFactory
Throws:
org.opensubsystems.core.error.OSSException

save

public org.opensubsystems.core.data.ModifiableDataObject save(org.opensubsystems.core.data.ModifiableDataObject data)
                                                       throws org.opensubsystems.core.error.OSSException

Specified by:
save in interface org.opensubsystems.core.persist.ModifiableDataFactory
Throws:
org.opensubsystems.core.error.OSSException


Copyright © 2003 - 2006 OpenSubsystems s.r.o.