List of usage examples for org.springframework.jdbc.core JdbcTemplate execute
@Override public void execute(final String sql) throws DataAccessException
From source file:au.aurin.org.svc.GeodataFinder.java
public String FindApp(final String app_id) { LOGGER.info("FindApp, app_id {} ", app_id); try {/*from w w w .j a v a 2 s .com*/ final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); final String query = "Select appname || ': ' || appurl from application where app_id=" + app_id; LOGGER.info(" query FindApp is {} ", query); jdbcTemplate.execute(query); return jdbcTemplate.queryForObject(query, String.class); } catch (final Exception e) { LOGGER.info("FindApp failed error is: ", e.toString()); return ""; } }
From source file:au.aurin.org.svc.GeodataFinder.java
public String changePassword(final String user_id, final String password) { String query = ""; try {//from ww w . j ava 2s .c o m final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); query = "update users set password='" + password + "' where " + " user_id = " + user_id; LOGGER.info("changePassword: query is {} ", query); jdbcTemplate.execute(query); return "Success"; } catch (final Exception e) { LOGGER.info("error in changePassword is : {}", e.toString()); } return null; }
From source file:au.aurin.org.svc.GeodataFinder.java
public Boolean changeuuidPassword(final String uuid, final String password) { String query = ""; try {//www .j a v a 2s .c o m final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); query = "update users set password='" + password + "' where " + " uuid = '" + uuid + "'"; LOGGER.info("changePassword: query is {} ", query); jdbcTemplate.execute(query); return true; } catch (final Exception e) { LOGGER.info("error in changeuuidPassword is : {}", e.toString()); } return false; }
From source file:au.aurin.org.svc.GeodataFinder.java
public long InsertOrgs(final String org_id, final long user_id) { LOGGER.info("InsertOrgs, org_id {}, user_id {} ", org_id, user_id); try {/*from w ww.j a v a2 s . co m*/ final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); final String query = "Insert into user_orgs (org_id, user_id) values(" + org_id + "," + user_id + ")"; LOGGER.info(" query InsertOrgs is {} ", query); jdbcTemplate.execute(query); return jdbcTemplate.queryForLong("SELECT max(user_org_id) FROM user_orgs"); } catch (final Exception e) { LOGGER.info("InsertOrgs failed error is: ", e.toString()); return 0; } }
From source file:au.aurin.org.svc.GeodataFinder.java
public long InsertApps(final String app_id, final long user_id) { LOGGER.info("InsertApps, app_id {}, user_id {} ", app_id, user_id); try {/* w w w. j a va 2 s . c o m*/ final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); final String query = "Insert into user_apps (app_id, user_id) values(" + app_id + "," + user_id + ")"; LOGGER.info(" query InsertApps is {} ", query); jdbcTemplate.execute(query); return jdbcTemplate.queryForLong("SELECT max(user_app_id) FROM user_apps"); } catch (final Exception e) { LOGGER.info("InsertApps failed error is: ", e.toString()); return 0; } }
From source file:au.aurin.org.svc.GeodataFinder.java
public long InsertRoles(final String role_id, final long user_id) { LOGGER.info("InsertRoles, role_id {}, user_id {} ", role_id, user_id); try {//from w w w . j a v a2s. co m final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); final String query = "Insert into user_roles (role_id, user_id) values(" + role_id + "," + user_id + ")"; LOGGER.info(" query InsertRoles is {} ", query); jdbcTemplate.execute(query); return jdbcTemplate.queryForLong("SELECT max(user_role_id) FROM user_roles"); } catch (final Exception e) { LOGGER.info("InsertRoles failed error is: ", e.toString()); return 0; } }
From source file:au.aurin.org.svc.GeodataFinder.java
public long InsertAcclvl(final String acclvl_id, final long user_id) { LOGGER.info("InsertAcclvl, acclvl_id {}, user_id {} ", acclvl_id, user_id); try {/*from w w w . ja v a 2s .c o m*/ final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); final String query = "Insert into user_acclvls (acclvl_id, user_id) values(" + acclvl_id + "," + user_id + ")"; LOGGER.info(" query InsertAcclvl is {} ", query); jdbcTemplate.execute(query); return jdbcTemplate.queryForLong("SELECT max(user_acclvl_id) FROM user_acclvls"); } catch (final Exception e) { LOGGER.info("InsertAcclvl failed error is: ", e.toString()); return 0; } }
From source file:au.aurin.org.svc.GeodataFinder.java
public String resetLicense(final String user_id, final String app_id, final String lic_id) { String query = ""; try {//ww w . j a v a 2 s .co m final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); query = "update agreement set agreed= 0, aggtime=now() " + " where " + " user_id = " + user_id + " and app_id = " + app_id + " and lic_id = " + lic_id; LOGGER.info("resetLicense: query is {} ", query); jdbcTemplate.execute(query); return "Success"; } catch (final Exception e) { LOGGER.info("error in resetLicense is : {}", e.toString()); } return null; }
From source file:au.aurin.org.svc.GeodataFinder.java
public String updateLicense(final String user_id, final String app_id, final String lic_id) { String query = ""; try {//from ww w. j a va2 s.c o m final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); query = "update agreement set agreed= 1, aggtime=now() " + " where " + " user_id = " + user_id + " and app_id = " + app_id + " and lic_id = " + lic_id; LOGGER.info("updateLicense: query is {} ", query); jdbcTemplate.execute(query); return "Success"; } catch (final Exception e) { LOGGER.info("error in updateLicense is : {}", e.toString()); } return null; }
From source file:au.aurin.org.svc.GeodataFinder.java
public String updateuser(final String user_id, final String firstname, final String lastname, final String email) { String query = ""; try {//from www .j a v a 2 s.c o m final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); query = "update users set" + " firstname='" + firstname + "'," + " lastname='" + lastname + "'," + " email='" + email + "'" + " where " + " user_id = " + user_id; LOGGER.info("updateuser query is {} ", query); jdbcTemplate.execute(query); return "Success"; } catch (final Exception e) { LOGGER.info("error in updateuser is : {}", e.toString()); } return null; }