/* Automatically generated.
 * Copyright (c) 2000-2006 by SAP AG, Walldorf.,
 * http://www.sap.com
 * All rights reserved.
 *
 * This software is the confidential and proprietary information
 * of SAP AG, Walldorf. You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms
 * of the license agreement you entered into with SAP.
 * Do not edit.
 */

import ro.emid.common.utils.ObjectUtils;
import ro.emid.common.types.DataObj;
import ro.emid.common.db.DataDB;
import ro.emid.common.constants.NomConstants;
import ro.emid.incidente.IncidenteSessionUtils;
import ro.emid.common.types.Category;
import ro.emid.common.utils.Util;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;

public class JEE_jsp_WEB_2d_INF_pagelet_nomen_ajax_getNomenclatorFromServer_1495030454335 extends com.sap.engine.services.servlets_jsp.lib.jspruntime.JspBase{

	public void _jspService(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException
	{
		//isXml=false
		JspFactory  _jspFactory     = JspFactory.getDefaultFactory();
		PageContext pageContext = _jspFactory.getPageContext(this,request,response,null,true,32768,true);
		ServletConfig config = pageContext.getServletConfig();
		ServletContext application = pageContext.getServletContext();
		com.sap.engine.services.servlets_jsp.lib.jspruntime.PageContextImpl _jspx_pageContext = (com.sap.engine.services.servlets_jsp.lib.jspruntime.PageContextImpl) pageContext;
		com.sap.engine.services.servlets_jsp.server.application.InjectionWrapper _jspx_resourceInjector = ((com.sap.engine.services.servlets_jsp.server.application.ServletContextImpl)_jspx_pageContext.getServletContext()).getApplicationContext().getInjectionWrapper();
		HttpSession session = pageContext.getSession();
		if (!response.isCommitted()) {
		response.setContentType("text/html;charset=UTF-8");
		}
		JspWriter   out     = pageContext.getOut();
		java.lang.Object page = this;
		try {
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(1,53);to=(2,0)]
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(2,49);to=(3,0)]
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(3,45);to=(4,0)]
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(4,58);to=(5,0)]
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(5,60);to=(6,0)]
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(6,50);to=(7,0)]
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(7,46);to=(8,0)]
// end
// begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(8,0);to=(39,2)]
			
    final int tipNom = ObjectUtils.getIntValue(request.getParameter("tipNom"), -1);
    final String codParent = ObjectUtils.getStringValue(request.getParameter("codParent")).trim();
    final String codSapCE = ObjectUtils.getStringValue(request.getParameter("codSapCE")).trim();
    final int nrOfParent = ObjectUtils.getIntValue(request.getParameter("nrOfParent"), 1);
    final DataObj[] datas;
    final boolean printVersion = ObjectUtils.getStringValue(request.getParameter("printVersion")).equals("true");

    if (nrOfParent == 1) {
        final Category filiala = IncidenteSessionUtils.getFiliala(session);
        final Category sucursala = IncidenteSessionUtils.getSucursala(session);
        final Category centru = IncidenteSessionUtils.getCentru(session);
        if( filiala.isMunteniaSud() && centru.isCentruPRAM()){   //show all LF from Sucursala
            datas = DataDB.getAllByCodSucursala(sucursala.getCodSap(), tipNom, "");
        }else{
            datas = DataDB.getAllByCodCe(codParent, tipNom, "");
        }
    } else if ("-1".equals(codParent)) {    //cand Statia este pe "Selectati:"
        datas = DataDB.getAllEQByCodCEOrfane(codSapCE, tipNom);
    } else if( -2 == nrOfParent ){
        datas = DataDB.getAllByCodCe( codSapCE, tipNom, "");
    } else {
        datas = DataDB.getAllEQByCodLocFunctional(codParent, tipNom);
    }


    final long selectedValue = ObjectUtils.getLongValue(request.getParameter("selectedValue"), -1);


    final String selectName = ObjectUtils.getStringValue(request.getParameter("selectName"));


// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(39,2);to=(41,4)]
			out.print("\r\n<respmesg>\r\n    ");
// end
// begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(41,4);to=(41,48)]
			 if (tipNom == NomConstants.NOM_STATII){
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(41,48);to=(42,22)]
			out.print("\r\n        <select name=\"");
// end
// begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(42,22);to=(42,37)]
			out.print(selectName);
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(42,37);to=(42,89)]
			out.print("\" class=\"gSAPSelect\" onchange=\"on_statie_changed()\" ");
// end
// begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(42,89);to=(42,120)]
			out.print(printVersion?"disabled":"");
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(42,120);to=(44,12)]
			out.print(" >\r\n            <OPTION value=\"-1\">Selectati:</OPTION>\r\n            ");
// end
// begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(44,12);to=(44,83)]
			 Util.showDataOptionsValueIsId( out, datas, selectedValue, false); 
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(44,83);to=(47,22)]
			out.print("\r\n        </select>\r\n\r\n        <select name=\"");
// end
// begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(47,22);to=(47,37)]
			out.print(selectName);
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(47,37);to=(49,12)]
			out.print("h\" class=\"gSAPSelect\" style=\"display: none\">\r\n            <OPTION value=\"-1\">Selectati:</OPTION>\r\n            ");
// end
// begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(49,12);to=(49,63)]
			    Util.showDataOptionsValueIsCod(out, datas);
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(49,63);to=(51,4)]
			out.print("\r\n        </select>\r\n    ");
// end
// begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(51,4);to=(51,52)]
			 }else if(tipNom == NomConstants.NOM_LINII){
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(51,52);to=(52,22)]
			out.print("\r\n        <select name=\"");
// end
// begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(52,22);to=(52,37)]
			out.print(selectName);
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(52,37);to=(52,89)]
			out.print("\" class=\"gSAPSelect\" onchange=\"on_linie_changed();\" ");
// end
// begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(52,89);to=(52,120)]
			out.print(printVersion?"disabled":"");
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(52,120);to=(54,12)]
			out.print(" >\r\n            <OPTION value=\"-1\">Selectati:</OPTION>\r\n            ");
// end
// begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(54,12);to=(54,83)]
			 Util.showDataOptionsValueIsId( out, datas, selectedValue, false); 
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(54,83);to=(57,22)]
			out.print("\r\n        </select>\r\n\r\n        <select name=\"");
// end
// begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(57,22);to=(57,37)]
			out.print(selectName);
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(57,37);to=(59,12)]
			out.print("h\" class=\"gSAPSelect\" style=\"display: none\">\r\n            <OPTION value=\"-1\">Selectati:</OPTION>\r\n            ");
// end
// begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(59,12);to=(59,64)]
			    Util.showDataOptionsValueIsCod( out, datas);
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(59,64);to=(61,4)]
			out.print("\r\n        </select>\r\n    ");
// end
// begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(61,4);to=(61,16)]
			 }else {
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(61,16);to=(62,22)]
			out.print("\r\n        <select name=\"");
// end
// begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(62,22);to=(62,37)]
			out.print(selectName);
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(62,37);to=(62,58)]
			out.print("\" class=\"gSAPSelect\" ");
// end
// begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(62,58);to=(62,89)]
			out.print(printVersion?"disabled":"");
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(62,89);to=(64,12)]
			out.print(" onchange=\"onChangeSelect( this)\">\r\n            <OPTION value=\"-1\">Selectati:</OPTION>\r\n            ");
// end
// begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(64,12);to=(64,83)]
			 Util.showDataOptionsValueIsId( out, datas, selectedValue, false); 
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(64,83);to=(66,4)]
			out.print("\r\n        </select>\r\n    ");
// end
// begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(66,4);to=(66,10)]
			 }
// end
// HTML // begin [file="D:/usr/sap/POR/J00/j2ee/cluster/apps/JavaEE/emid-incidente/servlet_jsp/emid-incidente/root/WEB-INF/pagelet/nomen/ajax/getNomenclatorFromServer.jsp";from=(66,10);to=(68,0)]
			out.print("\r\n</respmesg>\r\n");
// end
		} catch (ThreadDeath tde) { throw tde;
		} catch (OutOfMemoryError ome) { throw ome;
		} catch (Throwable t) {
			if (!(t instanceof SkipPageException)) {
				try {
					out.clear();
				} catch(java.io.IOException _jspioex) {}
				_jspx_pageContext.handlePageException(t);
			}
		}finally{
			_jspFactory.releasePageContext(pageContext);
		}
	}

}
