
package cust.report;

import java.util.*;
import java.sql.Timestamp;

import wt.viewmarkup.*;
import wt.content.*;
import wt.ownership.*;
import wt.representation.*;

import wt.fc.*;
import wt.fc.WTObject;
import wt.fc.QueryResult;
import wt.fc.PersistenceHelper;

import wt.iba.value.AttributeContainer;

import wt.query.QuerySpec;
import wt.query.ArrayExpression;

import wt.method.RemoteMethodServer;
import wt.httpgw.GatewayAuthenticator;

import com.ptc.core.meta.type.mgmt.server.impl.*;
import com.ptc.core.meta.type.mgmt.server.TypeDefinition;

public class muQue_01g {

	static String div = "\n\n************************************************************\n";

	public static void main(String[] args) throws Exception {
		RemoteMethodServer rms = RemoteMethodServer.getDefault();
		GatewayAuthenticator auth = new GatewayAuthenticator();
		auth.setRemoteUser("wcadmin");
		rms.setAuthenticator(auth);

		new muQue_01g();
	}

	public muQue_01g() throws Exception {

		System.out.println("\n");

		//	WTMarkUp.class
		QueryResult resMU=PersistenceHelper.manager.find(new QuerySpec(WTMarkUp.class));
		while(resMU.hasMoreElements()) {

			WTMarkUp wtobj=(WTMarkUp)resMU.nextElement();

			System.out.println("Name: "+wtobj.getName());
			System.out.println("Description: "+wtobj.getDescription());
			System.out.println("Additional Info: "+wtobj.getAdditionalInfo());
			System.out.println("MarkUp Type: "+wtobj.getMarkUpType());
			System.out.println("Format Name: "+wtobj.getFormatName());
			System.out.println("Primary: "+wtobj.getPrimary());
			System.out.println("Lock Date: "+(Timestamp)wtobj.getLockDate());
			System.out.println("Lock Note: "+wtobj.getLockNote());
			System.out.println("Locker Name: "+wtobj.getLockerName());
			System.out.println("Locker FullName: "+wtobj.getLockerFullName());
			System.out.println("Ownership: "+(Ownership)wtobj.getOwnership());

			System.out.println("\n");
		}
		System.out.println("Number of WTMarkUp Objects: "+resMU.size()+div);

		// DerivedImage.class	//wt.viewmarkup.DerivedImage derivedimage
		QueryResult resDI=PersistenceHelper.manager.find(new QuerySpec(DerivedImage.class));
		while(resDI.hasMoreElements()) {

			DerivedImage wtobj=(DerivedImage)resDI.nextElement();

			System.out.println("Name: "+wtobj.getName());
			System.out.println("Description: "+wtobj.getDescription());
			System.out.println("Additional Info: "+wtobj.getAdditionalInfo());
			System.out.println("Format Name: "+wtobj.getFormatName());
			System.out.println("Primary: "+wtobj.getPrimary());
			System.out.println("Ownership: "+(Ownership)wtobj.getOwnership());
			System.out.println("Type: "+wtobj.getType());

			System.out.println("CAD Form Name: "+wtobj.getCADFormName());
			System.out.println("CAD Part Name: "+wtobj.getCADPartName());

			System.out.println("Representation Type: "+(RepresentationType)wtobj.getRepresentationType());
			System.out.println("Object Reference: "+(ObjectReference)wtobj.getDerivedFromReference());
			System.out.println("Derivation Type: "+(DerivationType)wtobj.getDerivationType());
			System.out.println("Derived From: "+(RepresentationContributor)wtobj.getDerivedFrom());
			System.out.println("Identification Object: "+(IdentificationObject)wtobj.getIdentificationObject());

			System.out.println("\n");
		}
		System.out.println("Number of DerivedImage Objects: "+resDI.size()+div);

		QueryResult resTD=PersistenceHelper.manager.find(new QuerySpec(WTTypeDefinition.class));
		while(resTD.hasMoreElements()) {

			WTTypeDefinition wtobj=(WTTypeDefinition)resTD.nextElement();

			System.out.println("Name: "+wtobj.getName());
			System.out.println("Icon: "+wtobj.getIcon());
			System.out.println("Description Key: "+wtobj.getDescriptionKey());
			System.out.println("Display Name Key: "+wtobj.getDisplayNameKey());
			System.out.println("Hierarchy Display Name Key: "+wtobj.getHierarchyDisplayNameKey());
			System.out.println("Deleted ID: "+wtobj.getDeleted_id());
			System.out.println("Logical Identifier: "+wtobj.getLogicalIdentifier());
			System.out.println("Ownership: "+(Ownership)wtobj.getOwnership());
			System.out.println("Attribute Container: "+(AttributeContainer)wtobj.getAttributeContainer());
			System.out.println("Parent: "+(TypeDefinition)wtobj.getParent());
			System.out.println("Parent Reference: "+(ObjectReference)wtobj.getParentReference());

			System.out.println("\n");
		}
		System.out.println("Number of WTTypeDefinition Objects: "+resTD.size()+div);

		QueryResult resTDM=PersistenceHelper.manager.find(new QuerySpec(WTTypeDefinitionMaster.class));
		while(resTDM.hasMoreElements()) {

			WTTypeDefinitionMaster wtobj=(WTTypeDefinitionMaster)resTDM.nextElement();

			System.out.println("Int Hid: "+wtobj.getIntHid());
			System.out.println("Series: "+wtobj.getSeries());
			System.out.println("Description Key: "+wtobj.getDescriptionKey());
			System.out.println("Display Name Key: "+wtobj.getDisplayNameKey());
			System.out.println("Hierarchy Display Name Key: "+wtobj.getHierarchyDisplayNameKey());
			System.out.println("Deleted ID: "+wtobj.getDeleted_id());

			System.out.println("\n");
		}
		System.out.println("Number of WTTypeDefinition Objects: "+resTDM.size()+div);

		ArrayExpression arrayexpression = new ArrayExpression(
			new String[] {
				(wt.epm.EPMDocument.class).getName(),
				(wt.epm.EPMDocumentMaster.class).getName(),
				(wt.epm.structure.EPMMemberLink.class).getName(),
				(wt.epm.structure.EPMReferenceLink.class).getName()
			}
		);

		for (int i = 0; i < arrayexpression.length; i++) {
			System.out.println( "arrayexpression["+i+"]: " + arrayexpression[i] );
		}
	}
}
