Package de.iritgo.aktera.persist

Examples of de.iritgo.aktera.persist.Persistent


    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;

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

        serviceSecurity.clear();
        serviceSecurity.setField("component", getComponentName(o.getService()));
        serviceSecurity.setField("groupname", oneGroup);
        serviceSecurity.setField("instance", instanceName);

        if (log.isDebugEnabled())
        {
          log.debug("Looking for " + serviceSecurity.toString());
        }

        if (serviceSecurity.find())
        {
          if (operationCode.equals("*"))
          {
            return true;
          }

          if (serviceSecurity.getFieldString("allowedoperations").indexOf(operationCode) > 0)
          {
            return true;
          }

          if (serviceSecurity.getFieldString("allowedoperations").equals("*"))
          {
            return true;
          }
        }
      }
View Full Code Here


   */
  @Override
  public void adjustFormular(ModelRequest request, FormularDescriptor formular, PersistentDescriptor persistents)
    throws ModelException, PersistenceException
  {
    Persistent user = persistents.getPersistent("sysUser");

    TreeMap themes = new TreeMap();

    persistents.putAttributeValidValues("preferences.theme", themes);
    themes.put("", "$default");

    for (Iterator i = KeelPreferencesManager.themeIterator(); i.hasNext();)
    {
      KeelPreferencesManager.ThemeInfo info = (KeelPreferencesManager.ThemeInfo) i.next();

      themes.put(info.getId(), info.getName());
    }

    boolean readOnly = user.getStatus() == Persistent.CURRENT
            && persistents.getPersistent("preferences").getFieldBoolean("protect");

    if (StringTools.trim(persistents.getPersistent("preferences").getField("security")).indexOf('W') != - 1)
    {
      readOnly = false;
    }

    formular.setReadOnly(readOnly);

    if (user.getStatus() == Persistent.CURRENT
            && ! persistents.getPersistent("preferences").getFieldBoolean("canChangePassword"))
    {
      formular.getGroup("account").getField("passwordNew").setVisible(false);
      formular.getGroup("account").getField("passwordNewRepeat").setVisible(false);
      formular.getGroup("account").getField("pinNew").setVisible(false);
View Full Code Here

            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())
                {
                  String firstName = address.getFieldString("firstName");
                  String lastName = address.getFieldString("lastName");
                  String displayName = (firstName != null ? firstName + " " : "") + lastName;

                  userEnv.setAttribute("sessionDisplayName", displayName);
                  userEnv.setAttribute("sessionFirstName", firstName != null ? firstName : "");
                  userEnv.setAttribute("sessionLastName", lastName != null ? lastName : "");
View Full Code Here

      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())
        {
          AktarioUser aktarioUser = aktarioUsers.getUserByName(user.getFieldString("name"));

          if (aktarioUser != null)
          {
            aktarioUserManager.delUser(aktarioUser);
          }
View Full Code Here

        Iterator persistentConfigIterator = persistentConfig.iterator();
        Configuration aPersistentConfig = (Configuration) persistentConfigIterator.next();

        if (aPersistentConfig.getAttribute("name", null) != null)
        {
          Persistent persistent = persistentManager.create(aPersistentConfig.getAttribute("name"));

          if (id.intValue() != - 1)
          {
            persistent.setField(aPersistentConfig.getAttribute("key"), id);
            persistent.find();
          }

          persistents.put(aPersistentConfig.getAttribute("id"), persistent);

          for (; persistentConfigIterator.hasNext();)
          {
            aPersistentConfig = (Configuration) persistentConfigIterator.next();

            if (aPersistentConfig.getAttribute("join", null) != null)
            {
              persistent = persistentManager.create(aPersistentConfig.getAttribute("name"));
              persistents.put(aPersistentConfig.getAttribute("id"), persistent);

              if (id.intValue() != - 1)
              {
                persistent.setField(aPersistentConfig.getAttribute("myKey"), persistents.getPersistent(
                        aPersistentConfig.getAttribute("join")).getField(
                        aPersistentConfig.getAttribute("otherKey")));

                persistent.find();
              }
            }
          }
        }
        else
View Full Code Here

        Iterator persistentConfigIterator = persistentConfig.iterator();
        Configuration aPersistentConfig = (Configuration) persistentConfigIterator.next();

        if (persistents.hasPersistent(aPersistentConfig.getAttribute("id")))
        {
          Persistent persistent = persistents.getPersistent(aPersistentConfig.getAttribute("id"));

          persistent.add();
          id = persistent.getFieldInt(aPersistentConfig.getAttribute("key"));
        }
        else
        {
          StandardDao standardDao = (StandardDao) SpringTools.getBean(StandardDao.ID);
          Object bean = persistents.get(aPersistentConfig.getAttribute("id"));
View Full Code Here

        throw new PermissionException("Permission denied to edit com device function keys of user " + userId);
      }

      try
      {
        Persistent user = pf.create("keel.user");

        user.setField("uid", userId);
        user.find();
        userName = user.getFieldString("name");
      }
      catch (PersistenceException x)
      {
      }
    }
View Full Code Here

   * record. Note that this method uses just the key fields to determine if
   * the record already exists.
   */
  public synchronized void addIfNeeded() throws PersistenceException
  {
    Persistent searchObj = getFactory().create(getName());
    String oneFieldName = null;

    for (Iterator i = myMetaData.getKeyFieldNames().iterator(); i.hasNext();)
    {
      oneFieldName = (String) i.next();
      searchObj.setField(oneFieldName, getField(oneFieldName));
    }

    if (! searchObj.find())
    {
      add();
    }
  } /* addOrUpdate() */
 
View Full Code Here

   * If not, add a new record. Note that this method uses *all* of the fields
   * currently set as search criteria (e.g. not just the key)
   */
  public synchronized void addOrUpdate() throws PersistenceException
  {
    Persistent searchObj = getFactory().create(getName());
    String oneFieldName = null;

    for (Iterator i = myMetaData.getFieldNames().iterator(); i.hasNext();)
    {
      oneFieldName = (String) i.next();
      searchObj.setField(oneFieldName, getField(oneFieldName));
    }

    if (! searchObj.find())
    {
      add();
    }
    else
    {
View Full Code Here

          break;
        }

        //Only allocate if we're gonna load this record
        Persistent myObj = getFactory().create(getName());
        int i = 1;
        Object oneFieldValue = null;

        for (Iterator it = retrievedFieldList.iterator(); it.hasNext();)
        {
          oneFieldName = (String) it.next();

          oneFieldValue = retrieveField(oneFieldName, rs, i);
          i++;
          myObj.setField(oneFieldName, oneFieldValue);
        } /* for each retrieved field name */
        // TODO - how to tell the new object it's now current
        //myObj.setStatus(Persistent.CURRENT);
        if (checkRowSecurity)
        {
          if (myObj.allowed(QUERY))
          {
            recordSet.add(myObj);
          }
        }
        else
View Full Code Here

TOP

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

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.