WBSCommitRes

using System;  using TestFramework.ApplicationAPI; using TestFramework.AuthenticateAPI;
using TestFramework;  namespace Tests.wbs { 	/// <summary>
	/// Summary description for WBSCommitRes.
	/// 
	/// this sample runs the method : commit affected resources
	/// on a project loaded from RPM repository 
	/// </summary>
	public class WBSCommitRes
	{
		public WBSCommitRes()
		{

		}

		public static String projectName = "IBM_GENERIC_PROJECT_ABC";
		
		//Session ID is use for all transaction and is get from the 
		//Authenticate.login function. The session ID will replace 
		// the User password while transacting
		public static String sessionid;

		public void sampleTest()
		{

			// initialize a session with the API
			sessionid = APISetup.SetUp();

			// create a task scope
			// this scope enables us to save 
			// information around the task
			WorkElementScope pScope = new WorkElementScope();

			// create a project object
			Project project = new Project();

			// query the project
			project = (Project)APISetup.application.loadFromXpath(
				sessionid, "/Project[name='" + projectName + "']", 
				pScope ).rpmObjectList[0];

			// run method commit affected resources on the project
			// with the use of a scope, this method can affect
			// many objects in a logical tree
			if (APISetup.application.commitAffectedResources(
				sessionid, project, pScope).taskSuccessfull)
			{
				//commit affected resources worked
			}


		// close connection with API
		APISetup.CleanUp(sessionid);
		}

	}
}