1 21 22 package org.opensubsystems.patterns.listdata.persist.db.impl; 23 24 import java.util.List ; 25 26 import org.opensubsystems.core.error.OSSException; 27 import org.opensubsystems.core.persist.db.DatabaseFactoryImpl; 28 import org.opensubsystems.patterns.listdata.data.ListDefinition; 29 import org.opensubsystems.patterns.listdata.data.ListOptions; 30 import org.opensubsystems.patterns.listdata.persist.ListFactory; 31 import org.opensubsystems.patterns.listdata.persist.db.ListDatabaseFactory; 32 import org.opensubsystems.patterns.listdata.persist.db.ListDatabaseSchema; 33 import org.opensubsystems.patterns.listdata.persist.db.ListDatabaseUtils; 34 35 43 public abstract class ListDatabaseFactoryImpl extends DatabaseFactoryImpl 44 implements ListFactory, 45 ListDatabaseFactory 46 { 47 49 53 protected int[] m_arrOrderColumnCodes; 54 55 59 protected String [] m_arrOrderDirections; 60 61 66 protected int[] m_arrShowColumnCodes; 67 68 71 protected ListDatabaseSchema m_listSchema; 72 73 75 91 public ListDatabaseFactoryImpl( 92 int iDataType, 93 int[] arrOrderColumnCodes, 94 String [] arrOrderDirections, 95 int[] arrShowColumnCodes, 96 ListDatabaseSchema listSchema 97 ) throws OSSException 98 { 99 super(iDataType); 100 101 m_arrOrderColumnCodes = arrOrderColumnCodes; 102 m_arrOrderDirections = arrOrderDirections; 103 m_arrShowColumnCodes = arrShowColumnCodes; 104 m_listSchema = listSchema; 105 } 106 107 109 112 public ListDefinition getDefaultListDefinition() 113 { 114 assert m_arrShowColumnCodes != null 115 : "No columns to retrieve were specified."; 116 117 return new ListDefinition(m_arrOrderColumnCodes, 118 m_arrOrderDirections, 119 m_arrShowColumnCodes); 120 } 121 122 125 public List get( 126 ListOptions options 127 ) throws OSSException 128 { 129 assert m_listSchema != null 130 : "No list database schema was specified."; 131 132 return ListDatabaseUtils.getInstance().getObjectList( 133 options, 134 m_listSchema.getSelectList(options, getDataType()), 135 this, m_listSchema); 136 } 137 138 143 public ListDatabaseSchema getListDatabaseSchema() 144 { 145 return m_listSchema; 146 } 147 } 148 | Popular Tags |