}
String filePath = SpringMvcUtils.getPath(FILE_MP3_PREFIX, form.getMp3());
VoiceOver vo;
IJpaFactory<VoiceOver> strategy = new VoiceOverFactory(new J2eeConfig());
try {
if (form.getId() == 0) {
vo = new VoiceOver();
IJpaFactory<VoiceOverSection> factory2 = new VoiceOverSectionFactory(new J2eeConfig());
try {
VoiceOverSection vos = factory2.get(form.getSectionid());
vo.setVoiceOverSection(vos);
} finally {
factory2.close();
}
} else {
vo = strategy.get(form.getId());
}
vo.setOrder(form.getOrder());
vo.setTitle(form.getTitle());
if (filePath != null) {
vo.setMp3(FILE_STORAGE_PREFIX + filePath);
}
if (form.getId() == 0) {
strategy.add(vo);
} else {
strategy.refresh(vo);
}
} finally {
strategy.close();
}
if (filePath != null) {
log.info("uploading file " + filePath);