public void save() throws RegistryException {
EntityManager em = null;
try {
em = ResourceUtils.getEntityManager();
ApplicationInput existingInput = em.find(ApplicationInput.class, new ApplicationInput_PK(inputKey, taskDetailResource.getTaskId()));
em.close();
em = ResourceUtils.getEntityManager();
em.getTransaction().begin();
ApplicationInput applicationInput = new ApplicationInput();
TaskDetail taskDetail = em.find(TaskDetail.class, taskDetailResource.getTaskId());
applicationInput.setTask(taskDetail);
applicationInput.setTaskId(taskDetail.getTaskId());
applicationInput.setInputKey(inputKey);
applicationInput.setInputKeyType(inputType);
if (value != null){
applicationInput.setValue(value.toCharArray());
}
applicationInput.setMetadata(metadata);
if (existingInput != null) {
existingInput.setTask(taskDetail);
existingInput.setTaskId(taskDetail.getTaskId());
existingInput.setInputKey(inputKey);