[Major] Using DateRange in DateSelector
This commit is contained in:
parent
e9fc3d7ac8
commit
b8bfaf8408
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package li.strolch.model.audit;
|
package li.strolch.model.audit;
|
||||||
|
|
||||||
import ch.eitchnet.utils.StringMatchMode;
|
|
||||||
import li.strolch.model.query.StringSelection;
|
import li.strolch.model.query.StringSelection;
|
||||||
|
import ch.eitchnet.utils.StringMatchMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||||
|
@ -44,6 +44,10 @@ public class ActionSelection extends AuditSelection {
|
||||||
return this.accessTypes;
|
return this.accessTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StringSelection getActionSelection() {
|
||||||
|
return this.actionSelection;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isWildcardActionType() {
|
public boolean isWildcardActionType() {
|
||||||
return this.accessTypes == null || this.accessTypes.length == 0;
|
return this.accessTypes == null || this.accessTypes.length == 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ public class DateRangeSelection extends AuditSelection {
|
||||||
|
|
||||||
public DateRangeSelection(AuditQuery query) {
|
public DateRangeSelection(AuditQuery query) {
|
||||||
super(query);
|
super(query);
|
||||||
|
this.dateRange = new DateRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateRange from(Date from, boolean inclusive) {
|
public DateRange from(Date from, boolean inclusive) {
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package li.strolch.model.audit;
|
package li.strolch.model.audit;
|
||||||
|
|
||||||
import ch.eitchnet.utils.StringMatchMode;
|
|
||||||
import li.strolch.model.query.StringSelection;
|
import li.strolch.model.query.StringSelection;
|
||||||
|
import ch.eitchnet.utils.StringMatchMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||||
|
@ -56,6 +56,10 @@ public class ElementSelection extends AuditSelection {
|
||||||
return this.elementAccessedSelection == null || this.elementAccessedSelection.isWildCard();
|
return this.elementAccessedSelection == null || this.elementAccessedSelection.isWildCard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isWildcard() {
|
||||||
|
return this.isElementsAccessedWildcard() && this.isElementTypesWildcard();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(AuditQueryVisitor visitor) {
|
public void accept(AuditQueryVisitor visitor) {
|
||||||
visitor.visit(this);
|
visitor.visit(this);
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package li.strolch.model.audit;
|
package li.strolch.model.audit;
|
||||||
|
|
||||||
import ch.eitchnet.utils.StringMatchMode;
|
|
||||||
import li.strolch.model.query.StringSelection;
|
import li.strolch.model.query.StringSelection;
|
||||||
|
import ch.eitchnet.utils.StringMatchMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||||
|
@ -79,6 +79,10 @@ public class IdentitySelection extends AuditSelection {
|
||||||
return this.usernameSelection == null || this.usernameSelection.isWildCard();
|
return this.usernameSelection == null || this.usernameSelection.isWildCard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isWildcard() {
|
||||||
|
return isFirstnameWildcard() && isLastnameWildcard() && isUsernameWildcard();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(AuditQueryVisitor visitor) {
|
public void accept(AuditQueryVisitor visitor) {
|
||||||
visitor.visit(this);
|
visitor.visit(this);
|
||||||
|
|
|
@ -17,19 +17,59 @@ package li.strolch.model.query;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import ch.eitchnet.utils.collections.DateRange;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||||
*/
|
*/
|
||||||
public class DateSelection extends OrderSelection {
|
public class DateSelection extends OrderSelection {
|
||||||
|
|
||||||
private Date date;
|
private DateRange dateRange;
|
||||||
|
|
||||||
public DateSelection(Date date) {
|
public DateSelection() {
|
||||||
this.date = date;
|
this.dateRange = new DateRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDate() {
|
public DateSelection from(Date from, boolean inclusive) {
|
||||||
return this.date;
|
this.dateRange.from(from, inclusive);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateSelection to(Date to, boolean inclusive) {
|
||||||
|
this.dateRange.to(to, inclusive);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getFromDate() {
|
||||||
|
return this.dateRange.getFromDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getToDate() {
|
||||||
|
return this.dateRange.getToDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFromBounded() {
|
||||||
|
return this.dateRange.isFromBounded();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isToBounded() {
|
||||||
|
return this.dateRange.isToBounded();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUnbounded() {
|
||||||
|
return this.dateRange.isUnbounded();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBounded() {
|
||||||
|
return this.dateRange.isBounded();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains(Date date) {
|
||||||
|
return this.dateRange.contains(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateRange getDateRange() {
|
||||||
|
return this.dateRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,9 +19,8 @@ import li.strolch.model.State;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class StateSelection {
|
public class StateSelection extends OrderSelection {
|
||||||
|
|
||||||
private State state;
|
private State state;
|
||||||
|
|
||||||
|
@ -29,10 +28,12 @@ public class StateSelection {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the state
|
|
||||||
*/
|
|
||||||
public State getState() {
|
public State getState() {
|
||||||
return this.state;
|
return this.state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(OrderSelectionVisitor visitor) {
|
||||||
|
visitor.visit(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue