Package nexj.core.meta

Examples of nexj.core.meta.PrivilegeSet


      contact.setValue("svector", new String[]{"a", "b", "c"});
      contact.setValue("vector", new Object[]{"a", "b", "c"});
      contact.setValue("function", new PCodeFunction(new char[]{0, 1, 2}, new Object[]{"abc"}));
      contact.setValue("macro", new PCodeMacro(new char[]{3, 4, 5}, new Object[]{"cde"}, null));

      PrivilegeSet privilegeSet = Repository.getMetadata().createPrivilegeSet();

      privilegeSet.add(Repository.getMetadata().getPrimitivePrivilege("updateContact"));
      privilegeSet.add(Repository.getMetadata().getPrimitivePrivilege("WorkflowManage"));
      contact.setValue("privilegeSet", privilegeSet);

      List addressList = new ArrayList();

      TransferObject address = new TransferObject();
View Full Code Here


      assertEquals(4, mac.code[1]);
      assertEquals(5, mac.code[2]);
      assertEquals(1, mac.constants.length);
      assertEquals("cde", mac.constants[0]);

      PrivilegeSet privilegeSet = (PrivilegeSet)contact.getValue("privilegeSet");

      assertTrue(privilegeSet.contains(Repository.getMetadata().getPrimitivePrivilege("updateContact")));
      assertTrue(privilegeSet.contains(Repository.getMetadata().getPrimitivePrivilege("WorkflowManage")));
      assertFalse(privilegeSet.contains(Repository.getMetadata().getPrimitivePrivilege("createContact")));

      List addressList = (List)contact.getValue("addresses");

      assertEquals(2, addressList.size());
View Full Code Here

      contact.setValue("svector", new String[]{"a", "b", "c"});
      contact.setValue("vector", new Object[]{"a", "b", "c"});
      contact.setValue("function", new PCodeFunction(new char[]{0, 1, 2}, new Object[]{"abc"}));
      contact.setValue("macro", new PCodeMacro(new char[]{3, 4, 5}, new Object[]{"cde"}, null));

      PrivilegeSet privilegeSet = Repository.getMetadata().createPrivilegeSet();

      privilegeSet.add(Repository.getMetadata().getPrimitivePrivilege("updateContact"));
      privilegeSet.add(Repository.getMetadata().getPrimitivePrivilege("WorkflowManage"));
      contact.setValue("privilegeSet", privilegeSet);

      ArrayList addressList = new ArrayList();
     
      TransferObject address = new TransferObject();
View Full Code Here

      assertEquals(4, mac.code[1]);
      assertEquals(5, mac.code[2]);
      assertEquals(1, mac.constants.length);
      assertEquals("cde", mac.constants[0]);

      PrivilegeSet privilegeSet = (PrivilegeSet)contact.getValue("privilegeSet");

      assertTrue(privilegeSet.contains(Repository
                                          .getMetadata()
                                             .getPrimitivePrivilege("updateContact")));
      assertTrue(privilegeSet.contains(Repository
                                          .getMetadata()
                                             .getPrimitivePrivilege("WorkflowManage")));
      assertFalse(privilegeSet.contains(Repository
                                           .getMetadata()
                                              .getPrimitivePrivilege("createContact")));

      List addressList = (List)contact.getValue("addresses");
View Full Code Here

    * Sets the invocation context user instance.
    * @param user The user instance.
    */
   protected void setUser(Instance user)
   {
      PrivilegeSet privilegeSet = null;
      String sFragmentName = m_sFragmentName;
      Instance partition = m_partition;

      if (user != null)
      {
         Metaclass metaclass = user.getMetaclass();
         PersistenceMapping mapping = metaclass.getPersistenceMapping();
         Attribute attribute = null;

         assert m_userClass.isUpcast(metaclass);

         if (mapping != null)
         {
            attribute = mapping.getFragmentAttribute();
         }

         if (attribute == null)
         {
            attribute = metaclass.findAttribute("fragmentName");
         }

         if (attribute != null)
         {
            sFragmentName = (String)((attribute.isStatic()) ?
               metaclass.getValue(attribute.getOrdinal()) :
                  user.getValue(attribute.getOrdinal()));
         }

         attribute = metaclass.findAttribute("partition");

         if (attribute != null)
         {
            partition = (Instance)((attribute.isStatic()) ?
               metaclass.getValue(attribute.getOrdinal()) :
                  user.getValue(attribute.getOrdinal()));
         }

         privilegeSet = (PrivilegeSet)user.getValue("privilegeSet");
      }

      if (privilegeSet == null)
      {
         privilegeSet = new PrivilegeSet(m_metadata.getPrimitivePrivilegeCount(), false);
      }

      m_user = user;
      m_privilegeSet = privilegeSet;
      m_sFragmentName = sFragmentName;
View Full Code Here

   /**
    * @see nexj.core.meta.Metadata#createPrivilegeSet()
    */
   public PrivilegeSet createPrivilegeSet()
   {
      return new PrivilegeSet(m_nPrimitivePrivilegeCount);
   }
View Full Code Here

      assertTrue(m_principal.isTypeCodeDispatched());
   }

   public void testIsTypeCodePrivileged()
   {
      PrivilegeSet privilegeSet = new PrivilegeSet(Repository.getMetadata().getPrimitivePrivilegeCount(), true);

      assertFalse(m_contact.isTypeCodePrivileged(privilegeSet));

      privilegeSet.remove(Repository.getMetadata().getPrimitivePrivilege("readSpecial"));

      assertTrue(m_contact.isTypeCodePrivileged(privilegeSet));
      assertFalse(m_principal.isTypeCodePrivileged(privilegeSet));
   }
View Full Code Here

      assertFalse(m_principal.isTypeCodePrivileged(privilegeSet));
   }
  
   public void testGetTypeCodeIterator()
   {
      PrivilegeSet privilegeSet = new PrivilegeSet(Repository.getMetadata().getPrimitivePrivilegeCount(), true);

      Iterator itr = m_contact.getTypeCodeIterator(privilegeSet);

      itr.next();
      itr.next();
      itr.next();
      itr.next();
      itr.next();
      itr.next();
      itr.next();
      itr.next();

      assertFalse(itr.hasNext());

      privilegeSet.remove(Repository.getMetadata().getPrimitivePrivilege("readSpecial"));
      itr = m_contact.getTypeCodeIterator(privilegeSet);

      itr.next();
      itr.next();
      itr.next();
View Full Code Here

TOP

Related Classes of nexj.core.meta.PrivilegeSet

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.