-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding validation-rules for RecordedCall Arrival-/DepartureStatus
- Loading branch information
Showing
2 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
.../no/rutebanken/anshar/routes/validation/validators/et/RecordedArrivalStatusValidator.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,55 @@ | ||
/* | ||
* Licensed under the EUPL, Version 1.2 or – as soon they will be approved by | ||
* the European Commission - subsequent versions of the EUPL (the "Licence"); | ||
* You may not use this work except in compliance with the Licence. | ||
* You may obtain a copy of the Licence at: | ||
* | ||
* https://joinup.ec.europa.eu/software/page/eupl | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the Licence is distributed on an "AS IS" basis, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the Licence for the specific language governing permissions and | ||
* limitations under the Licence. | ||
*/ | ||
|
||
package no.rutebanken.anshar.routes.validation.validators.et; | ||
|
||
import com.google.common.collect.Sets; | ||
import no.rutebanken.anshar.routes.validation.validators.LimitedSubsetValidator; | ||
import no.rutebanken.anshar.routes.validation.validators.Validator; | ||
import no.rutebanken.anshar.subscription.SiriDataType; | ||
import org.springframework.stereotype.Component; | ||
import uk.org.siri.siri21.CallStatusEnumeration; | ||
|
||
import static no.rutebanken.anshar.routes.validation.validators.Constants.RECORDED_CALL; | ||
|
||
/** | ||
* Verifies that the value for field ArrivalStatus is one of the allowed types | ||
* | ||
*/ | ||
@Validator(profileName = "norway", targetType = SiriDataType.ESTIMATED_TIMETABLE) | ||
@Component | ||
public class RecordedArrivalStatusValidator extends LimitedSubsetValidator { | ||
|
||
private String path; | ||
|
||
public RecordedArrivalStatusValidator() { | ||
FIELDNAME = "ArrivalStatus"; | ||
path = RECORDED_CALL + FIELD_DELIMITER + FIELDNAME; | ||
|
||
expectedValues = Sets.newHashSet( | ||
CallStatusEnumeration.ARRIVED.value(), | ||
CallStatusEnumeration.CANCELLED.value(), | ||
CallStatusEnumeration.MISSED.value(), | ||
CallStatusEnumeration.EARLY.value(), | ||
CallStatusEnumeration.ON_TIME.value(), | ||
CallStatusEnumeration.DELAYED.value()); | ||
} | ||
|
||
@Override | ||
public String getXpath() { | ||
return path; | ||
} | ||
|
||
} |
53 changes: 53 additions & 0 deletions
53
...o/rutebanken/anshar/routes/validation/validators/et/RecordedDepartureStatusValidator.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,53 @@ | ||
/* | ||
* Licensed under the EUPL, Version 1.2 or – as soon they will be approved by | ||
* the European Commission - subsequent versions of the EUPL (the "Licence"); | ||
* You may not use this work except in compliance with the Licence. | ||
* You may obtain a copy of the Licence at: | ||
* | ||
* https://joinup.ec.europa.eu/software/page/eupl | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the Licence is distributed on an "AS IS" basis, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the Licence for the specific language governing permissions and | ||
* limitations under the Licence. | ||
*/ | ||
|
||
package no.rutebanken.anshar.routes.validation.validators.et; | ||
|
||
import com.google.common.collect.Sets; | ||
import no.rutebanken.anshar.routes.validation.validators.LimitedSubsetValidator; | ||
import no.rutebanken.anshar.routes.validation.validators.Validator; | ||
import no.rutebanken.anshar.subscription.SiriDataType; | ||
import org.springframework.stereotype.Component; | ||
import uk.org.siri.siri21.CallStatusEnumeration; | ||
|
||
import static no.rutebanken.anshar.routes.validation.validators.Constants.RECORDED_CALL; | ||
|
||
/** | ||
* Verifies that the value for field DepartureStatus is one of the allowed types | ||
* | ||
*/ | ||
@Validator(profileName = "norway", targetType = SiriDataType.ESTIMATED_TIMETABLE) | ||
@Component | ||
public class RecordedDepartureStatusValidator extends LimitedSubsetValidator { | ||
|
||
private String path; | ||
|
||
public RecordedDepartureStatusValidator() { | ||
FIELDNAME = "DepartureStatus"; | ||
path = RECORDED_CALL + FIELD_DELIMITER + FIELDNAME; | ||
expectedValues = Sets.newHashSet( | ||
CallStatusEnumeration.DEPARTED.value(), | ||
CallStatusEnumeration.CANCELLED.value(), | ||
CallStatusEnumeration.MISSED.value(), | ||
CallStatusEnumeration.EARLY.value(), | ||
CallStatusEnumeration.ON_TIME.value(), | ||
CallStatusEnumeration.DELAYED.value()); | ||
} | ||
|
||
@Override | ||
public String getXpath() { | ||
return path; | ||
} | ||
} |