org.nakedobjects.example.expenses.claims.items.Airfare Maven / Gradle / Ivy
The newest version!
package org.nakedobjects.example.expenses.claims.items;
import org.nakedobjects.applib.annotation.MemberOrder;
import org.nakedobjects.applib.annotation.Named;
import org.nakedobjects.example.expenses.claims.ExpenseItem;
public class Airfare extends Journey {
// {{ Airline
private String airlineAndFlight;
public void setAirlineAndFlight(final String airline) {
this.airlineAndFlight = airline;
objectChanged();
}
@MemberOrder(sequence="2.4")
@Named("Airline & Flight No.")
public String getAirlineAndFlight() {
resolve(airlineAndFlight);
return airlineAndFlight;
}
public void modifyAirlineAndFlight(final String newAirline) {
setAirlineAndFlight(newAirline);
checkIfComplete();
}
public void clearAirlineAndFlight() {
setAirlineAndFlight(null);
checkIfComplete();
}
public String disableAirlineAndFlight() {
return disabledIfLocked();
}
// }}
// {{ Copying
@Override
protected void copyAnyEmptyFieldsSpecificToSubclassOfJourney(ExpenseItem otherItem) {
if (otherItem instanceof Airfare) {
Airfare airfare = (Airfare) otherItem;
if (airlineAndFlight == null || airlineAndFlight.length() == 0) {
modifyAirlineAndFlight(airfare.getAirlineAndFlight());
}
}
}
// }}
@Override
protected boolean mandatoryJourneySubClassFieldsComplete() {
return airlineAndFlight != null &! airlineAndFlight.equals("");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy