Map<String, ItemDefinition> itemDefinitions = (Map<String, ItemDefinition>)
((ProcessBuildData) parser.getData()).getMetaData("ItemDefinitions");
if (itemDefinitions == null) {
throw new IllegalArgumentException("No item definitions found");
}
ItemDefinition itemDefinition = itemDefinitions.get(itemRef);
if (itemDefinition == null) {
throw new IllegalArgumentException("Could not find itemDefinition " + itemRef);
}
ProcessBuildData buildData = (ProcessBuildData) parser.getData();
Map<String, Message> messages = (Map<String, Message>)
((ProcessBuildData) parser.getData()).getMetaData("Messages");
if (messages == null) {
messages = new HashMap<String, Message>();
buildData.setMetaData("Messages", messages);
}
Message message = new Message(id);
message.setType(itemDefinition.getStructureRef());
messages.put(id, message);
return message;
}