Package business

Source Code of business.LogManager

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package business;

import HibernateUtil.HibernateUtil;
import database.Log;
import java.util.List;
import org.hibernate.Session;
/**
*
* @author f
*/
public class LogManager {
   
    /**
     * adds new Log into Syslog Database
     * @param log - instance to be added
     * @deprecated - outside of scope of application
     */
    public void addLog(Log log) {

        Session session = HibernateUtil.getSessionFactory().getCurrentSession();

        session.beginTransaction();
        session.save(log);

        session.getTransaction().commit();
    }
   
    /**
     * Deletes log from Syslog Database
     * @param id - id of Log instance in database to be deleted
     * @deprecated - outside of scope of application
     */
    public void delLog(long id) {

        Session session = HibernateUtil.getSessionFactory().getCurrentSession();

        session.beginTransaction();
        Log Log = (Log) session.load(Log.class, id);
        session.delete(Log);

        session.getTransaction().commit();
    }
   
    /**
     * Deletes log from Syslog Database
     * @param Log - Log instance to be deleted
     * @deprecated - outside of scope of application
     */
    public void delLog(Log Log) {

        Session session = HibernateUtil.getSessionFactory().getCurrentSession();

        session.beginTransaction();
        session.delete(Log);

        session.getTransaction().commit();
    }
   
    /**
     * Updates/Synchronizes log in Syslog Database
     * @param Log - log to be synchronized
     * @deprecated - outside of scope of application
     */
    public void updateLog(Log Log) {

        Session session = HibernateUtil.getSessionFactory().getCurrentSession();

        session.beginTransaction();
        session.update(Log);

        session.getTransaction().commit();
    }

    /**
     * Returns log instance specified by ID
     * @param id - id of instance
     * @return - Log instance
     */
    public Log getLog(long id) {

        Session session = HibernateUtil.getSessionFactory().getCurrentSession();

        session.beginTransaction();
        Log Log = (Log) session.load(Log.class, id);

        session.getTransaction().commit();
        return Log;
    }

    /**
     * Returns List of all logs in Syslog Database
     * @return List
     */
    public List getLogList() {

        Session session = HibernateUtil.getSessionFactory().getCurrentSession();

        session.beginTransaction();
        List result = session.createQuery("from Log").list();

        session.getTransaction().commit();
        return result;
   
   
    public List getFacilityList() {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();

        session.beginTransaction();
        List result = session.createQuery("from Log").list();

        session.getTransaction().commit();
        return result;
    }
   
    public List getSeverityList() {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();

        session.beginTransaction();
        List result = session.createQuery("from Log").list();

        session.getTransaction().commit();
        return result;
    }
   
    public List getTagList() {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();

        session.beginTransaction();
        List result = session.createQuery("from Log").list();

        session.getTransaction().commit();
        return result;
    }
   
    public List getHostnameServerList() {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();

        session.beginTransaction();
        List result = session.createQuery("from Log").list();

        session.getTransaction().commit();
        return result;
    }
   
    public List getHostnameOrigList() {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();

        session.beginTransaction();
        List result = session.createQuery("from Log").list();

        session.getTransaction().commit();
        return result;
    }
}
TOP

Related Classes of business.LogManager

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.