Implementace uložiště podepsaných dokumentů. Při prvním podpisu se uloží podepsané PDF a vytvoří se záznam v agendě podepsaných dokumentů.
closes #243Verze_3.0
parent
6db416dd04
commit
cccd8177fa
@ -0,0 +1,25 @@
|
||||
package info.bukova.isspst;
|
||||
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
/**
|
||||
* @author Pepa Rokos
|
||||
*/
|
||||
public class SpringUtils {
|
||||
|
||||
private static WebApplicationContext webCtx(ServletContext sc) {
|
||||
return WebApplicationContextUtils.getRequiredWebApplicationContext(sc);
|
||||
}
|
||||
|
||||
public static Object getBean(String name, ServletContext sc) {
|
||||
return webCtx(sc).getBean(name);
|
||||
}
|
||||
|
||||
public static <T> T getBean(Class<T> clazz, ServletContext sc) {
|
||||
return webCtx(sc).getBean(clazz);
|
||||
}
|
||||
|
||||
}
|
@ -1,8 +1,14 @@
|
||||
package info.bukova.isspst.services.signeddocs;
|
||||
|
||||
import info.bukova.isspst.data.DataModel;
|
||||
import info.bukova.isspst.data.SignedDocument;
|
||||
import info.bukova.isspst.data.SignedDocumentItem;
|
||||
import info.bukova.isspst.services.Service;
|
||||
|
||||
public interface SignedDocumentService extends Service<SignedDocument> {
|
||||
|
||||
SignedDocument getForEntity(DataModel entity);
|
||||
SignedDocumentItem getItem(DataModel entity, long reportId);
|
||||
void addFromApprove(SignedDocument document);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
package info.bukova.isspst.storage;
|
||||
|
||||
import info.bukova.isspst.data.SignedDocumentItem;
|
||||
|
||||
/**
|
||||
* @author Pepa Rokos
|
||||
*/
|
||||
public interface ReportFileStorage extends FileStorage<SignedDocumentItem> {
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package info.bukova.isspst.storage;
|
||||
|
||||
import info.bukova.isspst.data.SignedDocumentItem;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Pepa Rokos
|
||||
*/
|
||||
public class ReportFileStorageImpl extends AbstractFileStorage<SignedDocumentItem> implements ReportFileStorage {
|
||||
|
||||
private String rootPath;
|
||||
|
||||
public void setRootPath(String rootPath) {
|
||||
this.rootPath = rootPath;
|
||||
}
|
||||
|
||||
private String getFilePath(String fileName) {
|
||||
return rootPath + "/" + fileName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveFile(byte[] data, SignedDocumentItem signedDocumentItem) {
|
||||
String fileName = signedDocumentItem.getFileName();
|
||||
|
||||
if (fileName == null) {
|
||||
fileName = UUID.randomUUID().toString() + ".pdf";
|
||||
}
|
||||
|
||||
saveFileDataToPath(data, getFilePath(fileName));
|
||||
signedDocumentItem.setFileName(fileName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveFile(File file, SignedDocumentItem fileId) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFile(SignedDocumentItem signedDocumentItem) {
|
||||
removeFileByPath(getFilePath(signedDocumentItem.getFileName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveFile(String source, String destination) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createDirectory(String dir) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] fileData(SignedDocumentItem signedDocumentItem) {
|
||||
return fileDataFromPath(getFilePath(signedDocumentItem.getFileName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public File file(SignedDocumentItem signedDocumentItem) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dirExists(String path) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String serverPath(SignedDocumentItem signedDocumentItem) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
@ -1,2 +1,3 @@
|
||||
storage.root=/home/pepa/tmp/isspst
|
||||
storage.fulltextIndex=/home/pepa/tmp/isspst
|
||||
storage.fulltextIndex=/home/pepa/tmp/isspst
|
||||
storage.signedDocuments=/home/pepa/tmp/isspst/signedDoc
|
Loading…
Reference in New Issue