Package org.objectweb.speedo.metadata

Examples of org.objectweb.speedo.metadata.SpeedoField


    private void defineGenClassNameDef(NameDef nd,
            GenClassRef gcr,
            SpeedoField sf,
            MIBuilderHelper mibh,
            boolean isGCId) throws SpeedoException, PException {
        SpeedoField pkField = sf.moClass.getUniquePKField();
        String prefix = mibh.getNameDefFieldPrefix(gcr, isGCId, isGCId, sf);
        String fn =  prefix + pkField.name;
        if (isGCId) {
          int size = PType.NOSIZE;
          int scale = PType.NOSIZE;
View Full Code Here


            SpeedoClass sc,
            ClassMapping cm,
            MIBuilderHelper mibh,
            JormMIMappingBuilder mb,
            Collection createdMOs) throws SpeedoException, PException {
        SpeedoField pkField = sc.getUniquePKField();
        String fieldName;
    if (pkField == null) {
        if (sc.identity.columns == null) {
            logger.log(BasicLevel.WARN,
                    "No mapping information for the identifier of the class '"
                    + sc.getFQName() +"'.");
              fieldName = ID_FIELD;
        } else {
            fieldName = sc.identity.columns[0].column.name;
        }
            mibh.createNameDefField(jc, fieldName, PTypeSpace.OBJLONG);
        } else {
            String type = pkField.type();
      if (!"java.lang.Long".equals(type) && !"Long".equals(type)
                    && !"long".equals(type)) {
                throw new SpeedoException(
                        "Impossible to use an auto incremented identifier: " +
                        "the field type of '" + pkField.name + "' is '" + pkField.type()
                        + "' and 'java.lang.Long' or long is expected (class '"
                        + sc.getFQName() + "'.");
            }
            fieldName = pkField.name;
        }
View Full Code Here

            SpeedoField sf,
            MIBuilderHelper mibh,
            String prefix) throws SpeedoException, PException {
        SpeedoClass referencedClass = sf.moClass.getSpeedoClassFromContext(
                cr.getMOClass().getFQName());
        SpeedoField pkField = (SpeedoField) referencedClass.getUniquePKField();
        String fieldName = null;
        PType fieldType;
    if (pkField == null) {
            fieldName = ID_FIELD;
            fieldType = PTypeSpace.OBJLONG;
        } else {
            String type = pkField.type();
      if ("java.lang.Long".equals(type) || "Long".equals(type)) {
        fieldType = PTypeSpace.OBJLONG;
      } else if ("long".equals(type)) {
        fieldType = PTypeSpace.LONG;
      } else {
                throw new SpeedoException(
                        "Impossible to use an auto incremented identifier: " +
                        "the field type of '" + pkField.name + "' is '" + pkField.type()
                        + "' and 'java.lang.Long' or long is expected (class '"
                        + pkField.moClass.getFQName() + "'.");
            }
            fieldName = pkField.name;
        }
View Full Code Here

            MIBuilderHelper mibh,
            boolean isGCId) throws SpeedoException, PException {
        //Find the unique pkField in order to get its name and its type
        String fieldName;
        PType fieldType;
        SpeedoField pkField = sf.moClass.getUniquePKField();
        if (isGCId) {
            //create hidden field in the GenClassRef for its identifier
            // the create field has a name built from the GCR name itself
        if (pkField == null) {
            //there is no pk field defined ==> new one
                fieldName = ID_FIELD;
                fieldType = PTypeSpace.OBJLONG;
            } else {
                fieldName = pkField.name;
                //Check the PK field type (Long or long only supported)
                String type = pkField.type();
          if ("java.lang.Long".equals(type) || "Long".equals(type)) {
            fieldType = PTypeSpace.OBJLONG;
          } else if ("long".equals(type)) {
            fieldType = PTypeSpace.LONG;
          } else {
                    throw new SpeedoException(
                            "Impossible to use an auto incremented identifier: " +
                            "the field type of '" + pkField.name + "' is '" + pkField.type()
                            + "' and 'java.lang.Long' or long is expected (class '"
                            + pkField.moClass.getFQName() + "'.");
                }
            }
            String prefix = mibh.getNameDefFieldPrefix(gcr, isGCId, isGCId, sf);
View Full Code Here

    }

    public NamingField[] getNamingfields(SpeedoClass sc) throws PException {
        Iterator it = sc.fields.values().iterator();
        while(it.hasNext()) {
            SpeedoField sf = (SpeedoField) it.next();
            if (sf.primaryKey) {
        java.lang.Class fieldType;
        PType fieldPType;
        if ("java.lang.Long".equals(sf.type()) || "Long".equals(sf.type())) {
          fieldType = Long.class;
          fieldPType = PTypeSpace.OBJLONG;
        } else if ("long".equals(sf.type())) {
          fieldType = Long.TYPE;
          fieldPType = PTypeSpace.LONG;
        } else {
          throw new PException(
              "Impossible to use an auto incremented identifier: " +
              "the field type of '" + sf.name + "' is '" + sf.type()
              + "' and 'java.lang.Long' or 'long' is expected (class '"
              + sc.getFQName() + "'.");
        }
                return new NamingField[] {
                    new NamingField(sf.name, fieldType, "lid", fieldPType)};
View Full Code Here

      //sc.name = ?;
      sc.name2query = new HashMap();
      //sc.noArgConstructorStatus = ?;
      //sc.version = ?;
    } else if (se instanceof SpeedoField) {
      SpeedoField sf = (SpeedoField) se;
      sf.name = null;
      //sf.visibility = ?;
      sf.propagate = SpeedoField.PROPAG_ALL;
      sf.type = null;
      sf.number = -1;
View Full Code Here

    }
    public Object[] getPNameHints2(SpeedoClass sc, NameDef nd) {
        return new Object[]{PNH_NULL_VALUE};
    }
    public NamingManager.NamingField[] getNamingfields(SpeedoClass sc) {
        SpeedoField sf;
        try {
            sf = sc.getUniquePKField();
        } catch (SpeedoException e) {
            sf = null;
        }
View Full Code Here

            ClassMapping cm,
            MIBuilderHelper mibh,
            JormMIMappingBuilder mb,
            Collection createdMOs)
            throws SpeedoException, PException {
    SpeedoField pkField = fetchUniqueLongPKField(sc);
    PrimitiveElement lid;
    String lidname;
    if (pkField == null) {
        if (sc.identity.columns == null) {
            logger.log(BasicLevel.WARN,
View Full Code Here

            SpeedoField sf,
            SpeedoClass currentClass,
            ClassMapping cm,
            MIBuilderHelper mibh,
            JormMIMappingBuilder mb) throws SpeedoException, PException {
        SpeedoField pkfield = sf.moClass.getUniquePKField();
        String fn;
        if (pkfield == null) {
            fn = getHiddenLidFieldName();
        } else {
            fn = pkfield.name;
View Full Code Here

      assignDummyKeyToFamilly(((org.objectweb.jorm.metainfo.api.Class) it.next()), nd);
    }
  }
  private SpeedoField fetchUniqueLongPKField(SpeedoClass tsc) throws SpeedoException {
    Iterator it = tsc.fields.values().iterator();
    SpeedoField sf = null;
    ArrayList al = null;
    while (it.hasNext()) {
      SpeedoField _sf = (SpeedoField) it.next();
      if (_sf.primaryKey) {
        if (sf != null) {
          if (al == null) {
            al = new ArrayList();
          }
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.metadata.SpeedoField

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.