Showing results for 
Search instead for 
Do you mean 
Reply

modifyProjects service

Hello,

 

I tried using the ProjectLevelSecurity.ProjectOpsResponse modifyProjects() to update Project description and members. The Project description was updated but not the Project members.I get the following output on the console when I run the Code that I have attached (ProjectManagement.java is called from Hello.java in HelloTeamcenter sample SOA project)

Modified Objects handled in com.teamcenter.clientx.AppXUpdateObjectListener.modelObjectChangeThe following objects have been updated in the client data model:   gsbhlo7zYH3MfD User mtuvm.18554.01.tcadm.00011: Core-2006-03-Session.logout gsbhlo7zYH3MfD is the UID of the Team Administrator.

 

package com.teamcenter.hello;

import com.teamcenter.clientx.AppXSession;
import com.teamcenter.services.strong.core.ProjectLevelSecurityService;
import com.teamcenter.services.strong.core._2012_09.ProjectLevelSecurity;
import com.teamcenter.services.strong.core._2012_09.ProjectLevelSecurity.ModifyProjectsInfo;
import com.teamcenter.services.strong.core._2012_09.ProjectLevelSecurity.ProjectInformation;
import com.teamcenter.services.strong.core._2012_09.ProjectLevelSecurity.ProjectOpsResponse;
import com.teamcenter.services.strong.core._2012_09.ProjectLevelSecurity.TeamMemberInfo;
import com.teamcenter.services.strong.core.DataManagementService;
import com.teamcenter.soa.client.model.ModelObject;
import com.teamcenter.soa.client.model.Property;
import com.teamcenter.soa.client.model.ServiceData;
import com.teamcenter.soa.client.model.strong.GroupMember;
import com.teamcenter.soa.client.model.strong.TC_Project;
import com.teamcenter.soa.client.model.strong.User;
import com.teamcenter.soa.exceptions.NotLoadedException;

public class ProjectManagement {
	private final String projectUID = "C$dhY41aYH3MfD";
	private final String userId = "gsbhlo7zYH3MfD"; //User that should be added to the project
	private final String grpMemberId = "QlWhX76hYH3MfD"; // Team administrator

	private TC_Project project;
	private User teamAdmin;
	private GroupMember grpMember;
	
	public void modifyProjects()
	{
		
		System.out.println("modify projects method");
		String desc;
		
		DataManagementService dmService = DataManagementService.getService(AppXSession.getConnection());
		ServiceData sData = dmService.loadObjects(new String[] {projectUID, userId, grpMemberId});			
		project = (TC_Project) sData.getPlainObject(0);
		teamAdmin = (User) sData.getPlainObject(1);
		grpMember = (GroupMember) sData.getPlainObject(2);

        ProjectLevelSecurityService prjService = ProjectLevelSecurityService.getService(AppXSession.getConnection());
        
        ModifyProjectsInfo modifyInput = new ModifyProjectsInfo();
        ProjectInformation projInfo = new ProjectInformation();
        TeamMemberInfo memberInfo[] = new TeamMemberInfo[2];
        
        memberInfo[0] = new TeamMemberInfo();
        memberInfo[0].teamMember = teamAdmin;
        memberInfo[0].teamMemberType = 2;
        
        memberInfo[1] = new TeamMemberInfo();
        memberInfo[1].teamMember = grpMember;
        memberInfo[1].teamMemberType = 0;
        
        
//        projInfo.clientId = projInfo.toString();
        projInfo.projectDescription = "Test desc";
        projInfo.projectName = "Teamcenter 12";
        projInfo.projectId = "Teamcenter 12";
        projInfo.active = true;
        
        projInfo.teamMembers = memberInfo;
        
//        modifyInput.clientId = modifyInput.toString();
        modifyInput.sourceProject = project;
        modifyInput.projectInfo = projInfo;
                      
        ProjectOpsResponse resp = prjService.modifyProjects(new ModifyProjectsInfo[] {modifyInput});
        
	}
}

Thanks.