Package de.iritgo.aktera.persist

Examples of de.iritgo.aktera.persist.PersistentFactory


      req = ModelTools.createModelRequest();

      Context context = (Context) keelIritgoAuthMap.get(new Long(userUniqueId));

      PersistentFactory persistentManager = null;

      if (context != null)
      {
        persistentManager = (PersistentFactory) req.getService(PersistentFactory.ROLE, "", context);
      }
      else
      {
        UserEnvironment userEnvironment = new DefaultUserEnvironment()
        {
          private LinkedList<String> fakeList;

          public List<String> getGroups()
          {
            if (fakeList == null)
            {
              fakeList = new LinkedList<String>();
              fakeList.add(new String("root"));
            }

            return fakeList;
          }
        };

        context = new DefaultContext();
        ((DefaultContext) context).put(UserEnvironment.CONTEXT_KEY, userEnvironment);

        persistentManager = (PersistentFactory) req.getService(PersistentFactory.ROLE, "", context);
      }

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

      Persistent persistent = persistentManager.create(properties.getProperty("persistent"));

      if (properties.getProperty("persistentFilter").equals("true"))
      {
        persistent.setField(properties.getProperty("persistentFilterAttributeName"), properties
                .get("persistentFilterAttribute"));
View Full Code Here


      if (value.equals(""))
      {
        return false;
      }

      PersistentFactory persistentManager = (PersistentFactory) req.getService(PersistentFactory.ROLE, req
              .getDomain());

      String name = fieldDescriptor.getName();
      String fieldName = name.substring(name.lastIndexOf('.') + 1);
      String persistentName = name.substring(0, Math.max(name.indexOf('.'), 0));
      String inputName = name.replace('.', '_');

      Persistent persistent = persistentDescriptor.getPersistent(persistentName);
      Persistent search = persistentManager.create(persistent.getName());

      search.setField(fieldName, value);

      if (search.find())
      {
View Full Code Here

        {
          req.getParameter(keyName).toString()
        };
      }

      PersistentFactory persistentManager = (PersistentFactory) req.getService(PersistentFactory.ROLE, req
              .getDomain());

      for (int i = 0; i < ids.length; ++i)
      {
        Persistent persistent = null;

        if (persistentConfig.size() != 0)
        {
          persistent = persistentManager.create(persistentConfig.get(0).getAttribute("name"));

          persistent.setField(persistentConfig.get(0).getAttribute("key"), NumberTools.toIntInstance(ids[i],
                  - 1));

          persistent.find();
View Full Code Here

        throw new LoginException("Error trying to get bypass auth manager " + e1.getMessage());
      }

      boolean authenticated = false;

      PersistentFactory pf = null;

      try
      {
        PersistentFactory pf1 = (PersistentFactory) getService(PersistentFactory.ROLE, domain);

        pf = (PersistentFactory) getService(PersistentFactory.ROLE, pf1.getSecurity());
        myUser = pf.create("keel.user");
        myUser.setBypassAuthorizationManager(bypassAm);
        myUser.setField("name", loginName);

        if (! myUser.find())
View Full Code Here

   * @return
   * @throws AuthorizationException
   */
  private boolean checkSecurable(Operation o, UserEnvironment ue) throws AuthorizationException
  {
    PersistentFactory pf = null;
    String operationCode = o.getOperationCode();

    if ((operationCode == null) || (operationCode.trim().equals("")))
    {
      operationCode = "*";
    }

    if (ue.getGroups().size() == 0)
    {
      throw new AuthorizationException("User '" + ue.getLoginName() + "' is not a member of any groups");
    }

    try
    {
      pf = getPersistentFactory();

      Persistent serviceSecurity = pf.create("component-security.componentsecurity");

      serviceSecurity.setBypassAuthorizationManager(bypassAm);

      /* Iterate through all the groups that this principal is a member of */
      String oneGroup = null;
View Full Code Here

    if ((operationCode == null) || (operationCode.trim().equals("")))
    {
      operationCode = "*";
    }

    PersistentFactory pf = null;

    /* There must be a rule */
    int totalRules = 0;

    /* And we must match all applicable rules */
    int rulesMatched = 0;

    try
    {
      pf = getPersistentFactory();

      String oneGroup = null;

      for (Iterator j = ue.getGroups().iterator(); j.hasNext();)
      {
        oneGroup = (String) j.next();

        Persistent ruleList = pf.create("component-security.invokationsecurity");

        ruleList.setBypassAuthorizationManager(bypassAm);
        ruleList.setField("component", getComponentName(o.getService()));
        ruleList.setField("instance", ((InstanceSecurable) o.getService()).getInstanceIdentifier());
        ruleList.setField("groupname", oneGroup);
View Full Code Here

  /**
   * Obtains the PersistentFactory initialized with a specific context
   */
  private PersistentFactory getPersistentFactory(Context c) throws AuthorizationException
  {
    PersistentFactory myFactory = null;

    try
    {
      PersistentFactory tmpFactory = (PersistentFactory) getService(PersistentFactory.ROLE, "default", c);

      myFactory = (PersistentFactory) getService(PersistentFactory.ROLE, tmpFactory.getSecurity(), c);
    }
    catch (ServiceException se)
    {
      throw new AuthorizationException("An error occured while trying to fetch the PersistentFactory.", se);
    }
View Full Code Here

    if ((operationCode == null) || (operationCode.trim().equals("")))
    {
      operationCode = "*";
    }

    PersistentFactory pf = null;

    if (ue.getGroups().size() == 0)
    {
      throw new AuthorizationException("User '" + ue.getLoginName() + "' is not a member of any groups");
    }

    try
    {
      pf = getPersistentFactory();

      Persistent serviceSecurity = pf.create("component-security.instancesecurity");

      serviceSecurity.setBypassAuthorizationManager(bypassAm);

      /* Iterate through all the groups that this principal is a member of */
      String oneGroup = null;
View Full Code Here

          if (userEnv.getAttribute("sessionInfoLoaded") == null
                  || "N".equals(userEnv.getAttribute("sessionInfoLoaded")))
          {
            try
            {
              PersistentFactory persistentManager = (PersistentFactory) req.getService(
                      PersistentFactory.ROLE, req.getDomain());

              Persistent preferences = persistentManager.create("aktera.Preferences");

              preferences.setField("userId", new Integer(userEnv.getUid()));
              preferences.find();
              userEnv.setAttribute("sessionPreferences", preferences.getBean());

              Persistent party = persistentManager.create("aktera.Party");

              party.setField("userId", new Integer(userEnv.getUid()));

              if (party.find())
              {
                Persistent address = persistentManager.create("aktera.Address");

                address.setField("partyId", party.getField("partyId"));

                if (address.find())
                {
View Full Code Here

      int userId = NumberTools.toInt(req.getParameter("id"), - 1);

      if (userId != - 1)
      {
        PersistentFactory persistentManager = (PersistentFactory) req.getService(PersistentFactory.ROLE, req
                .getDomain());

        Persistent user = persistentManager.create("keel.user");

        user.setField("uid", new Integer(userId));

        if (user.find())
        {
View Full Code Here

TOP

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

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.