CAA Web Services Home

 

Source code for  CAAENOVWSProdStructConfigCppUseCaseCar

Use Case Source code

Methods

List of method in CAAENOVWSProdStructConfigCppUseCaseCar.

To go back to Consuming the ENOVWSProdStructConfigCpp CAA Web Service

 

// COPYRIGHT DASSAULT SYSTEMES 2006
// =============================================================================
// This class provides a sample use case scenario that illustrates the 
// ENOVWSProdStructCpp CAA Web service.
// =============================================================================
package com.dassault_systemes.caaenovws.caaenovwsaxis1_3client;
import com.dassault_systemes.caaenovws.caaenovwsaxis1_3client.generated.CATServiceExceptionType;
import com.dassault_systemes.caaenovws.caaenovwsaxis1_3client.generated.ENOVIA;
import com.dassault_systemes.caaenovws.caaenovwsaxis1_3client.generated.Identifier;
import com.dassault_systemes.caaenovws.caaenovwsaxis1_3client.generated.holders.OperationStructureArrayTypeHolder;
import com.dassault_systemes.caaenovws.caaenovwsaxis1_3client.generated.holders.OperationStructureHolder;
import com.dassault_systemes.caaenovws.caaenovwsaxis1_3client.generated.OperationStructure;
/**
 * Class to hold the CAAENOVWSProdStructConfigCppUseCase car BOM.
 * 
 */
public class CAAENOVWSProdStructConfigCppUseCaseCar {
	//	appended uKey to to introduce new objects in ENOVIA LCA each time this use case is run
	private String uKey = null; 
	
    // top level Product
	private String carPRC = null;
	
	// part versions
	private String exhaustCPV = null;
	private String rearWDPV = null;	
	private String frontWDPV = null;
	private String allWDPV = null;;
	private String fourWDPV = null;
	private String tailSmallPV = null;	
	private String tailLargePV = null;
	
	//document
	private String ownerManualDOC = null;
	
	//item instance, assembly relationship Id
	private String exhaustCII = null;	
	private String rearWDII = null;	
	private String frontWDII = null;
	private String tailSmallII = null;	
	private String tailLargeII = null;
	
	//mods UUIds
	private String rearWDMod = null;
	private String frontWDMod = null;
	private String allWDMod = null;;
	private String fourWDMod = null;
	private String exhaustMod = null;
	private String tailSmallMod = null;	
	private String tailLargeMod = null;
	
	//configHandler UUIDIds
	private String carConfgHUnit1 = null;
	private String carConfgHUnit40 = null;
	private String carConfgHUnit51 = null;
	private String carConfgHUnit80 = null;
	private String carConfgHUnit91 = null;	 //car broken
	
	//acttion
	private String carAction1 = null;
	
	//-V_ID of the parts.
	private	String rearWDPV_ID = null;
	private	String frontWDPV_ID = null;
	private String allWDPV_ID = null;
	private String fourWDPV_ID = null;
	private String tailSmallPV_ID = null;
	private String tailLargePV_ID = null;
	private String exhaustCPV_ID = null;
	
	
	
	public CAAENOVWSProdStructConfigCppUseCaseCar(String prc, String key) {
		this.carPRC = prc;
		this.uKey = "-" + key;
		
		rearWDPV_ID = "rearWDPV" +uKey;
		frontWDPV_ID = "frontWDPV" +uKey;
		allWDPV_ID = "allWDPV" +uKey;
		fourWDPV_ID = "fourWDPV" +uKey;
		tailSmallPV_ID = "tailSmallPV" +uKey;
		tailLargePV_ID = "tailLargePV" +uKey;
		exhaustCPV_ID = "exhaustCPV" +uKey;
	}
	/*  creatPartVersionObjects
	 * 
	 *  Create a configured PV : Exhaust
	 *	Create the following un-configured PV:
	 *					Rear Wheel Drive
	 *					Front Wheel Drive
	 *					All Wheel Drive
	 *					Four Wheel Drive
	 *					Tail Small
	 *					Tail Large
	 */
	public void creatPartVersionObjects(CAAENOVWSProdStructCppWrapper psWrapper)  throws Exception {
		System.out.println("-> create car parts.");
		boolean success = false;
		try {			
			//create configured PV Exhaust
			String envDomain = "PRODUCT";
			String configurable = "TRUE";
			String[] partNumbers = {exhaustCPV_ID};
			ENOVIA createPartRefResultSet = psWrapper.createPartRef(partNumbers,envDomain, configurable);
			String[] partRefUUIDs = psWrapper.getENOVIA_VPMPartVersionUUIDs(createPartRefResultSet);
			if (partRefUUIDs.length != 1) {
				throw new Exception("-> Failed to create the just 1 part references");
			}
			exhaustCPV = partRefUUIDs[0];
			//create unconfigured PVs
			configurable = "FALSE";
			String[] partCollection_ID = { rearWDPV_ID,frontWDPV_ID,allWDPV_ID,fourWDPV_ID,tailSmallPV_ID,tailLargePV_ID};
            
			ENOVIA createPartRefResultSetB = psWrapper.createPartRef(partCollection_ID,envDomain, configurable);
			String[] partRefUUIDsB = psWrapper.getENOVIA_VPMPartVersionUUIDs(createPartRefResultSetB);
			if (partRefUUIDsB.length != 6) {
				throw new Exception("-> Failed to create the just 6 part references");
			}
			rearWDPV = partRefUUIDsB[0];
			frontWDPV = partRefUUIDsB[1];
			allWDPV = partRefUUIDsB[2];
			fourWDPV = partRefUUIDsB[3];
			tailSmallPV = partRefUUIDsB[4];
			tailLargePV = partRefUUIDsB[5];
			
			success = true;	
		} catch (Exception e) {
			CAAENOVWSUtils.ProcessException(e);
		}
		if (success)
			System.out.println("-> create car parts.- sucess.");	
		else
		throw new Exception("-> create car parts. - failure.");		
		
	}//[Top] 
	/*
	 * Create car owner manual document
	 */
	public void creatDocumentObjects(CAAENOVWSCntMgmtCppWrapper cntWrapper) throws Exception{
		System.out.println("-> create a document CAR owner manual.");
		boolean success = false;
		Exception exception = null;
		
		try {
			String docId = "PSCWSDoc"+uKey;
			String docName = "carOwnerManual"+uKey;
			String domain = "DOCDIR";			
			ENOVIA createDocResultSet1 = cntWrapper.createDocument(docId,docName,domain);
			String[] docUUIDs1 = cntWrapper.getENOVIA_VPMDocumentRevisionUUIDs(createDocResultSet1);
			if (docUUIDs1.length != 1) {
				throw new Exception("-> Failed to create the 1 document");
			}		
			ownerManualDOC = docUUIDs1[0];
			success = true;
		} catch (CATServiceExceptionType e) {
			exception = e;
 		} catch (Exception e) {
			exception = e;
 		}
 		if (success)
			System.out.println("-> create a document CAR owner manual - sucess.");	
		else
		throw new Exception("-> create a document CAR owner manual - failure.");				
	}//[Top] 
	/*  
	 * buildProdStruct as follows
	 *  - Add Child Part Service on	Exhaust
	 *        Pass in the following parts
	 *					Tail Small
	 * 					Tail Large
	 */
	public void buildProdStructExhaust(CAAENOVWSProdStructCppWrapper psWrapper) throws Exception{
		System.out.println("-> build second level product structure Exhaust.");
		boolean success = false;
		
		try {			
			//add Child Part Service on	Exhaust
			String[] partRefUUIDs2 = {tailSmallPV,tailLargePV};
			ENOVIA createPartInstResultSet2 = psWrapper.createPartInst(exhaustCII, partRefUUIDs2);
			String[] vpmBOPartInstanceUUIDArray2 = psWrapper.getVPMBOPartInstanceUUIDs(createPartInstResultSet2);
			if (vpmBOPartInstanceUUIDArray2.length != 2) {
				 throw new Exception("-> Failed to create just the 2 part instances on the Exhaust");
			}
			tailSmallII = vpmBOPartInstanceUUIDArray2[0];
			tailLargeII = vpmBOPartInstanceUUIDArray2[1];
						
			success = true;
		} catch (Exception e) {
			CAAENOVWSUtils.ProcessException(e);
		}
		if (success)
			System.out.println("-> build second level product structure Exhaust - sucess.");	
		else
		throw new Exception("-> build second level product structure Exhaust - failure.");		
	}//[Top] 
	/*  
	 * buildProdStruct as follows
	 * 	- Add Child Part Service on CAR 
	 *        Pass in the following parts
	 *                  Rear Wheel Drive
	 *					Front Wheel Drive
	 * 					Exhaust
	 *
	 */
	public void buildProdStructCAR(CAAENOVWSProdStructCppWrapper psWrapper) throws Exception{
		System.out.println("-> build first level product structure CAR Product.");
		boolean success = false;
		
		try {			
			// Add Child Parts on CAR 
			String[] partRefUUIDs1 = {rearWDPV,frontWDPV,exhaustCPV};
			ENOVIA createPartInstResultSet1 = psWrapper.createPartInst(carPRC, partRefUUIDs1);
			String[] vpmBOPartInstanceUUIDArray1 = psWrapper.getVPMBOPartInstanceUUIDs(createPartInstResultSet1);
			if (vpmBOPartInstanceUUIDArray1.length != 3) {
				 throw new Exception("-> Failed to create just the 3 part instances on the Car");
			}
			rearWDII = vpmBOPartInstanceUUIDArray1[0];
			frontWDII = vpmBOPartInstanceUUIDArray1[1];
			exhaustCII = vpmBOPartInstanceUUIDArray1[2];
			success = true;
		} catch (Exception e) {
			CAAENOVWSUtils.ProcessException(e);
		}
		if (success)
			System.out.println("-> build first level product structure CAR Product - sucess.");	
		else
		throw new Exception("-> build first level product structure CAR Product - failure.");		
	}//[Top] 
	
    /*
	Create the following mods using Create Mod Service on CAR  configured object 
					Rear Wheel Drive(Engineering;unit 1-50)  
					Front Wheel Drive(Engineering; unit 51-100)
					All Wheel Drive (Engineering; unit 35-50)
					Four Wheel Drive (Engineering unit 80-90)
	*/
	public void creatModsForCar(CAAENOVWSProdStructConfigCppWrapper pscWrapper)
		throws Exception {
			System.out.println("-> create mods, one each for children of CAR : first level");
					boolean success = false;
			try {
									
				String rearWheel_MOD = "rearWDMod"+uKey;
				String frontWheel_MOD = "frontWDMod"+uKey;
				String allWheel_MOD = "allWDMod"+uKey;
				String fourWheel_MOD = "fourWDMod"+uKey;
				String exhaust_MOD = "exhaustMod"+uKey;				
				
				
				System.out.println("-> Creating Mod - Rear Wheel Drive(Engineering;unit 1-50) ");
				String iRearWheelExp = CAAENOVWSUtils.crtModConfigExp (rearWheel_MOD,"Engineering Effectivity","1","50");
				ENOVIA rearWheelResultSet = pscWrapper.createModification(carPRC, iRearWheelExp);
				rearWDMod =  pscWrapper.getENOVIA_EFF_MOD_UUID(rearWheelResultSet);
				
				System.out.println("-> Creating Mod - Front Wheel Drive(Engineering;unit 51-100) ");
				String iFrontWheelExp = CAAENOVWSUtils.crtModConfigExp (frontWheel_MOD,"Engineering Effectivity","51","100");
				ENOVIA frontWheelResultSet = pscWrapper.createModification(carPRC, iFrontWheelExp);
				frontWDMod =  pscWrapper.getENOVIA_EFF_MOD_UUID(frontWheelResultSet);
								
				System.out.println("-> Creating Mod - All Wheel Drive(Engineering;unit 35-50) ");
				String iAllWheelExp = CAAENOVWSUtils.crtModConfigExp (allWheel_MOD,"Engineering Effectivity","35","50");
				ENOVIA allWheelResultSet = pscWrapper.createModification(carPRC, iAllWheelExp);
				allWDMod =  pscWrapper.getENOVIA_EFF_MOD_UUID(allWheelResultSet);
								
				System.out.println("-> Creating Mod - Four Wheel Drive(Engineering;unit 80-90) ");
				String iFourWheelExp = CAAENOVWSUtils.crtModConfigExp (fourWheel_MOD,"Engineering Effectivity","80","90");
				ENOVIA fourWheelResultSet = pscWrapper.createModification(carPRC, iFourWheelExp);
			    fourWDMod =  pscWrapper.getENOVIA_EFF_MOD_UUID(fourWheelResultSet);
				System.out.println("-> Creating Mod - Exhaust(Engineering;unit 1-100) ");
				String iExhaust = CAAENOVWSUtils.crtModConfigExp (exhaust_MOD,"Engineering Effectivity","1","100");
				ENOVIA exhaustResultSet = pscWrapper.createModification(carPRC, iExhaust);
				exhaustMod =  pscWrapper.getENOVIA_EFF_MOD_UUID(exhaustResultSet);
				success = true;
				
			} catch (Exception e) {
				CAAENOVWSUtils.ProcessException(e);
			}
			
			if (success)
						System.out.println("-> create mods, one each for children of CAR : first level - sucess.");
					else
					throw new Exception("-> create mods, one each for children of CAR : first level - failure.");
					
						
	}//[Top] 
	/*
	Create the following mods using Create Mod Service on Exhaust configured object
					Tail Small (Engineering; unit 1-25, unit 51-75)
					Tail Large (Engineering; unit 26-50, 76-100)
	*/
	public void creatModsForExhaust(CAAENOVWSProdStructConfigCppWrapper pscWrapper)
		throws Exception {
			System.out.println("-> create mods, one each for children of Exhaust : second level");
								boolean success = false;
						try {
									
							String TailSmall = "tailSmallMod"+uKey;
							String TailLarge = "tailLargeMod"+uKey;
											
							StringBuffer iModConfigExpTailSmall = new StringBuffer();
						    iModConfigExpTailSmall.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
							iModConfigExpTailSmall.append("<ENOVIA_MODIFICATION NAME=\"");
							iModConfigExpTailSmall.append(TailSmall); 
							iModConfigExpTailSmall.append("\"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"Configuration_Final.xsd\">");
							iModConfigExpTailSmall.append("<MOD_DOMAIN>");
							iModConfigExpTailSmall.append("<EFF_DOMAIN NAME=\"Engineering Effectivity\">");
							iModConfigExpTailSmall.append("<MOD_EFFECTIVITY>");
							iModConfigExpTailSmall.append("<EFF_TYPE>");
							iModConfigExpTailSmall.append("<RANGE_RANGE END=\"25\" START=\"1\"/>");
							iModConfigExpTailSmall.append("<RANGE_RANGE END=\"75\" START=\"51\"/>");
							iModConfigExpTailSmall.append("</EFF_TYPE>");
							iModConfigExpTailSmall.append("</MOD_EFFECTIVITY>");
							iModConfigExpTailSmall.append("</EFF_DOMAIN>");
							iModConfigExpTailSmall.append("</MOD_DOMAIN>");
							iModConfigExpTailSmall.append("</ENOVIA_MODIFICATION>");
							String iTailSmallExp = iModConfigExpTailSmall.toString();
							
				
							System.out.println("-> Creating Mod - Tail Small (Engineering; unit 1-25, 51-75) ");
							ENOVIA tailSmallResultSet = pscWrapper.createModification(exhaustCPV, iTailSmallExp);
							String tailSmall_MOD =  pscWrapper.getENOVIA_EFF_MOD_UUID(tailSmallResultSet);
							
							StringBuffer iModConfigExpTailLarge = new StringBuffer();
							iModConfigExpTailLarge.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
							iModConfigExpTailLarge.append("<ENOVIA_MODIFICATION NAME=\" ");
							iModConfigExpTailLarge.append(TailLarge); 
							iModConfigExpTailLarge.append("\"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"Configuration_Final.xsd\"> ");
							iModConfigExpTailLarge.append("<MOD_DOMAIN>");
							iModConfigExpTailLarge.append("<EFF_DOMAIN NAME=\"Engineering Effectivity\">");
							iModConfigExpTailLarge.append("<MOD_EFFECTIVITY>");
							iModConfigExpTailLarge.append("<EFF_TYPE>");
							iModConfigExpTailLarge.append("<RANGE_RANGE END=\"50\" START=\"26\"/>");
							iModConfigExpTailLarge.append("<RANGE_RANGE END=\"100\" START=\"76\"/>");
							iModConfigExpTailLarge.append("</EFF_TYPE>");
							iModConfigExpTailLarge.append("</MOD_EFFECTIVITY>");
							iModConfigExpTailLarge.append("</EFF_DOMAIN>");
							iModConfigExpTailLarge.append("</MOD_DOMAIN>");
							iModConfigExpTailLarge.append("</ENOVIA_MODIFICATION>");
							String iTailLargeExp = iModConfigExpTailLarge.toString();
							
				
							
							
							System.out.println("-> Creating Mod - Tail Large (Engineering; unit 26-50,76-100) ");
							ENOVIA tailLargeResultSet = pscWrapper.createModification(exhaustCPV, iTailLargeExp);
							String tailLarge_MOD =  pscWrapper.getENOVIA_EFF_MOD_UUID(tailLargeResultSet);
							tailSmallMod = tailSmall_MOD;
							tailLargeMod = tailLarge_MOD;
							success = true;
			
						} catch (Exception e) {
							CAAENOVWSUtils.ProcessException(e);
						}
						if (success)
									System.out.println("-> create mods, one each for children of Exhaust : second level - sucess.");
								else
			throw new Exception("-> create mods, one each for children of Exhaust : second level - failure.");
	}//[Top] 
	/*
	Create the following config handlers:
				CAR 1(unit 1-1)	
				CAR 40(unit 40-40)	
				CAR 51(unit 51-51)
				CAR 80(unit 80-80)
				CAR broken(unit 91-91)	
	*/
	public void creatConfigHandlers(CAAENOVWSProdStructConfigCppWrapper pscWrapper)
		throws Exception {
			System.out.println("-> create config handlers to be used when BOM reports are generatd");
			boolean success = false;
			try {
			System.out.println("-> Creating CH - CAR 1 (Engineering; unit 1-1) ");
			String car1_Name = "CAR1"+uKey;
			String iCAR_1 = CAAENOVWSUtils.crtConfigHandlerExp(car1_Name,"CAR with Range1" ,"Engineering Effectivity","1","1");
			ENOVIA carRS_1 = pscWrapper.createConfigHandler(carPRC, iCAR_1);
			String carCH_1 =  pscWrapper.getENOVIA_CFHANDLER_UUID(carRS_1);
							
			String car40_Name = "CAR40"+uKey;
			System.out.println("-> Creating CH - CAR 40 (Engineering; unit 40-40) ");
			String iCAR_40 = CAAENOVWSUtils.crtConfigHandlerExp(car40_Name,"CAR with Range40" ,"Engineering Effectivity","40","40");
			ENOVIA carRS_40 = pscWrapper.createConfigHandler(carPRC, iCAR_40);
			String carCH_40 =  pscWrapper.getENOVIA_CFHANDLER_UUID(carRS_40);
				
			String car51_Name = "CAR51"+uKey;
			System.out.println("-> Creating CH - CAR 51 (Engineering; unit 51-51) ");
			String iCAR_51 = CAAENOVWSUtils.crtConfigHandlerExp(car51_Name,"CAR with Range51" ,"Engineering Effectivity","51","51");
			ENOVIA carRS_51 = pscWrapper.createConfigHandler(carPRC, iCAR_51);
			String carCH_51 =  pscWrapper.getENOVIA_CFHANDLER_UUID(carRS_51);
				
			String car80_Name = "CAR80"+uKey;
			System.out.println("-> Creating CH - CAR 80 (Engineering; unit 80-80) ");
			String iCAR_80 = CAAENOVWSUtils.crtConfigHandlerExp(car80_Name,"CAR with Range80" ,"Engineering Effectivity","80","80");
			ENOVIA carRS_80 = pscWrapper.createConfigHandler(carPRC, iCAR_80);
			String carCH_80 =  pscWrapper.getENOVIA_CFHANDLER_UUID(carRS_80);
			
			String car91_Name = "CAR91"+uKey;
			System.out.println("-> Creating CH - CAR broken (Engineering; unit 91-91) ");
			String iCAR_91 = CAAENOVWSUtils.crtConfigHandlerExp(car91_Name,"CAR with Range91" ,"Engineering Effectivity","91","91");
			ENOVIA carRS_91 = pscWrapper.createConfigHandler(carPRC, iCAR_91);
			String carCH_91 =  pscWrapper.getENOVIA_CFHANDLER_UUID(carRS_91);
//			configHandler UUIDIds
  			carConfgHUnit1 = carCH_1;
			carConfgHUnit40 = carCH_40;
			carConfgHUnit51 = carCH_51;
			carConfgHUnit80 = carCH_80;
			carConfgHUnit91 = carCH_91; 
			success = true;
				
			} catch (Exception e) {
				CAAENOVWSUtils.ProcessException(e);
			}
 		if (success)
			System.out.println("-> create config handlers to be used when BOM reports are generatd - sucess.");
						else
			throw new Exception("-> create config handlers to be used when BOM reports are generatd - failure.");
	}//[Top] 
	/*	
		 * Change Management
		 * Create Action using Create Action Service Action make CAR
	 */
	public void creatAction(CAAENOVWSChgMgmtCppWrapper chgWrapper)
		throws Exception {
			System.out.println("-> create an action to record changes to CAR.");
			boolean success = false;
		
			try {
				String actionId = "PSCWSAction"+uKey;
				String[] actionsID = {actionId};
				String actionDomain = "APLAFL";
				String actionPriority = "Routine";
				
				ENOVIA newAction = chgWrapper.createAction(	actionsID,
															actionDomain,
															actionPriority);
															
				String[] newActionUUIDs = chgWrapper.getENOVIA_Action_DesignUUIDs(newAction);
				if (newActionUUIDs.length != 1) {
					throw new Exception("-> Failed to create action" + newActionUUIDs);
				}
			
				carAction1 = newActionUUIDs[0];		
				success = true;
			} catch (Exception e) {
				CAAENOVWSUtils.ProcessException(e);
			}
			if (success)
				System.out.println("-> create an action to record changes to CAR - sucess.");	
			else
			throw new Exception("-> create an action to record changes to CAR - failure.");				
	}//[Top] 
	/*	
	Add Associated Object Service CAR	configured object on Action make CAR
			Pass in the following mods
	Rear Wheel Drive
						Front Wheel Drive
	*/
	public void addAssociatedObjectsToExhaust(CAAENOVWSChgMgmtCppWrapper chgWrapper) throws Exception{
		System.out.println("-> add associated object to action : CAR's Exhaust.");
		boolean success = false;
		
		try {
			
			String[] associateMods = {tailSmallMod,tailLargeMod};
			
			chgWrapper.addAssociatedObject(carAction1,exhaustCPV,associateMods);		
			success = true;
		} catch (Exception e) {
			CAAENOVWSUtils.ProcessException(e);
		}
		if (success)
			System.out.println("-> add associated object to action : CAR's Exhaust - sucess.");	
		else
		throw new Exception("-> add associated object to action : CAR's Exhaust - failure.");				
		
	}//[Top] 	
	/*
	Add Associate Object Service  Exhaust configured object on Action make CAR	Pass in the following mods
						Tail Small
						Tail Large
	*/
	public void addAssociatedObjectsToCar(CAAENOVWSChgMgmtCppWrapper chgWrapper) throws Exception{
		System.out.println("-> add associated object to action : CAR PRC.");
		boolean success = false;
		
		try {
			
			String[] associateMods = {rearWDMod,frontWDMod,allWDMod,fourWDMod,exhaustMod};
			
			chgWrapper.addAssociatedObject(carAction1,carPRC,associateMods);		
			success = true;
		} catch (Exception e) {
			CAAENOVWSUtils.ProcessException(e);
		}
		if (success)
			System.out.println("-> add associated object to action : CAR PRC - sucess.");	
		else
		throw new Exception("-> add associated object to action : CAR PRC - failure.");				
		
	}//[Top] 
	/*
	Add Affected Object Service CAR Owner Manual
	*/
	public void addAffectedObjects(CAAENOVWSChgMgmtCppWrapper chgWrapper) throws Exception{
		System.out.println("-> add affected object to action : CAR's owner manual.");
		boolean success = false;
		
		try {
			
			String[] inputAO = {ownerManualDOC};
			String[] outputAO = {};
			
			chgWrapper.addAffectedObject(carAction1,inputAO,outputAO);		
			success = true;
		} catch (Exception e) {
			CAAENOVWSUtils.ProcessException(e);
		}
		if (success)
			System.out.println("-> add affected object CAR owner manual - sucess.");	
		else
		throw new Exception("-> add affected object CAR owner manual - failure.");				
	
	}//[Top] 	
	
	/*
	Get Affected Object Service CAR Owner Manual
	*/
	public void getAffectedObjects(CAAENOVWSChgMgmtCppWrapper chgWrapper) throws Exception{
		System.out.println("-> get affected objects on action.");
		boolean success = false;
		
		try {
			
			String[] objTypes = null;
			ENOVIA affectedObjectsResultSet = chgWrapper.getAffectedObjects(carAction1,
																			objTypes,
																			null);
			// you need the size here ...	
			CAAENOVWSUtils.displayResults(affectedObjectsResultSet, 99);
			success = true;
		} catch (Exception e) {
			CAAENOVWSUtils.ProcessException(e);
		}
		if (success)
			System.out.println("-> get affected objects on action - sucess.");	
		else
		throw new Exception("-> get affected objects on action - failure.");				
	
	}//[Top] 	
	/* GetAndResolveOperations
	Get Operations Service on CAR
	Expand Service Zero Level Get Mods on configured object  CAR
	Resolve Operations Service:		II					Mod
								Rear Wheel Drive		Add	Rear Wheel Drive
								Front Wheel Drive		Add	Front Wheel Drive
								Exhaust					Add	Exhaust
														All Wheel Drive
														Four Wheel Drive
	Get Operations Service on Exhaust
	Resolve Operations Service:
							Tail SmallAdd		Tail Small
							Tail LargeAdd		Tail Large
	----------------
	after modification, more operation and resolve
	Expand Service Zero Level Get Mods on configured object  CAR
	Resolve Operations Service:		II				Mod
					Rear Wheel Drive Cut	All Wheel Drive
					All Wheel Drive Add		All Wheel Drive
					Four Wheel Drive Add	Four Wheel Drive
					Front Wheel Drive Cut	Four Wheel Drive
														
	*/
	/*
	 * objectId = configured item instance, e.g, carPRC, exhaustCII
	 */
	public void GetAndResolveOperationsExhaust(CAAENOVWSProdStructConfigCppWrapper pscWrapper)
		throws Exception {
			System.out.println("-> get and resolve operations on exhast.");
					boolean success = false;
					Exception exception = null;
					try {
						System.out.println("-> Get All Operations on the input.");
						OperationStructureArrayTypeHolder opers = pscWrapper.GetOpers(exhaustCII);
						
								
						OperationStructure[] valOpers =opers.value;
						int lenOper = valOpers.length;
						System.out.println("-> Number of Operations found "+ lenOper);
						for(int i=0;i<lenOper;i++)
						{
							String operStr=valOpers[i].getOperation();
							System.out.println("-> Operation "+operStr);
							
							
							String partName = CAAENOVWSUtils.ParseOperation(operStr);
							Identifier objID = valOpers[i].getOperandObjId1();
							System.out.println("-> Operation "+operStr);
													
							//System.out.println("------The type of object------"+objStr);
							OperationStructure[] resolveOperStruct = new OperationStructure[1];
							OperationStructure operStruct = new OperationStructure();
							operStruct.setOperandObjId1(objID);
							operStruct.setOperandObjId2(valOpers[i].getOperandObjId2());
							operStruct.setConfigViewId3(valOpers[i].getConfigViewId3());
							operStruct.setOperation(operStr);
							
							//Add the operStruct to the array
							resolveOperStruct[0]=operStruct;
							//Add the array to the holder
							OperationStructureArrayTypeHolder iOperations = new OperationStructureArrayTypeHolder(resolveOperStruct);
							
							if((operStr.indexOf(tailSmallPV_ID) > 0))
							{
								System.out.println("-> The Part Name = " +tailSmallPV_ID);
								pscWrapper.ResolveOpers(tailSmallMod, iOperations);
							}
							else if((operStr.indexOf(tailLargePV_ID) > 0))
							{
								System.out.println("-> The Part Name = " +tailLargePV_ID);
								pscWrapper.ResolveOpers(tailLargeMod, iOperations);
							}
							
						}
					
						
										
/*
Number of Operations found 6
Operation Add :: CAA_USECASE2 (nls_WIP) $ CAA_USECASE2
Operation Add :: PSCWSRearWDPV1138902732623.1 | PSCWSRearWDPV1138902732623 --- (Unconfigured) $ CAA_USECASE2
Operation Add :: PSCWSFrontWDPV1138902732623.1 | PSCWSFrontWDPV1138902732623 --- (Unconfigured) $ CAA_USECASE2
Operation Add :: PSCWSexhaustCPV1138902732623.1 | PSCWSexhaustCPV1138902732623 --- (Configured) $ CAA_USECASE2
Operation Add :: PSCWSexhaustCPV1138902732623 --- | PSCWSTailSmallPV1138902732623.1 | PSCWSTailSmallPV1138902732623--- (nls_WIP) $ PSCWSexhaustCPV1138902732623
Operation Add :: PSCWSexhaustCPV1138902732623 --- | PSCWSTailLargePV1138902732623.1 | PSCWSTailLargePV1138902732623--- (nls_WIP) $ PSCWSexhaustCPV1138902732623
create a document CAR - sucess.
			
*/
						
						
						success = true;
					} catch (Exception e) {
						CAAENOVWSUtils.ProcessException(e);
					}
					if (success)
						System.out.println("-> get and resolve operations on exhast - sucess.");
					else
			throw new Exception("-> get and resolve operations on exhast - failure.");
			
			
	}//[Top] 
	
	/*
	/*
	 * objectId = configured item instance, e.g, carPRC, exhaustCII
	 */
	public void GetAndResolveOperationsCAR(CAAENOVWSProdStructConfigCppWrapper pscWrapper)
		throws Exception {
			System.out.println("-> get and resolve operations on CAR Product");
					boolean success = false;
					Exception exception = null;
					try {
						System.out.println("-> Get All Operations on the input.");
						OperationStructureArrayTypeHolder opers = pscWrapper.GetOpers(carPRC);
						
								
						OperationStructure[] valOpers =opers.value;
						int lenOper = valOpers.length;
						System.out.println("-> Number of Operations found "+ lenOper);
						for(int i=0;i<lenOper;i++)
						{
							String operStr=valOpers[i].getOperation();
							System.out.println("-> Operation "+operStr);
							
							
							String partName = CAAENOVWSUtils.ParseOperation(operStr);
							Identifier objID = valOpers[i].getOperandObjId1();
							System.out.println("-> Operation "+operStr);
							System.out.println("-> The Part Name = " +partName);
							
							
							
							//System.out.println("------The type of object------"+objStr);
							OperationStructure[] resolveOperStruct = new OperationStructure[1];
							OperationStructure operStruct = new OperationStructure();
							operStruct.setOperandObjId1(objID);
							operStruct.setOperandObjId2(valOpers[i].getOperandObjId2());
							operStruct.setConfigViewId3(valOpers[i].getConfigViewId3());
							operStruct.setOperation(operStr);
							
							//Add the operStruct to the array
							resolveOperStruct[0]=operStruct;
							//Add the array to the holder
							OperationStructureArrayTypeHolder iOperations = new OperationStructureArrayTypeHolder(resolveOperStruct);
							
							
							
											
							if(partName.equals(rearWDPV_ID))
							{
								pscWrapper.ResolveOpers(rearWDMod, iOperations);
							}
							else if(partName.equals(frontWDPV_ID))
							{
								pscWrapper.ResolveOpers(frontWDMod, iOperations);
							}
							else if(partName.equals(allWDPV_ID))
							{
								pscWrapper.ResolveOpers(allWDMod, iOperations);
							}
							else if(partName.equals(fourWDPV_ID))
							{
								pscWrapper.ResolveOpers(fourWDMod, iOperations);
							}
							else if(partName.equals(exhaustCPV_ID))
							{
								pscWrapper.ResolveOpers(exhaustMod, iOperations);
							}
						}
					
						
										
/*
Number of Operations found 6
Operation Add :: CAA_USECASE2 (nls_WIP) $ CAA_USECASE2
Operation Add :: PSCWSRearWDPV1138902732623.1 | PSCWSRearWDPV1138902732623 --- (Unconfigured) $ CAA_USECASE2
Operation Add :: PSCWSFrontWDPV1138902732623.1 | PSCWSFrontWDPV1138902732623 --- (Unconfigured) $ CAA_USECASE2
Operation Add :: PSCWSexhaustCPV1138902732623.1 | PSCWSexhaustCPV1138902732623 --- (Configured) $ CAA_USECASE2
Operation Add :: PSCWSexhaustCPV1138902732623 --- | PSCWSTailSmallPV1138902732623.1 | PSCWSTailSmallPV1138902732623--- (nls_WIP) $ PSCWSexhaustCPV1138902732623
Operation Add :: PSCWSexhaustCPV1138902732623 --- | PSCWSTailLargePV1138902732623.1 | PSCWSTailLargePV1138902732623--- (nls_WIP) $ PSCWSexhaustCPV1138902732623
create a document CAR - sucess.
			
*/
						
						
						success = true;
					} catch (Exception e) {
						CAAENOVWSUtils.ProcessException(e);
					}
					if (success)
						System.out.println("-> get and resolve operations on CAR Product - sucess.");
					else
			throw new Exception("-> get and resolve operations on CAR Product - failure.");
			
			
	}//[Top] 
	


	/* Modify ProdStruct
	Replace Child Rear Wheel Drive with All Wheel Drive
	Cut Child Front Wheel Drive
	Add Child Four Wheel Drive
	*/
	public void modifyCar(CAAENOVWSProdStructCppWrapper psWrapper)
		throws Exception {
		System.out.println("-> modify the car product structure.");
		boolean success = false;
		
		try {
			System.out.println("-> Replace Child Rear Wheel Drive with All Wheel Drive.");
			ENOVIA createDocResultSet = psWrapper.replacePart(rearWDII,allWDPV);
			
			System.out.println("-> Cut Child Front Wheel Drive.");
			String [] childInstIds = {frontWDII};
			psWrapper.cutPartInstance(carPRC,childInstIds);
			System.out.println("-> Add Child Four Wheel Drive.");
			String [] childRefIds = {fourWDPV};
			psWrapper.createPartInst(carPRC,childRefIds );
	
			success = true;
		} catch (Exception e) {
			CAAENOVWSUtils.ProcessException(e);
		}		
		if (success)
			System.out.println("-> modify the car product structure - sucess.");	
		else
		throw new Exception("-> modify the car product structure - failure.");				
	}//[Top] 
	
	/* 
	 * Report BOM as follows:
	 *  Expand all levels on CARPRC using the config handlers to retrieve:
	 *          CAR 1(unit 1)	
	 *			CAR 40(unit 40)	
	 *			CAR 51(unit 51)
	 *			CAR 80(unit 80)
	 *			CAR broken(unit 91)
	 */
	public void reportBOM(	CAAENOVWSProdStructCppWrapper psWrapper,
							CAAENOVWSQueryCppWrapper queryWrapper) throws Exception{	
		System.out.println("-> reportBOM.");
		boolean success = false;
		
		try {
			String filter = null;
	
			System.out.println("-> expand car by applying config handler CAR unit 1 ::");
			expandCarByApplyingConfigHandler(psWrapper,carConfgHUnit1,queryWrapper);
			System.out.println("-> expand car by applying config handler CAR unit 40 ::");
			expandCarByApplyingConfigHandler(psWrapper,carConfgHUnit40,queryWrapper);
			System.out.println("-> expand car by applying config handler CAR unit 51 ::");
			expandCarByApplyingConfigHandler(psWrapper,carConfgHUnit51,queryWrapper);
			System.out.println("-> expand car by applying config handler CAR unit 80::");
			expandCarByApplyingConfigHandler(psWrapper,carConfgHUnit80,queryWrapper);
			System.out.println("-> expand car by applying config handler CAR unit 91 ::");
			expandCarByApplyingConfigHandler(psWrapper,carConfgHUnit91,queryWrapper);			
			success = true;		
		} catch (Exception e) {
			CAAENOVWSUtils.ProcessException(e);
		}		
		if (success)
			System.out.println("-> reportBOM - sucess.");	
		else
		throw new Exception("-> reportBOM - failure.");					
	}
	public void expandCarByApplyingConfigHandler(CAAENOVWSProdStructCppWrapper psWrapper, 
													String configHandlerUUID,
												CAAENOVWSQueryCppWrapper queryWrapper)throws Exception{	
		System.out.println("-> Expand CAR by applying config handler");
	
		boolean success = false;
		
		try { 
			//String configHandlerID = CAAENOVWSUtils.getConfigHandlerID(configHandlerUUID,queryWrapper);
			String filter = CAAENOVWSUtils.buildExpandConfigHandlerFilter(carPRC, configHandlerUUID);			
			ENOVIA expandResultSet = psWrapper.expandProductStructure(carPRC,1, filter);
			if (expandResultSet.getENOVIA_VPMProductRootClass() == null || expandResultSet.getENOVIA_VPMProductRootClass().length != 1) {
				throw new Exception("-> Failed to find product root class");
			}  /*else if (expandResultSet.getVPMBOPartInstance() == null || expandResultSet.getVPMBOPartInstance().length <= 0) {
				throw new Exception("-> Failed to find item instances");
			} */
			CAAENOVWSUtils.displayResults(expandResultSet, 3);			
			success = true;		
		} catch (Exception e) {
			CAAENOVWSUtils.ProcessException(e);
		}		
		if (success)
			System.out.println("-> Expand CAR by applying config handler - sucess.");	
		else
		throw new Exception("-> Expand CAR by applying config handler - failure.");					
	}				
}

[Top]


History

Version: 1 [Feb 2006] Document created
[Top]

Copyright © 1994-2006, Dassault Systèmes. All rights reserved.