import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import org.apache.log4j.Logger; import com.appiancorp.services.ServiceContext; import com.appiancorp.suiteapi.common.ServiceLocator; import com.appiancorp.suiteapi.content.ContentConstants; import com.appiancorp.suiteapi.content.ContentService; import com.appiancorp.suiteapi.expression.annotations.Function; import com.appiancorp.suiteapi.expression.annotations.Parameter; import com.appiancorp.suiteapi.knowledge.DocumentDataType; import com.appiancorp.suiteapi.process.ProcessDesignService; import com.appiancorp.suiteapi.rules.Constant; import com.appiancorp.suiteapi.type.AppianType; import com.appiancorp.suiteapi.type.TypedValue; @HashingFunctionCategory public class hashcode { private static final Logger LOG = Logger.getLogger(hashcode.class); @Function(returnType = AppianType.INTEGER) public ArrayList hashcode(ServiceContext sc, @Parameter @DocumentDataType Long param0) throws Exception { ContentService cs = ServiceLocator.getContentService(sc); String fileName = cs.getInternalFilename(cs.getVersionId(param0, ContentConstants.VERSION_CURRENT)); ArrayList a=new ArrayList(); BufferedReader r = new BufferedReader(new FileReader(new File(fileName))); String line; while ((line = r.readLine()) != null) { String fline = line; String obj = new String(fline); a.add(obj.hashCode()); } r.close(); return a; } }