Hi,
I have a Custom Java Component that collects a file from my project workspace for processing based on an input port field value. Everything works fine, however, in order to access the file I need to provide the full file path from my C Drive despite the file sitting in a project directory. This is inconvenient as if I ever move the component to a different project I would need to rekey in the project location.
Here is a snippet of my current code
String WorkingFolder = "C:/Users/<My User>/clover_workspace/<clover project>";
String Dir = getProperties().getStringProperty("Directory");
DataRecord inRecord = inRecords[0];
DataRecord outRecord = outRecords[0];
while ((inRecord = readRecordFromPort(0)) != null) {
String fileUrl = WorkingFolder+Dir+inRecord.getField(0).getValue().toString();
...
Is there a more elegant way to achieve this? I tried using the project Graph Parameter via graph.getGraphParameters() but it returns “.” as opposed to the full file path.
Thanks,
Paul