public void addProgramObjectToCms(IEnterpriseSession enterpriseSession,

            String jarPath, int parentFolderId, String programName)

            throws SDKException {

       

      IInfoStore infoStore = (IInfoStore) enterpriseSession

                .getService(“InfoStore”);

        IPluginMgr pluginMgr = infoStore.getPluginMgr();

        IPluginInfo pluginInfo = pluginMgr

                .getPluginInfo(“CrystalEnterprise.Program”);

        IInfoObjects newInfoObjects = infoStore.newInfoObjectCollection();

        IInfoObject newProgram = newInfoObjects.add(pluginInfo);

//folder in which you want to add the program

        newProgram.properties().setProperty(“SI_PARENTID”, parentFolderId);

        newProgram.properties().setProperty(“SI_NAME”, programName);

        File programFile = new File(jarPath);

        newProgram.getFiles().addFile(programFile);

        IProgram program = (IProgram) newProgram;

        IJavaProgram javaProgram = (IJavaProgram) program.getProgramInterface();

        javaProgram.setUserName(“administrator”);

        javaProgram.setPassword(“password”);

      // Give main class

        javaProgram.setMainClass(“com.JavaProgram”);

     //add arguments

        javaProgram.setArgs(“abc”);

     //commit the changes

        infoStore.commit(newInfoObjects);

    }

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply