org.nakedobjects.example.expenses.fixtures.StatusFixture Maven / Gradle / Ivy
The newest version!
package org.nakedobjects.example.expenses.fixtures;
import org.nakedobjects.applib.DomainObjectContainer;
import org.nakedobjects.applib.annotation.Hidden;
import org.nakedobjects.applib.fixtures.AbstractFixture;
import org.nakedobjects.example.expenses.claims.ClaimStatus;
import org.nakedobjects.example.expenses.claims.ExpenseItemStatus;
public class StatusFixture extends AbstractFixture {
// {{ Injected: Container
private DomainObjectContainer container;
/**
* This field is not persisted, nor displayed to the user.
*/
protected DomainObjectContainer getContainer() {
return this.container;
}
/**
* Injected by the application container itself.
*/
public final void setContainer(final DomainObjectContainer container) {
this.container = container;
}
// }}
public static ClaimStatus NEW_CLAIM;
public static ClaimStatus SUBMITTED;
public static ClaimStatus RETURNED;
public static ClaimStatus PAID;
public void install() {
createExpenseItemStatus(ExpenseItemStatus.NEW_COMPLETE);
createExpenseItemStatus(ExpenseItemStatus.NEW_INCOMPLETE);
createExpenseItemStatus(ExpenseItemStatus.REJECTED);
createExpenseItemStatus(ExpenseItemStatus.APPROVED);
createExpenseItemStatus(ExpenseItemStatus.QUERIED);
NEW_CLAIM = createClaimStatus(ClaimStatus.NEW);
SUBMITTED = createClaimStatus(ClaimStatus.SUBMITTED);
RETURNED = createClaimStatus(ClaimStatus.RETURNED);
PAID = createClaimStatus(ClaimStatus.PAID);
}
@Hidden
public ExpenseItemStatus createExpenseItemStatus( final String description) {
final ExpenseItemStatus status = (ExpenseItemStatus) newTransientInstance(ExpenseItemStatus.class);
status.setTitleString(description);
getContainer().makePersistent(status);
return status;
}
@Hidden
public ClaimStatus createClaimStatus(final String description) {
final ClaimStatus status = (ClaimStatus) getContainer().newTransientInstance(ClaimStatus.class);
status.setTitleString(description);
makePersistent(status);
return status;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy