434445464748495051
public void doSave(File file, Resume resume) { try { file.createNewFile(); } catch (IOException e) { throw new WebAppException("Couldn't write file " + file.getAbsolutePath(), resume, e); } write(file, resume); }
5657585960616263
protected void write(File file, Resume resume) { try { doWrite(new FileOutputStream(file), resume); } catch (IOException e) { throw new WebAppException("Couldn't write file " + file.getAbsolutePath(), resume, e); } }
7273747576777879
try { Resume r = doRead(new FileInputStream(file)); r.setUuid(file.getName()); return r; } catch (IOException e) { throw new WebAppException("Couldn't read file " + file.getAbsolutePath(), e); } }
24252627282930
if (!exist(ctx)) { LOGGER.info("Save resume with uuid=" + resume.getUuid()); doSave(ctx, resume); return resume.getUuid(); } throw new WebAppException("Resume " + resume + " already present", resume); }
33343536373839
LOGGER.info("Load resume with uuid=" + uuid); C ctx = createCtx(uuid); if (exist(ctx)) { return doLoad(ctx); } throw new WebAppException("Resume not found", uuid); }
43444546474849
C ctx = createCtx(uuid); if (exist(ctx)) { doDelete(ctx); return; } throw new WebAppException("Resume not found", uuid); }
53545556575859
C ctx = createCtx(resume.getUuid()); if (exist(ctx)) { doUpdate(ctx, resume); return; } throw new WebAppException("Resume not found", resume); }
2425262728293031
@Override protected Resume doRead(InputStream is) throws IOException { try (ObjectInputStream ois = new ObjectInputStream(is)) { return (Resume) ois.readObject(); } catch (ClassNotFoundException e) { throw new WebAppException("Error read resume", e); } }