Package org.exoplatform.services.jcr.impl.xml.importing.dataflow

Examples of org.exoplatform.services.jcr.impl.xml.importing.dataflow.ImportNodeData


            NoSuchNodeTypeException
   {
      ImportPropertyData propertyData;
      InternalQName[] mixinNames = new InternalQName[propertyInfo.getValuesSize()];
      List<ValueData> values = new ArrayList<ValueData>(propertyInfo.getValuesSize());
      ImportNodeData currentNodeInfo = (ImportNodeData) getParent();
      for (int i = 0; i < propertyInfo.getValuesSize(); i++)
      {

         String value = propertyInfo.getValues().get(i).toString();

         mixinNames[i] = locationFactory.parseJCRName(value).getInternalName();
         currentNodeInfo.addNodeType((nodeTypeDataManager.findNodeType(mixinNames[i])));
         values.add(new TransientValueData(value.toString()));
      }

      currentNodeInfo.setMixinTypeNames(mixinNames);

      propertyData =
               new ImportPropertyData(QPath.makeChildPath(currentNodeInfo.getQPath(), propertyInfo.getName()),
                        propertyInfo.getIndentifer(), 0, propertyInfo.getType(), currentNodeInfo.getIdentifier(), true);
      propertyData.setValues(parseValues());
      return propertyData;
   }
View Full Code Here


    *
    * @throws RepositoryException
    */
   private void endNode() throws RepositoryException
   {
      ImportNodeData currentNodeInfo = (ImportNodeData) tree.pop();

      currentNodeInfo.setMixinTypeNames(currentNodeInfo.getMixinTypeNames());

      if (currentNodeInfo.isMixVersionable())
      {
         createVersionHistory(currentNodeInfo);
      }

      currentNodeInfo.setACL(initAcl(currentNodeInfo.getACL(), currentNodeInfo.isExoOwneable(), currentNodeInfo
               .isExoPrivilegeable(), currentNodeInfo.getExoOwner(), currentNodeInfo.getExoPrivileges()));
   }
View Full Code Here

   {
      ImportPropertyData propertyData;
      String sName = propertyInfo.getValues().get(0).toString();
      InternalQName primaryTypeName = locationFactory.parseJCRName(sName).getInternalName();

      ImportNodeData nodeData = (ImportNodeData) tree.pop();
      if (!Constants.ROOT_UUID.equals(nodeData.getIdentifier()))
      {
         NodeData parentNodeData = getParent();
         // nodeTypeDataManager.findChildNodeDefinition(primaryTypeName,)
         if (!nodeTypeDataManager.isChildNodePrimaryTypeAllowed(primaryTypeName, parentNodeData.getPrimaryTypeName(),
                  parentNodeData.getMixinTypeNames()))
         {
            throw new ConstraintViolationException("Can't add node " + nodeData.getQName().getAsString() + " to "
                     + parentNodeData.getQPath().getAsString() + " node type " + sName
                     + " is not allowed as child's node type for parent node type "
                     + parentNodeData.getPrimaryTypeName().getAsString());
         }
      }
      //
      nodeData.addNodeType((nodeTypeDataManager.findNodeType(primaryTypeName)));
      nodeData.setPrimaryTypeName(primaryTypeName);

      propertyData =
               new ImportPropertyData(QPath.makeChildPath(nodeData.getQPath(), propertyInfo.getName()), propertyInfo
                        .getIndentifer(), 0, propertyInfo.getType(), nodeData.getIdentifier(), false);
      propertyData.setValues(parseValues());
      tree.push(nodeData);
      return propertyData;
   }
View Full Code Here

         endVersionable((ImportNodeData) getParent(), parseValues());
      }
      else
      {

         ImportNodeData currentNodeInfo = (ImportNodeData) getParent();
         List<ValueData> values = parseValues();

         // determinating is property multivalue;
         boolean isMultivalue = true;

         PropertyDefinitionDatas defs =
                  nodeTypeDataManager.findPropertyDefinitions(propertyInfo.getName(), currentNodeInfo
                           .getPrimaryTypeName(), currentNodeInfo.getMixinTypeNames());

         if (defs == null)
         {
            if (!((Boolean) context.get(ContentImporter.RESPECT_PROPERTY_DEFINITIONS_CONSTRAINTS)))
            {
               log.warn("Property definition not found for " + propertyInfo.getName());
               return null;
            }
            else
               throw new RepositoryException("Property definition not found for " + propertyInfo.getName());

         }

         if (values.size() == 1)
         {
            // there is single-value defeniton
            if (defs.getDefinition(false) != null)
            {
               isMultivalue = false;
            }
         }
         else
         {
            if ((defs.getDefinition(true) == null) && (defs.getDefinition(false) != null))
            {
               throw new ValueFormatException("Can not assign multiple-values " + "Value to a single-valued property "
                        + propertyInfo.getName().getName());
            }
         }
         log.debug("Import " + propertyInfo.getName().getName() + " size=" + propertyInfo.getValuesSize()
                  + " isMultivalue=" + isMultivalue);

         propertyData =
                  new ImportPropertyData(QPath.makeChildPath(currentNodeInfo.getQPath(), propertyInfo.getName()),
                           propertyInfo.getIndentifer(), 0, propertyInfo.getType(), currentNodeInfo.getIdentifier(),
                           isMultivalue);
         propertyData.setValues(values);

      }
      return propertyData;
View Full Code Here

    * @throws IllegalPathException
    */
   private ImportPropertyData endUuid() throws RepositoryException, PathNotFoundException, IllegalPathException
   {
      ImportPropertyData propertyData;
      ImportNodeData currentNodeInfo = (ImportNodeData) tree.pop();

      currentNodeInfo.setMixReferenceable(nodeTypeDataManager.isNodeType(Constants.MIX_REFERENCEABLE, currentNodeInfo
               .getPrimaryTypeName(), currentNodeInfo.getMixinTypeNames()));

      if (currentNodeInfo.isMixReferenceable())
      {
         currentNodeInfo.setMixVersionable(nodeTypeDataManager.isNodeType(Constants.MIX_VERSIONABLE, currentNodeInfo
                  .getPrimaryTypeName(), currentNodeInfo.getMixinTypeNames()));
         checkReferenceable(currentNodeInfo, propertyInfo.getValues().get(0).toString());
      }

      propertyData =
               new ImportPropertyData(QPath.makeChildPath(currentNodeInfo.getQPath(), propertyInfo.getName()),
                        propertyInfo.getIndentifer(), 0, propertyInfo.getType(), currentNodeInfo.getIdentifier(), false);
      propertyData.setValue(new TransientValueData(currentNodeInfo.getIdentifier()));

      tree.push(currentNodeInfo);
      return propertyData;
   }
View Full Code Here

         }
      }

      if (propertyInfo.getType() == ExtendedPropertyType.PERMISSION)
      {
         ImportNodeData currentNodeInfo = (ImportNodeData) getParent();
         currentNodeInfo.setExoPrivileges(stringValues);
      }
      else if (Constants.EXO_OWNER.equals(propertyInfo.getName()))
      {
         ImportNodeData currentNodeInfo = (ImportNodeData) getParent();
         currentNodeInfo.setExoOwner(stringValues.get(0));
      }
      return values;

   }
View Full Code Here

   protected ImportNodeData processRootNode(QPath parentPath)
   {
      // remove the wrong root (null) from the stack
      tree.pop();

      ImportNodeData newNodeData =
         new ImportNodeData(Constants.ROOT_PATH, Constants.ROOT_UUID, -1, Constants.NT_UNSTRUCTURED,
            new InternalQName[0], 0, null, new AccessControlList());

      // persisted.
      changesLog.add(new ItemState(newNodeData, ItemState.ADDED, true, parentPath, false, true));
View Full Code Here

         {
            currentNodeName = locationFactory.parseJCRName(svName).getInternalName();
         }

         int nodeIndex = getNodeIndex(parentData, currentNodeName, null);
         ImportNodeData newNodeData = new ImportNodeData(parentData, currentNodeName, nodeIndex);
         // preset of ACL
         newNodeData.setACL(parentData.getACL());
         newNodeData.setOrderNumber(getNextChildOrderNum(parentData));
         newNodeData.setIdentifier(IdGenerator.generate());

         changesLog.add(new ItemState(newNodeData, ItemState.ADDED, true, getAncestorToSave()));

         tree.push(newNodeData);
View Full Code Here

      NoSuchNodeTypeException
   {
      ImportPropertyData propertyData;
      InternalQName[] mixinNames = new InternalQName[propertyInfo.getValuesSize()];
      List<ValueData> values = new ArrayList<ValueData>(propertyInfo.getValuesSize());
      ImportNodeData currentNodeInfo = (ImportNodeData)getParent();
      for (int i = 0; i < propertyInfo.getValuesSize(); i++)
      {

         String value = propertyInfo.getValues().get(i).toString();

         mixinNames[i] = locationFactory.parseJCRName(value).getInternalName();
         currentNodeInfo.addNodeType((nodeTypeDataManager.getNodeType(mixinNames[i])));
         values.add(new TransientValueData(value.toString()));
      }

      currentNodeInfo.setMixinTypeNames(mixinNames);

      propertyData =
         new ImportPropertyData(QPath.makeChildPath(currentNodeInfo.getQPath(), propertyInfo.getName()), propertyInfo
            .getIndentifer(), 0, propertyInfo.getType(), currentNodeInfo.getIdentifier(), true);
      propertyData.setValues(parseValues());
      return propertyData;
   }
View Full Code Here

    *
    * @throws RepositoryException
    */
   private void endNode() throws RepositoryException
   {
      ImportNodeData currentNodeInfo = (ImportNodeData)tree.pop();

      currentNodeInfo.setMixinTypeNames(currentNodeInfo.getMixinTypeNames());

      if (currentNodeInfo.isMixVersionable())
      {
         createVersionHistory(currentNodeInfo);
      }

      currentNodeInfo.setACL(initAcl(currentNodeInfo.getACL(), currentNodeInfo.isExoOwneable(), currentNodeInfo
         .isExoPrivilegeable(), currentNodeInfo.getExoOwner(), currentNodeInfo.getExoPrivileges()));
   }
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.impl.xml.importing.dataflow.ImportNodeData

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.