dloy avatar dloy committed 3afb086

Add number of mods/dc to process

Comments (0)

Files changed (1)

core/src/main/java/org/cdlib/mrt/core/DC.java

     /**
      * Build a LinkedHashList containing DC values extracted from METS
      * @param metsDoc METS Document
+     * @param maxDMDSec number of DMDSec elements allowed for processing
      * @param logger file logger
      * @return list of (repeating) DC values
      * @throws TException process exception
      */
     public static LinkedHashList getDC (
             Document metsDoc,
+            int maxDMDSec,
             LoggerInf logger)
         throws TException
     {
-
+        int maxDMDCnt = 0;
         try {
 
             Element root = metsDoc.getDocumentElement();
                     MESSAGE + "METS does not contain dmdSec");
             }
             for (int i=0; i<size; i++) {
+                if (maxDMDCnt >= maxDMDSec) break;
                 fileNode = (Element)list.item(i);
                 isDC = isDC(fileNode, logger);
                 if (DEBUG) System.out.println("isDC=" + isDC);
                 int modsSize = listMODS.getLength();
                 if (modsSize > 0) {
                     getDCFromModsMets(returnList, metsDoc, logger);
+                    maxDMDCnt++;
                     continue;
                 }
 
                 int dcSize = listDC.getLength();
                 if (dcSize > 0) {
                     getMetsDC(returnList,metsDoc, logger);
+                    maxDMDCnt++;
                     continue;
 
                 } else if (isDC) {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.