Package org.gatein.wsrp.consumer.registry.mapping

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


      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

   {
      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

   {
      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

            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

      return PRODUCER_INFOS_PATH + "/" + producerInfoId;
   }

   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

TOP

Related Classes of org.gatein.wsrp.consumer.registry.mapping.ProducerInfoMapping

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.