/** * {@inheritDoc} * * <p>Inserts an instance of Project into the database. */ public void insert(Project project) { // FIXME: need to set the names of each sample!! TreeSet<Sample> list = new TreeSet<Sample>(); // FIXME: why do I have to manually set these!?!?! /* * project.getSample1().setCreateTimestamp(new Date()); * project.getSample2().setCreateTimestamp(new Date()); * project.getSample3().setCreateTimestamp(new Date()); * project.getSample4().setCreateTimestamp(new Date()); * project.getSample5().setCreateTimestamp(new Date()); * project.getSample6().setCreateTimestamp(new Date()); * project.getSample7().setCreateTimestamp(new Date()); * project.getSample8().setCreateTimestamp(new Date()); * project.getSample1().setProject(project); * project.getSample2().setProject(project); * project.getSample3().setProject(project); * project.getSample4().setProject(project); * project.getSample5().setProject(project); * project.getSample6().setProject(project); * project.getSample7().setProject(project); * project.getSample8().setProject(project); list.add(project.getSample1()); * list.add(project.getSample2()); list.add(project.getSample3()); * list.add(project.getSample4()); list.add(project.getSample5()); * list.add(project.getSample6()); list.add(project.getSample7()); * list.add(project.getSample8()); */ project.setSamples(list); project.setCreateTimestamp(new Date()); // Debug.put(": readyToProcess = " + project.getReadyToProcess()); // Debug.put(": ownerId = " + project.getOwnerId()); // if (project.getReadyToProcess() != null && // project.getReadyToProcess().equals("Y")) { // project.setStatus("ready_to_process"); } // else { project.setStatus("not_ready_to_process"); }; projectDAO.insert(project); }
private void fillInSamples(Project project) { Object[] samples = project.getSamples().toArray(); if (samples.length >= 8) { /* * project.setSample1((Sample)samples[7]); * project.setSample2((Sample)samples[6]); * project.setSample3((Sample)samples[5]); * project.setSample4((Sample)samples[4]); * project.setSample5((Sample)samples[3]); * project.setSample6((Sample)samples[2]); * project.setSample7((Sample)samples[1]); * project.setSample8((Sample)samples[0]); */ } }