Tabnine Logo
Projection
Code IndexAdd Tabnine to your IDE (free)

How to use
Projection
in
com.redhat.lightblue.query

Best Java code snippets using com.redhat.lightblue.query.Projection (Showing top 20 results out of 315)

origin: com.redhat.lightblue/metadata

@Override
public Projection parseProjection(JsonNode object) {
  return object == null ? null : Projection.fromJson(object);
}
origin: com.redhat.lightblue/metadata

@Override
public void putProjection(JsonNode object,String name,Projection p) {
  if(p!=null)
    ((ObjectNode)object).put(name,p.toJson());
}

origin: org.esbtools.lightblue-notification-hook/lightblue-notification-hook

private boolean isProjected(Path field,Projection p) {
  switch(p.getFieldInclusion(field)) {
  case explicit_inclusion:
  case implicit_inclusion:return true;
  default: return false;
  }
}
origin: com.redhat.lightblue/lightblue-core-query-api

/**
 * 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;
}
origin: com.redhat.lightblue/lightblue-core-query-api

Path mfield = toMask(field);
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()));
    Path nestedCtx = new Path(absField, Path.ANYPATH);
    boolean ret = ((ArrayQueryMatchProjection) this).getMatch().isRequired(field, nestedCtx);
      ret = ((ArrayProjection) this).getProject().isFieldRequiredToEvaluateProjection(field, nestedCtx);
  return getFieldInclusion(mfield, (ArrayProjection) this, ctx) != Inclusion.undecided;
} else if (this instanceof ProjectionList) {
  for (Projection x : ((ProjectionList) this).getItems()) {
    if (x.isFieldRequiredToEvaluateProjection(field, ctx)) {
      return true;
origin: com.redhat.lightblue/lightblue-core-query-api

/**
 * Returns true if the field is needed to evaluate the projection
 */
public boolean isFieldRequiredToEvaluateProjection(Path field) {
  LOGGER.debug("Checking if {} is referenced in projection", field);
  return isFieldRequiredToEvaluateProjection(field, Path.EMPTY);
}
origin: com.redhat.lightblue/lightblue-core-query-api

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;
}
origin: org.esbtools.lightblue-notification-hook/lightblue-notification-hook

private Projection addArrayIdentities(Projection p,EntityMetadata md) {
  // If an array is included in the projection, make sure its identity is also included
  Map<Path,List<Path>> arrayIdentities=md.getEntitySchema().getArrayIdentities();
  List<Projection> addFields=new ArrayList<>();
  for(Map.Entry<Path,List<Path>> entry:arrayIdentities.entrySet()) {
    Path array=entry.getKey();
    List<Path> identities=new ArrayList<>();
    for(Path x:entry.getValue())
      identities.add(new Path(array,new Path(Path.ANYPATH,x)));
    
    if(isProjected(array,p)) {
      for(Path id:identities) {
        if(!isProjected(id,p)) {
          addFields.add(new FieldProjection(id,true,true));
        }
      }
    }
  }
  if(!addFields.isEmpty()) {
    LOGGER.debug("Excluded array identities are added to projection:{}",addFields);
    // Need to first add the original projection, then the included fields.
    // This is order sensitive
    return Projection.add(p,new ProjectionList(addFields));
  } else
    return p;
}

origin: com.redhat.lightblue/lightblue-core-crud

public JsonNodeBuilder add(String key, Projection value) {
  if (include(value)) {
    getRoot().put(key, value.toString());
  }
  return this;
}
origin: lightblue-platform/lightblue-core

Path mfield = toMask(field);
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()));
    Path nestedCtx = new Path(absField, Path.ANYPATH);
    boolean ret = ((ArrayQueryMatchProjection) this).getMatch().isRequired(field, nestedCtx);
      ret = ((ArrayProjection) this).getProject().isFieldRequiredToEvaluateProjection(field, nestedCtx);
  return getFieldInclusion(mfield, (ArrayProjection) this, ctx) != Inclusion.undecided;
} else if (this instanceof ProjectionList) {
  for (Projection x : ((ProjectionList) this).getItems()) {
    if (x.isFieldRequiredToEvaluateProjection(field, ctx)) {
      return true;
origin: lightblue-platform/lightblue-core

/**
 * Returns true if the field is needed to evaluate the projection
 */
public boolean isFieldRequiredToEvaluateProjection(Path field) {
  LOGGER.debug("Checking if {} is referenced in projection", field);
  return isFieldRequiredToEvaluateProjection(field, Path.EMPTY);
}
origin: lightblue-platform/lightblue-core

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;
}
origin: com.redhat.lightblue.mongo/lightblue-mongo

DBCollection collection = db.getCollection(store.getCollectionName());
Projection combinedProjection = Projection.add(projection, roleEval.getExcludedFields(FieldAccessRoleEvaluator.Operation.find));
origin: lightblue-platform/lightblue-core

/**
 * 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;
}
origin: com.redhat.lightblue/crud

public JsonNodeBuilder add(String key, Projection value) {
  if (include(value)) {
    getRoot().put(key, value.toString());
  }
  return this;
}
origin: com.redhat.lightblue/lightblue-core-metadata

@Override
public void putProjection(JsonNode object, String name, Projection p) {
  if (p != null) {
    ((ObjectNode) object).set(name, p.toJson());
  }
}
origin: lightblue-platform/lightblue-core

@Override
public Projection getProjection(JsonNode object, String name) {
  JsonNode node = object.get(name);
  return node == null ? null : Projection.fromJson(node);
}
origin: com.redhat.lightblue/metadata

/**
 * 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;
}
origin: com.redhat.lightblue.mongo/lightblue-mongo-crud

  (node instanceof ArrayElement)) {
} else if( (p!=null && p.isFieldRequiredToEvaluateProjection(field)) ||
      (q!=null && q.isRequired(field)) ||
      (s!=null && s.isRequired(field)) ) {
origin: com.redhat.lightblue.mongo/lightblue-mongo-crud

DBCollection collection = db.getCollection(store.getCollectionName());
Projection combinedProjection = Projection.add(projection, roleEval.getExcludedFields(FieldAccessRoleEvaluator.Operation.find));
com.redhat.lightblue.queryProjection

Javadoc

Base class for all projection objects

Most used methods

  • fromJson
  • toJson
  • getFieldInclusion
    Determine if the field is explicitly included/excluded, implicitly included, or the projection does
  • isFieldRequiredToEvaluateProjection
    Returns true if the field is needed to evaluate the projection
  • add
    Adds two projections and returns a new projection containing both. Any projection can be null. If th
  • toString
  • fieldAncestorOfPattern
    If the field is an ancestor of the pattern, and if inclusion is true, returns true. Otherwise, retur
  • fieldMatchesPattern
    Returns whether to include/exclude the field based on whether the field matches the pattern
  • impliedInclusion
    Returns if the field should be included based on the recursive pattern.
  • isFieldIncluded
    Returns if the field should be included based on the pattern given.
  • toMask
    If a path includes array indexes, change the indexes into ANY
  • toMask

Popular in Java

  • Reading from database using SQL prepared statement
  • setContentView (Activity)
  • compareTo (BigDecimal)
  • getContentResolver (Context)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Option (scala)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now