Skip to content

Instantly share code, notes, and snippets.

package com.besuricata.rest.controllers.impl;
import com.besuricata.rest.controllers.BasicControllerAbstract;
import com.besuricata.rest.domain.Suricata;
import com.besuricata.rest.services.impl.SuricataService;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
package com.besuricata.rest.controllers;
import com.besuricata.rest.services.BasicService;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.Collection;
package com.besuricata.rest.controllers;
import java.util.Collection;
interface BasicController<T, ID> {
T getById(ID identifier);
Collection<T> get();
package com.besuricata.rest.services;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.Collection;
public abstract class BasicServiceAbstract<T, ID> implements BasicService<T, ID> {
protected JpaRepository<T, ID> repository;
package com.besuricata.rest.services;
import java.util.Collection;
public interface BasicService<T, ID> {
T getById(ID identifier);
Collection<T> findAll();
package com.besuricata.rest.repositories;
import com.besuricata.rest.domain.Suricata;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.Collection;
@Repository
public interface SuricataRepository extends JpaRepository<Suricata, Long> {
package com.besuricata.rest.domain;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.io.Serializable;
@Entity
public class Suricata implements Serializable {
package es.pablocloud.accidentswatcher
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.scheduling.annotation.EnableScheduling
@SpringBootApplication
@EnableScheduling
class AccidentswatcherApplication {
@pablocloud
pablocloud / Grails Pagination For MaterializeCSS
Last active October 17, 2016 17:34
This was used to use materialize with Grails pagination, tag is g:pagination
package swimpee
import grails.util.TypeConvertingMap
import grails.web.mapping.UrlMapping
import org.grails.taglib.TagOutput
import org.grails.taglib.encoder.OutputContextLookupHelper
import org.springframework.web.servlet.support.RequestContextUtils
class PaginationTagLib {