Package de.iritgo.aktera.persist

Examples of de.iritgo.aktera.persist.PersistentMetaData


    return sb.toString();
  }

  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 + "'");
    }
View Full Code Here


      throw new PersistenceException("Name of Persistent must be of the form 'schema.name'" + ":'" + name + "'");
    }

    try
    {
      PersistentMetaData pmd = getMetaData(name);

      /**
       * If this persistent is not instantiated using a custom class...
       */
      if (pmd.getClassName() == null)
      {
        if (pmd.isRowSecurable())
        {
          newPersistent = new RowSecurablePersistent();
        }
        else
        {
          newPersistent = new DefaultPersistent();
        }

        /* We pass our persistent's the same log as the factory... */
        newPersistent.setLogger(log);

        /* And a reference back to their factory, so they can */
        /* access getService, etc */
        newPersistent.setFactory(this);
        newPersistent.setMetaData(pmd);
        newPersistent.setAuthorizationManager(pmd.getAuthManager());

        /* If auth manager bypass is allowed at all for this persistent, */
        /* hand it the default bypass manager */
        if (pmd.isAuthManagerBypassAllowed())
        {
          newPersistent.setBypassAuthorizationManager(getByPassAuthManager());
        }

        return newPersistent;
      }
      else
      {
        Class c = Class.forName(pmd.getClassName());
        Object o = c.newInstance();

        /* If the class we instantiated extends Persistent... */
        if (o instanceof Persistent)
        {
          Persistent p = (Persistent) c.newInstance();

          p.setMetaData(pmd);

          return p;
        }
        else
        {
          /* If it does not, then "wrap" it in a persistent */
          DefaultPersistent np = null;

          if (pmd.isRowSecurable())
          {
            np = new RowSecurablePersistent();
          }
          else
          {
            np = new DefaultPersistent();
          }

          /* We pass our persistent's the same log as the factory... */
          np.setLogger(log);

          /* And a reference back to their factory, so they can */
          /* access getService, etc */
          np.setFactory(this);
          np.setMetaData(pmd);
          np.setAuthorizationManager(pmd.getAuthManager());

          /* If auth manager bypass is allowed at all for this persistent, */
          /* hand it the default bypass manager */
          if (pmd.isAuthManagerBypassAllowed())
          {
            np.setBypassAuthorizationManager(getByPassAuthManager());
          }

          np.setBean(o);
View Full Code Here

      for (int i = 0; i < eachPersistent.length; i++)
      {
        Configuration onePersistent = eachPersistent[i];
        String persistentName = onePersistent.getAttribute("name");
        PersistentMetaData pmd = getMetaData(schema + "." + persistentName);

        databaseType.createTable(pmd, dataSource);

        /* Now look for default data */
        Configuration[] children = eachPersistent[i].getChildren();
View Full Code Here

      for (int i = 0; i < eachPersistent.length; i++)
      {
        Configuration onePersistent = eachPersistent[i];
        String persistentName = onePersistent.getAttribute("name");
        PersistentMetaData pmd = getMetaData(schema + "." + persistentName);

        databaseType.createIndices(pmd, dataSource);
      }
    }
    catch (Exception ce)
View Full Code Here

      for (int i = 0; i < eachPersistent.length; i++)
      {
        Configuration onePersistent = eachPersistent[i];
        String persistentName = onePersistent.getAttribute("name");
        PersistentMetaData pmd = getMetaData(schema + "." + persistentName);

        databaseType.dropIndices(pmd, dataSource);
      }
    }
    catch (Exception ce)
View Full Code Here

  public static BasicDynaClass getInstance(Persistent pe)
  {
    try
    {
      PersistentMetaData pmd = pe.getMetaData();
      int propCount = 0;
      DynaProperty[] props = new DynaProperty[pmd.getFieldNames().size()];
      String oneFieldName = null;
      int oneType;

      for (Iterator ef = pmd.getFieldNames().iterator(); ef.hasNext();)
      {
        oneFieldName = (String) ef.next();
        oneType = JDBCDatabaseType.stringToType(pmd.getType(oneFieldName));

        String typeClass = "java.lang.Object";

        switch (oneType)
        {
View Full Code Here

    super(PersistentDynaClassFactory.getInstance(pe));
  }

  public void setPersistent(Persistent pe) throws PersistenceException
  {
    PersistentMetaData pmd = pe.getMetaData();
    String oneFieldName = null;
    int oneType;

    for (Iterator ef = pmd.getFieldNames().iterator(); ef.hasNext();)
    {
      oneFieldName = (String) ef.next();
      oneType = JDBCDatabaseType.stringToType(pmd.getType(oneFieldName));

      switch (oneType)
      {
        case java.sql.Types.ARRAY:
          set(oneFieldName, pe.getField(oneFieldName));
View Full Code Here

    }
    catch (Exception x)
    {
      try
      {
        PersistentMetaData versionMeta = version.getMetaData();

        versionMeta.getDatabaseType().createTable(versionMeta, versionMeta.getDataSource());
      }
      catch (PersistenceException xx)
      {
        throw new ModelException(xx);
      }
View Full Code Here

    {
      metas = new HashMap();
    }

    /* See if we have already configured the meta-data for this Persistent */
    PersistentMetaData pd = (PersistentMetaData) metas.get(persistentName);

    if (pd != null)
    {
      return pd;
    }

    /*
     * Now fish through our own configuration and find the definition of
     * this Persistent, pass it on
     */

    /* to the PersistentMetaData to allow it to configure itself */
    StringTokenizer stk = new StringTokenizer(persistentName, ".");

    String firstPart = stk.nextToken();

    SuperString.assertNotBlank(firstPart, "Schema name must be specified");

    String secondPart = null;

    if (stk.hasMoreTokens())
    {
      secondPart = stk.nextToken();
    }

    SuperString
            .assertNotBlank(secondPart, "Persistent name must be specified, only '" + persistentName
                    + "' found");

    Configuration mySchema = (Configuration) schemas.get(firstPart);

    if (mySchema == null)
    {
      throw new PersistenceException("No such schema '" + firstPart + "' defined for PersistentFactory '"
              + getName() + "'");
    }

    Configuration[] eachTable = mySchema.getChildren();

    if (eachTable.length == 0)
    {
      throw new PersistenceException("No persistent obejcts defined in schema '" + firstPart + "' for factory '"
              + getName() + "'");
    }

    for (int i = 0; i < eachTable.length; i++)
    {
      Configuration oneTable = eachTable[i];

      if (oneTable.getName().equals("persistent"))
      {
        if (oneTable.getAttribute("name").equals(secondPart))
        {
          try
          {
            pd = (PersistentMetaData) getService(PersistentMetaData.ROLE);

            pd.setFactory(this);
            pd.setSchemaName(firstPart);
            pd.setDataSource(dataSource);
            pd.setDatabaseType(databaseType);

            if (pd instanceof Serviceable)
            {
              ((Serviceable) pd).service(getServiceManager());
            }

            pd.configurePersistent(oneTable);
            metas.put(persistentName, pd);

            return pd;
          }
          catch (Exception e)
View Full Code Here

  public abstract void createTables() throws PersistenceException;

  public final void addInputs(ModelResponse res, Persistent p) throws PersistenceException, ModelException
  {
    PersistentMetaData pmd = p.getMetaData();
    String oneFieldName = null;

    for (Iterator i = pmd.getFieldNames().iterator(); i.hasNext();)
    {
      oneFieldName = (String) i.next();

      Input oneInput = res.createInput(oneFieldName);

      oneInput.setLabel(pmd.getDescription(oneFieldName));

      if (pmd.isMultiValued(oneFieldName))
      {
        oneInput.setValidValues(p.getValidValues(oneFieldName));
      }

      oneInput.setDefaultValue(p.getFieldString(oneFieldName));
View Full Code Here

TOP

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

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.