1 package org.openslx.imagemaster.db.mappers;
3 import java.sql.SQLException;
6 import org.apache.logging.log4j.LogManager;
7 import org.apache.logging.log4j.Logger;
14 import com.google.gson.annotations.SerializedName;
21 public static int add( UserInfo user, String displayName, List<String> address, String modulus, String exponent )
25 MysqlStatement stmt = connection.prepareStatement(
"INSERT INTO satellite"
26 +
" (dateline, userid, organizationid, satellitename, addresses, publickey)"
27 +
" VALUES (UNIX_TIMESTAMP(), :userid, :organizationid, :satellitename, :addresses, :pubkey)" );
29 stmt.
setString(
"organizationid", user.organizationId );
30 stmt.
setString(
"satellitename", displayName );
31 stmt.
setString(
"addresses", Json.serialize( address ) );
37 }
catch ( SQLException e ) {
38 LOGGER.error(
"Query failed in DbPendingSatellite.add()", e );
45 @SerializedName(
"type" )
47 @SerializedName(
"modulus" )
48 public String modulus;
49 @SerializedName(
"exponent" )
50 public String exponent;
52 public KeyWrapper( String modulus, String exponent )
55 this.modulus = modulus;
56 this.exponent = exponent;
static int add(UserInfo user, String displayName, List< String > address, String modulus, String exponent)
static final Logger LOGGER
static MysqlConnection getConnection()
Get a connection to the database.
int executeUpdate()
Executes the statement, which must be an SQL INSERT, UPDATE or DELETE statement; or an SQL statement ...
void setString(String name, String value)
Sets a parameter.
Class for creating PreparedStatements with named parameters.