Changeset 1065:582a22afbc5e
- Timestamp:
- 05/14/10 16:05:53 (3 years ago)
- Author:
- tgambet
- Branch:
- default
- convert_revision:
- svn:cdcfb263-7567-472c-a848-e2c2df3466e7/trunk@1066
- Message:
-
updated to allow the status element to be at the bottom of a response file (see observationresponse2.xsd 1.10)
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r907
|
r1065
|
|
| 1 | | // $Id: DefaultResponseXBeans.java,v 1.14 2009-10-23 13:50:18 tgambet Exp $ |
| | 1 | // $Id: DefaultResponseXBeans.java,v 1.15 2010-05-14 16:05:53 tgambet Exp $ |
| 2 | 2 | // Author: Thomas Gambet |
| 3 | 3 | // (c) COPYRIGHT MIT, ERCIM and Keio, 2009. |
| … |
… |
|
| 21 | 21 | import org.w3.x2009.x10.unicorn.observationresponse.MessageType; |
| 22 | 22 | import org.w3.x2009.x10.unicorn.observationresponse.ObservationresponseDocument; |
| | 23 | import org.w3.x2009.x10.unicorn.observationresponse.StatusType; |
| 23 | 24 | import org.w3.x2009.x10.unicorn.observationresponse.ObservationresponseDocument.Observationresponse; |
| 24 | 25 | import org.w3c.unicorn.Framework; |
| … |
… |
|
| 133 | 134 | |
| 134 | 135 | public int getStatus() { |
| 135 | | if (or.isSetStatus() && or.getStatus().getValue().equalsIgnoreCase("passed")) { |
| 136 | | return PASSED; |
| 137 | | } else if ((or.isSetStatus() && or.getStatus().getValue().equalsIgnoreCase("failed")) || |
| 138 | | (!or.isSetStatus() && getErrorCount() > 0)) { |
| 139 | | return FAILED; |
| 140 | | } else { |
| 141 | | return UNDEF; |
| | 136 | if (or.getStatusList().size() == 0) { |
| | 137 | if (getErrorCount() > 0) { |
| | 138 | return FAILED; |
| | 139 | } else { |
| | 140 | return UNDEF; |
| | 141 | } |
| | 142 | } else { |
| | 143 | // Status element can be added at the top or the end of a document. If there are two status element, only the last one is used. |
| | 144 | StatusType status = or.getStatusList().get(or.getStatusList().size() - 1); |
| | 145 | if (status.isSetValue() && status.getValue().equalsIgnoreCase("passed")) { |
| | 146 | return PASSED; |
| | 147 | } else if (status.isSetValue() && status.getValue().equalsIgnoreCase("failed")) { |
| | 148 | return FAILED; |
| | 149 | } else { |
| | 150 | return UNDEF; |
| | 151 | } |
| 142 | 152 | } |
| 143 | 153 | } |
| 144 | 154 | |
| 145 | 155 | public Integer getRating() { |
| 146 | | if(or.isSetStatus() && or.getStatus().isSetRating()) |
| 147 | | return or.getStatus().getRating(); |
| | 156 | if (or.getStatusList().size() != 0) { |
| | 157 | StatusType status = or.getStatusList().get(or.getStatusList().size() - 1); |
| | 158 | if (status.isSetRating()) |
| | 159 | return status.getRating(); |
| | 160 | } |
| 148 | 161 | return null; |
| 149 | 162 | } |