String path = getPath();
String attachedToArtifactPath = attachedToArtifact.getPath();
if (attachedToArtifactPath == null) {
String msg = "'Attached to artifact' is not associated with a registry path.";
log.error(msg);
throw new GovernanceException(msg);
}
try {
registry.addAssociation(path, attachedToArtifactPath, GovernanceConstants.DEPENDS);
registry.addAssociation(attachedToArtifactPath, path, GovernanceConstants.USED_BY);
} catch (RegistryException e) {
String msg = "Error in attaching the artifact. source id: " + id + ", path: " + path +
", target id: " + attachedToArtifact.getId() + ", path:" +
attachedToArtifactPath +
", attachment type: " + attachedToArtifact.getClass().getName() + ".";
log.error(msg, e);
throw new GovernanceException(msg, e);
}
}