Package de.iritgo.aktera.model

Examples of de.iritgo.aktera.model.ModelRequest


  {
    if ((event != null) && (event.isLoggedIn()))
    {
      User user = event.getUser();

      ModelRequest req = null;

      try
      {
        req = ModelTools.createModelRequest();

        AuthenticationManager authMgr = (AuthenticationManager) req.getService(AuthenticationManager.ROLE,
                "default");

        authMgr.setUsername(user.getName());
        authMgr.setPassword(event.getPlainPassword());
        authMgr.setDomain("default");

        UserEnvironment userEnvironment = new DefaultUserEnvironment();
        Context context = new DefaultContext();

        ((DefaultContext) context).put(UserEnvironment.CONTEXT_KEY, userEnvironment);
        authMgr.login(userEnvironment);
        keelIritgoAuthMap.put(new Long(user.getUniqueId()), context);
      }
      catch (Exception x)
      {
        x.printStackTrace();
      }
      finally
      {
        ModelTools.releaseModelRequest(req);
      }
    }

    if ((event != null) && (event.isLoggedOut()))
    {
      User user = event.getUser();

      ModelRequest req = null;

      try
      {
        req = ModelTools.createModelRequest();

        AuthenticationManager authMgr = (AuthenticationManager) req.getService(AuthenticationManager.ROLE, "*");

        authMgr.setUsername(user.getName());
        authMgr.setPassword("");
        authMgr.setDomain("default");

 
View Full Code Here


   * @param DataObject The data object to save.
   * @param userUniqueId The user unique id.
   */
  public void saveKeelObject(String model, String keelObjectId, DataObject dataObject, long userUniqueId)
  {
    ModelRequest req = null;

    try
    {
      req = ModelTools.createModelRequest();

      Model saveModel = (Model) req.getService(Model.ROLE, model, (Context) keelIritgoAuthMap.get(new Long(
              userUniqueId)));

      ((KeelContextualizable) req).setKeelContext((Context) keelIritgoAuthMap.get(new Long(userUniqueId)));

      req.setParameter("id", keelObjectId);

      DataObject systemObject = (DataObject) Engine.instance().getBaseRegistry().get(dataObject.getUniqueId(),
              dataObject.getTypeId());

      for (Iterator i = dataObject.getAttributes().keySet().iterator(); i.hasNext();)
      {
        String attributeName = (String) i.next();

        systemObject.setAttribute(attributeName, dataObject.getAttribute(attributeName));
        req.setParameter(attributeName, dataObject.getAttribute(attributeName));
      }

      req.setParameter("id", dataObject.getStringAttribute("keelObjectId"));

      saveModel.execute(req);
      ActionTools.sendServerBroadcast(new EditIObjectAction(EditIObjectAction.OK, systemObject));
    }
    catch (Exception x)
View Full Code Here

  {
    JobDetail jobDetail = jobContext.getJobDetail();

    try
    {
      ModelRequest request = (ModelRequest) jobDetail.getJobDataMap().get("request");
      DefaultContext requestContext = ((DefaultContext) request.getContext());

      requestContext.put(UserEnvironment.CONTEXT_KEY, new RootUserEnvironment());
      request.execute();
      KeelContainer.defaultContainer().release(request);
    }
    catch (Exception x)
    {
      System.err.println("[QuartzModelJob] Error executing job '" + jobDetail.getName() + "': " + x);
View Full Code Here

   * @param params
   *            Model parameters.
   */
  public static ModelResponse callModel(String model, Properties params) throws ModelException
  {
    ModelRequest request = null;
    try
    {
      request = createModelRequest();
      return callModel(request, model, params);
    }
View Full Code Here

    {
      Container keelContainer = (Container) ServerAppContext.serverInstance().getObject("keel.container");

      Model model = (Model) keelContainer.getService(Model.ROLE, props.getProperty("model"));

      ModelRequest req = (ModelRequest) keelContainer.getService(ModelRequest.ROLE);
      DefaultContext context = new DefaultContext();

      ((KeelContextualizable) req).setKeelContext(context);

      String attributeName = null;

      for (Iterator i = props.keySet().iterator(); i.hasNext();)
      {
        attributeName = (String) i.next();
        req.setParameter(attributeName, props.getProperty(attributeName));
      }

      model.execute(req);
    }
    catch (Exception x)
View Full Code Here

  /**
   * @see de.iritgo.aktera.startup.StartupHandler#startup()
   */
  public void startup() throws StartupException
  {
    ModelRequest request = null;

    try
    {
      request = ModelTools.createModelRequest();

      SystemConfigManager systemConfigManager = (SystemConfigManager) request
              .getSpringBean(SystemConfigManager.ID);

      if (! StringTools.isTrimEmpty(systemConfigManager.getString("tb2", "logLevel")))
      {
        KeelContainer.defaultContainer().setLogLevel(systemConfigManager.getString("tb2", "logLevel"));
View Full Code Here

  /**
   * @see de.iritgo.aktera.startup.StartupHandler#startup()
   */
  public void startup() throws StartupException
  {
    ModelRequest request = null;

    initRound();

    try
    {
View Full Code Here

  /**
   * Initialize the component.
   */
  public void initialize()
  {
    ModelRequest req = null;

    //     try
    //     {
    //       req = ModelTools.createModelRequest ();

View Full Code Here

  public static void createDefaultValues(Integer userId)
  {
    try
    {
      ModelRequest modelReq = ModelTools.createModelRequest();
      createDefaultValues(modelReq, userId);
    }
    catch (Exception x)
    {
      //TODO: get a logger
View Full Code Here

    if (modelName != null && ! modelName.equals("null") && ! modelName.startsWith("_BEAN_."))
    {
      Model model = (Model) req.getService(Model.ROLE, modelName);

      ModelRequest mreq = (ModelRequest) req.getService(ModelRequest.ROLE, "default");

      mreq.copyFrom(req);
      mreq.removeParameter("listSearch");

      for (Iterator i = req.getParameters().keySet().iterator(); i.hasNext();)
      {
        String key = (String) i.next();

        if (key.startsWith("_lep"))
        {
          String keyName = key.substring(4);

          if (req.getParameter(keyName) == null)
          {
            mreq.setParameter(keyName, req.getParameter(key));
          }
        }

        if (key.startsWith("_lp"))
        {
          String keyName = key.substring(3);

          if (req.getParameter(keyName) == null)
          {
            mreq.setParameter(keyName, req.getParameter(key));
          }
        }
      }

      res = model.execute(mreq);
View Full Code Here

TOP

Related Classes of de.iritgo.aktera.model.ModelRequest

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.