Package org.chromattic.api

Examples of org.chromattic.api.ChromatticSession


      persister.closeSession(session, true);
   }

   public void saveConfiguration() throws Exception
   {
      ChromatticSession session = persister.getSession();

      ProducerConfigurationMapping pcm = session.findByPath(ProducerConfigurationMapping.class, PRODUCER_CONFIGURATION_PATH);
      if (pcm == null)
      {
         pcm = session.insert(ProducerConfigurationMapping.class, PRODUCER_CONFIGURATION_PATH);
      }
      pcm.initFrom(configuration);

      persister.closeSession(session, true);
   }
View Full Code Here


      this.mopManager = mopManager;
   }

   public ContentRegistry getContentRegistry()
   {
      ChromatticSession session = lifeCycle.getChromattic().openSession();
      ContentRegistry registry = session.findByPath(ContentRegistry.class, "app:applications");
      if (registry == null)
      {
         registry = session.insert(ContentRegistry.class, "app:applications");
      }
      return registry;
   }
View Full Code Here

   public void updateState(String stateId, PropertyMap propertyMap) throws NoSuchStateException, InvalidStateIdException
   {
      // more optimized version of updateState
      ParameterValidation.throwIllegalArgExceptionIfNull(propertyMap, "property map");

      ChromatticSession session = persister.getSession();

      PortletStateContextMapping pscm = getPortletStateContextMapping(session, stateId);
      PortletStateMapping psm = pscm.getState();
      psm.setProperties(propertyMap);
View Full Code Here


   @Override
   protected PortletStateContext getStateContext(String stateId)
   {
      ChromatticSession session = persister.getSession();

      PortletStateContextMapping pscm = getPortletStateContextMapping(session, stateId);
      PortletStateContext context;
      if (pscm == null)
      {
View Full Code Here

   }

   @Override
   protected String createStateContext(String portletId, PropertyMap propertyMap)
   {
      ChromatticSession session = persister.getSession();

      String encodedForPath = JCRPersister.PortletNameFormatter.encode(portletId);

      PortletStateContextMapping pscm = session.findByPath(PortletStateContextMapping.class, PATH + encodedForPath);
      if (pscm == null)
      {
         PortletStateContextsMapping portletStateContexts = getContexts(session);
         pscm = portletStateContexts.createPortletStateContext(portletId);
         portletStateContexts.getPortletStateContexts().add(pscm);
View Full Code Here

   }

   @Override
   protected PortletStateContext destroyStateContext(String stateId)
   {
      ChromatticSession session = persister.getSession();

      PortletStateContextMapping pscm = getPortletStateContextMapping(session, stateId);
      PortletStateContext result;
      if (pscm == null)
      {
         result = null;
      }
      else
      {
         getContexts(session).getPortletStateContexts().remove(pscm);
         session.remove(pscm);
         result = pscm.toPortletStateContext();
      }

      persister.closeSession(session, true);
      return result;
View Full Code Here

            }
         }
      }

      // Temporary work around, to fix in MOP and then remove
      ChromatticSession session;
      try
      {
         Field f = ModelImpl.class.getDeclaredField("session");
         f.setAccessible(true);
         session = (ChromatticSession)f.get(model);
      }
      catch (Exception e)
      {
         throw new Error(e);
      }
      Class<O> mappedClass = (Class<O>)mapping.get(type);
      return session.createQueryBuilder(mappedClass).where(statement).get().objects();
   }
View Full Code Here

   private abstract class TokenTask<V> extends ContextualTask<V>
   {

      protected final TokenContainer getTokenContainer() {
         SessionContext ctx = chromatticLifeCycle.getContext();
         ChromatticSession session = ctx.getSession();
         TokenContainer container = session.findByPath(TokenContainer.class, lifecycleName);
         if (container == null)
         {
            container = session.insert(TokenContainer.class, lifecycleName);
         }
         return container;
      }
View Full Code Here

   }

   @Override
   protected void save(ProducerInfo info, String messageOnError)
   {
      ChromatticSession session = persister.getSession();

      try
      {
         ProducerInfosMapping pims = getProducerInfosMapping(session);
         ProducerInfoMapping pim = pims.createProducerInfo(info.getId());
         String key = session.persist(pims, pim, info.getId());
         info.setKey(key);
         pim.initFrom(info);

         persister.closeSession(session, true);
      }
View Full Code Here

   }

   @Override
   protected void delete(ProducerInfo info)
   {
      ChromatticSession session = persister.getSession();
      delete(session, getPathFor(info));

      persister.closeSession(session, true);
   }
View Full Code Here

TOP

Related Classes of org.chromattic.api.ChromatticSession

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.