
package cust.report;

import java.util.*;
import java.sql.Timestamp;

import wt.viewmarkup.*;
import wt.content.*;
import wt.ownership.*;
import wt.representation.*;

import wt.queue.*;

import wt.locks.Lock;
import wt.locks.Lockable;
import wt.org.WTPrincipal;
import wt.org.WTPrincipalReference;

import wt.inf.container.*;

import wt.fc.*;
import wt.fc.WTObject;
import wt.fc.QueryResult;
import wt.fc.PersistenceHelper;

import wt.query.QuerySpec;
import wt.query.ArrayExpression;

import com.ptc.wvs.server.cadagent.*;
import com.ptc.wvs.common.ui.*;

import wt.method.RemoteMethodServer;
import wt.httpgw.GatewayAuthenticator;

public class wvsQue_01e {

	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 wvsQue_01e();
	}

	public wvsQue_01e() throws Exception {

		System.out.println("\n");

		//	WTMarkUp.class
		QueryResult reswtMU=PersistenceHelper.manager.find(new QuerySpec(WTMarkUp.class));
		while(reswtMU.hasMoreElements()) {

			WTMarkUp wtobj=(WTMarkUp)reswtMU.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: "+reswtMU.size()+div);

		//	MarkUp.class
		QueryResult resMU=PersistenceHelper.manager.find(new QuerySpec(MarkUp.class));
		while(resMU.hasMoreElements()) {

			MarkUp wtobj=(MarkUp)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 MarkUp 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);

		// PublishingSummary.class	//wt.viewmarkup.PublishingSummary
		QueryResult resPS=PersistenceHelper.manager.find(new QuerySpec(PublishingSummary.class));
		while(resPS.hasMoreElements()) {

			PublishingSummary wtobj=(PublishingSummary)resPS.nextElement();

			System.out.println("UserName: "+wtobj.getUserName());
			System.out.println("Authoring Application: "+wtobj.getAuthoringApplication());

			System.out.println("Container Name: "+wtobj.getContainerName());
			System.out.println("Container: "+(WTContainer)wtobj.getContainer());
			System.out.println("Container Reference: "+(WTContainerRef)wtobj.getContainerReference());

			System.out.println("Identity: "+wtobj.getIdentity());
			System.out.println("Type: "+wtobj.getType());
			System.out.println("Type Identifier: "+wtobj.getTypeIdentifier());

			System.out.println("PersistInfo: "+(PersistInfo)wtobj.getPersistInfo());

			System.out.println("Job Success: "+(Boolean)wtobj.getJobSuccess());
			System.out.println("Job Submit Time: "+(Timestamp)wtobj.getJobSubmitTime());
			System.out.println("Job End Time: "+(Timestamp)wtobj.getJobEndTime());
			System.out.println("Job Start Time: "+(Timestamp)wtobj.getJobStartTime());
			System.out.println("Job Request Type: "+(Integer)wtobj.getJobRequestType());
			System.out.println("Job Request Source: "+(Integer)wtobj.getJobRequestSource());
			System.out.println("Job Request Queue: "+wtobj.getJobRequestQueue());

			System.out.println("Worker Type: "+wtobj.getWorkerType());
			System.out.println("Worker Name: "+wtobj.getWorkerName());
			System.out.println("Worker Success: "+(Boolean)wtobj.getWorkerSuccess());
			System.out.println("Worker End Exec Time: "+(Timestamp)wtobj.getWorkerEndExecTime());
			System.out.println("Worker End Time: "+(Timestamp)wtobj.getWorkerEndTime());
			System.out.println("Worker Start Exec Time: "+(Timestamp)wtobj.getWorkerStartExecTime());
			System.out.println("Worker Start Time: "+(Timestamp)wtobj.getWorkerStartTime());
			System.out.println("Worker Start Transfer Time: "+(Timestamp)wtobj.getWorkerStartTransferTime());

			//System.out.println("Representable: "+(ObjectReference)wtobj.getRepresentable());

			System.out.println("\n");
		}
		System.out.println("Number of PublishingSummary Objects: "+resPS.size()+div);

		// WtQueue.class
		QueryResult resWtQ=PersistenceHelper.manager.find(new QuerySpec(WtQueue.class));
		while(resWtQ.hasMoreElements()) {

			WtQueue wtobj=(WtQueue)resWtQ.nextElement();

			System.out.println("Name: "+wtobj.getName());
			System.out.println("Execution Host: "+wtobj.getExecutionHost());
			System.out.println("Queue State: "+wtobj.getQueueState());

			System.out.println("Last State Set: "+wtobj.getLastStateSet());
			System.out.println("Suspend Until: "+(Long)wtobj.getSuspendUntil());
			System.out.println("Suspend Duration: "+(Long)wtobj.getSuspendDuration());
			System.out.println("Failure Notification Email: "+wtobj.getFailureNotificationEmail());
			System.out.println("Last Notification Time: "+(Long)wtobj.getLastNotificationTime());
			System.out.println("Total Entries: "+(Integer)wtobj.getTotalEntries());
			System.out.println("Waiting Entries: "+(Integer)wtobj.getWaitingEntries());
			System.out.println("CacheName: "+wtobj.getCacheName());
			System.out.println("QType: "+wtobj.getQType());

			System.out.println("Enabled: "+(boolean)wtobj.isEnabled());
			System.out.println("Running: "+(boolean)wtobj.isRunning());
			System.out.println("Remove Failed Entires: "+(boolean)wtobj.isRemoveFailedEntires());
			//System.out.println("Delete When Empty: "+(boolean)isDeleteWhenEmpty());

			System.out.println("queue Suspended: "+(boolean)wtobj.queueSuspended());

			System.out.println("\n");
		}
		System.out.println("Number of Publisher Objects: "+resWtQ.size()+div);

		// ScheduleQueueEntry.class
		QueryResult resSQE=PersistenceHelper.manager.find(new QuerySpec(ScheduleQueueEntry.class));
		while(resSQE.hasMoreElements()) {

			ScheduleQueueEntry wtobj=(ScheduleQueueEntry)resSQE.nextElement();

			System.out.println("Schedule Time: "+(Timestamp)wtobj.getScheduleTime());
			System.out.println("User=Principal: "+(WTPrincipal)wtobj.getPrincipal());
			System.out.println("Queue: "+(ScheduleQueue)wtobj.getQueue());
			System.out.println("Display String: "+wtobj.getDisplayString());

			System.out.println("Locked: "+(boolean)wtobj.isLocked());
			System.out.println("Lock Date: "+(Timestamp)wtobj.getLockDate());
			System.out.println("Lock Note: "+wtobj.getLockNote());
			System.out.println("Locker: "+(WTPrincipalReference)wtobj.getLocker());
			System.out.println("Locker EMail: "+wtobj.getLockerEMail());
			System.out.println("Locker Name: "+wtobj.getLockerName());
			System.out.println("Locker Full Name: "+wtobj.getLockerFullName());
			System.out.println("Lock: "+(Lock)wtobj.getLock());

			System.out.println("\n");
		}
		System.out.println("Number of Publisher Objects: "+resSQE.size()+div);

		/**
		// Publisher.class
		QueryResult resPSer=PersistenceHelper.manager.find(new QuerySpec(Publisher.class));
		while(resPSer.hasMoreElements()) {

			Publisher wtobj=(Publisher)resPSer.nextElement();

			System.out.println("PublishLog: "+wtobj.getPublishLog());

			System.out.println("\n");
		}
		System.out.println("Number of Publisher Objects: "+resPSer.size()+div);
		*/
	}
}