Pages

Monday, January 18, 2016

How to automate export and transfer process of archiver using RIDC ?

How to automate  export and transfer process of archiver  using RIDC ?






Purpose : Sample code to automate the archiver process

These are the basic Archiver process


1.Export ( Create batches )
2.Transfer
3.Delete batches

This RIDC code will do all the process required for archiver to run . Before running the code , there should be proxied target server should be configured . So that archiver can be transfer to there

Location of RIDC class : https://github.com/sterin501/ExportTransferRIDC

Step 1: Exporting

IDC service for export EXPORT_ARCHIVE

dataBinder.putLocal("IdcService", "EXPORT_ARCHIVE");
dataBinder.putLocal("IDC_Name",prop.getProperty("IDC_Name"));
dataBinder.putLocal("aArchiveName",prop.getProperty("aArchiveName"));
dataBinder.putLocal("dataSource","RevisionIDs");
dataBinder.putLocal("aDoExportTable","1");
dataBinder.putLocal("forceLogin","1");
dataBinder.putLocal("monitoredSubjects","collaborations");



2. Getting batch details created by step 1

dataBinder.putLocal("IdcService", "GET_BATCHFILES");
dataBinder.putLocal("IDC_Name",prop.getProperty("IDC_Name"));
dataBinder.putLocal("aArchiveName",prop.getProperty("aArchiveName"));

3. Getting ContentIDs from Batches created in Step 1

dataBinder.putLocal("IdcService", "GET_BATCH_FILE_DOCUMENTS");
dataBinder.putLocal("IDC_Name",prop.getProperty("IDC_Name"));
dataBinder.putLocal("aArchiveName",prop.getProperty("aArchiveName"));
dataBinder.putLocal("aBatchFile",aBatchFile);

This will provide “ExportResults” resultSet . From ther dDocName can be obtained


4.Transferring Batches

dataBinder.putLocal("IdcService", "TRANSFER_ARCHIVE");
dataBinder.putLocal("IDC_Name",prop.getProperty("IDC_Name"));
dataBinder.putLocal("aArchiveName",prop.getProperty("aArchiveName"));
dataBinder.putLocal("aTargetArchive",prop.getProperty("aTargetArchive"));
5. Getting Archiver Status before deleting the batches

dataBinder.putLocal("IdcService", "GET_ARCHIVES");
dataBinder.putLocal("IDC_Name",prop.getProperty("IDC_Name"));

This will return “ArchiveData” resultSet , which can be used to get the transfer count.

6. Verify the transfer count ,

you can compare the number of contents exported and transferred . Using Step 3 and Step 5 .



7. Delete Batches

dataBinder.putLocal("IdcService", "DELETE_BATCH_FILE");
dataBinder.putLocal("IDC_Name",prop.getProperty("IDC_Name"));
dataBinder.putLocal("aArchiveName",prop.getProperty("aArchiveName"));



Location of RIDC class : https://github.com/sterin501/ExportTransferRIDC

Wednesday, January 6, 2016

Method to print entire ResultSet in Custom component


   intradoc.data.ResultSet




private void traceResultSet (final intradoc.data.ResultSet rs)


            {

                               
                                    int rowCount = 0;
                                    int columsize = rs.getNumFields();


                                       for(rs.first(); rs.isRowPresent(); rs.next())

                                          {

                                                for (int j=0;j< columsize ; j++)

                                                  {
                                                     String   key = rs.getFieldName(j);
                                                     String   value = rs.getStringValueByName(key);
                                                     traceVerbose (key + "  " + value);

                                                  }
                                         
                                          rowCount++;
                                          traceVerbose ("Going to Next Row ---");          
                                  
                                          }


            } // end of traceResultSet


















private static void trace(final String message)

              {
                
                  Report.trace("MyCustomComponent", message, null);
              }       


 private static void traceVerbose(final String message)

                  {
               
                if (Report.m_verbose)
                         {
                        trace(message);
                         }
                   }  // end of TraceVerbose