Walk a tree of imported meta
This commit is contained in:
parent
c39aac83b5
commit
4132c4d470
1 changed files with 34 additions and 3 deletions
|
|
@ -930,7 +930,36 @@ class MetaInfo extends GISJsonSerialised {
|
|||
return releasemetaversionuniquecollection
|
||||
}
|
||||
|
||||
def walkrelated(ArrayList<MetaInfo> metacollection, String comment = '', int level = 0) {
|
||||
def openchildmeta(String gatheredpath, RelatedMetaInfo relatedmetainfo) {
|
||||
MetaInfo mi = new MetaInfot(script)
|
||||
|
||||
String nextpath
|
||||
if (gatheredpath) {
|
||||
nextpath = relatedmetainfo.offsetpath
|
||||
} else {
|
||||
nextpath = gatheredpath + '/' + relatedmetainfo.offsetpath
|
||||
}
|
||||
def importedmetafile = nextpath + '/' + METAFILENAME
|
||||
def boolean next
|
||||
if (script.fileExists(importedmetafile)) {
|
||||
script.echo("Deserialising meta at file: ${importedmetafile}")
|
||||
mi.deserialiseJson(importedmetafile)
|
||||
next = true
|
||||
} else {
|
||||
script.echo("Could not deserialise meta at file: ${importedmetafile} - Does not exist")
|
||||
next = false
|
||||
}
|
||||
|
||||
def childmetainfo = [
|
||||
next: next
|
||||
nextpath: nextpath,
|
||||
childmeta: mi
|
||||
]
|
||||
|
||||
return childmetainfo
|
||||
}
|
||||
|
||||
def walkrelated(ArrayList<MetaInfo> metacollection, String comment = '', int level = 0, String gatheredpath = '') {
|
||||
def results = [
|
||||
'metacollection' : metacollection,
|
||||
'comment': comment
|
||||
|
|
@ -938,8 +967,10 @@ class MetaInfo extends GISJsonSerialised {
|
|||
results.metacollection.add(this)
|
||||
results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n'
|
||||
for (relatedmetainfo in associatedmeta) {
|
||||
MetaInfo othermeta = relatedmetainfo.meta
|
||||
results = othermeta.walkrelated(results.metacollection, results.comment, level + 1)
|
||||
def childmetainfo = openchildmeta(gatheredpath, relatedmetainfo)
|
||||
if (childmetainfo.next) {
|
||||
results = childmetainfo.mi.walkrelated(results.metacollection, results.comment, level + 1, childmetainfo.nextpath)
|
||||
}
|
||||
}
|
||||
return [ 'metacollection' : results.metacollection, 'comment': results.comment ]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue