added a check
This commit is contained in:
parent
729c1d8f1a
commit
4a095277e9
|
@ -204,18 +204,22 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
PublicationReport report = manager.commitSafely(publish);
|
PublicationReport report = manager.commitSafely(publish);
|
||||||
LOG.info("PublicationReport: " + report);
|
LOG.info("PublicationReport: " + report);
|
||||||
Record registered = report.getTheRecord();
|
Record registered = report.getTheRecord();
|
||||||
|
|
||||||
if(registered==null)
|
|
||||||
throw new Exception(report.prettyPrint());
|
|
||||||
|
|
||||||
// String link = "toTest";
|
// String link = "toTest";
|
||||||
CommitReport cRep = new CommitReport();
|
CommitReport cRep = new CommitReport();
|
||||||
cRep.setRecordId(registered.getId());
|
|
||||||
|
if(registered!=null)
|
||||||
|
cRep.setRecordId(registered.getId());
|
||||||
|
|
||||||
cRep.setReport(report.prettyPrint());
|
cRep.setReport(report.prettyPrint());
|
||||||
|
|
||||||
switch (report.getStatus()) {
|
switch (report.getStatus()) {
|
||||||
case PASSED:
|
case PASSED:
|
||||||
cRep.setState(STATE.OK);
|
cRep.setState(STATE.OK);
|
||||||
|
if(cRep.getRecordId()==null) {
|
||||||
|
LOG.error("The record id is null!!!");
|
||||||
|
throw new Exception("Invalid record id");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case WARNING:
|
case WARNING:
|
||||||
cRep.setState(STATE.WARN);
|
cRep.setState(STATE.WARN);
|
||||||
|
@ -235,7 +239,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Error on commiting data: ", e);
|
LOG.error("Error on commiting data: ", e);
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
"Error occurred on saving data, try again or contact the support. Error: " + e.getMessage());
|
"Error occurred on saving data. Error: " + e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
// if(manager!=null) {
|
// if(manager!=null) {
|
||||||
// try {
|
// try {
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class CommitReport implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public STATE state = STATE.UNKNOWN;
|
public STATE state = STATE.UNKNOWN;
|
||||||
public long recordId;
|
public Long recordId;
|
||||||
public String msg;
|
public String msg;
|
||||||
public String report;
|
public String report;
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public class CommitReport implements Serializable {
|
||||||
*
|
*
|
||||||
* @return the record id
|
* @return the record id
|
||||||
*/
|
*/
|
||||||
public long getRecordId() {
|
public Long getRecordId() {
|
||||||
return recordId;
|
return recordId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue