/** * Performs a checkpoint on this Integrity CM Project * * @param integrityConfigurable Authenticated Integrity API Session * @param chkptLabel Checkpoint label string * @return Integrity API Response object * @throws APIException * @throws AbortException */ public Response checkpoint(IntegrityConfigurable integrityConfigurable, String chkptLabel) throws APIException, AbortException { // Construct the checkpoint command IAPICommand command = CommandFactory.createCommand(IAPICommand.CHECKPOINT_COMMAND, integrityConfigurable); command.addOption(new APIOption(IAPIOption.PROJECT, fullConfigSyntax)); // Set the label and description if applicable command.addAdditionalParameters(IAPIOption.CHECKPOINT_LABEL, chkptLabel); return command.execute(); }
/** * Applies a Project Label on this Integrity CM Project * * @param serverConf Authenticated Integrity API Session * @param chkptLabel Checkpoint label string * @return Integrity API Response object * @throws APIException * @throws AbortException */ public Response addProjectLabel( IntegrityConfigurable serverConf, String chkptLabel, String projectName, String projectRevision) throws APIException, AbortException { // Construct the addprojectlabel command IAPICommand command = CommandFactory.createCommand(IAPICommand.ADD_PROJECT_LABEL_COMMAND, serverConf); command.addOption(new APIOption(IAPIOption.PROJECT, projectName)); command.addOption(new APIOption(IAPIOption.LABEL, chkptLabel)); command.addOption(new APIOption(IAPIOption.PROJECT_REVISION, projectRevision)); return command.execute(); }
/** * Performs a projectCPDiff on this Integrity CM Project * * @param serverConf Authenticated Integrity API Session * @param past Past date * @return Set of closed CPIDs * @throws APIException * @throws AbortException */ public Set<String> projectCPDiff(IntegrityConfigurable serverConf, Date past) throws APIException, AbortException { final SimpleDateFormat dateFormat = new SimpleDateFormat("MMM d, yyyy h:mm:ss aa"); // Construct the command IAPICommand command = CommandFactory.createCommand(IAPICommand.PROJECT_CPDIFF_COMMAND, serverConf); command.addOption(new APIOption(IAPIOption.PROJECT, fullConfigSyntax)); command.addOption(new APIOption(IAPIOption.RECURSE)); MultiValue mv = APIUtils.createMultiValueField(",", "id", "user"); command.addOption(new APIOption(IAPIOption.FIELDS, mv)); command.addOption(new APIOption(IAPIOption.REV, "asof:" + dateFormat.format(past))); Set<String> projectCPIDs = new HashSet<String>(); Response res = command.execute(); if (null != res) { if (res.getExitCode() == 0) { WorkItem wi = res.getWorkItem(getConfigurationPath()); Field cpField = wi.getField("CPEntries"); for (Iterator<Item> it = cpField.getList().iterator(); it.hasNext(); ) { Item cpInfo = it.next(); Field idField = cpInfo.getField("id"); String id = idField.getValueAsString(); projectCPIDs.add(id); Field userField = cpInfo.getField("user"); String user = userField.getValueAsString(); } } else { LOGGER.severe("An error occured projectCPDiff!"); } } else { LOGGER.severe("An error occured projectCPDiff!"); } return projectCPIDs; }