AnsweredAssumed Answered

Store User Defined properties in DataShape

Question asked by venkatesh.rupanagudi080702 on Dec 11, 2016
Latest reply on Dec 12, 2016 by venkatesh.rupanagudi080702

Hello,

 

I need store the Document property  from DataShape  value enc below. I'm storing to  

" document.dynamic.userdefined.ENCODING"  for value propValue. I'm unable to retrieve this value further in the process. Can you please help to determine what is wrong on below code ?.

 

import java.io.InputStream;
import java.util.Properties;
import java.lang.Object;
import org.apache.tika.detect.AutoDetectReader;
import java.nio.charset.Charset;
import com.boomi.execution.ExecutionUtil;

logger = ExecutionUtil.getBaseLogger();

for( int i = 0; i < dataContext.getDataCount(); i++ ) {
InputStream is = dataContext.getStream(i);
Properties props = dataContext.getProperties(i);

AutoDetectReader reader=new AutoDetectReader(is);
Charset charset=reader.getCharset();
String enc = charset.displayName();
logger.info("Charset=" + enc);
propValue = props.getProperty("document.dynamic.userdefined.ENCODING");
propValue = enc;
props.setProperty("document.dynamic.userdefined.ENCODING", propValue);

if (enc != null ) {
enc = "UTF-8";
}
logger.info("Charset After=" + enc);

is = dataContext.getStream(i);
dataContext.storeStream(is, props );
}

 

 

Thanks,

Venkatesh

Outcomes