Package org.xorm

Examples of org.xorm.ClassMapping


     * and sets the Type field to the correct class.
     */
    public boolean visitFieldAccess(Expression.FieldAccess exp) {
  if (exp == Expression.FieldAccess.THIS) { return true; }
        Expression owner = exp.getOwner();
        ClassMapping mapping;
        if (owner != Expression.FieldAccess.THIS) {
            owner.accept(this);
            mapping = getModelMapping()
                .getClassMapping(exp.getOwner().getType());
        } else {
            mapping = getModelMapping()
                .getClassMapping(query.getCandidateClass());
        }
        //System.out.println("Setting type of field " + exp.getName() + " to " + mapping.getFieldDescriptor(exp.getName()).type + " using mapping for " + mapping.getMappedClass());
        exp.setType(mapping.getFieldDescriptor(exp.getName()).type);
        return true;
    }
View Full Code Here


        return query.getExpression();
    }

    private Object getCollectionProxy(BoundExpression bound) {
        FetchGroupManager fgm = XORM.getFetchGroupManager(mgr);
        ClassMapping mapping = XORM.getModelMapping(mgr).getClassMapping(query.getCandidateClass());
        Selector selector = bound.getSelector();
        selector.require(fgm.getDataFetchGroup(mapping));
        CollectionProxy cp = new CollectionProxy(mgr, mapping, selector);
        openResults.add(cp);
        return cp;
View Full Code Here

            String fieldToken;
      FieldDescriptor fd;
      Selector firstSelector = null, currentSelector = null;
     
      while (modelMapping.isManagedType(currentClass)) {
    ClassMapping currentClassMapping = modelMapping.getClassMapping(currentClass);
   
    Selector nextSelector = new Selector(currentClassMapping.getTable(), null);
    if (currentSelector != null) {
        Condition condition = new SimpleCondition
      (column, Operator.EQUAL, nextSelector);
        currentSelector.setCondition(condition);
    } else {
        firstSelector = nextSelector;
    }
    currentSelector = nextSelector;

    if (!tok.hasMoreTokens()) {
        throw new JDOUserException(I18N.msg("E_ordering"));
    }
    fieldToken = tok.nextToken();
    fd = currentClassMapping.getFieldDescriptor(fieldToken);
    if (fd == null) {
        throw new JDOUserException(I18N.msg("E_unmapped_field", fieldToken));
    }
    column = currentClassMapping.getColumn(fieldToken);
    currentClass = fd.type;
      }

      top.merge(firstSelector, Operator.ANDC);
View Full Code Here

    }

    // Convert DataQuery to Selector
    private Selector makeSelector(DataQuery dataQuery) {
  Class targetClass = dataQuery.getCandidateClass();
  ClassMapping mapping = modelMapping.getClassMapping(targetClass);
  Table table = mapping.getTable();
  Condition dataCondition = dataQuery.getCondition();
  if (dataCondition instanceof RawCondition) {
      // Resolve parameters
      dataCondition = makeRawCondition((RawCondition) dataCondition);
  }
View Full Code Here

      if (valueMode) {
    // Introspect on lastValue (which should be a JDO object)
    InterfaceInvocationHandler handler = InterfaceInvocationHandler.getHandler(lastValue);
    Class returnType = exp.getType();
    ClassMapping returnTypeMapping = null;
    if (ClassMapping.isUserType(returnType)) {
        returnTypeMapping = modelMapping.getClassMapping(returnType);
    }
    lastValue = handler.invokeGet(exp.getName(), returnTypeMapping, exp.getType());
      } else {
View Full Code Here

    private void checkJoin(Expression owner) {
  if (lastRelationship != null) {
      // Ex. x.y; lastColumn = x
      // generate x_id = x.x_id
      ClassMapping nextMapping = modelMapping.getClassMapping(owner.getType());
      Selector se = new Selector(nextMapping.getTable(), null);
      SimpleCondition join = new SimpleCondition
    (mapping.getColumn(((Expression.Symbolic) owner).getName()),
     Operator.EQUAL, se);
      selector.setCondition(join);
      selector = se;
View Full Code Here

    return true;
      }

      String field = ((Expression.Member) owner).getName();
      RelationshipMapping rm = mapping.getRelationship(field);
      ClassMapping targetMapping = modelMapping.getClassMapping
    (rm.getSource().getElementClass());
      Selector s = null;
      Selector old = selector;
      if (operand instanceof Expression.Variable) {
    // This field is really the variable, using targetMapping
    selector = new Selector(targetMapping.getTable(),
          null);
      } else if (operand instanceof Expression.Parameter) {
    if (param != null) {
        param = XORM.extractPrimaryKey(JDOHelper.getObjectId(param));
    }
View Full Code Here

TOP

Related Classes of org.xorm.ClassMapping

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.