-
Notifications
You must be signed in to change notification settings - Fork 490
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
199 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/java/edu/harvard/iq/dataverse/ingest/SimpleIngestMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package edu.harvard.iq.dataverse.ingest; | ||
|
||
/** | ||
* | ||
* @author rmp553 | ||
*/ | ||
class SimpleIngestMessage{ | ||
|
||
public boolean success = true; | ||
public String errorMessage = null; | ||
|
||
public SimpleIngestMessage(boolean success, String errorMessage){ | ||
this.success = success; | ||
if (this.success == false){ | ||
if (errorMessage == null){ | ||
throw new NullPointerException("errorMessage cannot be null. If this was unsuccessfuly, you must include an errorMessage."); | ||
} | ||
this.errorMessage = errorMessage; | ||
} | ||
} | ||
|
||
public boolean wasErrorFound(){ | ||
return this.success; | ||
} | ||
|
||
public String getErrorMessage(){ | ||
return this.errorMessage; | ||
} | ||
|
||
public static SimpleIngestMessage getInfoSuccess(){ | ||
return new SimpleIngestMessage(true, null); | ||
} | ||
|
||
public static SimpleIngestMessage getInfoFail(String errorMsg){ | ||
return new SimpleIngestMessage(false, errorMsg); | ||
} | ||
|
||
} // end SimpleIngestMessage | ||
|