package com.incessant.objectproperties1; import java.text.DateFormat; import java.text.SimpleDateFormat; import org.apache.log4j.Logger; import com.appiancorp.suiteapi.common.exceptions.InvalidProcessModelException; import com.appiancorp.suiteapi.common.exceptions.InvalidVersionException; import com.appiancorp.suiteapi.common.exceptions.PrivilegeException; import com.appiancorp.suiteapi.content.Content; import com.appiancorp.suiteapi.content.ContentConstants; import com.appiancorp.suiteapi.content.ContentService; import com.appiancorp.suiteapi.content.exceptions.InvalidContentException; import com.appiancorp.suiteapi.expression.annotations.Function; import com.appiancorp.suiteapi.expression.annotations.Parameter; import com.appiancorp.suiteapi.process.ProcessDesignService; import com.appiancorp.suiteapi.process.ProcessModel; @com.appiancorp.suiteapi.expression.annotations.AppianScriptingFunctionsCategory public class ObjectProperties { private static final Logger LOG = Logger.getLogger(ObjectProperties.class); @Function public String getObjectProperties(ProcessDesignService pds,ContentService cs, @Parameter String objectUUID, @Parameter String propertyName) throws InvalidProcessModelException, PrivilegeException, InvalidContentException, InvalidVersionException { if (objectUUID == null || propertyName==null ) { LOG.error("getObjectProperties:: null or empty value passed for objectUUID or propertyName"); return null; } Long objectID; String latestVersionNumber_pn="latestVersionNumber"; String latestVersionNumber = null; String invalidObject="Inavlid object"; try{ objectID=cs.getIdByUuid(objectUUID); } catch (Exception e) { ProcessModel.Descriptor pmd; java.sql.Timestamp cdt; objectID=pds.getProcessModelIdByUuid(objectUUID); pmd=pds.getProcessModelDescriptor(objectID); latestVersionNumber= pmd.getVersion(); } if(propertyName.equals(latestVersionNumber_pn)) return latestVersionNumber; else return invalidObject; } }