Package de.iritgo.aktario.framework.dataobject

Examples of de.iritgo.aktario.framework.dataobject.DynDataObject


    if (Engine.instance().getIObjectFactory().contains(model))
    {
      return;
    }

    DynDataObject listObject = new DynDataObject(model);

    for (Iterator i = ((ResponseElement) resultList.getAttribute("header")).getAll().iterator(); i.hasNext();)
    {
      ResponseElement field = (ResponseElement) i.next();
      String attributeName = (String) ((Output) field).getContent();

      listObject.setAttribute(attributeName, "");
    }

    listObject.setAttribute("keelObjectId", "");
    listObject.setAttribute("userUniqueId", "");

    Engine.instance().getIObjectFactory().register(listObject);
  }
View Full Code Here


   * @return DynDataObject The generated object.
   */
  private DynDataObject createDataObjectAndRegister(KeelResponse keelForm, String model, String keelObjectId,
          boolean createNewObject)
  {
    DynDataObject dataObject = null;

    boolean isObjectNotRegistered = false;

    if (Engine.instance().getIObjectFactory().contains(model))
    {
      try
      {
        dataObject = (DynDataObject) Engine.instance().getIObjectFactory().newInstance(model);
      }
      catch (Exception x)
      {
        Log.log("system", "ConnectorServerManager.createDataObjectAndRegister",
                "DynDataObject can not created: " + model + " Error: " + x, Log.FATAL);
      }
    }
    else
    {
      dataObject = new DynDataObject(model);
      isObjectNotRegistered = true;
    }

    if (createNewObject)
    {
      dataObject.setUniqueId(Engine.instance().getPersistentIDGenerator().createId());
    }
    else
    {
      dataObject.setUniqueId(new Long(keelObjectId));
    }

    ResponseElement groups = keelForm.get("groups");

    for (Iterator i = groups.getAll().iterator(); i.hasNext();)
    {
      ResponseElement group = (ResponseElement) i.next();

      for (Iterator j = group.getAll().iterator(); j.hasNext();)
      {
        Input attribute = (Input) j.next();

        String attributeName = attribute.getName();
        String attributeContent = (String) attribute.getDefaultValue().toString();

        dataObject.setAttribute(attributeName, attributeContent);

        if ("combo".equals(attribute.getAttribute("editor")))
        {
          StringBuffer validValues = new StringBuffer();

          for (Iterator k = attribute.getValidValues().entrySet().iterator(); k.hasNext();)
          {
            Map.Entry value = (Map.Entry) k.next();

            validValues.append(value.getKey() + "|" + value.getValue());

            if (k.hasNext())
            {
              validValues.append("|");
            }
          }

          dataObject.setAttribute(attributeName + "ValidValues", validValues.toString());
        }
      }
    }

    if (createNewObject)
    {
      dataObject.setAttribute("keelObjectId", "-1");
    }
    else
    {
      dataObject.setAttribute("keelObjectId", keelObjectId);
    }

    if (isObjectNotRegistered)
    {
      Engine.instance().getIObjectFactory().register((IObject) dataObject);
    }

    IObjectProxy proxy = (IObjectProxy) new FrameworkProxy();

    proxy.setSampleRealObject((IObject) dataObject);

    Engine.instance().getBaseRegistry().add((BaseObject) dataObject);
    Engine.instance().getProxyRegistry().addProxy(proxy, dataObject.getTypeId());

    return dataObject;
  }
View Full Code Here

   * @return DynDataObject The generated object.
   */
  private DynDataObject createQueryDataObjectAndRegister(ResponseElement row, Iterator col,
          ResponseElement resultList, String listName, AkteraQuery akteraQuery)
  {
    DynDataObject listObject = null;

    try
    {
      listObject = (DynDataObject) Engine.instance().getIObjectFactory().newInstance(listName);
    }
    catch (Exception x)
    {
      return null;
    }

    if (! col.hasNext())
    {
      return null;
    }

    if (row.getAttribute("empty") != null)
    {
      return null;
    }

    String stringId = (String) row.getAttribute("id");

    listObject.setUniqueId(new Long(stringId));

    int colCounter = 0;

    while (col.hasNext())
    {
      ResponseElement colResp = (ResponseElement) col.next();

      String attributeName = (String) ((Output) ((ResponseElement) resultList.getAttribute("header")).getAll()
              .get(colCounter)).getContent();

      String content = (String) (((Output) colResp).getContent()).toString();

      listObject.setAttribute(attributeName, content);
      ++colCounter;
    }

    listObject.setAttribute("keelObjectId", stringId);
    listObject.setAttribute("userUniqueId", "" + akteraQuery.getUserUniqueId());

    IObjectProxy proxy = (IObjectProxy) new FrameworkProxy();

    proxy.setSampleRealObject((IObject) listObject);

    Engine.instance().getBaseRegistry().add((BaseObject) listObject);
    Engine.instance().getProxyRegistry().addProxy(proxy, listObject.getTypeId());

    ActionTools.sendServerBroadcast(new EditIObjectAction(EditIObjectAction.OK, listObject));

    return listObject;
  }
View Full Code Here

TOP

Related Classes of de.iritgo.aktario.framework.dataobject.DynDataObject

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.