if (context == null)
throw new IllegalArgumentException("Null context");
MutableAttachments mutable;
Attachments attachments = context.getPredeterminedManagedObjects();
// Nothing predetermined yet
if (attachments == null)
{
mutable = AttachmentsFactory.createMutableAttachments();;
context.setPredeterminedManagedObjects(mutable);
}
// Some predetermined but needs to be made mutable
else if (attachments instanceof MutableAttachments == false)
{
mutable = AttachmentsFactory.createMutableAttachments();
Map<String, Object> map = attachments.getAttachments();
if (map != null)
mutable.setAttachments(map);
context.setPredeterminedManagedObjects(mutable);
}
else