DFC to execute stateless process

shiv_g
edited August 21, 2014 in Documentum #1

Hi All,

Is there any way to execute a stateless process (send input parameters and retrieve output parameters at the end of execution) through DFC coding?

Thanks,

shiv

Best Answer

Answers

  • dnvhariprasad
    edited August 21, 2014 #3

    Yes it is possible.  You dont even need to use DFC.  All stateless processes are exposed as RESTful services.  Use some REST libraries in and call those processes.  It also accepts the inputs.

  • shiv_g
    edited August 21, 2014 #4

    Hi Hari,

    Thanks for pointing me the direction. Can you also please let me know if we have any sample source code/REST libraries details in this ecn forum?

  • dnvhariprasad
    edited August 21, 2014 #5 Answer ✓

    check this thread

  • @shiv_g said:
    Hi All,

    Is there any way to execute a stateless process (send input parameters and retrieve output parameters at the end of execution) through DFC coding?

    Thanks,

    shiv

    Yes, We can Run stateless Process Using Dfc Same as we run Workflow but How to get output ... I also want to know.

  • SumitShrotri
    edited July 18, 2018 #7

    public static String createDakFolderStructure(IDfSession session,Map<String, Object> singleMap) throws DfException {

        IDfWorkflowEx workflow = null;
    
        IDfProcess process = (IDfProcess) session.getObjectByQualification(
                "dm_process where system_name = 'Process Templete system name' and r_definition_state = 2 order by r_modify_date desc");
        if (process == null) {
            throw new IllegalStateException("Process nav_create_dak_folder not found!");
        }
    
        IDfWorkflowBuilder builder = session.newWorkflowBuilder(process.getObjectId());
    
    
        builder.initWorkflow();
    
        log.warn("Initiate work flow");
    
        workflow = (IDfWorkflowEx) builder.getWorkflow();
    
        log.warn("Workflow : " + workflow);
    
        log.warn("*********** singleMap *************");
        //single attributes
        for (Entry<String, Object> map : singleMap.entrySet()) {
            log.warn("Map key-->"+map.getKey()+"Map value-->"+map.getValue());
            workflow.setPrimitiveObjectValue(map.getKey(), map.getValue());
        }
        builder.runWorkflow();
        IDfList startActIds = builder.getStartActivityIds();
        IDfList startActNames = builder.getStartActivityNames();
        IDfActivity act = (IDfActivity) session.getObject((IDfId) startActIds.get(0));
        String activityName = (String) startActNames.get(0);
                log.warn("activityName :- " + activityName);
    
    
        int pkgCount = act.getPackageCount();
    
        log.warn("package count-->" + pkgCount);
        for (int k = 0; k < pkgCount; k++) {
            if (act.getPortType(k).equals("INPUT"))
                builder.addPackage(activityName, act.getPortName(k), act.getPackageName(k), act.getPackageType(k), "",
                        false, null);
        }
        return workflow.getObjectId().toString();
    }