forked from NCIP/cananolab
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When importing csv file, missing cells will no longer show [object Ob…
…ject] CANANOLAB-587 Server will report back to client all bad input for Characterization: Finding CANANOLAB-599 Selecting "Other" as a Column name, no longer causes error preventing editing other column headers CANANOLAB-592
- Loading branch information
Showing
5 changed files
with
845 additions
and
687 deletions.
There are no files selected for viewing
74 changes: 17 additions & 57 deletions
74
software/cananolab-webapp/src/gov/nih/nci/cananolab/dto/common/BadCellInputException.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 |
---|---|---|
@@ -1,78 +1,38 @@ | ||
package gov.nih.nci.cananolab.dto.common; | ||
|
||
import java.util.ArrayList; | ||
|
||
/** | ||
* Exception when bad data causes save to fail when saving Finding Info data. | ||
*/ | ||
public class BadCellInputException extends Exception { | ||
|
||
private String message; | ||
private String badData; | ||
private String columnName; | ||
private String columnType; | ||
|
||
public BadCellInputException( String badData) { | ||
this.badData = badData; | ||
} | ||
|
||
|
||
public BadCellInputException( String message, String badData, String columnName, String columnType ) | ||
{ | ||
this.badData = badData; | ||
this.message = message; | ||
this.columnName = columnName; | ||
this.columnType = columnType; | ||
} | ||
|
||
|
||
public String getBadData() | ||
{ | ||
return badData; | ||
} | ||
public class BadCellInputException extends Exception | ||
{ | ||
|
||
public void setBadData( String badData ) | ||
{ | ||
this.badData = badData; | ||
} | ||
|
||
public String getColumnName() | ||
{ | ||
return columnName; | ||
} | ||
ArrayList<ArrayList<String>> errorData; | ||
String errorMessage = ""; | ||
|
||
public void setColumnName( String columnName ) | ||
public BadCellInputException( ArrayList<ArrayList<String>> errorData ) | ||
{ | ||
this.columnName = columnName; | ||
this.errorMessage = "Cell data error"; | ||
this.errorData = errorData; | ||
} | ||
|
||
public String getColumnType() | ||
{ | ||
return columnType; | ||
} | ||
|
||
public void setColumnType( String columnType ) | ||
public BadCellInputException( String message, ArrayList<ArrayList<String>> errorData ) | ||
{ | ||
this.columnType = columnType; | ||
this.errorMessage = message; | ||
this.errorData = errorData; | ||
} | ||
|
||
@Override | ||
public String getMessage() | ||
{ | ||
return message + "\nColumn: " + columnName + "\nCell data: " + badData; | ||
} | ||
StringBuilder sb = new StringBuilder( "Bad cell input data:\n" ); | ||
for (ArrayList<String> row : errorData) { | ||
sb.append( "\nColumn: " + row.get(1) + "\nCell data: " + row.get(0) +"\n"); | ||
} | ||
|
||
public void setMessage( String message ) | ||
{ | ||
this.message = message; | ||
return sb.toString(); | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return "{\n \"BadCellInputException\":\n" | ||
+ " \"message\":\"" + message + "\",\n" | ||
+ " \"badData\":\"" + badData + "\",\n" | ||
+ " \"columnName\":\"" + columnName + "\",\n" | ||
+ " \"columnType\":\"" + columnType + "\",\n" | ||
+ "}"; | ||
} | ||
} |
Oops, something went wrong.