Commit fc26274b authored by smanohar's avatar smanohar

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@217372 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6ad8f205
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>webitm-webservice</name> <name>webitm-bmr</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>
......
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.compliance=1.8
......
This diff is collapsed.
package ibase.webitm.ejb.bmr.util;
import ibase.utility.UserInfoBean;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.HashMap;
@javax.ejb.Local
public interface BMRUIActionLocal {
public String getProcessRouteXML() throws RemoteException, ITMException;
public String getBmrTemplateXML( boolean isNotNullTemplates ) throws RemoteException, ITMException;
public String saveXmlData(String bmrRefID, String dataString)throws RemoteException, ITMException;
public String getXmlData(String bmrRefID)throws RemoteException, ITMException;
public String saveStepXmlData(String tranIdRef, String stepID, String stepDescr, String stepXmlString, String ipAddress, UserInfoBean userInfo)throws RemoteException, ITMException;
public ArrayList<String> createWorkOrderDetails() throws RemoteException, ITMException;
public String getFormatedXsl(String xmlInputData,String xslFilePath,String targetDir) throws RemoteException, ITMException;
public String getUserInfo( String tranIdRef, String stepID ) throws RemoteException, ITMException;
public String updateGlobalvars(String workorder, HashMap<String, String> globalVars) throws RemoteException, ITMException;
public String getStepXmlData(String stepId , String tranId)throws RemoteException, ITMException;
//Added by Dnyaneshwar Chavan on 12-DEC-13 [ Preview the BMR Screen ] START
//public String getBMRData( String workOrder ) throws RemoteException,ITMException;
//Added by Dnyaneshwar Chavan on 12-DEC-13 [ Preview the BMR Screen ] END
public String getReviewXmlData( String bmrRefID , String workOrder ) throws RemoteException, ITMException;
public String getBMRTreeData() throws RemoteException,ITMException;
public String updateObsrvStatus( String obsrvStatus , String workOrder , String operation , String seqNo ) throws RemoteException,ITMException;
public String updateStepRemark( String dataString , String stepRemark ,UserInfoBean userInfo ) throws RemoteException,ITMException;
public ArrayList<String> getReviewedStep( String workOrder , String operation , String seq_no ) throws RemoteException,ITMException;
public ArrayList<String> getRemarkableStep( String workOrder , String operation , String seq_no )throws RemoteException,ITMException;
public String getReviewedFeedback( String workOrder , String operation , String seq_no , String step_id ) throws RemoteException,ITMException;
public String updateReviewedFeedback( String workOrder , String operation , String seq_no , String step_id , String feedback_detail , String role_type , UserInfoBean userInfo ) throws RemoteException,ITMException ;
//Changed by Shivaji on 13-04-2015 to pass IpAddress to method
public String updateObservationDetail( HashMap<String,String> observationDetail , UserInfoBean userInfo , String actionType , String response_data , String ipAddress) throws RemoteException,ITMException ; //Added by Lokesh on 6-Feb-2015
// Ended by Shivaji on 13-04-2015
public String getExceptionDetail( HashMap<String,String> observationDetail , String obsrvType )throws RemoteException,ITMException ; //Added by Lokesh on 16-Feb-2015
//public String getObservationDetail( HashMap<String,String> observationDetail )throws RemoteException,ITMException ; //Added by Lokesh on 16-Feb-2015
}
package ibase.webitm.ejb.bmr.util;
import ibase.utility.UserInfoBean;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.HashMap;
@javax.ejb.Remote
public interface BMRUIActionRemote {
public String getProcessRouteXML() throws RemoteException, ITMException;
public String getBmrTemplateXML( boolean isNotNullTemplates ) throws RemoteException, ITMException;
public String saveXmlData(String bmrRefID, String dataString) throws RemoteException, ITMException;
public String getXmlData(String bmrRefID) throws RemoteException, ITMException;
public String saveStepXmlData(String tranIdRef, String stepID, String stepDescr, String stepXmlString, String ipAddress, UserInfoBean userInfo)throws RemoteException, ITMException;
public ArrayList<String> createWorkOrderDetails() throws RemoteException, ITMException;
public String getFormatedXsl(String xmlInputData,String xslFilePath,String targetDir) throws RemoteException, ITMException;
public ArrayList<String> getObserveDataXml(String routeCode) throws RemoteException, ITMException;
public String getUserInfo( String tranIdRef, String stepID ) throws RemoteException, ITMException;
public String updateGlobalvars(String workorder, HashMap<String, String> globalVars) throws RemoteException, ITMException;
public String getStepXmlData(String stepId , String tranId)throws RemoteException, ITMException;
//Added by Dnyaneshwar Chavan on 12-DEC-13 [ Preview the BMR Screen ] START
// public String getBMRData( String workOrder ) throws RemoteException,ITMException;
//Added by Dnyaneshwar Chavan on 12-DEC-13 [ Preview the BMR Screen ] END
public String getReviewXmlData( String bmrRefID , String workOrder ) throws RemoteException, ITMException;
public String getBMRTreeData() throws RemoteException,ITMException;
public String updateObsrvStatus( String obsrvStatus , String workOrder , String operation , String seqNo ) throws RemoteException,ITMException;
public String updateStepRemark( String dataString , String stepRemark ,UserInfoBean userInfo ) throws RemoteException,ITMException;
public ArrayList<String> getReviewedStep( String workOrder , String operation , String seq_no ) throws RemoteException,ITMException;
public ArrayList<String> getRemarkableStep( String workOrder , String operation , String seq_no )throws RemoteException,ITMException;
public String getReviewedFeedback( String workOrder , String operation , String seq_no , String step_id ) throws RemoteException,ITMException;
public String updateReviewedFeedback( String workOrder , String operation , String seq_no , String step_id , String feedback_detail , String role_type ,UserInfoBean userInfo ) throws RemoteException,ITMException ;
//Chnaged by Shivaji on 13-04-2015 to add one more argument to method
public String updateObservationDetail( HashMap<String,String> observationDetail , UserInfoBean userInfo , String actionType , String response_data, String ipAddress) throws RemoteException,ITMException ; //Added by Lokesh on 6-Feb-2015
// Ended by Shivaji on 13-04-2015
public String getExceptionDetail( HashMap<String,String> observationDetail , String obsrvType )throws RemoteException,ITMException ; //Added by Lokesh on 16-Feb-2015
//public String getObservationDetail( HashMap<String,String> observationDetail )throws RemoteException,ITMException ; //Added by Lokesh on 16-Feb-2015
}
package ibase.webitm.ejb.bmr.util;
import ibase.utility.CommonConstants;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.util.ArrayList;
public class BMRXMLData {
private String winName = null;
private String tranIdCol = null;
private String tranId = null;
private String filePath = null;
private PreparedStatement pstmt = null;
private ResultSet rs = null;
private String winSqls[];
//private String formNos[];
private ArrayList formNos = new ArrayList();
public BMRXMLData(){}
public BMRXMLData( String winName, String tranIdCol )
{
this.winName = winName;
this.tranIdCol = tranIdCol;
//to change as per the db name
filePath = CommonConstants.JBOSSHOME + File.separator + "SQL" + File.separator + CommonConstants.DB_NAME + File.separator;
}
public String getTranXML( String tranId, Connection conn ) throws Exception
{
String sql = "select form_no from obj_forms where win_name = '" + this.winName + "'";
this.tranId = tranId;
pstmt = conn.prepareStatement( sql );
rs = pstmt.executeQuery();
while( rs.next() )
{
formNos.add( rs.getString( "form_no" ) );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
int noOfForms = formNos.size();
winSqls = new String[ noOfForms ];
for( int formIdx = 0; formIdx < noOfForms ; formIdx++ )
{
sql = getFormSQL( ( String )formNos.get( formIdx ) );
winSqls[ formIdx ] = sql;
}
return prepareXML( winSqls, conn );
}
private String getFormSQL( String formNo ) throws Exception
{
StringBuffer dataBuff = new StringBuffer();
String lineStr = null;
String fileName = winName.substring( 2 ) + ( formNo.equalsIgnoreCase( "1" ) ? "21" : "1" + formNo );
BufferedReader br = new BufferedReader( new FileReader( filePath + fileName + ".sql" ) );
while( ( lineStr = br.readLine() ) != null )
{
dataBuff.append( lineStr );
}
return dataBuff.toString();
}
private String prepareXML( String []formSQLs, Connection conn ) throws Exception
{
StringBuffer tranXmlBuff = new StringBuffer( " <DocumentRoot> "
+" <description>Datawindow Root</description> "
+" <group0><description>Group0 description</description> "
+" <Header0><description>Header0 members</description> "
+" <DocumentRoot><description>Datawindow Root</description> "
+" <group0><description>Group0 description</description> "
+" <Header0><description>Header0 members</description> "
);
String colName = null;
String colVal = null;
String colXml = null;
String detTag = null;
String detEndTag = null;
for( int formSqlIdx = 0; formSqlIdx < formSQLs.length ; formSqlIdx++ )
{
pstmt = conn.prepareStatement( formSQLs[ formSqlIdx ] );
pstmt.setString( 1, this.tranId );
rs = pstmt.executeQuery();
ResultSetMetaData rsmd = rs.getMetaData();
int numberOfColumns = rsmd.getColumnCount();
detTag = "<Detail" + ( formSqlIdx + 1 ) + ">";
detEndTag = "</Detail" + ( formSqlIdx + 1 ) + ">";
while( rs.next() )
{
tranXmlBuff.append( "\n\t" + detTag );
for( int rsIdx = 1; rsIdx < numberOfColumns ; rsIdx++ )
{
colName = rsmd.getColumnName( rsIdx );
colVal = rs.getString( colName );
colXml = "\n\t\t<" + colName.toLowerCase() + ">"
+ ( colVal == null || colVal.trim().length() == 0 || colVal.equalsIgnoreCase( "null" ) ? "" : colVal )
+ "</" + colName.toLowerCase() + ">";
tranXmlBuff.append( colXml );
}
tranXmlBuff.append( "\t" + detEndTag );
}
rsmd = null;
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
tranXmlBuff.append( " </Header0> "
+" </group0> "
+" </DocumentRoot> "
+" </Header0> "
+" </group0> "
+"</DocumentRoot> " );
return tranXmlBuff.toString();
}
}
package ibase.webitm.ejb.bmr.util;
import java.util.*;
import java.io.*;
import java.text.*;
import java.sql.*;
class BMRXSLConverter
{
public static String convert( String xhtmlStr ) throws Exception
{
String str = null;
String str1 = null;
try
{
/*
String filePath = "D:/testpkg/RCPTEST.xhtml";
File inFile = new File( filePath );
BufferedReader readFile = new BufferedReader( new InputStreamReader( new FileInputStream ( inFile ) ) );
StringBuffer strBuff = new StringBuffer();
String str = null;
while( ( str = readFile.readLine() ) != null )
{
strBuff.append( str + "\n" );
}
readFile.close();
readFile = null;
*/
StringBuffer strBuff = new StringBuffer( xhtmlStr );
final String XSLSTART = "<?xml version='1.0' encoding='utf-8'?> "
+" <xsl:stylesheet version=\"1.0\" "
+" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" "
+" xmlns:NonHtml=\"http://www.progress.com/StylusStudio/NonHtml\" "
+" exclude-result-prefixes=\"NonHtml\"> "
+" <xsl:output method=\"html\"/>"
+"<xsl:template match=\"/\"> "
+"<html>";
final String XSLEND = "</xsl:template>"
+" </xsl:stylesheet>";
final String addperf ="<td align=\"center\"> \n"
+"<xsl:value-of select=\"observation/perfd_by\" /> \n"
+"</td> \n"
+"<td align=\"center\"> \n"
+"<xsl:value-of select=\"observation/checked_by\" /> \n"
+"</td> \n"
+"</tr> \n"
+"</xsl:for-each> \n";
str = strBuff.toString();
str = strBuff.toString().replaceAll( "xhtml:", "" );
str = str.replaceAll( "xf:group ref", "xsl:for-each select" );
str = str.replaceAll( "</xf:group>", "</xsl:for-each>" );
str = str.replaceAll( "xf:input ref", "xsl:value-of select" );
str = str.replaceAll( "</xf:input>", "</xsl:value-of>" );
str = str.replaceAll( "input ref", "xsl:value-of select" );
str = str.replaceAll( "</input>", "</xsl:value-of>" );
str = str.replaceAll( "disabled=\"disabled\"", "" );
str = str.replaceAll( "readonly=\"readonly\"", "" );
str = str.replaceAll( "size=\"8\"", "" );
str = str.replaceAll( "class=\"ntabtext\"", "" );
str = str.replaceAll( "class=\"ltabtext\"", "" );
str = str.replaceAll( "class=\"mtabtext\"", "" );
str = str.replaceAll( "class=\"big\"", "" );
str = str.replaceAll( "instance\\('DBDATA'\\)/group0/Header0", "/" );
/* added by ubehera on 22/12/09 */
str = str.replaceAll( "<th colspan=\"2\">Time</th>", "<th colspan=\"2\">Time</th><th rowspan=\"2\">Perfd By</th><th rowspan=\"2\">Checked By</th> " );
str = str.replaceAll( "width=\"1000\"", "width=\"800\"" );
str = str.replaceAll( "width=\"10%\"", "width=\"5%\"" );
/* ended by ubehera on 22/12/09 */
str = str.replaceAll( "<xf:input1 ref =\"observation/perfd_by\"/>", "<td align=\"center\"><xsl:value-of select=\"observation/perfd_by\" /></td> " );
/* commented by ubehera on 26/12/09 */
/* str = str.replaceAll( "<xf:input1 ref =\"observation/checked_by\"/>", "<td align=\"center\"><xsl:value-of select=\"observation/checked_by\" /></td> " ); */
/* commented by ubehera on 26/12/09 */
str = str.replaceAll( "<xf:input1 ref =\"observation/checked_by\"/>","<td><xsl:value-of select=\"//Detail1/conf_fname\"/>&#160;<xsl:value-of select=\"//Detail1/conf_mname\"/>&#160;<xsl:value-of select=\"//Detail1/conf_lname\"/></td>" );
str = str.replaceAll("?¿??¿?","");
//str = str.replaceAll("?","");
//str = str.replaceAll("?","&#176;");
str = str.replaceAll("±","&#177;");
str = str.replaceAll("","&#177;");
//str = str.replaceAll("\\?","&#63;");
str = str.replaceAll("&#63;","");
//str = str.replaceAll("°","&#176;");
str = str.replaceAll("","");
//do something to convert into to &#176; srart
//str = str.replaceAll("Target Temp. 27 C","Target Temp. 27&#176; C");
//str = str.replaceAll("25-30C","25-30&#176;C");
//str = str.replaceAll("C","&#176;C");
str = str.replaceAll("","&#176;");
//do something to convert into to &#176; end
str = str.replaceAll("~","&#126;");
//str = str.replaceAll("ÿ","&#255;");
//added by ubehera on 13/1/10
str = str.replaceAll("","&#176;");
//ended by ubehera on 13/1/10
str = str.replaceAll("ÿ","");
str = str.replaceAll("&#160;","");
str = str.replaceAll("<title align=\"center\"","<title");
str = str.replaceAll("align=\"center\"","");
str = str.replaceAll("<td>","<td align=\"center\">");
str = BMRXSLConverter.replaceStr( new StringBuffer( str ), "<html xmlns:", ">", "" ).toString();
str = BMRXSLConverter.replaceStr( new StringBuffer( str ), "<xf:model", "</xf:model>", "" ).toString();
str = BMRXSLConverter.replaceStr( new StringBuffer( str ), "<xf:trigger", "</xf:trigger>", "" ).toString();
str = BMRXSLConverter.replaceStr( new StringBuffer( str ), "<xf:action", "</xf:action>", "" ).toString();
str = BMRXSLConverter.replaceStr( new StringBuffer( str ), "<xf:select", "</xf:select>", "" ).toString();
str = XSLSTART + str + XSLEND;
str1 = BMRXSLConverter.removeSpaces(str);
}
catch( Exception e )
{
e.printStackTrace();
}
return str1;
}
public static StringBuffer replaceStr( StringBuffer src, String startSeq, String endSeq, String replacement )
{
int beginIdx = src.indexOf( startSeq );
int endIdx = -1;
while( beginIdx > - 1 )
{
endIdx = src.indexOf( endSeq ) + endSeq.length();
src = src.replace( beginIdx, endIdx, "" );
beginIdx = src.indexOf( startSeq );
}
return src;
}
public static String removeSpaces(String str)
{
StringTokenizer strToken = new StringTokenizer(str,"\n");
String temp = "",temp1 = "";
int cnt12 = 0;
boolean flag = false;
while(strToken.hasMoreTokens())
{
temp = strToken.nextToken();
cnt12++;
if(!flag)
{
if(temp.indexOf("<xsl:value-of") != -1 )
{
temp1 = temp1 + temp ;
if(temp.indexOf("/>") != -1)
temp1 = temp1 + "\n" ;
}
else
temp1 = temp1 + temp + "\n";
}
if(temp.indexOf("<xsl:value-of") != -1 && !(temp.indexOf("/>") != -1) )
{
flag = true;
temp1 = temp1 + "</xsl:value-of>\n";
}
else if(temp.indexOf("</xsl:value-of") != -1)
flag = false;
}
return temp1;
}
}
package ibase.webitm.ejb.bmr.util;
import ibase.system.config.AppConnectParm;
import ibase.utility.CommonConstants;
import ibase.webitm.utility.ITMException;
import java.io.File;
import java.rmi.RemoteException;
import java.util.ArrayList;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.http.HttpSession;
/**
* @author Harshada
* Bean to print eBMR page using JSP interface
*/
public class BmrBean
{
String workOrder;
String routeCode;
ArrayList<String> workOrderDetailsList;
public BmrBean()
{
try
{
System.out.println("Initiating BmrBean....");
AppConnectParm appConnect = new AppConnectParm();
InitialContext ctx = new InitialContext( appConnect.getProperty() );
BMRUIActionRemote bmrActionRemote = (BMRUIActionRemote) ctx.lookup("ibase/BMRUIActionEJB/remote");
setWorkOrderDetailsList(bmrActionRemote.createWorkOrderDetails());
System.out.println("WorkOrder list created...");
}
catch (NamingException e) {
System.out.println("NamingException occured in BmrBean: " + e);
e.printStackTrace();
} catch (Exception e) {
System.out.println("Exception occured in BmrBean: " + e);
e.printStackTrace();
}
}
public String getObserveData(String contextPath) throws RemoteException, ITMException
{
StringBuilder mergedXmlData = null;
try
{
mergedXmlData = new StringBuilder();
String observDataHtml="";
//String routeCode = getRouteCode();
//String appContextPath = CommonConstants.APPLICATION_CONTEXT;
System.out.println("appContextPath: "+contextPath);
System.out.println("Selected route code: "+ routeCode);
String resourcePath = contextPath + "BMRFiles" + File.separator + "ToPrint"+ File.separator;
String targetDir = contextPath + "temp" + File.separator;
System.out.println("resourcePath: ["+ resourcePath+"]");
System.out.println("targetDir: ["+ targetDir+"]");
AppConnectParm appConnect = new AppConnectParm();
InitialContext ctx = new InitialContext( appConnect.getProperty() );
BMRUIActionRemote bmrActionRemote = (BMRUIActionRemote) ctx.lookup("ibase/BMRUIActionEJB/remote");
System.out.println("route code in bean:" + routeCode);
if(routeCode.equals("null") || routeCode != null )
{
ArrayList<String> observDetails = bmrActionRemote.getObserveDataXml(routeCode);
int len = observDetails.size();
for(int i=0; i < len ;i++)
{
String splitStr[] = observDetails.get(i).split("~");
String xmlInputData = splitStr[0];
String xslFileName = splitStr[1];
String xslFilePath = resourcePath + xslFileName + ".xsl" ;
//System.out.println("xmlInputData on seperation bean:[" + xmlInputData+"]");
System.out.println("xslFileName: "+ xslFilePath);
observDataHtml = bmrActionRemote.getFormatedXsl(xmlInputData, xslFilePath, targetDir);
mergedXmlData.append(observDataHtml);
}
}
else{
observDataHtml = "No Preview Available";
mergedXmlData.append(observDataHtml);
}
//System.out.println("final output string: ["+mergedXmlData.toString()+"]");
} catch (NamingException e) {
System.out.println("NamingException in getObserveData : "+e);
e.printStackTrace();
} catch (Exception e) {
System.out.println("Exception in getObserveData : "+e);
e.printStackTrace();
}
return mergedXmlData.toString();
}
public ArrayList<String> getWorkOrderDetailsList() {
return workOrderDetailsList;
}
public void setWorkOrderDetailsList(ArrayList<String> workOrderDetailsList) {
this.workOrderDetailsList = workOrderDetailsList;
}
public String getWorkOrder() {
return workOrder;
}
public void setWorkOrder(String workOrder) {
this.workOrder = workOrder;
}
public String getRouteCode() {
return routeCode;
}
public void setRouteCode(String routeCode) {
this.routeCode = routeCode;
}
}
package ibase.webitm.ejb.bmr.util;
import ibase.webitm.ejb.mfg.bmr.Instruction;
import ibase.webitm.ejb.mfg.bmr.Observation;
import java.util.ArrayList;
public class CreateDummyInstr
{
private String routeCode = "DUMMY";
private int operation = 1;
private int seqNo = 1;
private String instruction = null;
private int templateNo;
public CreateDummyInstr(){}
public static Instruction getInstance( String instrStr, int templateNo )
{
CreateDummyInstr cdI = new CreateDummyInstr();
Instruction instr = new Instruction();
ArrayList tagList = Utils.getAllCustomTagSpecs( instrStr );
instr.routeCode = cdI.routeCode;
instr.operation = cdI.operation;
instr.seqNo = cdI.seqNo;
instr.instruction = instrStr;
instr.templateNo = templateNo;
int tagListLen = tagList.size();
ArrayList obsArr = new ArrayList();
Observation observ = null;
for( int idx = 0; idx < tagListLen; idx++ )
{
observ = new Observation();
TagSpec ts = new TagSpec( ( (TagIndex)tagList.get( idx ) ).tagSpec );
observ.routeCode = cdI.routeCode;
observ.operation = cdI.operation;
observ.seqNo = ts.ref;
observ.seqNoInstr = cdI.seqNo;
if( ts.tagName.equalsIgnoreCase( "input" ) )
{
//observ.observName = "Observation " + ( idx + 1 );
//observ.observTrail = "Trail " + ( idx + 1 );
}else if( ts.tagName.equalsIgnoreCase( "table" ) )
{
String dummyHdr = "";
for( int hdrIdx = 0; hdrIdx < ts.col; hdrIdx++ )
{
dummyHdr = dummyHdr + "Header " + ( hdrIdx + 1 ) + (hdrIdx + 1 == ts.col ? "" : "," );
}
observ.defaultValue = dummyHdr;
}
obsArr.add( observ );
observ = null;
}
instr.observations = obsArr;
instr.observMap = instr.getObservMap();
return instr ;
}
}
package ibase.webitm.ejb.bmr.util;
import ibase.webitm.ejb.mfg.bmr.Instruction;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.Tag;
public class GenCustomTag implements Tag{
private PageContext pageContext;
private Tag parent;
private String instruction = null;
private int templateNo = 0;
public void setInstruction( String instr ){ this.instruction = instr; }
public void setTemplateNo( int templtNo ){ this.templateNo = templtNo; }
public String getInstruction( ){ return this.instruction; }
public int getTemplateNo(){ return this.templateNo; }
public GenCustomTag() {
super();
}
public int doStartTag() throws JspException {
try {
HttpServletRequest req = (HttpServletRequest)pageContext.getRequest();
String viewStr = null;
Instruction instrObj = CreateDummyInstr.getInstance( getInstruction(), getTemplateNo() );
try{
viewStr = Utils.getDummyTemplate( instrObj );
}catch( Exception ex )
{
ex.printStackTrace();
throw new JspException(ex);
}
pageContext.getOut().print( viewStr );
} catch (IOException ioe) {
throw new JspException("Error: IOException while writing to client" + ioe.getMessage());
}
return SKIP_BODY;
}
public int doEndTag() throws JspException {
return SKIP_PAGE;
}
public void release() {
}
public void setPageContext(PageContext
pageContext) {
this.pageContext = pageContext;
}
public void setParent(Tag parent) {
this.parent = parent;
}
public Tag getParent() {
return parent;
}
}
package ibase.webitm.ejb.bmr.util;
public class LoginInfo
{
public String empCode = null;
public String fName = null;
public String mName = null;
public String lName = null;
public String getFullName()
{
String fullName = "";
fullName = fName + " " + ( mName == null || mName.trim().length() == 0 ? "" : mName.trim() )
+ " " + ( lName == null || lName.trim().length() == 0 ? "" : lName.trim() );
return fullName.trim();
}
}
package ibase.webitm.ejb.bmr.util;
public class TabHdrInfo
{
public String groupHdr = null;
public int colSpan = -1;
public int rowSpan = -1;
public String subGroupHdr[]={};
}
package ibase.webitm.ejb.bmr.util;
import ibase.webitm.ejb.mfg.bmr.CustomTag;
public class TagIndex
{
public String tagSpec = null;
public int pos = -1;
public CustomTag customTag = null;
public TagIndex(){}
public TagIndex( String t, int i )
{
this.tagSpec = t;
this.pos = i;
this.customTag = null;
}
}
This diff is collapsed.
This diff is collapsed.
package ibase.webitm.ejb.bmr.util;
import ibase.webitm.ejb.mfg.bmr.BMRTemplateBean;
import ibase.webitm.ejb.mfg.bmr.Observation;
import ibase.webitm.ejb.mfg.bmr.WorkOrderObservBean;
import java.util.ArrayList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class XMLToBeanConverter {
public XMLToBeanConverter(){}
public ArrayList getAllObservFromXml( BMRTemplateBean templateObj ) throws Exception
{
ArrayList observList = new ArrayList();
WorkOrderObservBean woObservRec = null;
String observVal = null;
Observation observ = null;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document dom = db.parse( new java.io.ByteArrayInputStream( templateObj.observData.getBytes() ) );
NodeList instrNodeList = dom.getElementsByTagName( "instruction" );
Node instrNode = instrNodeList.item( 0 );
NodeList observNodeList = instrNode.getChildNodes();
int LEN = observNodeList.getLength();
Node observNode = null;
String elemName = null;
int elemType;
String nameArr[] = {};
for( int observIdx = 0; observIdx < LEN; observIdx++ )
{
observNode = observNodeList.item( observIdx );
elemName = observNode.getNodeName();
elemType = observNode.getNodeType();
if( elemType == Node.ELEMENT_NODE
&& elemName.indexOf( "observ" ) > -1
&& !"observ_val".equalsIgnoreCase( elemName ) )
{
nameArr = elemName.split( "_" );
if( nameArr.length == 2 || nameArr.length == 4 )
{
woObservRec = new WorkOrderObservBean();
woObservRec.setRouteCode( templateObj.routeCode );
woObservRec.setOperation( templateObj.operation );
woObservRec.setSeqNoInstr( templateObj.seqNo );
woObservRec.setSeqNoObserv( Integer.parseInt( nameArr[1] ) );
observVal = null;
observVal = observNode.getNodeValue();
woObservRec.setObservValue( observVal );
observ = (Observation)templateObj.instrMst.observMap.get( "observ_" + woObservRec.getSeqNoObserv() );
//if nameArr.lenght == 2 => Its a simple text box.
//if nameArr.lenght == 4 => Its a table so get its column header.
woObservRec.setObservDetail( nameArr.length == 2 ? "" : observ.getColumnHdr( Integer.parseInt( nameArr[2] ), Integer.parseInt( nameArr[3] ) ) );
observList.add( woObservRec );
woObservRec = null;
}
}
}
return observList;
}
}
This diff is collapsed.
/**
* PURPOSE : Local Interface
* AUTHOR : Kunal Mandhre
* Date : 22/11/2012
*/
package ibase.webitm.ejb.mfg;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import org.w3c.dom.*;
@javax.ejb.Local
public interface BmrEntryScreenICLocal extends ValidatorLocal
{
public String wfValData(Document currDom, Document hdrDom, Document allDom, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(String currFrmXmlStr, String hdrFrmXmlStr, String allFrmXmlStr, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(String currFrmXmlStr, String hdrFrmXmlStr,String allFrmXmlStr, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document currDom, Document hdrDom, Document allDom, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
}
This diff is collapsed.
This diff is collapsed.
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
import org.w3c.dom.*;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface BmrTemplateLocal extends ValidatorLocal//, EJBObject
{
public String wfValData() throws RemoteException,ITMException;
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException;
public String wfValData(Document dom, Document dom1,Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged() throws RemoteException,ITMException;
public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1,Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment