}
public void upgrade(UpgradeMessage message)
throws ConfigurationIsCorruptedException
{
Configuration oldc = (Configuration) message.getConfiguration();
org.sonatype.security.model.v2_0_2.Configuration newc = new org.sonatype.security.model.v2_0_2.Configuration();
newc.setVersion(org.sonatype.security.model.Configuration.MODEL_VERSION);
for (CUser oldu : (List<CUser>) oldc.getUsers()) {
org.sonatype.security.model.v2_0_2.CUser newu = new org.sonatype.security.model.v2_0_2.CUser();
newu.setEmail(oldu.getEmail());
newu.setId(oldu.getId());
newu.setName(oldu.getName());
newu.setPassword(oldu.getPassword());
newu.setStatus(oldu.getStatus());
// convert the old roles mapping to the new one
this.migrateOldRolesToUserRoleMapping(oldu.getId(), DEFAULT_SOURCE, oldu.getRoles(), newc);
newc.addUser(newu);
}
Map<String, String> roleIdMap = new HashMap<String, String>();
for (CRole oldr : (List<CRole>) oldc.getRoles()) {
org.sonatype.security.model.v2_0_2.CRole newr = new org.sonatype.security.model.v2_0_2.CRole();
newr.setDescription(oldr.getDescription());
newr.setId(oldr.getId());
newr.setName(oldr.getName());
newr.setPrivileges(oldr.getPrivileges());
newr.setRoles(oldr.getRoles());
newr.setSessionTimeout(oldr.getSessionTimeout());
newc.addRole(newr);
}
for (CPrivilege oldp : (List<CPrivilege>) oldc.getPrivileges()) {
org.sonatype.security.model.v2_0_2.CPrivilege newp = new org.sonatype.security.model.v2_0_2.CPrivilege();
newp.setDescription(oldp.getDescription());
newp.setId(oldp.getId());
newp.setName(oldp.getName());