class DocumentImpl implements Document, LazyLoaded<DocumentStorageService> {

    @Override
    public File toFile() throws IOException {
        String[] nameParts = getName().split("\\.");
        File file = File.createTempFile(nameParts[0], "." + nameParts[1]);
        file.setLastModified(getLastModified().getTime());
        FileOutputStream fos = new FileOutputStream(file);
        fos.write(getContent());
        fos.close();
        return file;
    }

    public  DocumentImpl();
    public  DocumentImpl(String identifier,
                        String name,
                        long size,
                        Date lastModified);
    public  DocumentImpl(String name,
                        long size,
                        Date lastModified);
    public  DocumentImpl(String identifier,
                        String name,
                        long size,
                        Date lastModified,
                        String link);

}