}
public void upgrade(UpgradeMessage message)
throws ConfigurationIsCorruptedException
{
Configuration oldc = (Configuration) message.getConfiguration();
org.sonatype.security.model.v2_0_0.Configuration newc = new org.sonatype.security.model.v2_0_0.Configuration();
newc.setVersion(org.sonatype.security.model.v2_0_0.Configuration.MODEL_VERSION);
for (CUser oldu : (List<CUser>) oldc.getUsers()) {
org.sonatype.security.model.v2_0_0.CUser newu = new org.sonatype.security.model.v2_0_0.CUser();
newu.setEmail(oldu.getEmail());
newu.setId(oldu.getUserId());
newu.setName(oldu.getName());
newu.setPassword(oldu.getPassword());
newu.setStatus(oldu.getStatus());
newu.setRoles(oldu.getRoles());
newc.addUser(newu);
}
for (CRole oldr : (List<CRole>) oldc.getRoles()) {
org.sonatype.security.model.v2_0_0.CRole newr = new org.sonatype.security.model.v2_0_0.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 (CRepoTargetPrivilege oldp : (List<CRepoTargetPrivilege>) oldc.getRepositoryTargetPrivileges()) {
org.sonatype.security.model.v2_0_0.CPrivilege newp = new org.sonatype.security.model.v2_0_0.CPrivilege();
newp.setDescription(oldp.getDescription());
newp.setId(oldp.getId());
newp.setName(oldp.getName());
newp.setType("target");
org.sonatype.security.model.v2_0_0.CProperty prop = new org.sonatype.security.model.v2_0_0.CProperty();
prop.setKey("method");
prop.setValue(oldp.getMethod());
newp.addProperty(prop);
if (!StringUtils.isEmpty(oldp.getRepositoryId())) {
prop = new org.sonatype.security.model.v2_0_0.CProperty();
prop.setKey("repositoryGroupId");
prop.setValue(oldp.getGroupId());
newp.addProperty(prop);
}
if (!StringUtils.isEmpty(oldp.getRepositoryId())) {
prop = new org.sonatype.security.model.v2_0_0.CProperty();
prop.setKey("repositoryId");
prop.setValue(oldp.getRepositoryId());
newp.addProperty(prop);
}
prop = new org.sonatype.security.model.v2_0_0.CProperty();
prop.setKey("repositoryTargetId");
prop.setValue(oldp.getRepositoryTargetId());
newp.addProperty(prop);
newc.addPrivilege(newp);
}
for (CApplicationPrivilege oldp : (List<CApplicationPrivilege>) oldc.getApplicationPrivileges()) {
org.sonatype.security.model.v2_0_0.CPrivilege newp = new org.sonatype.security.model.v2_0_0.CPrivilege();
newp.setDescription(oldp.getDescription());
newp.setId(oldp.getId());
newp.setName(oldp.getName());