When running StarTeam SDK code why are the changes not being updated on the StarTeam server?

0 Likes

Problem:

When running StarTeam SDK code why are the changes not being updated on the StarTeam server?

Resolution:


  • Product Name: StarTeam
  • Product Version: All
  • Product Component: SDK
  • Platform/OS Version: N/A

The most likely cause of this issue is that the code is using the refresh() command rather than the update() command. In order for changes on a view or project (e.g. after the rename, change operations etc.) to be committed, the code needs to use the update() call instead of refresh() call. An example is shown below:

//Connect to the server

public Project findProject(String projectName)

{
String connString = user ":" password "@" strAddress ":" nPort "/" projectName;
Project project = StarTeamFinder.openProject(connString);
return(project);
}

// The code below is being used to attempt to rename the project but is failing:

public int renameProject(Project project, String originalName){

String newName = "OLD";


// Get the start of the name



String[] temp;
temp = project.getName().split("_");
for(int i =1; i


newName = newName "_" temp;
String title = "Renaming project";

String message = "Renaming project " originalName " to " newName;
int reply = JOptionPane.showConfirmDialog(null, message, title, JOptionPane.OK_CANCEL_OPTION);

if (reply == JOptionPane.OK_OPTION) {
View defaultView = project.getDefaultView();


logMessage("Changed Default view name from " defaultView.getName() " to " newName);
defaultView.setName(newName);
defaultView.refresh();

Folder rootFolder = defaultView.getRootFolder();
logMessage("Changed root folder name from " rootFolder.getName() " to " newName);
rootFolder.setName(newName);
rootFolder.refresh();


logMessage("Renaming project " originalName " to " newName);
project.setName(newName);
project.refresh();
return(1);
}

else

{
logMessage("Cancelled rename for project " originalName);
return(0);
}


}

Note the use of the refresh() call. These will need to be changed to Update() calls to ensure the changes are committed and reflected on the server, as shown below:


defaultView.update();
rootFolder.update();
project.update();

For a full list of the current SDK classes please refer to the SDK API


Old KB# 30134
Comment List
Related
Recommended