/** * Transforms a set of version properties into a CruiseControl Modification object. * * @param versionList a set of version information properties * @param n the index of the property information to use * @return a Modification object representing the change */ protected Modification transformJCaVersionContainerToModification( JCaContainer versionList, int n, boolean promote) { Modification mod = new Modification("harvest"); mod.revision = versionList.getString(JCaAttrKey.CA_ATTRKEY_MAPPED_VERSION_NAME, n); Modification.ModifiedFile modfile = mod.createModifiedFile( versionList.getString(JCaAttrKey.CA_ATTRKEY_NAME, n), versionList.getString(JCaAttrKey.CA_ATTRKEY_FULL_PATH_NAME, n)); modfile.revision = mod.revision; JCaTimeStamp created = versionList.getTimeStamp(JCaAttrKey.CA_ATTRKEY_MODIFIED_TIME, n); mod.modifiedTime = created.toDate(); mod.userName = versionList.getString(JCaAttrKey.CA_ATTRKEY_MODIFIER_NAME, n); mod.emailAddress = getEmailAddress(mod.userName); mod.comment = versionList.getString(JCaAttrKey.CA_ATTRKEY_DESCRIPTION, n); String status = versionList.getString(JCaAttrKey.CA_ATTRKEY_VERSION_STATUS, n); if (promote) { if (status.equals("N")) { // If this is the first revision, then the file has been newly added if (mod.revision.equals("0")) { modfile.action = "added"; } else { modfile.action = "modified"; } } else if (status.equals("D")) { modfile.action = "deleted"; if (propertyOnDelete != null) { properties.put(propertyOnDelete, "true"); } } else if (status.equals("R")) { modfile.action = "reserved"; } else if (status.equals("M")) { modfile.action = "merge_tagged"; } } else { // Any versions which have been demoted are effectively deleted from the state modfile.action = "deleted"; if (propertyOnDelete != null) { properties.put(propertyOnDelete, "true"); } } if (property != null) { properties.put(property, "true"); } return mod; }