Clarity

Expand all | Collapse all

Xog In Documents to the Project Object

  • 1.  Xog In Documents to the Project Object

    Posted Jul 19, 2011 10:22 AM
    Hi All,
    I have tried to xog in documents to projects, and i'm not sure I have the correct syntax. Although XOG is not giving me an Error, it is not populating the doc.
    This is the xml that i am using.

    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_project.xsd">
    <Header action="write" externalSource="NIKU" objectType="project" version="12.1.0.5840" />
    <Projects>
    <Project name="Project1" projectID="PRJ-01043">
    <CustomInformation>
    <ColumnValue name="test">
    <Documents>
    <Parent documentLocation="E:\Temp">
    <Document fileCreatedDate="2011-02-03T00:00:00" hasAllParticipants="1" language="en" mimeType="x" name="allocationsRVSolis11.xml" numCheckoutDays="0" versioningEnabled="0">
    <Version id="1" versionNumber="1" />
    </Document>
    </Parent>
    </Documents>
    </ColumnValue>
    </CustomInformation>
    </Project>
    </Projects>
    </NikuDataBus>

    Or if someone knows how i can read the documents from a project, I can figure out the tag structure to load new ones in.
    I tried with this argument, but no luck
    <args name="documentLocation" value="D:\Temp" />
    Any assistance is appreciated.
    Thanks
    Federico


  • 2.  RE: Xog In Documents to the Project Object
    Best Answer

    Posted Jul 21, 2011 02:00 AM
    Hi,

    I dont have the exact code but what we did recently was
    "we will copy all the values in the custom sub object of Investment object and create exact copy instance.
    one of the attribute in that custom object is of attachment data type.
    when a document is attached we can find

    1. Extension of document
    2. Language
    3. Name of the document in database etc.. ( query to retrieve the details is in the script)

    Now we will be having the details of the documents but not the document.So we will select the required details from database and XOG in as the new object instance.

    In our case the document is stored in the application server(default path-- C:\niku\clarity\filestore) . we have to know the path where it gets stored.( you can find in properties.xml)

    You may get some idea when you go through the below script.


    <gel:script
    xmlns:x="jelly:xml"
    xmlns:core="jelly:core"
    xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
    xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
    xmlns:file="jelly:com.niku.union.gel.FileTagLibrary"
    xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:sql="jelly:sql"
    xmlns:xog="http://www.niku.com/xog"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <gel:parameter var="XOGURL" default="http://excers-18"/>
    <gel:parameter var="XOGusername" default="admin"/>
    <gel:parameter secure="true" var="XOGpassword" default="Excers_18"/>
    <gel:parameter var="Filestore" default="D:\niku\clarity\filestore"/>
    <gel:setDataSource dbId="niku"/>
    <sql:query var="data">
    select i.code,
    i.id,
    ext.code,
    ext.name,
    ext.odf_cncrt_parent_id,
    ext.odf_parent_id,
    ext.partition_code,
    ext.created_date,
    ext.created_by,
    ext.last_updated_by
    from
    (select * from niku.odf_ca_work_request ext
    where ext.copy_request = 1
    ) ext,
    niku.inv_investments i where i.id=ext.ODF_PARENT_ID
    and
    ext.id = ${gel_objectInstanceId}
    </sql:query>

    <core:forEach items="${data.rowsByIndex}" trim="true"
    var="row_project_query">

    <!-- QUERY TO RETRIEVE ATTACHMENT DETAILS-->

    <sql:query var="sow">
    select convert(VARCHAR(23),files.created_date,126) ,
    files.has_all_participants, files.language,files.name, files.num_checkout_days, files.mime_type,
    files.versioning_enabled,ver.id,
    ver.version_number, convert(VARCHAR(23),files.file_created_date,126), folders.path_name,folders.name
    from niku.clb_dms_files files, niku.clb_dms_folders folders , niku.clb_dms_versions ver, niku.clb_dms_histories history
    where folders.id=files.parent_folder_id and ver.file_id=files.id and ver.id=history.version_id
    and folders.name='attach_sow_doc::ODF::Attribute' and folders.assoc_obj_id = ${gel_objectInstanceId}
    </sql:query>


    <soap:invoke endpoint="${XOGURL}/niku/xog" var="xog_login">
    <soap:message>
    <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">
    <soap-env:Body>
    <!-- start of XOG script -->

    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_customObjectInstance.xsd">


    <Header action="write" externalSource="NIKU" objectType="customObjectInstance" overrideAutoNumbering ="false" version="12.0.4"/>


    <customObjectInstances objectCode="work_request">


    <instance instanceCode= "-1" objectCode="work_request"
    parentInstanceCode="${row_project_query[0]}" parentObjectCode="inv">

    <CustomInformation>


    <ColumnValue name="code">-1</ColumnValue>


    <ColumnValue name="name">${row_project_query[3]}</ColumnValue>


    <ColumnValue name="odf_parent_id">${row_project_query[5]}</ColumnValue>
    <ColumnValue name="odf_cncrt_parent_id">${row_project_query[4]}</ColumnValue>


    <ColumnValue name="partition_code">${row_project_query[6]}</ColumnValue>

    <ColumnValue name="attach_sow_doc">
    <core:forEach items="${sow.rowsByIndex}" trim="true" var="row_sow_query">
    <Documents>
    <Parent documentLocation="${Filestore}">
    <Document fileCreatedDate="${row_sow_query[0]}"
    hasAllParticipants="${row_sow_query[1]}" language="${row_sow_query[2]}" name="${row_sow_query[3]}"
    numCheckoutDays="${row_sow_query[4]}" mimeType="${row_sow_query[5]}"
    versioningEnabled="${row_sow_query[6]}">
    <Version id="${row_sow_query[7]}" versionNumber="${row_sow_query[8]}" />
    </Document>
    </Parent>
    </Documents>
    </core:forEach>
    </ColumnValue>

    </CustomInformation>
    </instance>
    </customObjectInstances>
    </NikuDataBus>






    <xog:Login xmlns="http://www.niku.com/xog">
    <xog:Username>${XOGusername}</xog:Username>
    <xog:Password>${XOGpassword}</xog:Password>
    </xog:Login>
    </soap-env:Body>
    </soap-env:Envelope>
    </soap:message>
    </soap:invoke>
    </core:forEach>

    </gel:script>


  • 3.  RE: Xog In Documents to the Project Object

     
    Posted Jul 29, 2011 01:05 PM
    Hi Federico - Did this resolve your issue? If so can this one be marked resolved?

    Thanks!
    Chris


  • 4.  RE: Xog In Documents to the Project Object

    Posted Jul 29, 2011 06:59 PM
    The issue is that specific example is just for loading docs into a document field (for which I have no problem doing). I'm trying to get it to work with the document manager.
    syntax is somewhat different, and can't really get it to work.


  • 5.  RE: Xog In Documents to the Project Object

    Posted Aug 01, 2011 03:54 AM
    Elaborate a little please:
    Are your documents already in filestore ie a folder and you are trying to write the linku to the document to the project doucments?
    Or are your documents somewher else and you are storign them in the databse and you are trying to write the document as well to the blob field?

    Martti K.


  • 6.  RE: Xog In Documents to the Project Object

    Posted Sep 01, 2011 12:57 PM
    Hi Marti,
    I am trying to migrate thousands of documents as well as a folder structure to projects as part of a new initiative this company is having.
    I really just need the xml that is used to load documents into the collaboration manager.
    I have tried everything and have not been able to do it.
    Any help would be apreciated


  • 7.  RE: Xog In Documents to the Project Object

     
    Posted Sep 14, 2011 12:53 PM
    Hi Federico - Were you able to resolve your issue? If so please mark post as Accepted Solution.

    Thanks!
    Chris


  • 8.  RE: Xog In Documents to the Project Object

    Posted May 02, 2012 01:53 PM
    I know this is kind of a late response, but perhaps you can try this...


    <?xml version="1.0"?>
    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd">

    <Header version="7.5" action="read" objectType="document"
    externalSource="NIKU">


    <args name="documentLocation" value="c:\xog/test/documentXogLocation"/>

    </Header>

    <DocumentQuery>


    <Filter name="parentObjectID" criteria="EQUALS">5000019</Filter>

    <Filter name="parentObjectType" criteria="EQUALS">Projects</Filter>

    </DocumentQuery>
    </NikuDataBus>


    The project id is the actual internal ID from the SRM_PROJECTS table...

    Please note that the files will be placed on the app server, same procedure has to be done while XOG in the documents, you have to copy the files into the server then XOG in.

    Cheers,
    Jair


  • 9.  RE: Xog In Documents to the Project Object

    Posted Aug 01, 2011 02:21 PM
    Are you running the XOG from the server? I have an old tech note from Niku that states the following about XOGging documents:


    The script must reside on the server.
    The XOG toolset must be installed on the server
    The XOG command must be run from the server.
    The documentLocation must be on the server.
    The full path must be used for the documentLocation.
    parentObjectId is the internal database ID for the project, i.e. the 5000000 series numbers, not the ID which the end user may recognise the project by.
    The document hierarchy is prepared, beginning with documentLocation, which becomes "Top" in the project documents.


  • 10.  Re: Xog In Documents to the Project Object

    Posted Jun 08, 2015 03:37 PM

    Hi Federico

    Could you share us the syntax of xml that is used to load documents into the collaboration manager (not the attachment field)



  • 11.  Re: Xog In Documents to the Project Object

    Posted Jun 08, 2015 05:18 PM

    Hi Clarityhelp,

    if you run the XML provided by Jair above against your clairty environment, it should create your needed syntax to load back in.

     

    If this does not work, i can look for an example for you.

    cheers,

    Federico



  • 12.  Re: Xog In Documents to the Project Object

    Posted Jun 17, 2015 03:55 PM

    Hi fpena

     

    My requirement is to copy attachment attribute from a custom object to project collaboration tab. Folder path of the attachment in file store is "/files/123/456" and file name is 890.

    In the folder "/files/123/456" there are 5 files along with 890

    890

    567

    568

    569

    453

    How do I copy only 890 file to the project collab tab. I tried with below xml but it is copying all 5 files under "/files/123/456" and also test folder is not getting created but instead folder structure "/files/123/456" is created in the collab tab

     

    Can you help me what am I doing wrong here?

     

    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_document.xsd">

    <Header action="write" externalSource="OS" objectType="document" version="13.3.0.286"/>

    <Documents>

    <Parent documentLocation="/files/123/456" parentObjectId="3456789" parentObjectType="Projects">

    <Folder allowNonParticipants="0" hasAllParticipants="1" name="test">

    <Document allowNonParticipants="0" fileCreatedDate="2015-06-17T10:35:41" hasAllParticipants="1" language="en" name="890" numCheckoutDays="1"

          owner="admin" status="0" versioningEnabled="1">

       <Version id="-1" owner="admin" versionNumber="1"/>

       </Document></Folder></Parent></Documents></NikuDataBus>



  • 13.  Re: Xog In Documents to the Project Object

    Posted Jun 17, 2015 05:44 PM

    As you have probably seen, when you xog documents in/out of Clarity, they are copied into Clarity's document file store from some location, and exported out of Clarity's document file store to some other location visible to the server.

     

    Your request however is referencing an existing part of the document store and re-importing it to the same place.. I would not recommend this.

     

    Instead, you need to export your document attachments somewhere, arrange them with the appropriate files/folders as you wish them to exist in the application, and then issue the import specifying the location you want to bring them in.

     

    That way if you have this structure at the documentLocation specified:

     

    folder123

    |_______expenses.xlsx

    |_______deliverables.docx

    folderabc

    |_______folderxyz

    |              |_______meeting_minutes_template.docx

    |_______meeting_minutes_january.docx

    |_______meeting_minutes_february.docx

     

    Then just by specifying the folder containing this structure, you would bring in those files/folders under the collaboration tab of your project without extra content needed in your XOG document import file, and they would retain that same structure:

     

    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_document.xsd">

    <Header action="write" externalSource="OS" objectType="document" version="13.3.0.286"/>

    <Documents>

    <Parent documentLocation="/correct/path/to/folder" parentObjectId="3456789" parentObjectType="Projects">

    </Parent>

    </Documents>

    </NikuDataBus>

     

    If your location is an existing part of the filestore, then you're going to import a lot of oddly named files/folders that are part of the internal storage structure used by Clarity, and could bring in files from quite a span or range of Clarity records (almost randomly) and you wouldn't want that.  It should (always) be a separate and unrelated file/folder path that doesn't already belong to your Clarity installation.



  • 14.  Re: Xog In Documents to the Project Object

    Posted Jun 17, 2015 06:11 PM

    In pictures.

     

    XOG file:

     

    Project prior to import:

     

    Files/folders at documentLocation (on the Clarity server where the app services run):

     

    Running the XOG request:

     

    XOG output:

     

     

    And finally, how it ends up looking in Clarity on the project:

     



  • 15.  Re: Xog In Documents to the Project Object

    Posted Jun 18, 2015 10:06 AM

    Hi Nick

     

    Thanks a lot for your suggestion. It worked great and it did saved lot of time for me. I have exported document from custom object to a separate folder unrelated to the file store and I was able to import documents into project collaboration tab from that folder. This way I was able to import only related documents to that project. One last question when I export the document from custom object, files are created with internal ID's under clarity folder structure like clarity/Files/004/457/345678 where 345678 is the file name in clarity. How do I export documents with actual file names and get rid of the clarity internal folder structure. Users may not understand what 345678 is and they would want to see the actual file name. Any inputs here please???



  • 16.  Re: Xog In Documents to the Project Object

    Posted Jun 18, 2015 10:19 AM

    I do understand the challenge created by the folder/filename structure of the export, but I haven't personally had to address it or seen any of the created solutions.

     

    I expect that at least one already exists out there created and used by other customers or partners (quite possible CA Services have created such things as billable deliverables on projects too), I just haven't been exposed to them.  All I can expect is that those solutions involved taking the filenames from the disk and looking up the version_id column of the database view clb_dms_files_read_v (or similar) in order to discover the path and filename to use for reconstructing the layout.



  • 17.  Re: Xog In Documents to the Project Object

    Posted Jun 18, 2015 10:25 AM

    Thanks Nick. I will go from there . You have been a great help here..



  • 18.  Re: Xog In Documents to the Project Object

    Posted Jul 05, 2016 11:28 AM

    Hi Nick

     

    As you mentioned "Instead, you need to export your document attachments somewhere, arrange them with the appropriate files/folders as you wish them to exist in the application, and then issue the import specifying the location you want to bring them in."

     

    My requirement is to transfer the files along with folder structure from one clarity instance to other.  What kind of programming do you recommend to arrange the files/folders in the server with meaningful names instead of internal id's