plugin/src/java/org/pm4knime/node/conversion/table2log/ToXLogConverter.java
public void convertDataTable2Log(BufferedDataTable csvData, ExecutionContext exec) throws CanceledExecutionException {
		
		// get trace and event attribute available sets here 
		List<String> traceColumns= config.getMTraceAttrSet().getIncludeList();
		// find the idx for it, for once 
		List<String> eventColumns= config.getMEventAttrSet().getIncludeList();
		
		int[] traceColIndices = csvData.getDataTableSpec().columnsToIndices(traceColumns.toArray(new String[0]));
		int[] eventColIndices = csvData.getDataTableSpec().columnsToIndices(eventColumns.toArray(new String[0]));
		boolean[] traceColVisited = new boolean[traceColIndices.length];
		boolean[] eventColVisited = new boolean[eventColIndices.length];
		
		int caseIDIdx = -1, eventClassIdx, tsIdx = -1;
		
		caseIDIdx = traceColumns.indexOf(config.getMCaseID().getStringValue());
		eventClassIdx = eventColumns.indexOf(config.getMEventClass().getStringValue());
		// complete time the time stamp here in default
		tsIdx = eventColumns.indexOf(config.getMTimeStamp().getStringValue());
//		String tsFormat = config.getMTSFormat().getStringValue();
//		df = DateTimeFormatter.ofPattern(tsFormat);
		
		// optional for lifecycle column, but there is no need to specify the event ID for it!!  Lifecycle is useful!!
		boolean withLifecycle = false; 
		int  lifecycleIdx = -1;
		if(!config.getMLifecycle().getStringValue().equals(SMTable2XLogConfig.CFG_NO_OPTION)) {
			// exception happens, when eventAttrSet excluses life-cycle column, which one is the optimal choices?
			// if we choose lifecycle there, then we should keep it into our event attr!! 
			// only when it is no-available, it can be excluded. But we test it in configuration part.
			withLifecycle = true;
			lifecycleIdx = eventColumns.indexOf(config.getMLifecycle().getStringValue());
			eventColVisited[lifecycleIdx] =  true;
		}
		
		traceColVisited[caseIDIdx] = true;
		eventColVisited[eventClassIdx] =true;
		eventColVisited[tsIdx] =true;
		
		
		String currentCaseID = "-1", newCaseID="";
		
		String logName = csvData.getSpec().getName();
		startLog(logName + " event log");
		
		for(DataRow row : csvData) {
			exec.checkCanceled();
			// when it is a integer or string, not matter, right?? 
			DataCell traceIDData = row.getCell(traceColIndices[caseIDIdx]);
			
			newCaseID = traceIDData.toString();
			
			if(!newCaseID.equals(currentCaseID)) {
				// we meet a new trace, end old one and begin new one
				if(!currentCaseID.equals("-1"))
					endTrace(currentCaseID); // make it as a string
				
				currentCaseID = newCaseID;
				startTrace(currentCaseID);
			}
			
			// get trace attributes 
			for(int tIdx = 0; tIdx< traceColIndices.length ; tIdx++) {
				if(traceColVisited[tIdx])
					continue; 
				if(traceAttrMap.containsKey(traceColumns.get(tIdx))) {
					// if contains value, compare if they are same 
					if(!traceAttrMap.get(traceColumns.get(tIdx)).equals(row.getCell(traceColIndices[tIdx]))) {
//						System.out.println("Error happens with the trace Attributes here");
						errorDetected = true;
						break;
					}
				}else {
					// for the values there, we deal with it later 
					traceAttrMap.put(traceColumns.get(tIdx), row.getCell(traceColIndices[tIdx]));
				}
			}

			// deal with new event class, it can be in discrete value
			String eventClass = null;
			DataCell eventClassData = row.getCell(eventColIndices[eventClassIdx]);
			eventClass = ((StringCell)eventClassData).getStringValue();
			
				
			try {
				// if the values there are also like this, what to do?? 
				// String cTime = ((StringCell) row.getCell(eventColIndices[cTimeIdx])).getStringValue();
				Date timeStamp = convertString2Date( row.getCell(eventColIndices[tsIdx]));
				
				// here we check the lifecycle transition and assign the values to it!! 
				String lifecycle = null ;
				if(withLifecycle) {
					// here we need to get the value from the column
					DataCell lifecycleData = row.getCell(eventColIndices[lifecycleIdx]);
					lifecycle = ((StringCell)lifecycleData).getStringValue();
					
				}
				
				
				startEvent(eventClass, timeStamp, lifecycle);
				
			} catch (ParseException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
			// after this, we process other attributes, like resource, costs;; At this point, we need to differ their types 
			// and add attributes to the currentEventClass...
			for(int eIdx =0; eIdx< eventColIndices.length; eIdx++) {
				if(eventColVisited[eIdx])
					continue;

				DataCell otherData = row.getCell(eventColIndices[eIdx]);
				String attrName = eventColumns.get(eIdx);
				assignAttributeWithDataCell(currentEvent, otherData, attrName);
			}
			
			endEvent();
		}
		// Close last trace
		endTrace(currentCaseID + "");	
		
		endLog();
	}
/**
	 * convert CSV data table into xlog, but we need to know the column index,
	 * so we know which one is which event?
	 * @param exec 
	 * @param logName
	 * @throws CanceledExecutionException 
	 */
convert CSV data table into xlog, but we need to know the column index,
so we know which one is which event.
@param exec
@param logName
@throws CanceledExecutionException
convert CSV data table into xlog but we need to know the column index so we know which one is which event . @param exec @param logName @throws CanceledExecutionException
public void convertDataTable2Log(BufferedDataTable csvData, ExecutionContext exec) throws CanceledExecutionException {
		List<String> traceColumns= config.getMTraceAttrSet().getIncludeList();
		List<String> eventColumns= config.getMEventAttrSet().getIncludeList();
		int[] traceColIndices = csvData.getDataTableSpec().columnsToIndices(traceColumns.toArray(new String[0]));
		int[] eventColIndices = csvData.getDataTableSpec().columnsToIndices(eventColumns.toArray(new String[0]));
		boolean[] traceColVisited = new boolean[traceColIndices.length];
		boolean[] eventColVisited = new boolean[eventColIndices.length];
		int caseIDIdx = -1, eventClassIdx, tsIdx = -1;
		caseIDIdx = traceColumns.indexOf(config.getMCaseID().getStringValue());
		eventClassIdx = eventColumns.indexOf(config.getMEventClass().getStringValue());
		tsIdx = eventColumns.indexOf(config.getMTimeStamp().getStringValue());
		boolean withLifecycle = false; 
		int  lifecycleIdx = -1;
		if(!config.getMLifecycle().getStringValue().equals(SMTable2XLogConfig.CFG_NO_OPTION)) {
			withLifecycle = true;
			lifecycleIdx = eventColumns.indexOf(config.getMLifecycle().getStringValue());
			eventColVisited[lifecycleIdx] =  true;
		}
		traceColVisited[caseIDIdx] = true;
		eventColVisited[eventClassIdx] =true;
		eventColVisited[tsIdx] =true;
		String currentCaseID = "-1", newCaseID="";
		String logName = csvData.getSpec().getName();
		startLog(logName + " event log");
		for(DataRow row : csvData) {
			exec.checkCanceled();
			DataCell traceIDData = row.getCell(traceColIndices[caseIDIdx]);
			newCaseID = traceIDData.toString();
			if(!newCaseID.equals(currentCaseID)) {
				if(!currentCaseID.equals("-1"))
					endTrace(currentCaseID); 
				currentCaseID = newCaseID;
				startTrace(currentCaseID);
			}
			for(int tIdx = 0; tIdx< traceColIndices.length ; tIdx++) {
				if(traceColVisited[tIdx])
					continue; 
				if(traceAttrMap.containsKey(traceColumns.get(tIdx))) {
					if(!traceAttrMap.get(traceColumns.get(tIdx)).equals(row.getCell(traceColIndices[tIdx]))) {
						errorDetected = true;
						break;
					}
				}else {
					traceAttrMap.put(traceColumns.get(tIdx), row.getCell(traceColIndices[tIdx]));
				}
			}
			String eventClass = null;
			DataCell eventClassData = row.getCell(eventColIndices[eventClassIdx]);
			eventClass = ((StringCell)eventClassData).getStringValue();
			try {
				Date timeStamp = convertString2Date( row.getCell(eventColIndices[tsIdx]));
				String lifecycle = null ;
				if(withLifecycle) {
					DataCell lifecycleData = row.getCell(eventColIndices[lifecycleIdx]);
					lifecycle = ((StringCell)lifecycleData).getStringValue();
				}
				startEvent(eventClass, timeStamp, lifecycle);
			} catch (ParseException e) {
				e.printStackTrace();
			}
			for(int eIdx =0; eIdx< eventColIndices.length; eIdx++) {
				if(eventColVisited[eIdx])
					continue;
				DataCell otherData = row.getCell(eventColIndices[eIdx]);
				String attrName = eventColumns.get(eIdx);
				assignAttributeWithDataCell(currentEvent, otherData, attrName);
			}
			endEvent();
		}
		endTrace(currentCaseID + "");	
		endLog();
	}
public void convertDataTable2Log ( BufferedDataTable csvData , ExecutionContext exec ) throws CanceledExecutionException { List < String > traceColumns = config . getMTraceAttrSet ( ) . getIncludeList ( ) ; List < String > eventColumns = config . getMEventAttrSet ( ) . getIncludeList ( ) ; int [ ] traceColIndices = csvData . getDataTableSpec ( ) . columnsToIndices ( traceColumns . toArray ( new String [ 0 ] ) ) ; int [ ] eventColIndices = csvData . getDataTableSpec ( ) . columnsToIndices ( eventColumns . toArray ( new String [ 0 ] ) ) ; boolean [ ] traceColVisited = new boolean [ traceColIndices . length ] ; boolean [ ] eventColVisited = new boolean [ eventColIndices . length ] ; int caseIDIdx = - 1 , eventClassIdx , tsIdx = - 1 ; caseIDIdx = traceColumns . indexOf ( config . getMCaseID ( ) . getStringValue ( ) ) ; eventClassIdx = eventColumns . indexOf ( config . getMEventClass ( ) . getStringValue ( ) ) ; tsIdx = eventColumns . indexOf ( config . getMTimeStamp ( ) . getStringValue ( ) ) ; boolean withLifecycle = false ; int lifecycleIdx = - 1 ; if ( ! config . getMLifecycle ( ) . getStringValue ( ) . equals ( SMTable2XLogConfig . CFG_NO_OPTION ) ) { withLifecycle = true ; lifecycleIdx = eventColumns . indexOf ( config . getMLifecycle ( ) . getStringValue ( ) ) ; eventColVisited [ lifecycleIdx ] = true ; } traceColVisited [ caseIDIdx ] = true ; eventColVisited [ eventClassIdx ] = true ; eventColVisited [ tsIdx ] = true ; String currentCaseID = "-1" , newCaseID = "" ; String logName = csvData . getSpec ( ) . getName ( ) ; startLog ( logName + " event log" ) ; for ( DataRow row : csvData ) { exec . checkCanceled ( ) ; DataCell traceIDData = row . getCell ( traceColIndices [ caseIDIdx ] ) ; newCaseID = traceIDData . toString ( ) ; if ( ! newCaseID . equals ( currentCaseID ) ) { if ( ! currentCaseID . equals ( "-1" ) ) endTrace ( currentCaseID ) ; currentCaseID = newCaseID ; startTrace ( currentCaseID ) ; } for ( int tIdx = 0 ; tIdx < traceColIndices . length ; tIdx ++ ) { if ( traceColVisited [ tIdx ] ) continue ; if ( traceAttrMap . containsKey ( traceColumns . get ( tIdx ) ) ) { if ( ! traceAttrMap . get ( traceColumns . get ( tIdx ) ) . equals ( row . getCell ( traceColIndices [ tIdx ] ) ) ) { errorDetected = true ; break ; } } else { traceAttrMap . put ( traceColumns . get ( tIdx ) , row . getCell ( traceColIndices [ tIdx ] ) ) ; } } String eventClass = null ; DataCell eventClassData = row . getCell ( eventColIndices [ eventClassIdx ] ) ; eventClass = ( ( StringCell ) eventClassData ) . getStringValue ( ) ; try { Date timeStamp = convertString2Date ( row . getCell ( eventColIndices [ tsIdx ] ) ) ; String lifecycle = null ; if ( withLifecycle ) { DataCell lifecycleData = row . getCell ( eventColIndices [ lifecycleIdx ] ) ; lifecycle = ( ( StringCell ) lifecycleData ) . getStringValue ( ) ; } startEvent ( eventClass , timeStamp , lifecycle ) ; } catch ( ParseException e ) { e . printStackTrace ( ) ; } for ( int eIdx = 0 ; eIdx < eventColIndices . length ; eIdx ++ ) { if ( eventColVisited [ eIdx ] ) continue ; DataCell otherData = row . getCell ( eventColIndices [ eIdx ] ) ; String attrName = eventColumns . get ( eIdx ) ; assignAttributeWithDataCell ( currentEvent , otherData , attrName ) ; } endEvent ( ) ; } endTrace ( currentCaseID + "" ) ; endLog ( ) ; }
convert CSV data table into xlog, but we need to know the column index,
 so we know which one is which event?
convert CSV data table into xlog but we need to know the column index so we know which one is which event?
// get trace and event attribute available sets here  // find the idx for it, for once  // complete time the time stamp here in default //		String tsFormat = config.getMTSFormat().getStringValue(); //		df = DateTimeFormatter.ofPattern(tsFormat); // optional for lifecycle column, but there is no need to specify the event ID for it!!  Lifecycle is useful!! // exception happens, when eventAttrSet excluses life-cycle column, which one is the optimal choices? // if we choose lifecycle there, then we should keep it into our event attr!!  // only when it is no-available, it can be excluded. But we test it in configuration part. // when it is a integer or string, not matter, right??  // we meet a new trace, end old one and begin new one // make it as a string // get trace attributes  // if contains value, compare if they are same  //						System.out.println("Error happens with the trace Attributes here"); // for the values there, we deal with it later  // deal with new event class, it can be in discrete value // if the values there are also like this, what to do??  // String cTime = ((StringCell) row.getCell(eventColIndices[cTimeIdx])).getStringValue(); // here we check the lifecycle transition and assign the values to it!!  // here we need to get the value from the column // TODO Auto-generated catch block // after this, we process other attributes, like resource, costs;; At this point, we need to differ their types  // and add attributes to the currentEventClass... // Close last trace