This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static Logger logger = Logger.getLogger(BaseAgent.class); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Controller implements Runnable { | |
private static Logger logger = Logger.getLogger(Controller.class); | |
public void run() { | |
logger.info("Starting subsystem AgentController"); | |
String sql = "select * from agent where active=true"; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.io.InputStream; | |
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.ResultSet; | |
import java.sql.SQLException; | |
import java.sql.Statement; | |
import java.util.Properties; | |
import org.apache.log4j.Logger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.persistence.Column; | |
import javax.persistence.Entity; | |
import javax.persistence.GeneratedValue; | |
import javax.persistence.GenerationType; | |
import javax.persistence.Id; | |
import javax.persistence.Table; | |
import javax.persistence.UniqueConstraint; | |
@Entity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.boot.context.properties.ConfigurationProperties; | |
import org.springframework.stereotype.Component; | |
@Component | |
@ConfigurationProperties("web.start") | |
public class StartPageProperties { | |
private String appName; | |
private String pageTitle; | |
private String templateFolder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.List; | |
import org.springframework.data.jpa.repository.JpaRepository; | |
public interface AgentRepository extends JpaRepository<Agent, Long> { | |
List<Agent> findByActive(boolean active); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.stereotype.Controller; | |
import org.springframework.ui.Model; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.RequestMethod; | |
@Controller | |
@RequestMapping("/") | |
public class Start { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Security | |
security.basic.enabled=false | |
management.security.enabled=false | |
# Database settings | |
spring.datasource.url=jdbc:mysql://localhost/alfmonitor | |
spring.datasource.username=admin | |
spring.datasource.password=admin | |
spring.datasource.driver-class-name=com.mysql.jdbc.Driver | |
#spring.jpa.hibernate.ddl-auto=update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.hibernate.SessionFactory; | |
import org.hibernate.cfg.Configuration; | |
public class HibernateUtil { | |
private static final SessionFactory sessionFactory = buildSessionFactory(); | |
private static SessionFactory buildSessionFactory() { | |
try { | |
// Create the SessionFactory from hibernate.cfg.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Session session = HibernateUtil.getSessionFactory().openSession(); | |
session.setFlushMode(FlushMode.MANUAL); | |
ManagedSessionContext.bind(session); | |
session.beginTransaction(); | |
Query getAgentsQuery = session.createQuery(" from AgentModel where active=true"); | |
@SuppressWarnings("unchecked") | |
List<AgentModel> agentList = getAgentsQuery.list(); | |
for (AgentModel agentModel : agentList) { |
OlderNewer