public void save() throws RegistryException{
EntityManager em = null;
try {
em = ResourceUtils.getEntityManager();
Experiment_Input existingInput = em.find(Experiment_Input.class, new Experiment_Input_PK(experimentResource.getExpID(), experimentKey));
em.close();
em = ResourceUtils.getEntityManager();
em.getTransaction().begin();
Experiment_Input exInput = new Experiment_Input();
exInput.setEx_key(experimentKey);
Experiment experiment = em.find(Experiment.class, experimentResource.getExpID());
exInput.setExperiment(experiment);
exInput.setExperiment_id(experiment.getExpId());
if (value != null){
exInput.setValue(value.toCharArray());
}
exInput.setInputType(inputType);
exInput.setMetadata(metadata);
if (existingInput != null) {
existingInput.setEx_key(experimentKey);
existingInput.setExperiment(experiment);
existingInput.setExperiment_id(experiment.getExpId());