Content Management and Capture

Content Management and Capture

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
  • 1.  Setting up Development Environment on Eclipse

    Posted Thu March 04, 2021 08:57 AM

    Hi,

    I've almost finished setting up environment for Development of ICN Plugin. However, I'm not able to fix a runtime error in a request filter -

    public JSONObject filter(PluginServiceCallbacks callbacks, HttpServletRequest request, JSONArtifact jsonRequest) throws Exception { JSONObject json = new JSONObject(); String repositoryId = request.getParameter("repositoryId"); String documentId = request.getParameter("docid"); ODHit odhit=callbacks.getODDocument(repositoryId, documentId, null); return json; }

    error: package com.ibm.edms.od does not exist

    I've added ODApi.jar in project's build path.

    ODWEK is installed on my system

    Entry in env variable Path is made - C:\dms-cft\apps\IBM\OnDemand\V9.5\bin;

    Entry in CLASSPATH is made - C:\dms-cft\apps\IBM\OnDemand\V9.5\www\api\ODApi.jar

    Had 1 more query which all parameters does the HttpServletRequest request contain like 'docid'. Is it mentioned anywhere? unable to find it.



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 2.  RE: Setting up Development Environment on Eclipse

    Posted Thu March 04, 2021 09:23 AM

    Hi,

    Is ODApi.jar added to your application server CLASSPATH environment variable? See https://www.ibm.com/support/knowledgecenter/en/SSEUEX_3.0.8/com.ibm.installingeuc.doc/eucts021.html .

    There is no list for all parameters in the HttpServletRequest request. The parameters varies with APIs.

    Regards,

    Angie



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 3.  RE: Setting up Development Environment on Eclipse

    Posted Thu March 04, 2021 09:39 AM

    Hello Angie,

    Thanks for having a look at it.

    I've not yet deployed the plugin in ICN. I'm getting error: package com.ibm.edms.od does not exist while just doing Ant Build in Eclipse.


    Actually I was looking for list of parameters in Request filter HttpServletRequest request object which is mentioned in the main question.



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 4.  RE: Setting up Development Environment on Eclipse

    Posted Thu March 04, 2021 09:59 AM

    Hi,

    You may add the jar to the classpath in the ant script.

    Which REST API are you filtering?

    Regards,

    Angie



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 5.  RE: Setting up Development Environment on Eclipse

    Posted Thu March 04, 2021 11:46 AM

    Adding the jar to ant CLASSPATH resolved the issue, thanks a lot!

    I'm trying to filter { "/od/openItem" } request.


    Actually my requirement is pretty simple - when user double clicks a document, I've to fetch the FileType property value stored in doc and rename the MIMEType of document.

    Like if filename is abc.trns and FileType prop value is doc. So when user double clicks it the doc should get downloaded in his machine as abc.doc.



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 6.  RE: Setting up Development Environment on Eclipse

    Posted Fri March 05, 2021 07:43 AM

    Hi Rishav,

    You may see parameters of "/od/openItem" in browser developer tool, when viewing properties of a document. Yet downloading document won't send the openItem request. You may implement a new download action and set the filename in the response. Refer to SampleRepositoryGetDocument.java of the sample plugin.

    Regards,

    Angie



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 7.  RE: Setting up Development Environment on Eclipse

    Posted Sat March 06, 2021 01:13 PM

    Hi Angie.

    Thanks for your help so far. I've set the response header with new filename as you advised but now how to invoke below service when a user double clicks a document? And do you see any issues with below implementation?


    public void execute(PluginServiceCallbacks callbacks, HttpServletRequest request, HttpServletResponse response)

    throws Exception {

    ClassLoader cl = ClassLoader.getSystemClassLoader();

    String repositoryId = request.getParameter("repositoryId");

    String folderName = request.getParameter("template_name");

    String docId = request.getParameter("docId");

    System.out.println(request.getParameter("docId"));

    ODServer server = callbacks.getODServer(repositoryId);

    ODFolder folder = null;

    try {

    folder = server.openFolder(folderName);

    ODHit hit = folder.recreateHit(docId);

    String fileType = hit.getDisplayValue("File Type");

    System.out.println(fileType);

    String fileName = hit.getDocumentName() + fileType;

    response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");

    ResourceBundle bundle = ResourceBundle.getBundle("mimetype", Locale.UK, cl);

    response.setContentType(bundle.getString(fileType));

    response.setContentLength(hit.getDocumentSize());

    } finally {

    folder.close();

    }

    }



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 8.  RE: Setting up Development Environment on Eclipse

    Posted Mon March 08, 2021 03:14 PM

    Hi Rishav,

    It could be easier to use a mimetype JSON file that maps the specific mimetype with the preferred extension. ICN download actions would take the extension from the JSON file. Configure the "Mime Type Extensions JSON File" on admin desktop -> Settings. Then restart the application server.

    Regards,

    Angie



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration