<?xml version="1.0" standalone="yes"?>
<%@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>
<!DOCTYPE PROCESS>

<process name="Query AccessPDM Parts">

  <description>
    Query AccessPDM parts by where clause; it includes a mapping of Windchill-to-Legacy system attributes
    Input: from @FORM:
    				where = a where clause in Windchill format
    				attribute = a list of attributes, that should be returned
    		  from group_in:
    				not used
    Output: a group of elements with standard windchill attribute names
    
		The following webjects/tasks/jsp-scriplet do:
			1. Setup Database Mapping Table
			2. Build mapped WhereClause (replaces attributes in WT where clause with Source DB attributes) 
			3. Build mapped attribute list (replaces attributes in WT attribute list with Source DB attributes) 
			4. Query Source DB
			5. Map attributes of result (from Source DB to WT)
			6. add derived attributes (Icon, ObjPropsUrl) to result
			7. add actions from UIActionController.xml
			8. add output group to VDB by using Return-Group
  </description>
<!--the following is for:  -->

<!--switching debug on & off, degug of input groups-->
<%
	boolean VERBOSE = false;
	Group groupIn = getGroupIn();
//	groupIn.setName("jdbcPdmInput");
	if(VERBOSE){
		System.out.println("_______________in AccessPDM Query Task");
		getContextGroup("FORM").toXML(new java.io.PrintWriter(System.out),true) ;
		System.out.println(" AccessPDM Query Task, groupIn.getName()="+groupIn.getName());
		groupIn.toXML(new java.io.PrintWriter(System.out),true) ;
	}
%>

<ie:webject name="Create-Group" type="GRP">
	<ie:param name="ELEMENT" data="ID=:PACKAGE=:CONTEXT=:TAG=:FILE=:obid=unknown:class=DCAElement"/>
	<ie:param name="GROUP_OUT" data="output"/>
</ie:webject>

<%
Group x=getGroup("output");
if(VERBOSE)System.out.println("group: "+x+" count: "+x.getElementCount());
Enumeration e=x.getElements();
while(e.hasMoreElements())
{
Element el=(Element)e.nextElement();
String ufid=(String)el.getValue("obid");
String otype="DCAElement";
System.out.println("obid: "+ufid+" class: "+otype+"  name: "+el.getName());
el.addMeta("com.infoengine.object.type",otype);
el.addMeta("com.infoengine.object.id",ufid);
el.addMeta("com.infoengine.element.id",ufid);
el.setUfid(ufid);
el.setFti(otype);
el.setName(ufid);
}
%>

	<%
		//getGroup("output").printTree() ;
	%>
</process>
