How to use getSearchString method of org.cerberus.crud.dao.impl.InvariantDAO class

Best Cerberus-source code snippet using org.cerberus.crud.dao.impl.InvariantDAO.getSearchString

Source:InvariantDAO.java Github

copy

Full Screen

...245 StringBuilder query = new StringBuilder();246 query.append("SELECT SQL_CALC_FOUND_ROWS * FROM invariant ");247 if (!searchTerm.equals("") && !individualSearch.equals("")) {248 searchSQL.append(" and ");249 searchSQL.append(getSearchString(searchTerm));250 searchSQL.append(" and ");251 searchSQL.append(individualSearch);252 } else if (!individualSearch.equals("")) {253 searchSQL.append(" and `");254 searchSQL.append(individualSearch);255 searchSQL.append("`");256 } else if (!searchTerm.equals("")) {257 searchSQL.append(" and ");258 searchSQL.append(getSearchString(searchTerm));259 }260 if (!(PublicPrivateFilter.equalsIgnoreCase(""))) {261 searchSQL.append(" and ");262 searchSQL.append(PublicPrivateFilter);263 }264 query.append(searchSQL);265 query.append(" order by `");266 query.append(column);267 query.append("` ");268 query.append(dir);269 int nrTotalRows = 0;270 if ((amount <= 0) || (amount >= MAX_ROW_SELECTED)) {271 query.append(" limit ").append(start).append(" , ").append(MAX_ROW_SELECTED);272 } else {273 query.append(" limit ").append(start).append(" , ").append(amount);274 }275 // Debug message on SQL.276 if (LOG.isDebugEnabled()) {277 LOG.debug("SQL : " + query);278 }279 Connection connection = this.databaseSpring.connect();280 try {281 PreparedStatement preStat = connection.prepareStatement(query.toString());282 try {283 ResultSet resultSet = preStat.executeQuery();284 try {285 while (resultSet.next()) {286 invariantList.add(this.loadFromResultSet(resultSet));287 }288 //get the total number of rows289 resultSet = preStat.executeQuery("SELECT FOUND_ROWS()");290 if (resultSet != null && resultSet.next()) {291 nrTotalRows = resultSet.getInt(1);292 }293 if (invariantList.isEmpty()) {294 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_NO_DATA_FOUND);295 } else {296 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);297 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "SELECT"));298 }299 } catch (SQLException exception) {300 LOG.warn("Unable to execute query : " + exception.toString());301 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);302 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));303 invariantList.clear();304 } finally {305 if (resultSet != null) {306 resultSet.close();307 }308 }309 } catch (SQLException exception) {310 LOG.warn("Unable to execute query : " + exception.toString());311 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);312 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));313 } finally {314 if (preStat != null) {315 preStat.close();316 }317 }318 } catch (SQLException exception) {319 LOG.warn("Unable to execute query : " + exception.toString());320 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);321 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));322 } finally {323 try {324 if (connection != null) {325 connection.close();326 }327 } catch (SQLException e) {328 LOG.warn(e.toString());329 }330 }331 answer.setResultMessage(msg);332 answer.setTotalRows(nrTotalRows);333 answer.setDataList(invariantList);334 return answer;335 }336 @Override337 public AnswerList<Invariant> readByCriteria(int start, int amount, String column, String dir, String searchTerm, Map<String, List<String>> individualSearch, String PublicPrivateFilter) {338 List<Invariant> invariantList = new ArrayList<>();339 AnswerList<Invariant> answer = new AnswerList<>();340 List<String> individalColumnSearchValues = new ArrayList<>();341 MessageEvent msg;342 StringBuilder searchSQL = new StringBuilder();343 searchSQL.append(" where 1=1 ");344 StringBuilder query = new StringBuilder();345 query.append("SELECT SQL_CALC_FOUND_ROWS * FROM invariant ");346 if (!Strings.isNullOrEmpty(searchTerm)) {347 searchSQL.append(" and (idname like ? or value like ? or sort like ? or description like ? or VeryShortDesc like ? or gp1 like ? or gp2 like ? or gp3 like ?)");348 }349 if (!Strings.isNullOrEmpty(PublicPrivateFilter)) {350 searchSQL.append(" and ");351 searchSQL.append(PublicPrivateFilter);352 }353 if (individualSearch != null && !individualSearch.isEmpty()) {354 searchSQL.append(" and ( 1=1 ");355 for (Map.Entry<String, List<String>> entry : individualSearch.entrySet()) {356 searchSQL.append(" and ");357 searchSQL.append(SqlUtil.getInSQLClauseForPreparedStatement(entry.getKey(), entry.getValue()));358 individalColumnSearchValues.addAll(entry.getValue());359 }360 searchSQL.append(" )");361 }362 query.append(searchSQL);363 query.append(" order by `");364 query.append(column);365 query.append("` ");366 query.append(dir);367 int nrTotalRows = 0;368 if ((amount <= 0) || (amount >= MAX_ROW_SELECTED)) {369 query.append(" limit ").append(start).append(" , ").append(MAX_ROW_SELECTED);370 } else {371 query.append(" limit ").append(start).append(" , ").append(amount);372 }373 // Debug message on SQL.374 if (LOG.isDebugEnabled()) {375 LOG.debug("SQL : " + query);376 }377 Connection connection = this.databaseSpring.connect();378 try {379 PreparedStatement preStat = connection.prepareStatement(query.toString());380 int i = 1;381 if (!StringUtil.isNullOrEmpty(searchTerm)) {382 preStat.setString(i++, "%" + searchTerm + "%");383 preStat.setString(i++, "%" + searchTerm + "%");384 preStat.setString(i++, "%" + searchTerm + "%");385 preStat.setString(i++, "%" + searchTerm + "%");386 preStat.setString(i++, "%" + searchTerm + "%");387 preStat.setString(i++, "%" + searchTerm + "%");388 preStat.setString(i++, "%" + searchTerm + "%");389 preStat.setString(i++, "%" + searchTerm + "%");390 }391 for (String individualColumnSearchValue : individalColumnSearchValues) {392 preStat.setString(i++, individualColumnSearchValue);393 }394 try {395 ResultSet resultSet = preStat.executeQuery();396 try {397 while (resultSet.next()) {398 invariantList.add(this.loadFromResultSet(resultSet));399 }400 //get the total number of rows401 resultSet = preStat.executeQuery("SELECT FOUND_ROWS()");402 if (resultSet != null && resultSet.next()) {403 nrTotalRows = resultSet.getInt(1);404 }405 if (invariantList.isEmpty()) {406 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_NO_DATA_FOUND);407 } else {408 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);409 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "SELECT"));410 }411 } catch (SQLException exception) {412 LOG.warn("Unable to execute query : " + exception.toString());413 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);414 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));415 invariantList.clear();416 } finally {417 if (resultSet != null) {418 resultSet.close();419 }420 }421 } catch (SQLException exception) {422 LOG.warn("Unable to execute query : " + exception.toString());423 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);424 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));425 } finally {426 if (preStat != null) {427 preStat.close();428 }429 }430 } catch (SQLException exception) {431 LOG.warn("Unable to execute query : " + exception.toString());432 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);433 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));434 } finally {435 try {436 if (connection != null) {437 connection.close();438 }439 } catch (SQLException e) {440 LOG.warn(e.toString());441 }442 }443 answer.setResultMessage(msg);444 answer.setTotalRows(nrTotalRows);445 answer.setDataList(invariantList);446 return answer;447 }448 @Override449 public AnswerList<String> readDistinctValuesByCriteria(String column, String dir, String searchTerm, Map<String, List<String>> individualSearch, String PublicPrivateFilter, String columnName) {450 List<String> invariantList = new ArrayList<>();451 AnswerList<String> answer = new AnswerList<>();452 List<String> individalColumnSearchValues = new ArrayList<>();453 MessageEvent msg;454 StringBuilder searchSQL = new StringBuilder();455 searchSQL.append(" where 1=1 ");456 StringBuilder query = new StringBuilder();457 query.append("SELECT distinct ");458 query.append(columnName);459 query.append(" as distinctValues FROM invariant");460 if (!Strings.isNullOrEmpty(searchTerm)) {461 searchSQL.append(" and (idname like ? or value like ? or sort like ? or description like ? or VeryShortDesc like ? or gp1 like ? or gp2 like ? or gp3 like ?)");462 }463 if (!Strings.isNullOrEmpty(PublicPrivateFilter)) {464 searchSQL.append(" and ");465 searchSQL.append(PublicPrivateFilter);466 }467 if (individualSearch != null && !individualSearch.isEmpty()) {468 searchSQL.append(" and ( 1=1 ");469 for (Map.Entry<String, List<String>> entry : individualSearch.entrySet()) {470 searchSQL.append(" and ");471 searchSQL.append(SqlUtil.getInSQLClauseForPreparedStatement(entry.getKey(), entry.getValue()));472 individalColumnSearchValues.addAll(entry.getValue());473 }474 searchSQL.append(" )");475 }476 query.append(searchSQL);477 query.append(" order by `");478 query.append(column);479 query.append("` ");480 query.append(dir);481 int nrTotalRows = 0;482 Connection connection = this.databaseSpring.connect();483 try {484 PreparedStatement preStat = connection.prepareStatement(query.toString());485 int i = 1;486 if (!StringUtil.isNullOrEmpty(searchTerm)) {487 preStat.setString(i++, "%" + searchTerm + "%");488 preStat.setString(i++, "%" + searchTerm + "%");489 preStat.setString(i++, "%" + searchTerm + "%");490 preStat.setString(i++, "%" + searchTerm + "%");491 preStat.setString(i++, "%" + searchTerm + "%");492 preStat.setString(i++, "%" + searchTerm + "%");493 preStat.setString(i++, "%" + searchTerm + "%");494 preStat.setString(i++, "%" + searchTerm + "%");495 }496 for (String individualColumnSearchValue : individalColumnSearchValues) {497 preStat.setString(i++, individualColumnSearchValue);498 }499 try {500 ResultSet resultSet = preStat.executeQuery();501 try {502 while (resultSet.next()) {503 invariantList.add(resultSet.getString("distinctValues"));504 }505 if (invariantList.isEmpty()) {506 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_NO_DATA_FOUND);507 } else {508 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);509 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "SELECT"));510 }511 } catch (SQLException exception) {512 LOG.warn("Unable to execute query : " + exception.toString());513 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);514 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));515 invariantList.clear();516 } finally {517 if (resultSet != null) {518 resultSet.close();519 }520 }521 } catch (SQLException exception) {522 LOG.warn("Unable to execute query : " + exception.toString());523 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);524 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));525 } finally {526 if (preStat != null) {527 preStat.close();528 }529 }530 } catch (SQLException exception) {531 LOG.warn("Unable to execute query : " + exception.toString());532 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);533 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));534 } finally {535 try {536 if (connection != null) {537 connection.close();538 }539 } catch (SQLException e) {540 LOG.warn(e.toString());541 }542 }543 answer.setResultMessage(msg);544 answer.setTotalRows(nrTotalRows);545 answer.setDataList(invariantList);546 return answer;547 }548 @Override549 public AnswerList<Invariant> readCountryListEnvironmentLastChanges(String system, Integer nbdays) {550 AnswerList<Invariant> response = new AnswerList<>();551 MessageEvent msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);552 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", ""));553 List<Invariant> objectList = new ArrayList<>();554 StringBuilder searchSQL = new StringBuilder();555 StringBuilder query = new StringBuilder();556 //SQL_CALC_FOUND_ROWS allows to retrieve the total number of columns by disrearding the limit clauses that 557 //were applied -- used for pagination p558 query.append("SELECT distinct i.* FROM countryenvparam_log cl ");559 query.append(" JOIN invariant i on i.value=cl.country and i.idname='COUNTRY' ");560 query.append(" WHERE TO_DAYS(NOW()) - TO_DAYS(cl.datecre) <= ? and build != '' and `System` = ? order by i.sort;");561 // Debug message on SQL.562 if (LOG.isDebugEnabled()) {563 LOG.debug("SQL : " + query.toString());564 LOG.debug("SQL.param : " + nbdays);565 LOG.debug("SQL.param : " + system);566 }567 Connection connection = this.databaseSpring.connect();568 try {569 PreparedStatement preStat = connection.prepareStatement(query.toString());570 try {571 int i = 1;572 preStat.setInt(i++, nbdays);573 preStat.setString(i++, system);574 ResultSet resultSet = preStat.executeQuery();575 try {576 //gets the data577 while (resultSet.next()) {578 objectList.add(this.loadFromResultSet(resultSet));579 }580 //get the total number of rows581 resultSet = preStat.executeQuery("SELECT FOUND_ROWS()");582 int nrTotalRows = 0;583 if (resultSet != null && resultSet.next()) {584 nrTotalRows = resultSet.getInt(1);585 }586 if (objectList.size() >= MAX_ROW_SELECTED) { // Result of SQl was limited by MAX_ROW_SELECTED constrain. That means that we may miss some lines in the resultList.587 LOG.error("Partial Result in the query.");588 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_WARNING_PARTIAL_RESULT);589 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Maximum row reached : " + MAX_ROW_SELECTED));590 response = new AnswerList<>(objectList, nrTotalRows);591 } else if (objectList.size() <= 0) {592 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_NO_DATA_FOUND);593 response = new AnswerList<>(objectList, nrTotalRows);594 } else {595 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);596 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "SELECT"));597 response = new AnswerList<>(objectList, nrTotalRows);598 }599 } catch (SQLException exception) {600 LOG.error("Unable to execute query : " + exception.toString());601 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);602 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));603 } finally {604 if (resultSet != null) {605 resultSet.close();606 }607 }608 } catch (SQLException exception) {609 LOG.error("Unable to execute query : " + exception.toString());610 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);611 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));612 } finally {613 if (preStat != null) {614 preStat.close();615 }616 }617 } catch (SQLException exception) {618 LOG.error("Unable to execute query : " + exception.toString());619 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);620 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));621 } finally {622 try {623 if (!this.databaseSpring.isOnTransaction()) {624 if (connection != null) {625 connection.close();626 }627 }628 } catch (SQLException exception) {629 LOG.warn("Unable to close connection : " + exception.toString());630 }631 }632 response.setResultMessage(msg);633 response.setDataList(objectList);634 return response;635 }636 @Override637 public Answer create(Invariant object) {638 MessageEvent msg = null;639 StringBuilder query = new StringBuilder();640 query.append("INSERT INTO invariant (`idname`, `value`, `sort`, `description`, `VeryShortDesc`, `gp1`, `gp2`, `gp3`, `gp4`, `gp5`, `gp6`, `gp7`, `gp8`, `gp9`) ");641 query.append("VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)");642 // Debug message on SQL.643 if (LOG.isDebugEnabled()) {644 LOG.debug("SQL : " + query.toString());645 }646 Connection connection = this.databaseSpring.connect();647 try {648 PreparedStatement preStat = connection.prepareStatement(query.toString());649 try {650 int i = 1;651 preStat.setString(i++, object.getIdName());652 preStat.setString(i++, object.getValue());653 preStat.setInt(i++, object.getSort());654 preStat.setString(i++, object.getDescription());655 preStat.setString(i++, object.getVeryShortDesc());656 preStat.setString(i++, object.getGp1());657 preStat.setString(i++, object.getGp2());658 preStat.setString(i++, object.getGp3());659 preStat.setString(i++, object.getGp4());660 preStat.setString(i++, object.getGp5());661 preStat.setString(i++, object.getGp6());662 preStat.setString(i++, object.getGp7());663 preStat.setString(i++, object.getGp8());664 preStat.setString(i++, object.getGp9());665 preStat.executeUpdate();666 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);667 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "INSERT"));668 } catch (SQLException exception) {669 LOG.error("Unable to execute query : " + exception.toString());670 if (exception.getSQLState().equals(SQL_DUPLICATED_CODE)) { //23000 is the sql state for duplicate entries671 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_DUPLICATE);672 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "INSERT").replace("%REASON%", exception.toString()));673 } else {674 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);675 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));676 }677 } finally {678 preStat.close();679 }680 } catch (SQLException exception) {681 LOG.error("Unable to execute query : " + exception.toString());682 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);683 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));684 } finally {685 try {686 if (connection != null) {687 connection.close();688 }689 } catch (SQLException exception) {690 LOG.error("Unable to close connection : " + exception.toString());691 }692 }693 return new Answer(msg);694 }695 @Override696 public Answer delete(Invariant object) {697 MessageEvent msg = null;698 final String query = "DELETE FROM invariant WHERE idname = ? and `value` = ?";699 // Debug message on SQL.700 if (LOG.isDebugEnabled()) {701 LOG.debug("SQL : " + query);702 }703 Connection connection = this.databaseSpring.connect();704 try {705 PreparedStatement preStat = connection.prepareStatement(query);706 try {707 preStat.setString(1, object.getIdName());708 preStat.setString(2, object.getValue());709 preStat.executeUpdate();710 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);711 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "DELETE"));712 } catch (SQLException exception) {713 LOG.error("Unable to execute query : " + exception.toString());714 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);715 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));716 } finally {717 preStat.close();718 }719 } catch (SQLException exception) {720 LOG.error("Unable to execute query : " + exception.toString());721 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);722 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));723 } finally {724 try {725 if (connection != null) {726 connection.close();727 }728 } catch (SQLException exception) {729 LOG.warn("Unable to close connection : " + exception.toString());730 }731 }732 return new Answer(msg);733 }734 @Override735 public Answer update(String idname, String value, Invariant object) {736 MessageEvent msg = null;737 final String query = "UPDATE invariant SET idname = ?, `value` = ?, sort = ?, Description = ?, VeryShortDesc = ?, gp1 = ?, gp2 = ?, gp3 = ?, gp4 = ?, gp5 = ?, gp6 = ?, gp7 = ?, gp8 = ?, gp9 = ? WHERE idname = ? and `value` = ?";738 // Debug message on SQL.739 if (LOG.isDebugEnabled()) {740 LOG.debug("SQL : " + query);741 LOG.debug("SQL.param.idname : " + idname);742 LOG.debug("SQL.param.value : " + value);743 }744 Connection connection = this.databaseSpring.connect();745 try {746 PreparedStatement preStat = connection.prepareStatement(query);747 try {748 int i = 1;749 preStat.setString(i++, object.getIdName());750 preStat.setString(i++, object.getValue());751 preStat.setInt(i++, object.getSort());752 preStat.setString(i++, object.getDescription());753 preStat.setString(i++, object.getVeryShortDesc());754 preStat.setString(i++, object.getGp1());755 preStat.setString(i++, object.getGp2());756 preStat.setString(i++, object.getGp3());757 preStat.setString(i++, object.getGp4());758 preStat.setString(i++, object.getGp5());759 preStat.setString(i++, object.getGp6());760 preStat.setString(i++, object.getGp7());761 preStat.setString(i++, object.getGp8());762 preStat.setString(i++, object.getGp9());763 preStat.setString(i++, idname);764 preStat.setString(i++, value);765 preStat.executeUpdate();766 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);767 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "UPDATE"));768 } catch (SQLException exception) {769 LOG.error("Unable to execute query : " + exception.toString());770 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);771 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));772 } finally {773 preStat.close();774 }775 } catch (SQLException exception) {776 LOG.error("Unable to execute query : " + exception.toString());777 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);778 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));779 } finally {780 try {781 if (connection != null) {782 connection.close();783 }784 } catch (SQLException exception) {785 LOG.warn("Unable to close connection : " + exception.toString());786 }787 }788 return new Answer(msg);789 }790 public Invariant loadFromResultSet(ResultSet resultSet) throws SQLException {791 String idName = (resultSet.getString("idName") != null) ? resultSet.getString("idName") : "";792 int sort = resultSet.getInt("sort");793 String description = (resultSet.getString("description") != null) ? resultSet.getString("description") : "";794 String veryShortDesc = (resultSet.getString("VeryShortDesc") != null) ? resultSet.getString("VeryShortDesc") : "";795 String gp1 = (resultSet.getString("gp1") != null) ? resultSet.getString("gp1") : "";796 String gp2 = (resultSet.getString("gp2") != null) ? resultSet.getString("gp2") : "";797 String gp3 = (resultSet.getString("gp3") != null) ? resultSet.getString("gp3") : "";798 String gp4 = (resultSet.getString("gp4") != null) ? resultSet.getString("gp4") : "";799 String gp5 = (resultSet.getString("gp5") != null) ? resultSet.getString("gp5") : "";800 String gp6 = (resultSet.getString("gp6") != null) ? resultSet.getString("gp6") : "";801 String gp7 = (resultSet.getString("gp7") != null) ? resultSet.getString("gp7") : "";802 String gp8 = (resultSet.getString("gp8") != null) ? resultSet.getString("gp8") : "";803 String gp9 = (resultSet.getString("gp9") != null) ? resultSet.getString("gp9") : "";804 String value = (resultSet.getString("value") != null) ? resultSet.getString("value") : "";805 return factoryInvariant.create(idName, value, sort, description, veryShortDesc, gp1, gp2, gp3, gp4, gp5, gp6, gp7, gp8, gp9);806 }807 private String getSearchString(String searchTerm) {808 if (StringUtil.isNullOrEmpty(searchTerm)) {809 return "";810 } else {811 StringBuilder gSearch = new StringBuilder();812 gSearch.append(" (`idname` like '%");813 gSearch.append(searchTerm);814 gSearch.append("%'");815 gSearch.append(" or `value` like '%");816 gSearch.append(searchTerm);817 gSearch.append("%'");818 gSearch.append(" or `sort` like '%");819 gSearch.append(searchTerm);820 gSearch.append("%'");821 gSearch.append(" or `description` like '%");...

Full Screen

Full Screen

getSearchString

Using AI Code Generation

copy

Full Screen

1String applicationObject = invariantDAO.getSearchStringByKey("cerberus_application_object", "value");2String applicationObject = invariantDAO.getSearchStringByKey("cerberus_application_object", "value");3String applicationObject = invariantDAO.getSearchStringByKey("cerberus_application_object", "value");4String applicationObject = invariantDAO.getSearchStringByKey("cerberus_application_object", "value");5String applicationObject = invariantDAO.getSearchStringByKey("cerberus_application_object", "value");6String applicationObject = invariantDAO.getSearchStringByKey("cerberus_application_object", "value");7String applicationObject = invariantDAO.getSearchStringByKey("cerberus_application_object", "value");8String applicationObject = invariantDAO.getSearchStringByKey("cerberus_application_object", "value");9String applicationObject = invariantDAO.getSearchStringByKey("cerberus_application_object", "value");

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Cerberus-source automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful