57
57
* Date: 4/2/13
58
58
* Time: 2:54 PM
59
59
*/
60
- abstract public class AbstractDataDefinedTable extends CustomPermissionsTable
60
+ abstract public class AbstractDataDefinedTable < SchemaType extends UserSchema > extends CustomPermissionsTable < SchemaType >
61
61
{
62
62
protected String _pk ;
63
63
64
64
protected String _filterColumn ;
65
65
protected String _filterValue ;
66
66
protected String _valueColumn ;
67
67
68
- public AbstractDataDefinedTable (UserSchema schema , SchemaTableInfo table , ContainerFilter cf , String filterColumn , String valueColumn , String tableName , String filterValue )
68
+ public AbstractDataDefinedTable (SchemaType schema , SchemaTableInfo table , ContainerFilter cf , String filterColumn , String valueColumn , String tableName , String filterValue )
69
69
{
70
70
super (schema , table , cf );
71
71
_filterColumn = filterColumn ;
@@ -77,23 +77,23 @@ public AbstractDataDefinedTable(UserSchema schema, SchemaTableInfo table, Contai
77
77
}
78
78
79
79
@ Override
80
- public CustomPermissionsTable init ()
80
+ public CustomPermissionsTable < SchemaType > init ()
81
81
{
82
82
super .init ();
83
83
84
84
ColumnInfo col = getRealTable ().getColumn (_filterColumn );
85
85
addCondition (col , _filterValue ); //enforce only showing rows from this category
86
86
87
87
List <String > pks = getRealTable ().getPkColumnNames ();
88
- assert pks .size () > 0 ;
88
+ assert ! pks .isEmpty () ;
89
89
_pk = pks .get (0 );
90
90
91
91
var valueCol = getMutableColumn (_valueColumn );
92
92
assert valueCol != null ;
93
93
94
94
valueCol .setKeyField (true );
95
95
valueCol .setNullable (false );
96
- getMutableColumn (_pk ).setKeyField (false );
96
+ getMutableColumnOrThrow (_pk ).setKeyField (false );
97
97
98
98
ColumnInfo filterCol = getColumn (_filterColumn );
99
99
assert filterCol != null ;
@@ -135,7 +135,7 @@ protected class UpdateService extends SimpleQueryUpdateService
135
135
{
136
136
private final ValuesManager _vm ;
137
137
138
- public UpdateService (SimpleUserSchema .SimpleTable ti )
138
+ public UpdateService (SimpleUserSchema .SimpleTable < SchemaType > ti )
139
139
{
140
140
super (ti , ti .getRealTable ());
141
141
@@ -217,8 +217,7 @@ public boolean testIfRowExists(String value)
217
217
{
218
218
boolean ret = _distinctValues .contains (value );
219
219
220
- if (!_distinctValues .contains (value ))
221
- _distinctValues .add (value );
220
+ _distinctValues .add (value );
222
221
223
222
return ret ;
224
223
}
0 commit comments