Examples of ProducerInfoMapping


Examples of org.gatein.portal.wsrp.state.consumer.mapping.ProducerInfoMapping

      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);
      }
      catch (Exception e)
      {
View Full Code Here

Examples of org.gatein.portal.wsrp.state.consumer.mapping.ProducerInfoMapping

         throw new IllegalArgumentException("ProducerInfo '" + producerInfo.getId()
            + "' hasn't been persisted and thus cannot be updated.");
      }

      ChromatticSession session = persister.getSession();
      ProducerInfoMapping pim = session.findById(ProducerInfoMapping.class, key);
      if (pim == null)
      {
         throw new IllegalArgumentException("Couldn't find ProducerInfoMapping associated with key " + key);
      }
      String oldId = pim.getId();
      String newId = producerInfo.getId();
      pim.initFrom(producerInfo);

      persister.closeSession(session, true);

      // if the consumer's id has changed, return the old one so that state can be updated
      return (oldId.equals(newId)) ? null : oldId;
View Full Code Here

Examples of org.gatein.portal.wsrp.state.consumer.mapping.ProducerInfoMapping

         List<WSRPConsumer> consumers = fromXML.getConfiguredConsumers();
         for (WSRPConsumer consumer : consumers)
         {
            ProducerInfo info = consumer.getProducerInfo();

            ProducerInfoMapping pim = producerInfosMapping.createProducerInfo(info.getId());

            // need to add to parent first to attach newly created ProducerInfoMapping
            infos.add(pim);

            // init it from ProducerInfo
            pim.initFrom(info);
         }
      }

      return producerInfosMapping;
   }
View Full Code Here

Examples of org.gatein.portal.wsrp.state.consumer.mapping.ProducerInfoMapping

      return producerInfosMapping;
   }

   private void delete(ChromatticSession session, String path)
   {
      ProducerInfoMapping old = session.findByPath(ProducerInfoMapping.class, path);

      if (old != null)
      {
         session.remove(old);
      }
View Full Code Here

Examples of org.gatein.portal.wsrp.state.consumer.mapping.ProducerInfoMapping

      return PRODUCER_INFOS_PATH + "/" + info.getId();
   }

   private static ProducerInfoMapping toProducerInfoMapping(ProducerInfo producerInfo, ChromatticSession session)
   {
      ProducerInfoMapping pim = session.findById(ProducerInfoMapping.class, producerInfo.getKey());
      if (pim == null)
      {
         pim = session.insert(ProducerInfoMapping.class, getPathFor(producerInfo));
      }

      pim.initFrom(producerInfo);

      return pim;
   }
View Full Code Here

Examples of org.gatein.wsrp.consumer.registry.mapping.ProducerInfoMapping

         // 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);
      }
      catch (Exception e)
      {
View Full Code Here

Examples of org.gatein.wsrp.consumer.registry.mapping.ProducerInfoMapping

      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();
         newId = producerInfo.getId();
         pim.initFrom(producerInfo);

         idUnchanged = oldId.equals(newId);

         // if the ProducerInfo's last modified date is posterior to the set it's contained in, modify that one too
         ProducerInfosMapping pims = getProducerInfosMapping(session);
         final long pimsLastModified = pims.getLastModified();
         final long lastModified = producerInfo.getLastModified();
         if (lastModified > pimsLastModified)
         {
            pims.setLastModified(lastModified);
         }

         if (!idUnchanged)
         {
            // the consumer was renamed, we need to update its parent
            Map<String, ProducerInfoMapping> nameToProducerInfoMap = pims.getNameToProducerInfoMap();
            nameToProducerInfoMap.put(pim.getId(), pim);
         }

         persister.save();

         // if the consumer's id has changed, return the old one so that state can be updated
View Full Code Here

Examples of org.gatein.wsrp.consumer.registry.mapping.ProducerInfoMapping

   {
      try
      {
         ChromatticSession session = persister.getSession();

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

Examples of org.gatein.wsrp.consumer.registry.mapping.ProducerInfoMapping

   {
      try
      {
         ChromatticSession session = persister.getSession();

         ProducerInfoMapping pim = getProducerInfoMapping(id, session);
         if (pim != null)
         {
            return pim.getLastModified();
         }
         else
         {
            log.debug("There is no ProducerInfo with id '" + id + "'. Return Long.MIN_VALUE for last modified time.");
            return Long.MIN_VALUE;
View Full Code Here

Examples of org.gatein.wsrp.consumer.registry.mapping.ProducerInfoMapping

            for (WSRPConsumer consumer : xmlConsumers)
            {
               ProducerInfo info = consumer.getProducerInfo();

               // create the ProducerInfoMapping children node
               ProducerInfoMapping pim = producerInfosMapping.createProducerInfo(info.getId());

               // need to add to parent first to attach newly created ProducerInfoMapping
               infos.add(pim);

               // init it from ProducerInfo
               pim.initFrom(info);

               // update ProducerInfo with the persistence key
               info.setKey(pim.getKey());

               // populate the cache with the newly created consumer
               consumerCache.putConsumer(info.getId(), consumer);
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.