We are modifying continuously a document, and have verified that for each 50 document's versions, the time increases around 4 seconds,
It´s to say:
version 1 to 50:6 seconds
version 51 to 100:10 seconds
version 101 to 150:14 seconds
version 151 to 200:18 seconds
version 201 to 250:22 seconds
version 251 to 300:26 seconds
Next we attach the method that modifies the file´s content.
public Boolean updateContent(String Id, byte[] contenido, String descripcion, String mimetype)throws GestorDocumentalException{
// Obtenemos los servicios adecuados.
ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
AuthoringServiceSoapBindingStub authoringService = WebServiceFactory.getAuthoringService();
Node nodo = getNode(Id);
Reference contentReference = nodo.getReference();
Boolean flag=false;
// Si no es versionable, lo hacemos.
if (!checkVersionable(nodo)){
//makeVersionable(Id);
makeVersionable(nodo);
}
// Hacemos un checkout del fichero poniendo la copia de trabajo en el mismo espacio (carpeta).
Predicate itemsToCheckOut = new Predicate(new Reference[]{contentReference}, null, null);
try {
CheckoutResult checkOutResult;
checkOutResult = authoringService.checkout(itemsToCheckOut, null);
// Obtenemos referencia a la copia de trabajo.
Reference workingCopyReference = checkOutResult.getWorkingCopies()[0];
// Actualizamos el contenido de la copia de trabajo.
ContentFormat format=null;
if(mimetype==null){
format= new ContentFormat(Constants.MIMETYPE_TEXT_PLAIN, "UTF-8");
}else{
format= new ContentFormat(mimetype, "UTF-8");
}
contentService.write(workingCopyReference, Constants.PROP_CONTENT, contenido, format);
// Hacemos un checkin de la copia de trabajo a�adiendo la descripci�n del cambio.
// La versi�n anterior se a�ade al historial del documento.
Predicate predicate = new Predicate(new Reference[]{workingCopyReference}, null, null);
NamedValue[] comments = new NamedValue[]{Utils.createNamedValue("description", descripcion)};
authoringService.checkin(predicate, comments, false);
log.debug("El contenido de "+getNombre(nodo)+" se ha actualizado correctamente.");
return Boolean.TRUE;
} catch (AuthoringFault e) {
flag=true;
throw new GestorDocumentalException("No tiene permisos para hacer checkout "+getNombre(nodo)+".");
} catch (RemoteException e) {
flag=true;
throw new GestorDocumentalException("Error de servicio remoto.");
}finally{
try{
if(flag)
authoringService.cancelCheckout(itemsToCheckOut);
} catch (AuthoringFault e) {
throw new GestorDocumentalException("No tiene permisos para hacer checkin "+getNombre(nodo)+".");
} catch (RemoteException e) {
throw new GestorDocumentalException("Error de servicio remoto.");
}
}
}
can anybody talk me, How can reduce this time