Package org.jboss.system.server.profileservice.persistence.xml

Examples of org.jboss.system.server.profileservice.persistence.xml.PersistedComponent


   {
      if(root == null)
         throw new IllegalArgumentException("null persistence root");
     
      ComponentMapper mapper = getComponentMapper(parent);
      PersistedComponent persistedComponent = mapper.removeComponent(parent.getAttachment(), component);
      return addPersistedComponent(root, persistedComponent);
   }
View Full Code Here


   {
      if(root == null)
         throw new IllegalArgumentException("null persistence root");
     
      ComponentMapper mapper = getComponentMapper(parent);
      PersistedComponent persistedComponent = mapper.updateComponent(parent.getAttachment(), component);
      return addPersistedComponent(root, persistedComponent);
   }
View Full Code Here

    */
   @Override
   public PersistenceRoot resetComponent(PersistenceRoot root, ManagedObject parent, ManagedComponent component)
   {
      ComponentMapper mapper = getComponentMapper(parent);
      PersistedComponent persistedComponent = mapper.updateComponent(parent.getAttachment(), component);
      // Map the components
      Map<String, PersistedComponent> components = mapComponents(root);
      // Remove the component
      PersistedComponent previous = components.remove(persistedComponent.getOriginalName());
      if(previous == null)
         previous = components.remove(persistedComponent.getName());
      // Set the new values
      root.setComponents(new ArrayList<PersistedComponent>(components.values()));
      return root;
View Full Code Here

    * @return the update persistence root
    */
   protected PersistenceRoot addPersistedComponent(PersistenceRoot root, PersistedComponent component)
   {
      Map<String, PersistedComponent> components = mapComponents(root);
      PersistedComponent previous = components.remove(component.getOriginalName());
      if(previous == null)
         previous = components.remove(component.getName());
      // Add the persisted component
      components.put(component.getName(), component);
     
      // Override with some previous information
      if(previous != null)
      {
         // A added component should remain on added
         if(previous.getModificationInfo() == ModificationInfo.ADDED
               && component.getModificationInfo() == ModificationInfo.MODIFIED)
            component.setModificationInfo(ModificationInfo.ADDED);
        
         // Just remove a previously added component
         if(previous.getModificationInfo() == ModificationInfo.ADDED
               && component.getModificationInfo() == ModificationInfo.REMOVED)
            components.remove(component.getName());
        
         // Override the name
         if(previous.getOriginalName() != null)
            component.setOriginalName(previous.getOriginalName());        
      }
     
      root.setComponents(new ArrayList<PersistedComponent>(components.values()));
      return root;
   }
View Full Code Here

TOP

Related Classes of org.jboss.system.server.profileservice.persistence.xml.PersistedComponent

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.