Skip to content

Commit

Permalink
Clean up some code structure
Browse files Browse the repository at this point in the history
  • Loading branch information
ghelmling committed Jan 27, 2010
1 parent 661df95 commit 03b1966
Show file tree
Hide file tree
Showing 16 changed files with 585 additions and 529 deletions.
16 changes: 11 additions & 5 deletions src/java/meetup/beeno/Criteria.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import meetup.beeno.filter.ColumnMatchFilter;
import meetup.beeno.filter.WhileMatchFilter;
import meetup.beeno.mapping.EntityInfo;
import meetup.beeno.mapping.FieldMapping;
import meetup.beeno.util.IOUtil;
import meetup.beeno.util.PBUtil;

Expand Down Expand Up @@ -36,6 +38,10 @@ public Criteria add(Expression expr) {
return this;
}

public boolean isEmpty() {
return this.expressions.isEmpty();
}

public List<Expression> getExpressions() {
return this.expressions;
}
Expand Down Expand Up @@ -102,7 +108,7 @@ public static abstract class Expression implements Externalizable {
public Expression() {
}

public abstract Filter getFilter(EntityMetadata.EntityInfo info) throws HBaseException;
public abstract Filter getFilter(EntityInfo info) throws HBaseException;

public String toString() {
return "["+this.getClass().getSimpleName()+"]";
Expand Down Expand Up @@ -157,8 +163,8 @@ public PropertyComparison(String prop, Object val, ColumnMatchFilter.CompareOp o
this.op = op;
}

public Filter getFilter(EntityMetadata.EntityInfo entityInfo) throws HBaseException {
EntityMetadata.FieldMapping mapping = entityInfo.getPropertyMapping(this.property);
public Filter getFilter(EntityInfo entityInfo) throws HBaseException {
FieldMapping mapping = entityInfo.getPropertyMapping(this.property);
if (mapping == null) {
throw new MappingException( entityInfo.getEntityClass(),
String.format("No mapping for criteria! class=%s, property=%s",
Expand Down Expand Up @@ -190,7 +196,7 @@ public RequireExpression(Expression required) {
this.required = required;
}

public Filter getFilter(EntityMetadata.EntityInfo entityInfo) throws HBaseException {
public Filter getFilter(EntityInfo entityInfo) throws HBaseException {
if (log.isDebugEnabled())
log.debug(String.format("Adding filter: WhileMatchFilter for expr %s", this.required.toString()));

Expand Down Expand Up @@ -233,7 +239,7 @@ public CompoundExpression(boolean reqAll) {
this.oper = FilterList.Operator.MUST_PASS_ONE;
}

public Filter getFilter(EntityMetadata.EntityInfo entityInfo) throws HBaseException {
public Filter getFilter(EntityInfo entityInfo) throws HBaseException {
FilterList newFilter = new FilterList(this.oper, new ArrayList<Filter>());
for (Expression expr : this.subconditions) {
newFilter.addFilter(expr.getFilter(entityInfo));
Expand Down
3 changes: 2 additions & 1 deletion src/java/meetup/beeno/EntityIndexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.List;
import java.util.Map;

import meetup.beeno.mapping.IndexMapping;
import meetup.beeno.util.HUtil;
import meetup.beeno.util.PBUtil;

Expand Down Expand Up @@ -42,7 +43,7 @@ public class EntityIndexer {
private boolean invertDate = false;
private List<HUtil.HCol> extraFields;

public EntityIndexer(EntityMetadata.IndexMapping mapping) {
public EntityIndexer(IndexMapping mapping) {
this.indexTable = mapping.getTableName();
this.primaryField = new HUtil.HCol(mapping.getPrimaryField().getFamily(),
mapping.getPrimaryField().getColumn());
Expand Down
Loading

0 comments on commit 03b1966

Please sign in to comment.