Mercurial > hg > openmind
changeset 83:979604ccc6db
rename ChangeEntityPrivacity.
author | Robert Casties <casties@mpiwg-berlin.mpg.de> |
---|---|
date | Mon, 10 Jul 2017 18:53:04 +0200 |
parents | 90f9a1c45b15 |
children | 68e3e4b569f9 |
files | src/main/java/org/mpi/openmind/scripts/ChangeAllEntitiesPrivacity.java src/main/java/org/mpi/openmind/scripts/ChangeEntityPrivacity.java |
diffstat | 2 files changed, 63 insertions(+), 63 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/org/mpi/openmind/scripts/ChangeAllEntitiesPrivacity.java Mon Jul 10 18:53:04 2017 +0200 @@ -0,0 +1,63 @@ +package org.mpi.openmind.scripts; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.Statement; + +import org.apache.commons.lang.StringUtils; + +public class ChangeAllEntitiesPrivacity { + + public static void execute(boolean privacity) { + try { + + Connection conn; + + Class.forName("com.mysql.jdbc.Driver").newInstance(); + String url = "jdbc:mysql://localhost/openmind?characterEncoding=UTF-8"; + conn = DriverManager.getConnection(url, "ismi", "ismipw"); + + + Statement st = conn.createStatement(); + //((privacity)? "1" : "0") + String sql = "UPDATE node SET public =" + privacity + ""; + System.out.println("Executing:"); + System.out.println(sql); + int n = st.executeUpdate(sql); + //System.out.println(n + " rows were modified"); + + conn.close(); + + } catch (ClassNotFoundException ex) { + System.err.println(ex.getMessage()); + ex.printStackTrace(); + } catch (IllegalAccessException ex) { + System.err.println(ex.getMessage()); + ex.printStackTrace(); + } catch (InstantiationException ex) { + System.err.println(ex.getMessage()); + ex.printStackTrace(); + } catch (SQLException ex) { + System.err.println(ex.getMessage()); + ex.printStackTrace(); + } + } + + public static void main(String[] args) { + String arg = args[0]; + System.out.println("arg: " + arg); + boolean privacity = false; + if(StringUtils.isNotEmpty(arg)){ + try{ + privacity = new Boolean(arg); + }catch (Exception e) { + e.printStackTrace(); + } + } + + ChangeAllEntitiesPrivacity.execute(privacity); + System.exit(0); + } + +}
--- a/src/main/java/org/mpi/openmind/scripts/ChangeEntityPrivacity.java Mon Jul 10 17:15:34 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -package org.mpi.openmind.scripts; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Statement; - -import org.apache.commons.lang.StringUtils; - -public class ChangeEntityPrivacity { - - public static void execute(boolean privacity) { - try { - - Connection conn; - - Class.forName("com.mysql.jdbc.Driver").newInstance(); - String url = "jdbc:mysql://localhost/openmind?characterEncoding=UTF-8"; - conn = DriverManager.getConnection(url, "ismi", "ismipw"); - - - Statement st = conn.createStatement(); - //((privacity)? "1" : "0") - String sql = "UPDATE node SET public =" + privacity + ""; - System.out.println("Executing:"); - System.out.println(sql); - int n = st.executeUpdate(sql); - //System.out.println(n + " rows were modified"); - - conn.close(); - - } catch (ClassNotFoundException ex) { - System.err.println(ex.getMessage()); - ex.printStackTrace(); - } catch (IllegalAccessException ex) { - System.err.println(ex.getMessage()); - ex.printStackTrace(); - } catch (InstantiationException ex) { - System.err.println(ex.getMessage()); - ex.printStackTrace(); - } catch (SQLException ex) { - System.err.println(ex.getMessage()); - ex.printStackTrace(); - } - } - - public static void main(String[] args) { - String arg = args[0]; - System.out.println("arg: " + arg); - boolean privacity = false; - if(StringUtils.isNotEmpty(arg)){ - try{ - privacity = new Boolean(arg); - }catch (Exception e) { - e.printStackTrace(); - } - } - - ChangeEntityPrivacity.execute(privacity); - System.exit(0); - } - -}