package com.enioka.jqm.model;
import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import com.enioka.jqm.jdbc.DatabaseException;
import com.enioka.jqm.jdbc.DbConn;
/**
* <strong>Not part of any API - this an internal JQM class and may change without notice.</strong> <br>
* Persistence class for storing the parameters of {@link ClHandler}s.
*/
public class ClHandlerParameter implements Serializable
{
private static final long serialVersionUID = 7803057784162464423L;
private Integer id;
private String key;
private String value;
/**
* A technical ID without any meaning. Generated by the database.
*/
public Integer getId()
{
return id;
}
/**
* See {@link #getId()}
*/
public void setId(Integer id)
{
this.id = id;
}
/**
* The name of the parameter.<br>
* Max length is 50.
*/
public String getKey()
{
return key;
}
/**
* See {@link #getKey()}
*/
public void setKey(String key)
{
this.key = key;
}
/**
* Value of the parameter.<br>
* Max length is 100.
*/
public String getValue()
{
return value;
}
/**
* See {@link #getValue()}
*/
public void setValue(String value)
{
this.value = value;
}
public static Map<String, String> select_map(DbConn cnx, String query_key, Object... args)
{
Map<String, String> res = new HashMap<String, String>();
try
{
ResultSet rs = cnx.runSelect(query_key, args);
while (rs.next())
{
res.put(rs.getString(2), rs.getString(3));
}
}
catch (SQLException e)
{
throw new DatabaseException(e);
}
return res;
}
}