Package org.infoglue.cms.entities.management

Examples of org.infoglue.cms.entities.management.SiteNodeTypeDefinition


    if(siteNode == null || availableServiceBindingName == null)
      return null;
   
    AvailableServiceBinding availableServiceBinding = null;
   
    SiteNodeTypeDefinition siteNodeTypeDefinition = siteNode.getSiteNodeTypeDefinition();
    if(siteNodeTypeDefinition != null)
    {
      Collection availableServiceBindings = siteNodeTypeDefinition.getAvailableServiceBindings();
     
      Iterator availableServiceBindingsIterator = availableServiceBindings.iterator();
      while(availableServiceBindingsIterator.hasNext())
      {
        AvailableServiceBinding currentAvailableServiceBinding = (AvailableServiceBinding)availableServiceBindingsIterator.next();
View Full Code Here


    beginTransaction(db);

    try
    {
      SiteNodeTypeDefinition siteNodeTypeDefinition = SiteNodeTypeDefinitionController.getController().getSiteNodeTypeDefinitionWithId(siteNodeTypeDefinitionId, db);
      Collection assignedAvailableServiceBinding = siteNodeTypeDefinition.getAvailableServiceBindings();
      assignedAvailableServiceBindingVOList = AvailableServiceBindingController.toVOList(assignedAvailableServiceBinding);
         
      //If any of the validations or setMethods reported an error, we throw them up now before create.
      ceb.throwIfNotEmpty();
           
View Full Code Here

    Integer originalSiteNodeId = siteNode.getSiteNodeId();

    logger.info("originalSiteNodeId:" + originalSiteNodeId);

    SiteNodeTypeDefinition originalSiteNodeTypeDefinition = siteNode.getSiteNodeTypeDefinition();
    SiteNodeTypeDefinition siteNodeTypeDefinition = null;
    if(originalSiteNodeTypeDefinition != null)
    {
      logger.info("originalSiteNodeTypeDefinition:" + originalSiteNodeTypeDefinition);
      siteNodeTypeDefinition = SiteNodeTypeDefinitionController.getController().getSiteNodeTypeDefinitionWithName(siteNode.getSiteNodeTypeDefinition().getName(), db, false);
      logger.info("siteNodeTypeDefinition:" + siteNodeTypeDefinition);
      if(siteNodeTypeDefinition == null)
      {
          db.create(originalSiteNodeTypeDefinition);
          siteNodeTypeDefinition = originalSiteNodeTypeDefinition;
      }
     
      siteNode.setSiteNodeTypeDefinition((SiteNodeTypeDefinitionImpl)siteNodeTypeDefinition);
    }
   
    String mappedMetaInfoContentId = "-1";
    if(siteNode.getMetaInfoContentId() != null)
    {
      if(contentIdMap.containsKey(siteNode.getMetaInfoContentId().toString()))
        mappedMetaInfoContentId = (String)contentIdMap.get(siteNode.getMetaInfoContentId().toString());
    }
    siteNode.setMetaInfoContentId(new Integer(mappedMetaInfoContentId));
   
    siteNode.setName(substituteStrings(siteNode.getName(), replaceMap));

    db.create(siteNode);
   
    allSiteNodes.add(siteNode);
       
    Integer newSiteNodeId = siteNode.getSiteNodeId();
    logger.info(originalSiteNodeId + ":" + newSiteNodeId);
    siteNodeIdMap.put(originalSiteNodeId.toString(), newSiteNodeId.toString());
   
    Collection childSiteNodes = siteNode.getChildSiteNodes();
    if(childSiteNodes != null)
    {
      Iterator childSiteNodesIterator = childSiteNodes.iterator();
      while(childSiteNodesIterator.hasNext())
      {
        SiteNode childSiteNode = (SiteNode)childSiteNodesIterator.next();
        childSiteNode.setRepository(siteNode.getRepository());
        childSiteNode.setParentSiteNode((SiteNodeImpl)siteNode);
        createStructure(childSiteNode, contentIdMap, siteNodeIdMap, siteNodeVersionIdMap, readAvailableServiceBindings, allSiteNodes, db, onlyLatestVersions, replaceMap);
      }
    }

    Collection siteNodeVersions = siteNode.getSiteNodeVersions();
   
    if(onlyLatestVersions.equalsIgnoreCase("true"))
    {
        logger.info("org siteNodeVersions:" + siteNodeVersions.size());
      List selectedSiteNodeVersions = new ArrayList();
      Iterator realSiteNodeVersionsIterator = siteNodeVersions.iterator();
      while(realSiteNodeVersionsIterator.hasNext())
      {
        SiteNodeVersion siteNodeVersion = (SiteNodeVersion)realSiteNodeVersionsIterator.next();     
        Iterator selectedSiteNodeVersionsIterator = selectedSiteNodeVersions.iterator();
        boolean addVersion = true;
        while(selectedSiteNodeVersionsIterator.hasNext())
        {
          SiteNodeVersion currentSiteNodeVersion = (SiteNodeVersion)selectedSiteNodeVersionsIterator.next();
          if(siteNodeVersion.getIsActive().booleanValue() && siteNodeVersion.getSiteNodeVersionId().intValue() > currentSiteNodeVersion.getSiteNodeVersionId().intValue())
          {
            logger.info("A later version was found... removing this one..");
            selectedSiteNodeVersionsIterator.remove();
            addVersion = true;
          }           
        }
 
        if(addVersion)
          selectedSiteNodeVersions.add(siteNodeVersion);
     
     
      siteNodeVersions = selectedSiteNodeVersions;
    }

    Iterator siteNodeVersionsIterator = siteNodeVersions.iterator();
    while(siteNodeVersionsIterator.hasNext())
    {
      SiteNodeVersion siteNodeVersion = (SiteNodeVersion)siteNodeVersionsIterator.next();
     
      Collection serviceBindings = siteNodeVersion.getServiceBindings();

      siteNodeVersion.setOwningSiteNode((SiteNodeImpl)siteNode);
     
      Integer oldSiteNodeVersionId = siteNodeVersion.getId();

      db.create(siteNodeVersion);

      Integer newSiteNodeVersionId = siteNodeVersion.getId();
      siteNodeVersionIdMap.put(oldSiteNodeVersionId.toString(), newSiteNodeVersionId.toString());

      Iterator serviceBindingsIterator = serviceBindings.iterator();
      while(serviceBindingsIterator.hasNext())
      {
        ServiceBinding serviceBinding = (ServiceBinding)serviceBindingsIterator.next();
        logger.info("serviceBinding:" + serviceBinding.getName());
        ServiceDefinition originalServiceDefinition = serviceBinding.getServiceDefinition();
        if(originalServiceDefinition == null)
        {
          logger.error("Skipping serviceBinding:" + serviceBinding.getName() + ":" + "serviceBinding:" + serviceBinding.getId() + " " + serviceBinding.getServiceDefinition());
          continue;
        }
       
        String serviceDefinitionName = originalServiceDefinition.getName();
        ServiceDefinition serviceDefinition = ServiceDefinitionController.getController().getServiceDefinitionWithName(serviceDefinitionName, db, false);
        if(serviceDefinition == null)
        {
            db.create(originalServiceDefinition);
            serviceDefinition = originalServiceDefinition;
            //availableServiceBinding.getServiceDefinitions().add(serviceDefinition);
        }
       
        serviceBinding.setServiceDefinition((ServiceDefinitionImpl)serviceDefinition);

        AvailableServiceBinding originalAvailableServiceBinding = serviceBinding.getAvailableServiceBinding();
        String availableServiceBindingName = originalAvailableServiceBinding.getName();
        logger.info("availableServiceBindingName:" + availableServiceBindingName);
        logger.info("readAvailableServiceBindings:" + readAvailableServiceBindings.size() + ":" + readAvailableServiceBindings.containsKey(availableServiceBindingName));
        AvailableServiceBinding availableServiceBinding = (AvailableServiceBinding)readAvailableServiceBindings.get(availableServiceBindingName);
        logger.info("availableServiceBinding:" + availableServiceBinding);
        if(availableServiceBinding == null)
        {
          availableServiceBinding = AvailableServiceBindingController.getController().getAvailableServiceBindingWithName(availableServiceBindingName, db, false);
          logger.info("Read availableServiceBinding from database:" + availableServiceBindingName + "=" + availableServiceBinding);
          readAvailableServiceBindings.put(availableServiceBindingName, availableServiceBinding);
          logger.info("readAvailableServiceBindings:" + readAvailableServiceBindings.size() + ":" + readAvailableServiceBindings.containsKey(availableServiceBindingName));
        }
       
        if(availableServiceBinding == null)
        {
            logger.info("There was no availableServiceBinding registered under:" + availableServiceBindingName);
            logger.info("originalAvailableServiceBinding:" + originalAvailableServiceBinding.getName() + ":" + originalAvailableServiceBinding.getIsInheritable());
            db.create(originalAvailableServiceBinding);
            availableServiceBinding = originalAvailableServiceBinding;
            readAvailableServiceBindings.put(availableServiceBindingName, availableServiceBinding);
           
            logger.info("Notifying:" + siteNodeTypeDefinition.getName() + " about the new availableServiceBinding " + availableServiceBinding.getName());
            if(siteNodeTypeDefinition != null)
            {
              siteNodeTypeDefinition.getAvailableServiceBindings().add((AvailableServiceBindingImpl)availableServiceBinding);
              serviceDefinition.getAvailableServiceBindings().add((AvailableServiceBindingImpl)availableServiceBinding);
              availableServiceBinding.getSiteNodeTypeDefinitions().add((SiteNodeTypeDefinitionImpl)siteNodeTypeDefinition);
              availableServiceBinding.getServiceDefinitions().add((ServiceDefinitionImpl)serviceDefinition);
            }
        }
        else
        {
          if(siteNodeTypeDefinition != null && !siteNodeTypeDefinition.getAvailableServiceBindings().contains(availableServiceBinding))
          {
            siteNodeTypeDefinition.getAvailableServiceBindings().add((AvailableServiceBindingImpl)availableServiceBinding);
            availableServiceBinding.getSiteNodeTypeDefinitions().add(siteNodeTypeDefinition);
          }
        }
       
        serviceBinding.setAvailableServiceBinding((AvailableServiceBindingImpl)availableServiceBinding);
View Full Code Here

TOP

Related Classes of org.infoglue.cms.entities.management.SiteNodeTypeDefinition

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.