Buenos días,
Soy nuevo con OpenKm, y estoy muy ilusionado con las posibilidades que me puede ofrecer.
Felicidades al equipo de OpenKM.
He instalado la versión Comunnity 6.3.1 desde el fichero openkm-6.3.1-community-linux-x64-installer.run, en un Ubuntu Server 16.04 y creo que la he hecho bien.
Ahora, quiero importar automáticamente ficheros en formato .PDF a una carpeta de OpenKM, y estoy intentando ejecutar el script que tenéis en http://wiki.openkm.com/index.php/Cronta ... e_importer, pero me devuelve un error, iIncluso lo estoy ejecutando desde la consoloa de Ubuntu con bsh.
¿Qué estoy haciendo mal?. Muchas gracias por adelantado.
El error es:
Evaluation Error: Sourced file: /home/administrador/download/ImportFromScanner2.bsh : Typed variable declaration : Attempt to resolve method: getInstance() on undefined variable or class name: DbSessionManager : at Line: 6 : in file: /home/administrador/download/ImportFromScanner2.bsh : DbSessionManager .getInstance ( )
El script es:
Soy nuevo con OpenKm, y estoy muy ilusionado con las posibilidades que me puede ofrecer.
Felicidades al equipo de OpenKM.
He instalado la versión Comunnity 6.3.1 desde el fichero openkm-6.3.1-community-linux-x64-installer.run, en un Ubuntu Server 16.04 y creo que la he hecho bien.
Ahora, quiero importar automáticamente ficheros en formato .PDF a una carpeta de OpenKM, y estoy intentando ejecutar el script que tenéis en http://wiki.openkm.com/index.php/Cronta ... e_importer, pero me devuelve un error, iIncluso lo estoy ejecutando desde la consoloa de Ubuntu con bsh.
¿Qué estoy haciendo mal?. Muchas gracias por adelantado.
El error es:
Evaluation Error: Sourced file: /home/administrador/download/ImportFromScanner2.bsh : Typed variable declaration : Attempt to resolve method: getInstance() on undefined variable or class name: DbSessionManager : at Line: 6 : in file: /home/administrador/download/ImportFromScanner2.bsh : DbSessionManager .getInstance ( )
El script es:
Code: Select all
import com.openkm.core.*;
import com.openkm.api.*;
import java.io.*;
import com.openkm.module.db.stuff.DbSessionManager;
String token = DbSessionManager.getInstance().getSystemToken();
OKMDocument document = OKMDocument.getInstance();
OKMFolder folder = OKMFolder.getInstance();
public void autoImport(String okmPath, File fldpath) {
try {
print("Scanning " + fldpath.getName() + "<br>");
for (File file : fldpath.listFiles()) {
print("Importing " + file.getName() + "<br>");
try {
if (file.isDirectory()) {
try {
folder.createSimple(token, okmPath + file.getName());
} catch (ItemExistsException ie) {
print("folder already exists<br>");
// Folder already exists - just ignore exception
}
autoImport( okmPath + file.getName() + "/", file);
} else {
// Check if file is still being written to
long length = file.length();
Thread.sleep(1000);
if (file.length() > length) continue; // Skip file this time
document.createSimple(token, okmPath + file.getName(), new FileInputStream(file));
}
print("Created " + okmPath + file.getName() + "<br>");
} catch (Exception e) {
print ("Exception:" + e + "<br>");
// Something bad happened to prevent import. Skip to next file.
continue;
}
file.delete();
}
} catch (Exception e) {
print("Exception: " + e + "<br>");
}
}
autoImport("/okm:root/Scans/", new File("/home/fom/scanner"));