@@ -13,11 +13,12 @@ import scala.collection.mutable.ListBuffer
1313
1414// this is to download collections
1515// that are not at the root level
16- class CollectionIterator (pathToFolder : String , parent_collection : models.Collection ,zip : ZipOutputStream , md5Files : scala.collection.mutable.HashMap [String , MessageDigest ], user : Option [User ],
17- collections : CollectionService , datasets : DatasetService , files : FileService , folders : FolderService , metadataService : MetadataService ,
16+ class CollectionIterator (pathToFolder : String , parent_collection : models.Collection , zip : ZipOutputStream ,
17+ md5Files : scala.collection.mutable.HashMap [String , MessageDigest ], user : Option [User ],
18+ bagit : Boolean , collections : CollectionService , datasets : DatasetService , files : FileService ,
19+ folders : FolderService , metadataService : MetadataService ,
1820 spaces : SpaceService ) extends Iterator [Option [InputStream ]] {
1921
20-
2122 def getNextGenerationCollections (currentCollections : List [Collection ]) : List [Collection ] = {
2223 var nextGenerationCollections : ListBuffer [Collection ] = ListBuffer .empty[Collection ]
2324 for (currentCollection <- currentCollections){
@@ -28,7 +29,7 @@ class CollectionIterator(pathToFolder : String, parent_collection : models.Colle
2829 nextGenerationCollections.toList
2930 }
3031
31- val datasetIterator = new DatasetsInCollectionIterator (pathToFolder,parent_collection,zip,md5Files,user,
32+ val datasetIterator = new DatasetsInCollectionIterator (pathToFolder,parent_collection,zip,bagit, md5Files,user,
3233 datasets,files, folders, metadataService,spaces)
3334
3435 var currentCollectionIterator : Option [CollectionIterator ] = None
@@ -40,7 +41,7 @@ class CollectionIterator(pathToFolder : String, parent_collection : models.Colle
4041 var childCollectionCount = 0
4142 var numChildCollections = child_collections.size
4243
43- var file_type = 0
44+ var file_type = if (bagit) 0 else 2
4445
4546 // TODO: Repeat from api/Collections
4647 def jsonCollection (collection : Collection ): JsValue = {
@@ -74,12 +75,12 @@ class CollectionIterator(pathToFolder : String, parent_collection : models.Colle
7475 if (file_type < 2 ){
7576 true
7677 }
77- else if (file_type == 2 ){
78+ else if (file_type == 2 ){
7879 if (datasetIterator.hasNext()){
7980 true
8081 } else if (numChildCollections > 0 ){
81-
82- currentCollectionIterator = Some ( new CollectionIterator (pathToFolder + " / " + child_collections(childCollectionCount).name, child_collections(childCollectionCount), zip,md5Files,user,collections,datasets,files,
82+ currentCollectionIterator = Some ( new CollectionIterator (pathToFolder + " / " + child_collections(childCollectionCount).name,
83+ child_collections(childCollectionCount), zip,md5Files,user, bagit, collections,datasets,files,
8384 folders,metadataService,spaces))
8485 file_type += 1
8586 true
@@ -94,7 +95,7 @@ class CollectionIterator(pathToFolder : String, parent_collection : models.Colle
9495 } else if (childCollectionCount < numChildCollections - 2 ){
9596 childCollectionCount+= 1
9697 currentCollectionIterator = Some (new CollectionIterator (pathToFolder+ " /" + child_collections(childCollectionCount).name, child_collections(childCollectionCount),zip,md5Files,user,
97- collections,datasets,files,
98+ bagit, collections,datasets,files,
9899 folders,metadataService,spaces))
99100 true
100101 } else {
0 commit comments