Package org.chromattic.api

Examples of org.chromattic.api.ChromatticSession


   public void save(ProducerInfo info, String messageOnError)
   {

      try
      {
         ChromatticSession session = persister.getSession();

         final long now = SupportsLastModified.now();

         // since we're creating a new ProducerInfo, we need to modify the parent as well
         ProducerInfosMapping pims = getProducerInfosMapping(session);
         pims.setLastModified(now);

         // use ProducerInfosMapping to create a child ProducerInfo node and initialize it
         ProducerInfoMapping pim = pims.createProducerInfo(info.getId());
         // we first need to persist the ProducerInfoMapping as a child of the ProducerInfosMapping element, using its id as path
         String key = session.persist(pims, pim, info.getId());
         info.setKey(key);
         info.setLastModified(now);
         pim.initFrom(info);

         persister.closeSession(true);
View Full Code Here


      // more optimized version of updateState
      ParameterValidation.throwIllegalArgExceptionIfNull(propertyMap, "property map");

      try
      {
         ChromatticSession session = persister.getSession();

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

      String newId;
      boolean idUnchanged;

      try
      {
         ChromatticSession session = persister.getSession();

         // retrieve the mapping associated with the persistence key and if it exists, reset it to the data of the specified ProducerInfo
         ProducerInfoMapping pim = session.findById(ProducerInfoMapping.class, key);
         if (pim == null)
         {
            throw new IllegalArgumentException("Couldn't find ProducerInfoMapping associated with key " + key);
         }
         oldId = pim.getId();
View Full Code Here

   @Override
   protected PortletStateContext getStateContext(String stateId)
   {
      try
      {
         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)
   {
      try
      {
         ChromatticSession session = persister.getSession();

         PortletStateContextsMapping portletStateContexts = getContexts(session);
         PortletStateContextMapping pscm = portletStateContexts.createPortletStateContext(UUID.randomUUID().toString());
         portletStateContexts.getPortletStateContexts().add(pscm);
View Full Code Here

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

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

   public Iterator<ProducerInfo> getProducerInfosFromStorage()
   {
      try
      {
         ChromatticSession session = persister.getSession();

         // get the ProducerInfoMappings from JCR
         List<ProducerInfoMapping> pims = getProducerInfosMapping(session).getProducerInfos();
         List<ProducerInfo> infos = new ArrayList<ProducerInfo>(pims.size());
         for (ProducerInfoMapping pim : pims)
View Full Code Here

   public ProducerInfo loadProducerInfo(String id)
   {
      try
      {
         ChromatticSession session = persister.getSession();

         ProducerInfoMapping pim = getProducerInfoMapping(id, session);
         if (pim != null)
         {
            return pim.toModel(null, this);
View Full Code Here

   @Override
   public long getPersistedLastModifiedForProducerInfoWith(String id)
   {
      try
      {
         ChromatticSession session = persister.getSession();

         ProducerInfoMapping pim = getProducerInfoMapping(id, session);
         if (pim != null)
         {
            return pim.getLastModified();
View Full Code Here

   @Override
   public boolean containsConsumer(String id)
   {
      try
      {
         ChromatticSession session = persister.getSession();

         // this operation is not part of Chromattic, so use the JCR functionality directly
         return session.getJCRSession().itemExists(rootNodePath + getPathFor(id));
      }
      catch (RepositoryException e)
      {
         throw new RuntimeException(e);
      }
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.