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

package com.k_int.webapp.admin;

import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.*;
import javax.ws.rs.Path;
import javax.ws.rs.POST;

import com.sun.jersey.api.view.Viewable;
import com.sun.jersey.api.view.ImplicitProduces;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlTransient;

import com.sun.jersey.spi.resource.Singleton;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import org.hibernate.SessionFactory;
import org.hibernate.Session;
import org.hibernate.Query;
import org.hibernate.Transaction;
import org.hibernate.HibernateException;

import javax.servlet.http.HttpServletRequest;
import org.springframework.orm.hibernate3.SessionFactoryUtils;

import com.k_int.sql.data_dictionary.*;
import java.util.List;

/**
 * REST Web Service
 *
 * @author ibbo
 */

@XmlRootElement
@ImplicitProduces("text/html;qs=5")
@XmlAccessorType(XmlAccessType.FIELD)
@Component
@Path("/admin/ConfigTree")
public class ConfigTree {

  @XmlTransient
  private static Log log = LogFactory.getLog(ConfigTree.class);

  @XmlTransient
  @Autowired
  @Qualifier(value="IdentSessionFactory")
  private SessionFactory factory = null;

  @XmlTransient
  @Context
  private UriInfo context;

  public ConfigTree() {
    log.debug("no args constructor");
  }

  /**
   * Retrieves representation of an instance of info.made4u.made4uws.workorder.Made4UWorkOrderResource
   * @param id resource URI parameter
   * @return an instance of java.lang.String
   */
  @GET
  @Produces({MediaType.TEXT_HTML,MediaType.APPLICATION_XHTML_XML})
  public Viewable getXml(@PathParam("identifier") String identifier) {
    log.debug("getXml()");
    return new Viewable("index",this);
  }

  @GET
  @Produces({MediaType.APPLICATION_JSON})
  public ConfigTree getJson(@PathParam("identifier") String identifier) {
    log.debug("getJson");
    return this;
  }
}
