if (!project.getRootDir().exists()) {
return;
}
MetadataJobProperty property = getOrCreateProperty();
if (property == null) {
return;
}
cleanGeneratedValues(property);
TreeNodeMetadataValue[] tree = TreeStructureUtil.createTreePath("", "job-info", "last-saved");
TreeNodeMetadataValue jobInfo = tree[0];
TreeNodeMetadataValue lastSaved = tree[1];
TreeStructureUtil.addValue(lastSaved, Calendar.getInstance(), "", true, false, "time");
TreeStructureUtil.addValue(lastSaved, currentUser.getDisplayName(), "", "user", "display-name");
TreeStructureUtil.addValue(lastSaved, currentUser.getFullName(), "", "user", "full-name");
if (project instanceof MatrixConfiguration) {
logger.log(Level.FINER, "Adding matrix combination data for {0}", project);
MatrixConfiguration configuration = (MatrixConfiguration)project;
TreeNodeMetadataValue[] path = TreeStructureUtil.createTreePath("", "matrix", "combination");
TreeNodeMetadataValue matrixNode = path[0];
TreeNodeMetadataValue combinationNode = path[1];
Combination combination = configuration.getCombination();
//ToString version of the combination in job-info.matrix.combination.value
TreeStructureUtil.addValue(combinationNode, combination.toString(',', ':'), "", "value");
//Each axis in job-info.matrix.combination.[name]=[value]
for (Map.Entry<String, String> axis : combination.entrySet()) {
TreeStructureUtil.addValue(combinationNode, axis.getValue(), "", "axis", axis.getKey());
}
jobInfo.addChild(matrixNode);
}
logger.finer("Adding standard generated metadata");
property.addChild(jobInfo);
ExtensionList<JobMetadataContributor> contributors = JobMetadataContributor.all();
for (JobMetadataContributor contributor : contributors) {
List<MetadataValue> dataFor = contributor.getMetaDataFor(project);
if (dataFor != null && !dataFor.isEmpty()) {
Collection<MetadataValue> leftover = property.addChildren(dataFor);
logger.warning("Failed to add the following contributor's[" + contributor + "] metadata to "
+ project + "\n"
+ TreeStructureUtil.prettyPrint(leftover, "\t"));
}
}