private boolean isProjected(Path field,Projection p) { switch(p.getFieldInclusion(field)) { case explicit_inclusion: case implicit_inclusion:return true; default: return false; } }
/** * Returns true if field inclusion is explicit. * * @param field the path to check * @return */ private boolean isProjected(Path field) { LOGGER.debug("Checking if {} is explicitly projected", field); for (Projection p : projections) { Projection.Inclusion inc=p.getFieldInclusion(field); if(inc==Projection.Inclusion.explicit_inclusion) return true; } return false; }
/** * Determines if the field is included in this projection * * @param field The absolute name of the field * * If the field name contains array indexes, they are converted to '*' * before evaluation. */ public Inclusion getFieldInclusion(Path field) { LOGGER.debug("Checking if {} is projected", field); Inclusion ret=getFieldInclusion(field, Path.EMPTY); LOGGER.debug("Inclusion {}={}",field,ret); return ret; }
/** * Determines if the field is included in this projection * * @param field The absolute name of the field * * If the field name contains array indexes, they are converted to '*' * before evaluation. */ public Inclusion getFieldInclusion(Path field) { LOGGER.debug("Checking if {} is projected", field); Inclusion ret=getFieldInclusion(field, Path.EMPTY); LOGGER.debug("Inclusion {}={}",field,ret); return ret; }
/** * Determine if the field is explicitly included/excluded, implicitly * included, or the projection does not decide on the field. */ public Inclusion getFieldInclusion(Path field, Path ctx) { Path mfield = toMask(field); ctx = toMask(ctx); if (this instanceof FieldProjection) { return getFieldInclusion(mfield, (FieldProjection) this, ctx); } else if (this instanceof ArrayProjection) { return getFieldInclusion(mfield, (ArrayProjection) this, ctx); } else if (this instanceof ProjectionList) { return getFieldInclusion(mfield, (ProjectionList) this, ctx); } return Inclusion.undecided; }
/** * Returns true if field inclusion is explicit. * * @param field the path to check * @return */ private boolean isProjected(Path field) { LOGGER.debug("Checking if {} is explicitly projected", field); for (Projection p : projections) { Projection.Inclusion inc = p.getFieldInclusion(field); if (inc == Projection.Inclusion.explicit_inclusion) { LOGGER.debug("{} is explicitly projected by {}", field, p); return true; } else { LOGGER.debug("{} is not projected by {}", field,p); } } return false; }
/** * Determine if the field is explicitly included/excluded, implicitly * included, or the projection does not decide on the field. */ public Inclusion getFieldInclusion(Path field, Path ctx) { Path mfield = toMask(field); ctx = toMask(ctx); if (this instanceof FieldProjection) { return getFieldInclusion(mfield, (FieldProjection) this, ctx); } else if (this instanceof ArrayProjection) { return getFieldInclusion(mfield, (ArrayProjection) this, ctx); } else if (this instanceof ProjectionList) { return getFieldInclusion(mfield, (ProjectionList) this, ctx); } return Inclusion.undecided; }
/** * Returns true if field inclusion is explicit. * * @param field the path to check * @return */ private boolean isProjected(Path field) { LOGGER.debug("Checking if {} is explicitly projected", field); for (Projection p : projections) { Projection.Inclusion inc = p.getFieldInclusion(field); if (inc == Projection.Inclusion.explicit_inclusion) { LOGGER.debug("{} is explicitly projected by {}", field, p); return true; } else { LOGGER.debug("{} is not projected by {}", field,p); } } return false; }
Inclusion ret = itemsItr.previous().getFieldInclusion(field, context); if (ret != Inclusion.undecided) {
Inclusion ret = itemsItr.previous().getFieldInclusion(field, context); if (ret != Inclusion.undecided) {
private Inclusion getFieldInclusion(Path field, ArrayProjection p, Path context) { Path absField = new Path(context, toMask(p.getField())); LOGGER.debug("Checking if array projection on {} projects {}", absField, field); Inclusion inc = isFieldIncluded(field, absField, p.isInclude(), false); Inclusion inc2 = p.getProject().getFieldInclusion(field, new Path(absField, Path.ANYPATH)); Inclusion ret; if (inc == Inclusion.explicit_inclusion || inc2 == Inclusion.explicit_inclusion) { ret = Inclusion.explicit_inclusion; } else if (inc == Inclusion.implicit_inclusion || inc2 == Inclusion.implicit_inclusion) { ret = Inclusion.implicit_inclusion; } else if (inc == Inclusion.explicit_exclusion || inc2 == Inclusion.explicit_exclusion) { ret = Inclusion.explicit_exclusion; } else if (inc == Inclusion.implicit_exclusion || inc2 == Inclusion.implicit_exclusion) { ret = Inclusion.implicit_exclusion; } else { ret = Inclusion.undecided; } LOGGER.debug("array projection on {} projects {}: {}", absField, field, ret); return ret; }
ctx = toMask(ctx); if (this instanceof FieldProjection) { switch (getFieldInclusion(mfield, (FieldProjection) this, ctx)) { case implicit_inclusion: case explicit_inclusion: if (getFieldInclusion(mfield, (ArrayProjection) this, ctx) == Inclusion.undecided) { LOGGER.debug("whether to include {} is Undecided, checking projection query", mfield); Path absField = new Path(ctx, toMask(((ArrayQueryMatchProjection) this).getField())); return getFieldInclusion(mfield, (ArrayProjection) this, ctx) != Inclusion.undecided; } else if (this instanceof ProjectionList) { for (Projection x : ((ProjectionList) this).getItems()) {
private Inclusion getFieldInclusion(Path field, ArrayProjection p, Path context) { Path absField = new Path(context, toMask(p.getField())); LOGGER.debug("Checking if array projection on {} projects {}", absField, field); Inclusion inc = isFieldIncluded(field, absField, p.isInclude(), false); Inclusion inc2 = p.getProject().getFieldInclusion(field, new Path(absField, Path.ANYPATH)); Inclusion ret; if (inc == Inclusion.explicit_inclusion || inc2 == Inclusion.explicit_inclusion) { ret = Inclusion.explicit_inclusion; } else if (inc == Inclusion.implicit_inclusion || inc2 == Inclusion.implicit_inclusion) { ret = Inclusion.implicit_inclusion; } else if (inc == Inclusion.explicit_exclusion || inc2 == Inclusion.explicit_exclusion) { ret = Inclusion.explicit_exclusion; } else if (inc == Inclusion.implicit_exclusion || inc2 == Inclusion.implicit_exclusion) { ret = Inclusion.implicit_exclusion; } else { ret = Inclusion.undecided; } LOGGER.debug("array projection on {} projects {}: {}", absField, field, ret); return ret; }
ctx = toMask(ctx); if (this instanceof FieldProjection) { switch (getFieldInclusion(mfield, (FieldProjection) this, ctx)) { case implicit_inclusion: case explicit_inclusion: if (getFieldInclusion(mfield, (ArrayProjection) this, ctx) == Inclusion.undecided) { LOGGER.debug("whether to include {} is Undecided, checking projection query", mfield); Path absField = new Path(ctx, toMask(((ArrayQueryMatchProjection) this).getField())); return getFieldInclusion(mfield, (ArrayProjection) this, ctx) != Inclusion.undecided; } else if (this instanceof ProjectionList) { for (Projection x : ((ProjectionList) this).getItems()) {