2011년 12월 22일 목요일

Client API - 라이센스 부여


repo.login(monitor);

//static String userID = "jyyie";
IContributorManager contributorManager = repo.contributorManager();
IContributor contributor = contributorManager.fetchContributorByUserId(userID, monitor);

// Print licenses types in repository
ILicenseAdminService licenseService =
(ILicenseAdminService)((TeamRepository)repo).getServiceInterface(ILicenseAdminService.class);
IContributorLicenseType licenseTypes[] = licenseService.getLicenseTypes();
System.out.println("");
for(IContributorLicenseType licenseType : licenseTypes){
String id = licenseType.getId();
System.out.println(id);
}

/*
com.ibm.team.rrc.reviewer
com.ibm.team.rrc.author
com.ibm.team.rrc.system
com.ibm.team.rtc.stakeholder
com.ibm.team.rtc.contributor
com.ibm.team.rtc.developer
com.ibm.rtc.developer-iep
com.ibm.team.rtc.buildsystem
com.ibm.team.rtc.cc-connector
com.ibm.team.rtc.cq-connector
com.ibm.rqm.viewer
com.ibm.rqm.tester
com.ibm.rqm.functional
com.ibm.team.lpa.system
com.ibm.team.clm.datacollector
com.ibm.team.rrc.author.floating

com.ibm.team.rtc.contributor.floating
com.ibm.team.rtc.developer.floating
com.ibm.rqm.tester.floating
com.ibm.clm.professional.floating

*/



// Print licenses of user
System.out.println("\n");
String licenseTypeIds[] = licenseService.getAssignedLicenses(contributor);
for(String licenseTypeId : licenseTypeIds) {
System.out.println(licenseTypeId);
}

// Add licenses to user
IContributor contributorCopy = (IContributor)contributor.getWorkingCopy();
licenseService.assignLicense(contributorCopy, "com.ibm.team.rtc.developer");
//licenseService.unassignLicense(contributorCopy, "com.ibm.team.rtc.developer");
contributorManager.saveContributor(contributorCopy, monitor);

// Print licenses of user
contributor = contributorManager.fetchContributorByUserId(userID, monitor);
System.out.println("\n");
String license2TypeIds[] = licenseService.getAssignedLicenses(contributor);
for(String licenseTypeId : license2TypeIds) {
System.out.println(licenseTypeId);
}

TeamPlatform.shutdown();

댓글 없음:

댓글 쓰기