Skip to content

Commit

Permalink
When importing csv file, missing cells will no longer show [object Ob…
Browse files Browse the repository at this point in the history
…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
lernermh committed Apr 10, 2019
1 parent 4b564d7 commit 4dbfd88
Show file tree
Hide file tree
Showing 5 changed files with 845 additions and 687 deletions.
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"
+ "}";
}
}
Loading

0 comments on commit 4dbfd88

Please sign in to comment.