Package gov.nasa.arc.mct.importExport.provider.generated

Examples of gov.nasa.arc.mct.importExport.provider.generated.ComponentListType


    public void importTest(String inputFilename, String expectedRootID)
        throws Exception {
   
      File file = new File(inputFilename);
     
      ComponentListType components = XMLPersistence.unmarshal(file);
      ComponentType component = components.getComponent().get(0);
     
      Assert.assertNotNull(component);
      Assert.assertEquals(component.getComponentId(), expectedRootID);
     
    }
View Full Code Here


      XMLPersistence.marshal(newCompWOChildren(), file);
      if (!file.exists()) {
        Assert.fail("XML file was not generated.");
      }
     
      ComponentListType components = XMLPersistence.unmarshal(file);
      ComponentType component = components.getComponent().get(0);
      Assert.assertNotNull(component);
      Assert.assertEquals(component.getExternalKey(), "TheExternalKey");
       
      file.delete();
    }
View Full Code Here

    }
   
   
    private ComponentListType illegalComp() {
      ObjectFactory objFactory = new ObjectFactory();
      ComponentListType compList = objFactory.createComponentListType();
      compList.setSchemaVersion(new BigDecimal(1.0));
      ComponentType comp = objFactory.createComponentType();
      comp.setComponentId("askjdfskdjfk");
      compList.getComponent().add(comp);
      return compList;
    }
View Full Code Here

    }
   
    private ComponentListType newCompWOChildren() {
     
      ObjectFactory objFactory = new ObjectFactory();
      ComponentListType compList = objFactory.createComponentListType();
     
      compList.setSchemaVersion(new BigDecimal(1.0));
      ComponentType comp = objFactory.createComponentType();
      comp.setComponentId("askjdfskdjfk");
      comp.setComponentType("TheCompType");
      comp.setCreationDate(Utilities.convertToXMLGregorianCalendar(null));
      comp.setCreator("TheCreator");
      comp.setExternalKey("TheExternalKey");
      comp.setName("TheName");
      comp.setOwner("TheOwner");
      comp.setToplevel(true);
     
      compList.getComponent().add(comp);
     
      return compList;
    }
View Full Code Here

    ValidationEventCollector validationEventCollector =
                                       new ValidationEventCollector();
    Schema schema;
    JAXBElement<ComponentListType> root = null;
    String errStr = null;
    ComponentListType componentListType = null;
   
    try {
      JAXBContext jaxbContext = JAXBContext.newInstance(
                          ComponentListType.class.getPackage().getName(),
                          XMLPersistence.class.getClassLoader());
View Full Code Here

   */
  private AbstractComponent processFile(File file,
                                    AbstractComponent importParentComponent) {
    try {
      // Unmarshal data from file
      ComponentListType compList = XMLPersistence.unmarshal(file);
     
      allComponents = new ArrayList<Component>();
      badReferences = new ArrayList<String>();
      unimportableComps = new ArrayList<String>();

      if (compList != null && compList.getComponent().size() > 0) {
        // Create component with XML file name
        AbstractComponent fileComp = makeFileComponent(file,
                                                   importParentComponent);
        // Create components of data from file
        List<AbstractComponent> comps = convertComponents(compList);
View Full Code Here

            "Export Failed", OptionBox.ERROR_MESSAGE);
        return;
      }

      // Create ComponentListType from single AbstractComponent
      ComponentListType xmlComponentList = createXmlComponentList(selectedComponents);

      if (unexportableComps.size() > 0) {
        int rt = showUnexportableMsg();
        switch(rt){
        case JOptionPane.OK_OPTION:
View Full Code Here

   *            the component to be converted into a ComponentListType
   * @return the ComponentListType which was converted from a
   *         AbstractComponent
   */
  private ComponentListType createXmlComponentList(List<AbstractComponent> components) {
    ComponentListType xmlComponentList = objFactory.createComponentListType();

    // Set the schema version
    xmlComponentList.setSchemaVersion(schemaVersion);
   
    // Estimate total number of components for use with the progress bar
    for (AbstractComponent component : components) {
          totalSize = totalSize + estimateTotalSize(component);
    }
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.importExport.provider.generated.ComponentListType

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.