Hi,
I am trying to append the file name based on the metadata value.
The code below is meant to be run in the automation action "execute script"
However looking through the API i cannot seem to find the right method to get the file name and append the name with a "Merge!" at the end of the file name.
I am trying to append the file name based on the metadata value.
The code below is meant to be run in the automation action "execute script"
Code: Select all
import com.openkm.api.OKMPropertyGroup;
import com.openkm.api.OKMRepository;
import com.openkm.api.OKMDocument;
import java.util.*;
import com.openkm.bean.form.*;
import com.openkm.bean.Document;
String grpName = "okg:medicalrecord";
String path = OKMRepository.getInstance().getNodePath(null,uuid);
boolean merge;
for (FormElement formElement : OKMPropertyGroup.getInstance().getProperties(null,path,grpName)) {
if (formElement.getName().equals("okp:medicalrecord.merge")) {
merge = formElement.getValue();
if (merge==true) {
docName = OKMDocument.getInstance().getProperties(null,path).getTitle();
String newName = docName + " Merge!";
OKMDocument.getInstance().rename(null,path,newName);
//search for file with the same name, mrn,
//then merge pdf, inherit metadata
//condition to check - both have no metadata, one has, both have
}
}
}
However looking through the API i cannot seem to find the right method to get the file name and append the name with a "Merge!" at the end of the file name.