/** * Evaluates BuildRun description. * * @param changes - set of changes affected by this BuildRun. * @return description string. */ public static String getModificationDescription(Iterable<VcsModification> changes) { // Create Set to filter changes unique by User and Comment StringBuilder result = new StringBuilder(256); for (Iterator<VcsModification> it = changes.iterator(); it.hasNext(); ) { VcsModification mod = it.next(); result.append(mod.getUserName()); result.append(": "); result.append(mod.getComment()); if (it.hasNext()) { result.append("<br>"); } } return result.toString(); }
private void setChangeSets(BuildRun buildRun, BuildInfo info) { for (VcsModification change : info.getChanges()) { // See if we have this ChangeSet in the system. ChangeSetFilter filter = new ChangeSetFilter(); String id = change.getId(); filter.reference.add(id); Collection<ChangeSet> changeSetList = config.getV1Instance().get().changeSets(filter); if (changeSetList.isEmpty()) { // We don't have one yet. Create one. StringBuilder name = new StringBuilder(); name.append('\''); name.append(change.getUserName()); if (change.getDate() != null) { name.append("\' on \'"); name.append(new DB.DateTime(change.getDate())); } name.append('\''); Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put("Description", change.getComment()); ChangeSet changeSet = config.getV1Instance().create().changeSet(name.toString(), id, attributes); changeSetList = new ArrayList<ChangeSet>(1); changeSetList.add(changeSet); } Set<PrimaryWorkitem> workitems = determineWorkitems(change.getComment()); associateWithBuildRun(buildRun, changeSetList, workitems); } }