jllort wrote:Did you tested before from scripting ? check from there, might be some error ?
Declare the variable uuid
Code: Select allString uuid = "some document uuid";
I tried to set the uuid ex. (8fca2db5-a55b-4dc2-8ffb-2d46c766e49e)\
but still it does not work.
I have a question..in the code
does this
code gets the
uuid of the document uploaded by the user?? what is
env for?
Code: Select allString uuid = AutomationUtils.getUuid(env);
I also tried this script but it does not work also , the file is just uploaded normally..
Please see the script. Tell me what is wrong with it. Thanks
Code: Select allimport com.openkm.api.*;
import com.openkm.bean.*;
import java.util.*;
String uuid = AutomationUtils.getUuid(env);
// Get author
Document doc = OKMDocument.getInstance().getProperties(null, uuid);
String author = doc.getActualVersion().getAuthor();
// From here simply must be added the metadata group
OKMPropertyGroup.getInstance().addGroup(null, uuid, "okg:cdiap");
// And set the properties
Map map = new HashMap<String,String>();
map.put("okp.cdir.stno",author);
OKMPropertyGroup.getInstance().setPropertiesSimple(null, uuid, "okg:cdiap", map);
// rename document
String newName = "Store Number."+author + "." + FileUtils.getFileExtension(PathUtils.getName(uuid));
OKMDocument.getInstance().rename(null,uuid, newName);