@Override public String getSqlForFullTextSearch(String searchString) { String whereClause = KeywordsDictionary.SQL_UPPER(KeywordsDictionary.AGECLASSESDEFINITION_NAME) + KeywordsDictionary.SQL_LIKE_UPPER(searchString); return getSqlToLoadModels(whereClause); }
@Override public String getSqlToUpdateModel(Model model) { if (model == null || !(model instanceof AgeClassesDefinition)) { return null; } AgeClassesDefinition ageClassesDefinition = (AgeClassesDefinition) model; return KeywordsDictionary.SQL_UPDATE + KeywordsDictionary.DATABASE_SCHEME + "." + KeywordsDictionary.AGECLASSESDEFINITION + KeywordsDictionary.SQL_SET + KeywordsDictionary.AGECLASSESDEFINITION_NAME + "='" + ageClassesDefinition.getName() + "', " + KeywordsDictionary.getMODEL_META_ATTRIBUTES_FILLED(model) + KeywordsDictionary.SQL_WHERE_ID_IS + ageClassesDefinition.getId(); }
@Override public AgeClassesDefinition[] mapResultSetToModels(ResultSet resultSet) throws SQLException { AgeClassesDefinition[] ageClassesDefinitions = null; if (resultSet != null) { // create array resultSet.last(); ageClassesDefinitions = new AgeClassesDefinition[resultSet.getRow()]; resultSet.beforeFirst(); // loop resultSet int ageClassesDefinitionCount = 0; while (resultSet.next()) { AgeClassesDefinition ad = new AgeClassesDefinition(); ad.setId(resultSet.getInt(1)); ad.setName(resultSet.getString(2)); KeywordsDictionary.setMODEL_META_ATTRIBUTES(ad, resultSet, 3); ageClassesDefinitions[ageClassesDefinitionCount] = ad; ageClassesDefinitionCount++; } } return ageClassesDefinitions; }
@Override public String getSqlToInsertModel(Model model) { if (model == null || !(model instanceof AgeClassesDefinition)) { return null; } AgeClassesDefinition ageClassesDefinition = (AgeClassesDefinition) model; return KeywordsDictionary.SQL_INSERT_INTO + KeywordsDictionary.DATABASE_SCHEME + "." + KeywordsDictionary.AGECLASSESDEFINITION + " (" + KeywordsDictionary.AGECLASSESDEFINITION_NAME + ", " + KeywordsDictionary.MODEL_META_ATTRIBUTES + KeywordsDictionary.SQL_VALUES + "'" + ageClassesDefinition.getName() + "','" + KeywordsDictionary.getMODEL_META_ATTRIBUTE_VALUES(model) + ")"; }