Package org.objectweb.speedo.metadata

Examples of org.objectweb.speedo.metadata.SpeedoClass


            for (Iterator fieldIt = sc.fields.values().iterator(); fieldIt.hasNext();) {
                SpeedoField sf = (SpeedoField) fieldIt.next();
                if (sf.jdoTuple != null) {
                    references.add(sf);
                } else {
                    SpeedoClass rclass = sf.getReferencedClass();
                    if (rclass == null) {
                        primitiveFields.add(sf);
                    } else {
                        references.add(sf);
                    }
View Full Code Here


      sc.setSuperClassName(null);
      super.visitClass(sc);
      return;
    }
    //Always use the fully qualified name
    SpeedoClass supersc = sc.getSpeedoClassFromContext(sc.getSuperClassName());
    sc.setSuperClassName(supersc.getFQName());
    if (debug) {
      logger.log(BasicLevel.DEBUG, "class " + sc.getFQName()
          + " extends " + sc.getSuperClassName());
    }
    SpeedoExtension se = sc.getExtensionByKey(INHERITANCE_MAPPING);
    if (se == null) {
      se = new SpeedoExtension(VENDOR_NAME,
          INHERITANCE_MAPPING,
          DEFAULT_INHERITANCE_MAPPING, sc);
      sc.addExtension(se);
    }
    //Assign identifier information to all familly member
    List family = new ArrayList();
    getFamily(sc, family);
    SpeedoClass ancestor = (SpeedoClass) family.get(0);
    List extensions = findExtensions(ancestor, new String[] {
      ID, SQL_SEQ_ALLOCATOR, SQL_SEQ_CACHE, SQL_SEQ_INC, SQL_SEQ_NAME,
      SQL_SEQ_START});
    boolean detachable = ancestor.isDetachable;
    SpeedoIdentity currentIdentity = ancestor.identity;
    for(int i=1; i<family.size(); i++) {
      SpeedoClass anAncestor = (SpeedoClass) family.get(i);
      SpeedoNoFieldColumn[] cols = null;
      if (anAncestor.identity != null) {
          cols = anAncestor.identity.columns;
      }
            if (cols != null) {
View Full Code Here

  private void getFamily(SpeedoClass sc, List result) {
    result.add(0, sc);
    if (sc.getSuperClassName() == null) {
      return;
    }
    SpeedoClass supersc = sc.getSpeedoClassFromContext(sc.getSuperClassName());
    getFamily(supersc, result);
  }
View Full Code Here

            return;
        }

        //check that the extension REVERSE_FIELD is specified for a SpeedoField
        if (!(se.owner instanceof SpeedoField)) {
            SpeedoClass sc = getSpeedoClass(se.owner);
            logger.log(BasicLevel.ERROR, "You have specified the reverse field ('"
                    + se.value + "') in other thing than a field tag ('"
                    + se.owner.toString() + "')" +
                    (sc == null
                    ? ""
                    : " in class '" + sc.getFQName() + "' of the descriptor '"
                    + sc.moPackage.xmlDescriptor.xmlFile));
            super.visitExtension(se);
            return;
        }
View Full Code Here

            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;
            SpeedoClass sc2 = reverse.moClass;
            logger.log(BasicLevel.DEBUG, "You could remove one of the following extensions:"
                    + "\n- .jdo: '" + sc1.moPackage.xmlDescriptor.xmlFile
                    + "', class: '" + sc1.getFQName()
                    + "', field: '" + sf.name
                    + "',  extension: '" + ext1 + "'"

                    + "\n- .jdo: '" + sc2.moPackage.xmlDescriptor.xmlFile
                    + "', class: '" + sc2.getFQName()
                    + "', field: '" + reverse.name
                    + "',  extension: '" + ext2 + "'"
                    );
        }
    }
View Full Code Here

        sp.name = pac;
        sp.xmlDescriptor = (SpeedoXMLDescriptor) o;
                ((SpeedoXMLDescriptor) o).packages.put(pac, sp);
                logger.log(BasicLevel.DEBUG, "New package: name= " + pac);
          }
          SpeedoClass sc = new SpeedoClass();
          sc.name = sc.nameForQuery = cn;
          sc.moPackage = sp;
          sp.classes.put(cn, sc);
            logger.log(BasicLevel.DEBUG, "New class: name= " + cn + " in the package=" + pac);
          treatClassNode(sc);
View Full Code Here

    private SpeedoDiscriminator getDiscriminatorFromParent(SpeedoClass sc) throws SpeedoException {
        if (sc.inheritance == null) {
            return null;
        }
        SpeedoDiscriminator sd = sc.inheritance.discriminator;
        SpeedoClass parent = sc.getSuper();
        if (parent == null) {
            // sc is the root of the tree
            if (sd != null) {
                checkColumn(sc, sd);
                if (sd.strategy == SpeedoDiscriminator.STRATEGY_CLASS_NAME) {
View Full Code Here

                ruleName = RdbClassMapping.REMAP_FIELDS_TO_NEW_STRUCTURES;
            } else if (sc.inheritance.isVerticalMapping()) {
                ruleName = RdbClassMapping.MAP_NEW_FIELDS_TO_ADDED_STRUCTURES;
                //TODO: link the main table to the one of the parent
            }
            SpeedoClass parent = sc.getSpeedoClassFromContext(sc
                    .getSuperClassName());
            rcm.createParentClassMapping(ruleName, sc.jormclass
                    .getSuperClass(parent.getFQName()));
            //Add inter dependencies between the parent and its child
            if (debug) {
                logger.log(BasicLevel.DEBUG, "Add dependencies between "
                        + parent.getFQName() + " and " + sc.getFQName());
            }
            rcm.addDependency(parent.getFQName());
            getClassMapping(mapping, parent.jormclass).addDependency(
                    sc.getFQName());
        }
        return rcm;
    }
View Full Code Here

    public void createClassRefNameDefMapping(
            ClassMapping cm,
            NameDef nd,
            SpeedoCommonField sf) throws PException, SpeedoException {
        RdbClassMultiMapping rcm = (RdbClassMultiMapping) cm;
        SpeedoClass tclass = null;
        if (sf instanceof SpeedoField) {
            tclass = ((SpeedoField) sf).getReferencedClass();
        } else if (sf instanceof SpeedoInheritedField) {
            tclass = ((SpeedoInheritedField) sf).inheritedField.getReferencedClass();
        }
View Full Code Here

        GenClassRef gcr = (GenClassRef) gcm.getLinkedMO();
        if (nd.isFieldName()) {
            createPEMInGC(gcr.getHiddenField(nd.getFieldName()),
                    sf.columns[0], table, nd, null);
        } else {
            SpeedoClass tclass = sf.getReferencedClass();
            RdbClassMultiMapping trcm = getClassMapping(
                    (Mapping) gcm.getParent(), tclass.jormclass);
            NameDef tnd = (NameDef) trcm.getIdentifierMapping().getLinkedMO();
            Map tndproj = tnd.getNameRef().getProjection();
            Iterator it = nd.getNameRef().getProjection().entrySet()
View Full Code Here

TOP

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

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.