private MultiLoadParameter createMultiLoadParameter( String projectName, Project project, Sample sample, List<FileReadAttributeBean> frab) throws Exception { MultiLoadParameter loadParameter = new MultiLoadParameter(); boolean isSampleRegistration = false; boolean isProjectRegistration = false; if (this.eventName.equals(Constants.EVENT_PROJECT_REGISTRATION) && project.getProjectName() != null && !project.getProjectName().isEmpty()) { isProjectRegistration = true; List<Project> projectList = new ArrayList<Project>(); projectList.add(feedProjectData(project)); loadParameter.addProjects(projectList); /* * loads all event meta attributes from the parent * by hkim 6/11/13 */ List<EventMetaAttribute> emas = this.readPersister.getEventMetaAttributes( projectName, null); // , Constants.EVENT_PROJECT_REGISTRATION); if (emas != null && emas.size() > 0) { List<EventMetaAttribute> newEmas = new ArrayList<EventMetaAttribute>(emas.size()); for (EventMetaAttribute ema : emas) { EventMetaAttribute newEma = new EventMetaAttribute(); newEma.setProjectName(project.getProjectName()); newEma.setEventName(ema.getEventName()); newEma.setEventTypeLookupId(ema.getEventTypeLookupId()); newEma.setAttributeName(ema.getAttributeName()); newEma.setNameLookupId(ema.getNameLookupId()); newEma.setActive(ema.isActive()); newEma.setRequired(ema.isRequired()); newEma.setDesc(ema.getDesc()); newEma.setDataType(ema.getDataType()); newEma.setLabel(ema.getLabel()); newEma.setOntology(ema.getOntology()); newEma.setOptions(ema.getOptions()); newEma.setSampleRequired(ema.isSampleRequired()); newEmas.add(newEma); } loadParameter.addEventMetaAttributes(newEmas); } else { throw new Exception( String.format( "Event Metadata has not been set up for the parent project and the '%s' event type.", Constants.EVENT_PROJECT_REGISTRATION)); } List<SampleMetaAttribute> smas = this.readPersister.getSampleMetaAttributes(projectId); if (smas != null && smas.size() > 0) { List<SampleMetaAttribute> newSmas = new ArrayList<SampleMetaAttribute>(smas.size()); for (SampleMetaAttribute sma : smas) { SampleMetaAttribute newSma = new SampleMetaAttribute(); newSma.setProjectName(project.getProjectName()); newSma.setAttributeName(sma.getAttributeName()); newSma.setNameLookupId(sma.getNameLookupId()); newSma.setDataType(sma.getDataType()); newSma.setDesc(sma.getDesc()); newSma.setLabel(sma.getLabel()); newSma.setOntology(sma.getOntology()); newSma.setOptions(sma.getOptions()); newSma.setRequired(sma.isRequired()); newSma.setActive(sma.isActive()); newSmas.add(newSma); } loadParameter.addSampleMetaAttributes(newSmas); } List<ProjectMetaAttribute> pmas = this.readPersister.getProjectMetaAttributes(projectName); if (pmas != null && pmas.size() > 0) { List<ProjectMetaAttribute> newPmas = new ArrayList<ProjectMetaAttribute>(pmas.size()); for (ProjectMetaAttribute pma : pmas) { ProjectMetaAttribute newPma = new ProjectMetaAttribute(); newPma.setProjectName(project.getProjectName()); newPma.setAttributeName(pma.getAttributeName()); newPma.setDataType(pma.getDataType()); newPma.setDesc(pma.getDesc()); newPma.setLabel(pma.getLabel()); newPma.setNameLookupId(pma.getNameLookupId()); newPma.setOntology(pma.getOntology()); newPma.setOptions(pma.getOptions()); newPma.setRequired(pma.isRequired()); newPma.setActive(pma.isActive()); newPmas.add(newPma); } loadParameter.addProjectMetaAttributes(newPmas); } } else if (this.eventName.equals(Constants.EVENT_SAMPLE_REGISTRATION) && sample.getSampleName() != null && !sample.getSampleName().isEmpty()) { isSampleRegistration = true; List<Sample> sampleList = new ArrayList<Sample>(); sampleList.add(feedSampleData(sample)); loadParameter.addSamples(sampleList); } List<FileReadAttributeBean> loadingList = null; if (frab != null && frab.size() > 0) { loadingList = processFileReadBeans( isProjectRegistration ? project.getProjectName() : projectName, isSampleRegistration ? sample.getSampleName() : this.sampleName, frab); } if (loadingList != null && loadingList.size() > 0) { if (isProjectRegistration) { loadParameter.addProjectRegistrations(Constants.EVENT_PROJECT_REGISTRATION, loadingList); } else if (isSampleRegistration) { loadParameter.addSampleRegistrations(Constants.EVENT_SAMPLE_REGISTRATION, loadingList); } else { loadParameter.addEvents(this.eventName, loadingList); } } return loadParameter; }