Skip to content

Instantly share code, notes, and snippets.

View 3gcodes's full-sized avatar

Gregg Bolinger 3gcodes

View GitHub Profile
public interface Dao<T, ID extends Serializable> {
public List<T> read();
public T read(ID id);
public void save(T t);
public void delete(T t);
}
public class SqlMapBaseDao<T, ID extends Serializable> extends SqlMapClientDaoSupport implements Dao<T, ID> {
private Class<T> entityClass;
@Autowired
@SuppressWarnings("unchecked")
public void init(SqlMapClient sqlMapClient) {
entityClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
setSqlMapClient(sqlMapClient);
}
@Repository(UserDao.DAO_ID)
public class SqlMapUserDao extends SqlMapBaseDao<User, Integer> implements UserDao {
}
enum Rating {
G("G"),PG("PG"),PG13("PG-13"),R("R"),NC17("NC-17"),NR("Not Rated")
final String value
Rating(String value) {
this.value = value
}
class ArmoryController {
static allowedMethods = [queryAmory:'GET']
def queryAmory = {
String url = "http://www.wowarmory.com/search.xml?searchQuery=${params['id']}&searchType=items"
URL u = new URL(url);
URLConnection conn = u.openConnection()
String response = conn.content.text
render response
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.shape.Circle;
import javafx.scene.paint.Color;
import javafx.scene.image.ImageView;
import javafx.scene.image.Image;
import javafx.scene.*;
import javafx.scene.shape.*;
import javafx.scene.text.*;
import javafx.animation.*;
def colors = Color.list()
colors = colors.collect {
[cell: [it.name, it.description], id: it.id]
}
def jsonColors = [page: "${params.page}", records: numRecords, rows: colors, total: totalPages]
render jsonColors as JSON
def gridList = {
Integer page = Integer.parseInt(params.page)
Integer rows = Integer.parseInt(params.rows)
Integer numRecords = Color.count()
Integer totalPages = 0
if (numRecords > 0) {
totalPages = Math.ceil(numRecords / rows);
}
if (page > totalPages) {
def gridList = {
Integer page = Integer.parseInt(params.page)
Integer rows = Integer.parseInt(params.rows)
def sidx = params.sidx
def sord = params.sord
def color = new Color(params)
render colorService.filterColors(page, rows, sidx, sord, color) as JSON
}
public class Test {
public Test() {
}
public static void main(String[] args) {
System.out.println("Hello Hycel");
}