I create a scheduelr task for change properties of document. I followed the example to prakash.
Run but but not change nothing. the code is:
public class rellena implements ISchedulerTask {
public rellena(){
super();
}
public void run( String id, Properties properties ) {
// implement the tasks to be scheduled
try {
//prueba//
//cojo un documento y le cambio las propiedades
RID rid=RID.getRID("/documents/adios.txt");
IUser user=WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
ResourceContext ctxt = new ResourceContext(user);
IResource reVersioned =(IResource) ResourceFactory.getInstance().getResource(rid,ctxt);
IContent content=reVersioned.getContent();
IPropertyMap prop=reVersioned.getProperties();
IPropertyIterator iter=prop.iterator();
while(iter.hasNext()){
IProperty property=iter.next();
if(property.getPropertyName().getNamespace().equalsIgnoreCase("Clientes")){
property.getMutable().setStringValue("CambioValorSchedulerTask");
}
}
reVersioned.checkOut();
reVersioned.checkIn(content,prop,true);
}
}catch(Exception e){
e.printStackTrace();
}
}
public static void main (String args[]) {
rellena nu=new rellena();
String id="rellena";
Properties properties=null;
nu.run(id,properties);
}
}
what debbug this code???
why not run??
Hi,
try this:
IMutablePropertyMap mutPropMap = resource.getProperties().getMutable(); IPropertyIterator iter = mutPropMap.iterator(); while(iter.hasNext()){ ...
Best regards,
Avishai Zamir
Add a comment