Skip to content

Commit

Permalink
Merge pull request #748 from marklogic-community/export-cleanup
Browse files Browse the repository at this point in the history
cleaning up things I noticed while working on docs
  • Loading branch information
dmcassel authored Feb 16, 2018
2 parents c103860 + aa35da2 commit 05aad86
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ public JobDeleteResponse deleteJobs(String jobIds) {
*
* @param exportFilePath specifies where the zip file will be written
* @param jobIds a comma-separated list of jobIds; if null, all will be exported
*
* @return a report of what was exported
*/
public JobExportResponse exportJobs(Path exportFilePath, String[] jobIds) {
JobExportResponse response = new JobExportResponse();
Expand Down Expand Up @@ -178,6 +180,7 @@ public JobExportResponse exportJobs(Path exportFilePath, String[] jobIds) {
* Import Job documents and their associated Trace documents from a zip file.
*
* @param importFilePath specifies where the zip file exists
* @throws IOException if unable to open or read the target input file
*/
public void importJobs(Path importFilePath) throws IOException {
ZipFile importZip = new ZipFile(importFilePath.toFile());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,23 @@ import org.gradle.api.tasks.TaskAction

class ImportJobsTask extends HubTask {
@Input
public String jobIds
public String importFilename
public String filename

@TaskAction
void exportJobs() {
if (importFilename == null) {
importFilename = project.hasProperty("filename") ? project.property("filename") : "jobexport.zip"
if (filename == null) {
filename = project.hasProperty("filename") ? project.property("filename") : "jobexport.zip"
}
println("Importing jobs from " + importFilename)
println("Importing jobs from " + filename)

def jobManager = getJobManager()
def dh = getDataHub()
if (!dh.isInstalled()) {
println("Data Hub is not installed.")
return
}
def importPath = getHubConfig().hubConfigDir.resolve(importFilename)
def jobImportResponse = jobManager.importJobs(importPath)
print jobImportResponse
def importPath = getHubConfig().hubConfigDir.parent.resolve(filename)
jobManager.importJobs(importPath)
}

}

0 comments on commit 05aad86

Please sign in to comment.