Recursive Folder Creation (Single Activity) using Workflows

shaik.md.anees
edited December 7, 2016 in Documentum #1

Hi all,

I have a couple of months of experience in documentum.

Now I am working on workflows.

My requirement is like to create recursive folders dynamically by reading the values from XML file.

In the tags of XML file the names for the folders will be mentioned.

Please suggest me how to proceed.

Any help will be greatly appreciated.

Thanks and Regards,

Anees

Comments

  • DCTM_Guru
    edited November 28, 2016 #2

    This is unique requirement.  Look in the DFC java docs if you intend to do any custom development.

  • shaik.md.anees
    edited November 29, 2016 #3

    Hi Johnny,

    Thanks for your response but please suggest me how to create recursive folders. I need to check if the folder is present in the repository i need not to create it if it is not present then create it. This criteria i need to do for 6 folders. . Also I should not hard-code the folder path.Please suggest me how to move on.

    Thank you.

  • Haroon_A
    edited November 29, 2016 #4

    The idea is:

    Parse your folder path, say using tokenizer or other ways. i.e. /CABINETS/FolderA/FolderB/FolderC, by "/" separator, which will give you in this example 4 elements CABINETS, FolderA FolderB and FolderC.

    Then loop through, and verify whether each folder exists, if it does, then continue, else, create it.

    It's good idea to make this operation as SBO, so it can be leveraged through out the application. You need to pass probably a IDfSession variable, and a String folder path. then let the SBO takes care of verifying and creating the folder.

    Good idea would be to make the verify operation *synchronized*, to prevent simultaneous creation of the same folder, since/if it's a web app client.

  • shaik.md.anees
    edited November 30, 2016 #5

    Hi Ahmed. Thanks for your response. If you please help me to send sample DFC code to do this.

    We are preferring to use only workflows not SBO. Please try to respond.

    Thank you.

  • DCTM_Guru
    edited November 30, 2016 #6

    Look in the Documentum Component Exchange for sample code:

    https://developer-content.emc.com/developer/componentexchange.htm#0900c35580916f6d

  • shaik.md.anees
    edited December 1, 2016 #7

    Thank you Johnny for sharing information.

    It was really helpful.

    Thanks a lot.

  • shaik.md.anees
    edited December 5, 2016 #8

    Hi Johnny. Recursive folder creation is about to complete.

    But please help me to know how to configure loggers in Workflows/Activities.

  • DCTM_Guru
    edited December 5, 2016 #9

    Logging is done via log4j on JMS.  This is where server methods that your workflow calls is executed.

  • shaik.md.anees
    edited December 5, 2016 #10

    My log4j configuration:

    log4j.logger.com.agility.methods=DEBUG,recursivefolder

    log4j.appender.recursivefolder=org.apache.log4j.DailyRollingFileAppender

    log4j.appender.recursivefolder.layout=org.apache.log4j.PatternLayout

    log4j.appender.recursivefolder.layout.ConversionPattern=%d{yyMMdd HH:mm:ss,SSS} %-5p %c | %m%

    log4j.appender.recursivefolder.File=E\:/log_files/RecursiveFolderCreate1.log

    log4j.appender.recursivefolder.Append=true

    log4j.appender.recursivefolder.DatePattern='.'yyyy-MM-dd

    This code I updated in location  E:\Documentum\jboss7.1.1\server\DctmServer_MethodServer\deployments\ServerApps.ear\APP-INF\classes\log4j.properties

    The log file is created but the messages are not logged into the file.

    log4j.rootCategory=WARN, A1, F1 is the first statement int he log4j.properties

    How to proceed. Please Explain.

    Thank you.

  • Haroon_A
    edited December 5, 2016 #11

    change WARN to DEBUG

  • DCTM_Guru
    edited December 5, 2016 #12

    Please provide sample of your debugging statement as well.

  • shaik.md.anees
    edited December 5, 2016 #13

    Hi Johnny.Please refer debugging statements.

    protected int doTask(IDfWorkitem idfworkitem, IDfProperties idfproperties, PrintWriter printwriter)

             throws Exception{

      DfLogger.debug(this, "Executing doTask()..",  null, null);

             IDfSessionManager idfsessionmanager;

             String folder_full_name;

             String type="dm_folder";

             folder_full_name =(idfproperties.getString(CONTAINING_FOLDER_NAME));

             folder_full_name=folder_full_name.trim();

             String pathSep="/";

             String basePath="";

             idfsessionmanager = getSessionManager();

             int i;

             //String folderPath=" '"+CONTAINING_FOLDER_NAME+"' ";

             String folderPath=""+folder_full_name+"";

             DfLogger.debug(this, "Folder Path Obtained",  null, null);

    These statements are not logged into the log file. All the statements in my code are DfLogger.debug(this,"  ",null,null);

    Thanks for your response.

  • DCTM_Guru
    edited December 6, 2016 #14

    Did you clear the JMS cache and restart the JMS after making your log4j changes?

  • shaik.md.anees
    edited December 6, 2016 #15

    Yes I cleared JMS cache and restart the JMS but no results.

    Thank you

  • DCTM_Guru
    edited December 7, 2016 #16

    If you still have this statement:

    log4j.rootCategory=WARN, A1, F1


    Then log4j is looking appender options called A1, F1.  In your example, your appender option is called recursivefolder, so

    log4j.rootCategory=DEBUG,recursivefolder