Package org.objectweb.speedo.api

Examples of org.objectweb.speedo.api.SpeedoException


      if (oldse != null) {
        //The extension already exist on the SpeedoField
        if ((se.value == null && oldse.value!= null)
          || se.value != null && !se.value.equals(oldse.value)) {
          //different value ==> exception
          throw new SpeedoException(
            "Duplicate extension declaration without the same value: extension name='"
            + se.key + "', field name='" + sf.name
            + "' in the class '" + sf.moClass.getFQName()
            + "' in the jdo file " + sf.moClass.getXMLFileName()
            + "'");
View Full Code Here


        if (sf.reverseField == null) {
            return;
        }
        SpeedoField reverse = sf.getReverseField();
        if (reverse == null) {
            throw new SpeedoException("No reverse field '" + sf.reverseField
                    + "' found for the " + sf.getSourceDesc());
        }
        if (reverse.reverseField == null) {
            //fill the info about the current field on its reverse
            reverse.reverseField = sf.name;
            reverse.isCoherentReverseField = sf.isCoherentReverseField;
        } else if (!reverse.reverseField.equals(sf.name)) {
            throw new SpeedoException("Incoherent reverse field between the "
                    + sf.getSourceDesc() + " and the "
                    + reverse.getSourceDesc());
        }

        // compute relationType
View Full Code Here

        SpeedoField sf = (SpeedoField) se.owner;
        sf.reverseField = se.value;
        sf.isCoherentReverseField = true;
        SpeedoField reverse = sf.getReverseField();
        if (reverse == null) {
            throw new SpeedoException("No reverse field '" + sf.reverseField
                    + "' found for the " + sf.getSourceDesc());
        }
        checkExtension(sf, reverse,
                SpeedoProperties.TARGET_FK, SpeedoProperties.SOURCE_FK);
        checkExtension(sf, reverse,
View Full Code Here

            se2 = new SpeedoExtension(SpeedoProperties.VENDOR_NAME, ext2, se1.value, reverse);
            reverse.addExtension(se2);
            logger.log(BasicLevel.DEBUG, "add the extension(" + ext2
                    + ", " + se1.value +") on the " + reverse.getSourceDesc());
        } else if (!se2.value.equals(se1.value)) {
            throw new SpeedoException(
                    "A bad mapping has been specified on the reverse "
                    + reverse.getSourceDesc() + "' with regards to the "
                    + sf.getSourceDesc());
        } else if (debug) {
            SpeedoClass sc1 = sf.moClass;
View Full Code Here

        if (nd.isFieldName()) {
            //The identifier of the class is based on a single field
            PrimitiveElement pe = (PrimitiveElement) clazz.getTypedElement(nd
                    .getFieldName());
            if (pe == null) {
                throw new SpeedoException(
                        "impossible to map the fields of the namedef of the metaobject '"
                                + JormPathHelper.getPath(clazz) + "'.");
            }
            SpeedoField sf = sc.getField(pe.getName());
            if (sf == null) {
                // The single field used as identifier is not a visible
                // persistent field
                if (sc.identity.columns != null
                        && sc.identity.columns.length == 1
                        && sc.identity.columns[0] != null
                        && sc.identity.columns[0].column != null
                        && sc.identity.columns[0].column.name != null) {
                    // the column name of the hidden identity field has been
                    // specified
                    createFieldMapping(pe,
                            sc.identity.columns[0].column.name,
                            sc.identity.columns[0].column.sqlType,
                            rcm.getMainRdbTable(),
                            null);
                } else {
                    // No column name specified
                    createFieldMapping(pe, (SpeedoCommonField) null, cm);
                }
            }
        } else {
            // The identifier of the persistent class is based on several
            // persistent field.
            Collection c = nd.getNameRef().getProjection().values();
            int i = 0;
            for (Iterator it = c.iterator(); it.hasNext();) {
                PrimitiveElement pe = (PrimitiveElement) clazz
                        .getTypedElement((String) it.next());
                if (pe == null) {
                    throw new SpeedoException(
                            "impossible to map the fields of the namedef of the metaobject '"
                                    + JormPathHelper.getPath(clazz) + "'.");
                }
                //find the corresponding Speedo meta object.
                SpeedoField sf = sc.getField(pe.getName());
View Full Code Here

            t = rcm.getMainRdbTable();
        } else {
            //find the column corresponding to the primitive field
            SpeedoColumn[] cols = sf.columns;
            if (cols == null || cols.length == 0) {
                throw new SpeedoException("No column defined for the "
                        + sf.getSourceDesc());
            }
            if (cols.length > 1) {
                throw new SpeedoException("More than one column for the "
                        + sf.getSourceDesc());
            }
            SpeedoColumn col = cols[0];
            colName = col.name;
            colType = col.sqlType;
View Full Code Here

            SpeedoField sf,
            GenClassMapping gcm) throws PException, SpeedoException {
        //find the column corresponding to the generic class element
        SpeedoColumn[] cols = sf.columns;
        if (cols == null || cols.length == 0) {
            throw new SpeedoException(
                    "No column defined for the element of the "
                            + sf.getSourceDesc());
        }
        if (cols.length > 1) {
            throw new SpeedoException(
                    "More than one column for the element of the "
                            + sf.getSourceDesc());
        }
        return createFieldMapping(pe, cols[0].name, cols[0].sqlType,
                ((RdbGenClassMapping) gcm).getRdbTable(), null);
View Full Code Here

      return;
    }
    //Search the key field
    SpeedoField keyfield = sf.getFieldOfTheReferencedClass(se.value);
    if (keyfield == null) {
      throw new SpeedoException("No key field '" + se.value
                    + "' found for the" + sf.getSourceDesc());
    }
    SpeedoMap sm = (SpeedoMap) sf.jdoTuple;
    if (sm.keyType != null && ((String) sm.keyType).length() > 0) {
      //check the key field type and the
      if (keyfield.type().equalsIgnoreCase((String) sm.keyType)) {
                throw new SpeedoException("Bad type for the key field '" + se.value
                        + "' found for the" + sf.getSourceDesc());
      }
    } else {
      //specify the map key type from the keyField type
      sm.keyType = keyfield.type();
View Full Code Here

                        if (sd == null) {
                            current = current.getSuper();
                        }
                    }
                    if (sd == null || !sd.hasDiscriminator()) {
                        throw new SpeedoException("Extension '"
                                + INHERITANCE_KEY
                                + "' specified without filter definition in the "
                                + sc.getSourceDesc());
                    }
                }
View Full Code Here

        } else {
          logger.log(BasicLevel.ERROR, "Abort EJB enhancement: " + nbErrors
              + " errors found while parsing Entity classes defined in '"
              + ((SpeedoXMLDescriptor) xmldesc).xmlFile + "'.");
        }
        throw new SpeedoException("EJB parsing error.");
      }     
    }
  }
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.api.SpeedoException

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.