Package de.iritgo.aktera.persist

Examples of de.iritgo.aktera.persist.Relation


  }

  public final Set getDetailNames()
  {
    HashSet subSet = new HashSet();
    Relation oneRelation = null;
    String oneName = null;

    for (Iterator i = relations.keySet().iterator(); i.hasNext();)
    {
      oneName = (String) i.next();
      oneRelation = (Relation) relations.get(oneName);

      if (oneRelation.getType() == Relation.DETAIL)
      {
        subSet.add(oneName);
      }
    }
View Full Code Here


  }

  public List getDetails(String detailName) throws PersistenceException
  {
    PersistentMetaData pmd = getMetaData();
    Relation r = pmd.getRelation(detailName);

    if (r == null)
    {
      throw new PersistenceException("No such relation as '" + detailName + "'");
    }

    if (r.getType() != Relation.DETAIL)
    {
      throw new PersistenceException("Relation '" + detailName + "' is not a detail relation");
    }

    String toPersistent = r.getToPersistent();
    Persistent detList = myFactory.create(toPersistent);
    String oneFieldName = null;
    String oneFromFieldName = null;
    Iterator fromFields = r.getFromFields().iterator();

    for (Iterator i = r.getToFields().iterator(); i.hasNext();)
    {
      oneFieldName = (String) i.next();
      oneFromFieldName = (String) fromFields.next();
      detList.setField(oneFieldName, getField(oneFromFieldName));
    }
View Full Code Here

    for (Iterator ee = myMetaData.getDetailNames().iterator(); ee.hasNext();)
    {
      oneDet = (String) ee.next();

      Relation oneDetRelation = myMetaData.getRelation(oneDet);
      Persistent detailObj = null;

      try
      {
        detailObj = getFactory().create(oneDetRelation.getToPersistent());
      }
      catch (Exception e)
      {
        throw new PersistenceException("Unable to instantiate " + "detail db object '"
                + oneDetRelation.getToPersistent() + "'", e);
      }

      if (currentTransaction != null)
      {
        detailObj.setTransaction(currentTransaction);
      }

      if (! detailObj.allowed(Persistent.DELETE))
      {
        throw new PersistenceException("Delete of '" + oneDetRelation.getToPersistent() + "' not allowed");
      }

      Iterator stkLocal = oneDetRelation.getFromFields().iterator();
      Iterator stkForeign = oneDetRelation.getToFields().iterator();

      while (stkLocal.hasNext())
      {
        String localField = (String) stkLocal.next();
        String foreignField = (String) stkForeign.next();
View Full Code Here

TOP

Related Classes of de.iritgo.aktera.persist.Relation

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.