CheckKPIHelper.java 9.24 KB
package com.sitech.ismp.coll.tivoli;

import java.io.File;
import java.util.Vector;

import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;

import com.sitech.ismp.coll.basic.TblATO_KPIDETAIL;

public class CheckKPIHelper
{
	public static void Write_KPIValue2File(Vector KPISet,String filename)throws Exception
	{
		//WritableWorkbook workbook = Workbook.createWorkbook(new File(filename));
		WritableWorkbook workbook = Workbook.createWorkbook(new File(filename));
		WritableSheet sheet = workbook.createSheet("First Sheet",0);
        
		for(int i=0;i<KPISet.size();i++)
		{
			TblATO_KPIDETAIL kpidetail = (TblATO_KPIDETAIL)KPISet.elementAt(i);
			Label label1 = new Label(0,i,kpidetail.UNIT_ID);
			Label label2 = new Label(1,i,kpidetail.KPI_ID);
			Label label3 = new Label(2,i,kpidetail.KPI_VALUE);
			Label label4 = new Label(3,i,kpidetail.CLL_TIME_STR);
			sheet.addCell(label1);
			sheet.addCell(label2);
			sheet.addCell(label3);
			sheet.addCell(label4);
		}
		
		workbook.write();
		workbook.close();
		System.out.println(filename + " write successful!");
	}
	
	public static String [][] Check_AIX_HOST_KPI(Vector KPISet)
	{
		String AIX_HOST_KPI[][] = new String [][]{
				{"PM-00-01-001-01","inexistence"},
				{"PM-00-01-001-02","inexistence"},
				{"PM-00-01-001-03","inexistence"},
				{"PM-00-01-001-04","inexistence"},
				{"PM-00-01-001-05","inexistence"},
				{"PM-00-01-001-06","inexistence"},
				{"PM-00-01-002-01","inexistence"},
				{"PM-00-01-002-02","inexistence"},
				{"PM-00-01-002-03","inexistence"},
				{"PM-00-01-002-04","inexistence"},
				//{"PM-00-01-002-05","inexistence"},
				//{"PM-00-01-002-06","inexistence"},
				//{"PM-00-01-002-07","inexistence"},
				{"PM-00-01-002-08","inexistence"},
				{"PM-00-01-003-01","inexistence"},
				//{"PM-00-01-003-02","inexistence"},
				{"PM-00-01-003-03","inexistence"},
				{"PM-00-01-003-04","inexistence"},
				{"PM-00-01-003-05","inexistence"},
				{"PM-00-01-004-01","inexistence"},
				{"PM-00-01-004-02","inexistence"},
				{"PM-00-01-004-03","inexistence"},
				{"PM-00-01-005-01","inexistence"},
				//{"PM-00-01-005-02","inexistence"},
				{"PM-00-01-005-03","inexistence"},
				{"PM-00-01-005-04","inexistence"},
				{"PM-00-01-005-05","inexistence"},
				{"PM-00-01-005-06","inexistence"},
				{"FM-00-01-001-01","inexistence"},
				//{"FM-00-01-001-02","inexistence"},
				{"FM-00-01-001-03","inexistence"},
				{"FM-00-01-001-04","inexistence"},
				{"FM-00-01-001-05","inexistence"},
				{"CM-00-01-001-01","inexistence"},
				{"FM-00-01-900-01","inexistence"},
				{"CM-00-01-001-02","inexistence"},
				{"CM-00-01-001-03","inexistence"},
				{"CM-00-01-001-04","inexistence"},
				{"CM-00-01-001-05","inexistence"},
				{"CM-00-01-001-06","inexistence"},
				{"CM-00-01-001-07","inexistence"},
				{"CM-00-01-001-08","inexistence"},
				//{"CM-00-01-001-09","inexistence"},
				//{"CM-00-01-001-10","inexistence"},
				//{"CM-00-01-001-11","inexistence"},
				//{"CM-00-01-001-12","inexistence"},
				{"CM-00-01-001-13","inexistence"}
				//{"CM-00-01-001-14","inexistence"},
				//{"CM-00-01-001-15","inexistence"},
				//{"CM-00-01-001-16","inexistence"},
				//{"CM-00-01-001-17","inexistence"},
		};
		
		for(int i=0;i<KPISet.size();i++)
		{
			TblATO_KPIDETAIL kpidetail = (TblATO_KPIDETAIL)KPISet.elementAt(i);
			
			for(int j=0;j<AIX_HOST_KPI.length;j++)
			{
				if(kpidetail.KPI_ID.indexOf(AIX_HOST_KPI[j][0])>-1 && AIX_HOST_KPI[j][1].equals("inexistence"))
				{
					AIX_HOST_KPI[j][1]="exist";
				}
			}
		}
		return AIX_HOST_KPI;
	}
	
	public static String [][] Check_Tuxedo_KPI(Vector KPISet)
	{
		String Tuxedo_KPI [][] = new String [][]{
				{"PM-00-04-001-01","inexistence"},
				{"PM-00-04-001-02","inexistence"},
				{"PM-00-04-001-03","inexistence"},
				{"PM-00-04-001-04","inexistence"},
				{"PM-00-04-001-05","inexistence"},
				{"PM-00-04-001-06","inexistence"},
				{"PM-00-04-001-07","inexistence"},
				{"FM-00-04-001-01","inexistence"},
				{"FM-00-04-001-02","inexistence"},
				{"FM-00-04-001-03","inexistence"},
				{"CM-00-04-001-01","inexistence"},
				{"CM-00-04-001-02","inexistence"},
				{"CM-00-04-001-03","inexistence"},
				{"CM-00-04-001-04","inexistence"}
				//{"PM-00-04-002-01","inexistence"},
				//{"FM-00-04-002-01","inexistence"},
				//{"FM-00-04-002-02","inexistence"},
				//{"FM-00-04-002-03","inexistence"},
				//{"CM-00-04-002-01","inexistence"},
				//{"CM-00-04-002-02","inexistence"},
				//{"CM-00-04-002-03","inexistence"},
				//{"CM-00-04-002-04","inexistence"},
				//{"CM-00-04-002-05","inexistence"},
				//{"PM-00-04-003-01","inexistence"},
				//{"PM-00-04-003-02","inexistence"},
				//{"FM-00-04-003-01","inexistence"},
				//{"FM-00-04-003-02","inexistence"},
				//{"CM-00-04-003-01","inexistence"},
				//{"CM-00-04-003-02","inexistence"},
				//{"CM-00-04-003-03","inexistence"},
				//{"CM-00-04-003-04","inexistence"},
				//{"CM-00-04-003-05","inexistence"},
				//{"CM-00-04-003-06","inexistence"},
		};
		for(int i=0;i<KPISet.size();i++)
		{
			TblATO_KPIDETAIL kpidetail = (TblATO_KPIDETAIL)KPISet.elementAt(i);
			
			for(int j=0;j<Tuxedo_KPI.length;j++)
			{
				if(kpidetail.KPI_ID.indexOf(Tuxedo_KPI[j][0])>-1 && Tuxedo_KPI[j][1].equals("inexistence"))
				{
					Tuxedo_KPI[j][1]="exist";
				}
			}
		}
		return Tuxedo_KPI;
	}

	public static String [][] Check_Net_KPI(Vector KPISet)
	{
		String Tuxedo_KPI [][] = new String [][]{
				{"PM-00-02-001-01","inexistence"},
				{"PM-00-02-001-02","inexistence"},
				{"PM-00-02-001-03","inexistence"},
				{"PM-00-02-001-04","inexistence"},
				{"PM-00-02-001-05","inexistence"},
				{"PM-00-02-001-06","inexistence"},
				{"PM-00-02-001-07","inexistence"},
				//{"PM-00-02-001-08","inexistence"},
				
				{"FM-00-02-001-01","inexistence"},
				{"FM-00-02-001-02","inexistence"},
				{"FM-00-02-001-03","inexistence"},
				//{"FM-00-02-001-04","inexistence"},
				//{"FM-00-02-001-05","inexistence"},
				//{"FM-00-02-001-06","inexistence"},
				//{"FM-00-02-001-07","inexistence"},
				//{"FM-00-02-002-01","inexistence"},
				//{"FM-00-02-002-02","inexistence"},
				//{"FM-00-02-002-03","inexistence"},
				//{"FM-00-02-002-04","inexistence"},
				
				{"CM-00-02-001-01","inexistence"},
				{"CM-00-02-001-02","inexistence"},
				{"CM-00-02-001-03","inexistence"},
				{"CM-00-02-001-04","inexistence"},
				{"CM-00-02-001-05","inexistence"},
				{"CM-00-02-002-01","inexistence"},
				{"CM-00-02-002-02","inexistence"},
				{"CM-00-02-002-03","inexistence"},
				{"CM-00-02-002-04","inexistence"},
				{"CM-00-02-002-05","inexistence"},
				{"CM-00-02-002-06","inexistence"}
		};
		for(int i=0;i<KPISet.size();i++)
		{
			TblATO_KPIDETAIL kpidetail = (TblATO_KPIDETAIL)KPISet.elementAt(i);
			
			for(int j=0;j<Tuxedo_KPI.length;j++)
			{
				if(kpidetail.KPI_ID.indexOf(Tuxedo_KPI[j][0])>-1 && Tuxedo_KPI[j][1].equals("inexistence"))
				{
					Tuxedo_KPI[j][1]="exist";
				}
			}
		}
		return Tuxedo_KPI;
	}
	
	
	//inexistence	exist
	public static String [][] Check_Oracle_KPI(Vector KPISet)
	{
		String Oracle_KPI [][] = new String [][]{
				{"PM-00-03-001-01","inexistence"},
				{"PM-00-03-001-02","inexistence"},
				//{"PM-00-03-001-03","inexistence"},
				//{"PM-00-03-002-01","inexistence"},
				{"PM-00-03-003-01","inexistence"},
				{"PM-00-03-003-02","inexistence"},
				{"PM-00-03-004-01","inexistence"},
				//{"PM-00-03-005-01","inexistence"},
				//{"PM-00-03-005-02","inexistence"},
				{"PM-00-03-006-01","inexistence"},
				//{"PM-00-03-007-01","inexistence"},
				//{"PM-00-03-007-02","inexistence"},
				{"PM-00-03-008-01","inexistence"},
				//{"PM-00-03-009-01","inexistence"},
				{"PM-00-03-009-02","inexistence"},
				{"PM-00-03-009-03","inexistence"},
				{"PM-10-12-10-23","inexistence"},
				{"FM-00-03-001-01","inexistence"},
				{"FM-00-03-001-02","inexistence"},
				{"FM-00-03-001-03","inexistence"},
				//{"FM-00-03-002-03","inexistence"},
				//{"FM-00-03-002-04","inexistence"},
				{"CM-00-03-001-01","inexistence"},
				{"CM-00-03-001-02","inexistence"},
				{"CM-00-03-001-03","inexistence"},
				{"CM-00-03-001-04","inexistence"},
				{"CM-00-03-001-05","inexistence"},
				{"CM-00-03-001-06","inexistence"},
				{"CM-00-03-002-01","inexistence"},
				{"CM-00-03-003-01","inexistence"},
				{"CM-00-03-003-02","inexistence"},
				//{"CM-00-03-004-01","inexistence"},
				//{"CM-00-03-004-02","inexistence"},
				//{"CM-00-03-004-03","inexistence"},
				//{"CM-00-03-004-04","inexistence"},
				//{"CM-00-03-004-05","inexistence"},
				//{"CM-00-03-005-01","inexistence"},
				//{"CM-00-03-005-02","inexistence"},
				{"CM-00-03-006-01","inexistence"}
		};
		
		for(int i=0;i<KPISet.size();i++)
		{
			TblATO_KPIDETAIL kpidetail = (TblATO_KPIDETAIL)KPISet.elementAt(i);
			
			for(int j=0;j<Oracle_KPI.length;j++)
			{
				if(kpidetail.KPI_ID.indexOf(Oracle_KPI[j][0])>-1 && Oracle_KPI[j][1].equals("inexistence"))
				{
					Oracle_KPI[j][1]="exist";
				}
			}
		}
		return Oracle_KPI;
	}
	
	public static String [] getInexistence_KPI_ID (String str [][])
	{
		int inexistencenum=0;
		String inexistenceKPI_ID []=new String[str.length];
		
		for(int i=0;i<str.length;i++)
		{
			if(str[i][1].equalsIgnoreCase("inexistence"))
			{
				inexistenceKPI_ID[i]=str[i][0];
				inexistencenum++;
			}
		}
		return inexistenceKPI_ID;
	}
	
	public static void main(String args[])
	{
		//CheckKPIHelper.Check_Tuxedo_KPI()
	}
}