Java Examples for org.exolab.castor.xml.Marshaller

The following java examples will help you to understand the usage of org.exolab.castor.xml.Marshaller. These source code samples are taken from different open source projects.

Example 1
Project: ismp_manager-master  File: UdpUuidSender.java View source code
@Override
public void run() {
    // get the context
    m_context = Thread.currentThread();
    // get a logger
    ThreadCategory.setPrefix(m_logPrefix);
    boolean isTracing = log().isDebugEnabled();
    if (m_stop) {
        log().debug("Stop flag set before thread started, exiting");
        return;
    } else {
        log().debug("Thread context started");
    }
    /*
		 * This loop is labeled so that it can be
		 * exited quickly when the thread is interrupted.
		 */
    List<UdpReceivedEvent> eventHold = new ArrayList<UdpReceivedEvent>(30);
    Map<UdpReceivedEvent, EventReceipt> receipts = new HashMap<UdpReceivedEvent, EventReceipt>();
    RunLoop: while (!m_stop) {
        log().debug("Waiting on event receipts to be generated");
        synchronized (m_eventUuidsOut) {
            // wait for an event to show up. wait in 1 second intervals
            while (m_eventUuidsOut.isEmpty()) {
                try {
                    // use wait instead of sleep to release the lock!
                    m_eventUuidsOut.wait(1000);
                } catch (InterruptedException ie) {
                    log().debug("Thread context interrupted");
                    break RunLoop;
                }
            }
            eventHold.addAll(m_eventUuidsOut);
            m_eventUuidsOut.clear();
        }
        if (isTracing) {
            log().debug("Received " + eventHold.size() + " event receipts to process");
            log().debug("Processing receipts");
        }
        // build an event-receipt
        for (UdpReceivedEvent re : eventHold) {
            for (Event e : re.getAckedEvents()) {
                if (e.getUuid() != null) {
                    EventReceipt receipt = receipts.get(re);
                    if (receipt == null) {
                        receipt = new EventReceipt();
                        receipts.put(re, receipt);
                    }
                    receipt.addUuid(e.getUuid());
                }
            }
        }
        eventHold.clear();
        log().debug("Event receipts sorted, transmitting receipts");
        // turn them into XML and send it out the socket
        for (Map.Entry<UdpReceivedEvent, EventReceipt> entry : receipts.entrySet()) {
            UdpReceivedEvent re = entry.getKey();
            EventReceipt receipt = entry.getValue();
            StringWriter writer = new StringWriter();
            try {
                Marshaller.marshal(receipt, writer);
            } catch (ValidationException e) {
                log().warn("Failed to build event receipt for agent " + re.getSender().getHostAddress() + ":" + re.getPort() + ": " + e, e);
            } catch (MarshalException e) {
                log().warn("Failed to build event receipt for agent " + re.getSender().getHostAddress() + ":" + re.getPort() + ": " + e, e);
            }
            String xml = writer.getBuffer().toString();
            try {
                byte[] xml_bytes = xml.getBytes("US-ASCII");
                DatagramPacket pkt = new DatagramPacket(xml_bytes, xml_bytes.length, re.getSender(), re.getPort());
                if (isTracing) {
                    log().debug("Transmitting receipt to destination " + re.getSender().getHostAddress() + ":" + re.getPort());
                }
                m_dgSock.send(pkt);
                synchronized (m_handlers) {
                    for (EventHandler handler : m_handlers) {
                        try {
                            handler.receiptSent(receipt);
                        } catch (Throwable t) {
                            log().warn("Error processing event receipt: " + t, t);
                        }
                    }
                }
                if (isTracing) {
                    log().debug("Receipt transmitted OK {");
                    log().debug(xml);
                    log().debug("}");
                }
            } catch (UnsupportedEncodingException e) {
                log().warn("Failed to convert XML to byte array: " + e, e);
            } catch (IOException e) {
                log().warn("Failed to send packet to host" + re.getSender().getHostAddress() + ":" + re.getPort() + ": " + e, e);
            }
        }
        receipts.clear();
    }
    log().debug("Context finished, returning");
}
Example 2
Project: spring-batch-master  File: CastorMarshallingTests.java View source code
@Override
protected Marshaller getMarshaller() throws Exception {
    CastorMarshaller marshaller = new CastorMarshaller();
    // marshaller.setTargetClass(Trade.class);
    marshaller.setMappingLocation(new ClassPathResource("mapping-castor.xml", getClass()));
    // there is no way to call
    // org.exolab.castor.xml.Marshaller.setSupressXMLDeclaration();
    marshaller.afterPropertiesSet();
    return marshaller;
}
Example 3
Project: spring-framework-master  File: CastorMarshaller.java View source code
/**
	 * Template method that allows for customizing of the given Castor {@link Marshaller}.
	 */
protected void customizeMarshaller(Marshaller marshaller) {
    marshaller.setValidation(this.validating);
    marshaller.setSuppressNamespaces(this.suppressNamespaces);
    marshaller.setSuppressXSIType(this.suppressXsiType);
    marshaller.setMarshalAsDocument(this.marshalAsDocument);
    marshaller.setMarshalExtendedType(this.marshalExtendedType);
    marshaller.setRootElement(this.rootElement);
    marshaller.setNoNamespaceSchemaLocation(this.noNamespaceSchemaLocation);
    marshaller.setSchemaLocation(this.schemaLocation);
    marshaller.setUseXSITypeAtRoot(this.useXSITypeAtRoot);
    if (this.doctypes != null) {
        for (Map.Entry<String, String> doctype : this.doctypes.entrySet()) {
            marshaller.setDoctype(doctype.getKey(), doctype.getValue());
        }
    }
    if (this.processingInstructions != null) {
        for (Map.Entry<String, String> processingInstruction : this.processingInstructions.entrySet()) {
            marshaller.addProcessingInstruction(processingInstruction.getKey(), processingInstruction.getValue());
        }
    }
    if (this.namespaceMappings != null) {
        for (Map.Entry<String, String> entry : this.namespaceMappings.entrySet()) {
            marshaller.setNamespaceMapping(entry.getKey(), entry.getValue());
        }
    }
}
Example 4
Project: castor-master  File: SourceGenerator.java View source code
/**
     * Generates the mapping file.
     * @param packageName Package name to be generated
     * @param sInfo Source Generator current state
     * @throws IOException if this Exception occurs while generating the mapping file
     */
private void generateMappingFile(final String packageName, final SGStateInfo sInfo) throws IOException {
    String pkg = (packageName != null) ? packageName : "";
    MappingRoot mapping = sInfo.getMapping(pkg);
    if (mapping == null) {
        return;
    }
    FileWriter writer = new FileWriter(_mappingFilename);
    try {
        Marshaller marshaller = new Marshaller(writer);
        marshaller.setSuppressNamespaces(true);
        marshaller.marshal(mapping);
    } catch (Exception ex) {
        throw new NestedIOException(ex);
    } finally {
        writer.flush();
        writer.close();
    }
}
Example 5
Project: cocoon-master  File: Deploy.java View source code
/**
     * Prepare the web archive of the portlet web app
     */
public static void prepareWebArchive(String webAppsDir, String webModule) throws Exception {
    System.out.println("Preparing web archive '" + webModule + "' ...");
    // get portlet xml mapping file
    Mapping mappingPortletXml = getMapping(PortletDefinitionRegistryImpl.PORTLET_MAPPING);
    // get web xml mapping file
    Mapping mappingWebXml = getMapping(PortletDefinitionRegistryImpl.WEBXML_MAPPING);
    File portletXml = new File(webAppsDir + webModule + webInfDir + "portlet.xml");
    File webXml = new File(webAppsDir + webModule + webInfDir + "web.xml");
    Unmarshaller unmarshaller = new Unmarshaller(mappingPortletXml);
    PortletApplicationDefinitionImpl portletApp = (PortletApplicationDefinitionImpl) unmarshaller.unmarshal(new FileReader(portletXml));
    // refill structure with necessary information
    Vector structure = new Vector();
    structure.add(webModule);
    structure.add(null);
    structure.add(null);
    portletApp.preBuild(structure);
    if (debug) {
        System.out.println(portletApp);
    }
    // now generate web part
    WebApplicationDefinitionImpl webApp = null;
    if (webXml.exists()) {
        Unmarshaller unmarshallerWeb = new Unmarshaller(mappingWebXml);
        unmarshallerWeb.setIgnoreExtraElements(true);
        webApp = (WebApplicationDefinitionImpl) unmarshallerWeb.unmarshal(new FileReader(webXml));
    } else {
        webApp = new WebApplicationDefinitionImpl();
        DisplayNameImpl dispName = new DisplayNameImpl();
        dispName.setDisplayName(webModule);
        dispName.setLocale(Locale.ENGLISH);
        DisplayNameSetImpl dispSet = new DisplayNameSetImpl();
        dispSet.add(dispName);
        webApp.setDisplayNames(dispSet);
        DescriptionImpl desc = new DescriptionImpl();
        desc.setDescription("Automated generated Application Wrapper");
        desc.setLocale(Locale.ENGLISH);
        DescriptionSetImpl descSet = new DescriptionSetImpl();
        descSet.add(desc);
        webApp.setDescriptions(descSet);
    }
    ControllerFactory controllerFactory = new ControllerFactoryImpl();
    ServletDefinitionListCtrl servletDefinitionSetCtrl = (ServletDefinitionListCtrl) controllerFactory.get(webApp.getServletDefinitionList());
    Collection servletMappings = webApp.getServletMappings();
    Iterator portlets = portletApp.getPortletDefinitionList().iterator();
    while (portlets.hasNext()) {
        PortletDefinition portlet = (PortletDefinition) portlets.next();
        if (debug) {
            System.out.println("  Portlet: " + portlet.getId());
        }
        // check if already exists
        ServletDefinition servlet = webApp.getServletDefinitionList().get(portlet.getName());
        if (servlet != null) {
            if (!servlet.getServletClass().equals("org.apache.pluto.core.PortletServlet")) {
                System.out.println("Note: Replaced already existing the servlet with the name '" + portlet.getName() + "' with the wrapper servlet.");
            }
            ServletDefinitionCtrl _servletCtrl = (ServletDefinitionCtrl) controllerFactory.get(servlet);
            _servletCtrl.setServletClass("org.apache.pluto.core.PortletServlet");
        } else {
            servlet = servletDefinitionSetCtrl.add(portlet.getName(), "org.apache.pluto.core.PortletServlet");
        }
        ServletDefinitionCtrl servletCtrl = (ServletDefinitionCtrl) controllerFactory.get(servlet);
        DisplayNameImpl dispName = new DisplayNameImpl();
        dispName.setDisplayName(portlet.getName() + " Wrapper");
        dispName.setLocale(Locale.ENGLISH);
        DisplayNameSetImpl dispSet = new DisplayNameSetImpl();
        dispSet.add(dispName);
        servletCtrl.setDisplayNames(dispSet);
        DescriptionImpl desc = new DescriptionImpl();
        desc.setDescription("Automated generated Portlet Wrapper");
        desc.setLocale(Locale.ENGLISH);
        DescriptionSetImpl descSet = new DescriptionSetImpl();
        descSet.add(desc);
        servletCtrl.setDescriptions(descSet);
        ParameterSet parameters = servlet.getInitParameterSet();
        ParameterSetCtrl parameterSetCtrl = (ParameterSetCtrl) controllerFactory.get(parameters);
        Parameter parameter1 = parameters.get("portlet-class");
        if (parameter1 == null) {
            parameterSetCtrl.add("portlet-class", portlet.getClassName());
        } else {
            ParameterCtrl parameterCtrl = (ParameterCtrl) controllerFactory.get(parameter1);
            parameterCtrl.setValue(portlet.getClassName());
        }
        Parameter parameter2 = parameters.get("portlet-guid");
        if (parameter2 == null) {
            parameterSetCtrl.add("portlet-guid", portlet.getId().toString());
        } else {
            ParameterCtrl parameterCtrl = (ParameterCtrl) controllerFactory.get(parameter2);
            parameterCtrl.setValue(portlet.getId().toString());
        }
        boolean found = false;
        Iterator mappings = servletMappings.iterator();
        while (mappings.hasNext()) {
            ServletMapping servletMapping = (ServletMapping) mappings.next();
            if (servletMapping.getServletName().equals(portlet.getName())) {
                found = true;
                servletMapping.setUrlPattern("/" + portlet.getName().replace(' ', '_') + "/*");
            }
        }
        if (!found) {
            ServletMapping servletMapping = new ServletMapping();
            servletMapping.setServletName(portlet.getName());
            servletMapping.setUrlPattern("/" + portlet.getName().replace(' ', '_') + "/*");
            servletMappings.add(servletMapping);
        }
        SecurityRoleRefSet servletSecurityRoleRefs = ((ServletDefinitionImpl) servlet).getInitSecurityRoleRefSet();
        SecurityRoleRefSetCtrl servletSecurityRoleRefSetCtrl = (SecurityRoleRefSetCtrl) controllerFactory.get(servletSecurityRoleRefs);
        SecurityRoleSet webAppSecurityRoles = webApp.getSecurityRoles();
        SecurityRoleRefSet portletSecurityRoleRefs = portlet.getInitSecurityRoleRefSet();
        Iterator p = portletSecurityRoleRefs.iterator();
        while (p.hasNext()) {
            SecurityRoleRef portletSecurityRoleRef = (SecurityRoleRef) p.next();
            if (portletSecurityRoleRef.getRoleLink() == null && webAppSecurityRoles.get(portletSecurityRoleRef.getRoleName()) == null) {
                System.out.println("Note: The web application has no security role defined which matches the role name \"" + portletSecurityRoleRef.getRoleName() + "\" of the security-role-ref element defined for the wrapper-servlet with the name '" + portlet.getName() + "'.");
                break;
            }
            SecurityRoleRef servletSecurityRoleRef = servletSecurityRoleRefs.get(portletSecurityRoleRef.getRoleName());
            if (null != servletSecurityRoleRef) {
                System.out.println("Note: Replaced already existing element of type <security-role-ref> with value \"" + portletSecurityRoleRef.getRoleName() + "\" for subelement of type <role-name> for the wrapper-servlet with the name '" + portlet.getName() + "'.");
                servletSecurityRoleRefSetCtrl.remove(servletSecurityRoleRef);
            }
            servletSecurityRoleRefSetCtrl.add(portletSecurityRoleRef);
        }
    }
    TagDefinition portletTagLib = new TagDefinition();
    Collection taglibs = webApp.getCastorTagDefinitions();
    taglibs.add(portletTagLib);
    if (debug) {
        System.out.println(webApp);
    }
    OutputFormat of = new OutputFormat();
    of.setIndenting(true);
    // 2-space indention
    of.setIndent(4);
    of.setLineWidth(16384);
    // As large as needed to prevent linebreaks in text nodes
    of.setDoctype(WEB_PORTLET_PUBLIC_ID, WEB_PORTLET_DTD);
    FileWriter writer = new FileWriter(webAppsDir + webModule + SystemUtils.FILE_SEPARATOR + "WEB-INF" + SystemUtils.FILE_SEPARATOR + "web.xml");
    XMLSerializer serializer = new XMLSerializer(writer, of);
    try {
        Marshaller marshaller = new Marshaller(serializer.asDocumentHandler());
        marshaller.setMapping(mappingWebXml);
        marshaller.marshal(webApp);
    } finally {
        writer.close();
    }
    if (debug) {
        System.out.println("Finished!");
    }
}
Example 6
Project: axis2-java-master  File: StockQuoteServiceSkeleton.java View source code
/**
     * Auto generated method signature
     *
     * @param param0
     */
public OMElement getStockQuote(OMElement param0) throws AxisFault {
    Unmarshaller unmarshaller = new Unmarshaller(GetStockQuote.class);
    UnmarshalHandler unmarshalHandler = unmarshaller.createHandler();
    GetStockQuote stockQuote;
    try {
        ContentHandler contentHandler = Unmarshaller.getContentHandler(unmarshalHandler);
        TransformerFactory.newInstance().newTransformer().transform(param0.getSAXSource(false), new SAXResult(contentHandler));
        stockQuote = (GetStockQuote) unmarshalHandler.getObject();
    } catch (SAXException e) {
        throw new RuntimeException(e);
    } catch (TransformerException e) {
        throw new RuntimeException(e);
    }
    if (!stockQuote.getSymbol().equals("IBM")) {
        throw new AxisFault("StockQuote details for the symbol '" + stockQuote.getSymbol() + "' are not available.");
    }
    GetStockQuoteResponse stockQuoteResponse = new GetStockQuoteResponse();
    Quote quote = new Quote();
    quote.setSymbol(stockQuote.getSymbol());
    quote.setVolume(5000);
    LastTrade lastTrade = new LastTrade();
    lastTrade.setPrice(99);
    lastTrade.setDate(Calendar.getInstance().getTimeInMillis());
    quote.setLastTrade(lastTrade);
    Change change = new Change();
    change.setDollar(1);
    change.setPercent(10);
    change.setPositive(true);
    quote.setChange(change);
    stockQuoteResponse.setQuote(quote);
    OMDocument document = param0.getOMFactory().createOMDocument();
    try {
        Marshaller.marshal(stockQuoteResponse, document.getSAXResult().getHandler());
    } catch (MarshalException e) {
        throw new RuntimeException(e);
    } catch (ValidationException e) {
        throw new RuntimeException(e);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    return document.getOMDocumentElement();
}
Example 7
Project: cagrid2-master  File: SDKSerializer.java View source code
public void serialize(QName name, Attributes attributes, Object value, SerializationContext context) throws IOException {
    long startTime = System.currentTimeMillis();
    AxisContentHandler hand = new AxisContentHandler(context);
    Marshaller marshaller = new Marshaller(hand);
    try {
        Mapping mapping = EncodingUtils.getMapping(context.getMessageContext());
        marshaller.setMapping(mapping);
        marshaller.setValidation(true);
    } catch (MappingException e) {
        LOG.error("Problem establishing castor mapping!  Using default mapping.", e);
    }
    try {
        marshaller.marshal(value);
    } catch (MarshalException e) {
        LOG.error("Problem using castor marshalling.", e);
        throw new IOException("Problem using castor marshalling." + e.getMessage());
    } catch (ValidationException e) {
        LOG.error("Problem validating castor marshalling; message doesn't comply with the associated XML schema.", e);
        throw new IOException("Problem validating castor marshalling; message doesn't comply with the associated XML schema." + e.getMessage());
    }
    long duration = System.currentTimeMillis() - startTime;
    LOG.debug("Total time to serialize(" + name.getLocalPart() + "):" + duration + " ms.");
}
Example 8
Project: CASBaH-master  File: CasbahConfigurationHelper.java View source code
public static void writeToFile(CasbahConfiguration configuration, File configurationFile) throws CasbahException {
    try {
        FileWriter writer = new FileWriter(configurationFile);
        Marshaller marshaller = new Marshaller(writer);
        marshaller.setMapping(getMapping());
        marshaller.marshal(configuration);
        writer.close();
    } catch (Exception e) {
        throw new CasbahException("Could not write configuration to file", e);
    }
}
Example 9
Project: HR-WebServices-Examples-Java-master  File: StockQuoteServiceSkeleton.java View source code
/**
     * Auto generated method signature
     *
     * @param param0
     */
public org.apache.axiom.om.OMElement getStockQuote(org.apache.axiom.om.OMElement param0) throws AxisFault {
    StAXSource staxSource = new StAXSource(param0.getXMLStreamReader());
    Unmarshaller unmarshaller = new Unmarshaller(GetStockQuote.class);
    UnmarshalHandler unmarshalHandler = unmarshaller.createHandler();
    GetStockQuote stockQuote;
    try {
        ContentHandler contentHandler = Unmarshaller.getContentHandler(unmarshalHandler);
        TransformerFactory.newInstance().newTransformer().transform(staxSource, new SAXResult(contentHandler));
        stockQuote = (GetStockQuote) unmarshalHandler.getObject();
    } catch (SAXException e) {
        throw new RuntimeException(e);
    } catch (TransformerException e) {
        throw new RuntimeException(e);
    }
    if (!stockQuote.getSymbol().equals("IBM")) {
        throw new AxisFault("StockQuote details for the symbol '" + stockQuote.getSymbol() + "' are not available.");
    }
    GetStockQuoteResponse stockQuoteResponse = new GetStockQuoteResponse();
    Quote quote = new Quote();
    quote.setSymbol(stockQuote.getSymbol());
    quote.setVolume(5000);
    LastTrade lastTrade = new LastTrade();
    lastTrade.setPrice(99);
    lastTrade.setDate(Calendar.getInstance().getTimeInMillis());
    quote.setLastTrade(lastTrade);
    Change change = new Change();
    change.setDollar(1);
    change.setPercent(10);
    change.setPositive(true);
    quote.setChange(change);
    stockQuoteResponse.setQuote(quote);
    SAXOMBuilder builder = new SAXOMBuilder();
    try {
        Marshaller.marshal(stockQuoteResponse, builder);
    } catch (MarshalException e) {
        throw new RuntimeException(e);
    } catch (ValidationException e) {
        throw new RuntimeException(e);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    return builder.getRootElement();
}
Example 10
Project: OpenClinica-master  File: MetaDataReportBean.java View source code
private String handleLoadCastor(RulesPostImportContainer rpic) {
    try {
        // Create Mapping
        Mapping mapping = new Mapping();
        mapping.loadMapping(getCoreResources().getURL("mappingMarshallerMetadata.xml"));
        // Create XMLContext
        XMLContext xmlContext = new XMLContext();
        xmlContext.setProperty(XMLConfiguration.NAMESPACES, "true");
        xmlContext.addMapping(mapping);
        StringWriter writer = new StringWriter();
        Marshaller marshaller = xmlContext.createMarshaller();
        // marshaller.setNamespaceMapping("castor", "http://castor.org/sample/mapping/");
        marshaller.setWriter(writer);
        marshaller.marshal(rpic);
        String result = writer.toString();
        String newResult = result.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "");
        return newResult;
    } catch (FileNotFoundException ex) {
        throw new OpenClinicaSystemException(ex.getMessage(), ex.getCause());
    } catch (IOException ex) {
        throw new OpenClinicaSystemException(ex.getMessage(), ex.getCause());
    } catch (MarshalException e) {
        throw new OpenClinicaSystemException(e.getMessage(), e.getCause());
    } catch (ValidationException e) {
        throw new OpenClinicaSystemException(e.getMessage(), e.getCause());
    } catch (MappingException e) {
        throw new OpenClinicaSystemException(e.getMessage(), e.getCause());
    } catch (Exception e) {
        throw new OpenClinicaSystemException(e.getMessage(), e.getCause());
    }
}
Example 11
Project: tmdm-studio-se-master  File: ExportItemsWizard.java View source code
public void doexport(Object[] selectedObjs, IProgressMonitor monitor) {
    TreeObject[] objs = null;
    if (selectedObjs.length > 0 && selectedObjs[0] instanceof TreeObject) {
        objs = Arrays.asList(selectedObjs).toArray(new TreeObject[0]);
    }
    if (objs == null || objs.length == 0) {
        return;
    }
    monitor.beginTask(Messages.ExportItemsWizard_Export, IProgressMonitor.UNKNOWN);
    Exports eps = new Exports();
    List<TreeObject> exports = new ArrayList<TreeObject>();
    TMDMService service;
    try {
        service = Util.getMDMService(objs[0]);
        try {
            LocalTreeObjectRepository.getInstance().parseElementForOutput(objs);
        } catch (Exception e) {
        }
        for (TreeObject obj : objs) {
            StringWriter sw;
            ArrayList<String> items;
            String encodedID = null;
            switch(obj.getType()) {
                case TreeObject.DATA_CLUSTER:
                    monitor.subTask(Messages.ExportItemsWizard_2);
                    items = new ArrayList<String>();
                    // dataclusters
                    WSDataClusterPK pk = (WSDataClusterPK) obj.getWsKey();
                    try {
                        WSDataCluster cluster = service.getDataCluster(new WSGetDataCluster(pk));
                        // Marshal
                        sw = new StringWriter();
                        Marshaller.marshal(cluster, sw);
                        //$NON-NLS-1$
                        encodedID = URLEncoder.encode(cluster.getName(), "UTF-8");
                        //$NON-NLS-1$
                        writeString(sw.toString(), TreeObject.DATACONTAINER + "/" + encodedID);
                        //$NON-NLS-1$
                        items.add(TreeObject.DATACONTAINER + "/" + encodedID);
                        obj.setItems(items.toArray(new String[items.size()]));
                        exports.add(obj);
                    } catch (Exception e) {
                    }
                    monitor.worked(1);
                    // datacluster contents
                    monitor.subTask(Messages.bind(Messages.ExportItemsWizard_3, pk.getPk()));
                    exportCluster(exports, pk, service);
                    monitor.worked(1);
                    break;
                case TreeObject.DATA_MODEL:
                    monitor.subTask(Messages.ExportItemsWizard_5);
                    items = new ArrayList<String>();
                    // datamodels
                    try {
                        WSDataModel model = service.getDataModel(new WSGetDataModel((WSDataModelPK) obj.getWsKey()));
                        sw = new StringWriter();
                        Marshaller.marshal(model, sw);
                        //$NON-NLS-1$
                        encodedID = URLEncoder.encode(model.getName(), "UTF-8");
                        //$NON-NLS-1$
                        writeString(sw.toString(), TreeObject.DATAMODEL_ + "/" + encodedID);
                        //$NON-NLS-1$
                        items.add(TreeObject.DATAMODEL_ + "/" + encodedID);
                        obj.setItems(items.toArray(new String[items.size()]));
                        exports.add(obj);
                    } catch (Exception e) {
                    }
                    monitor.worked(1);
                    break;
                case TreeObject.MENU:
                    monitor.subTask(Messages.ExportItemsWizard_6);
                    // ExportItem exportItem=new ExportItem();
                    items = new ArrayList<String>();
                    // menu
                    try {
                        WSMenu menu = service.getMenu(new WSGetMenu((WSMenuPK) obj.getWsKey()));
                        // Marshal
                        sw = new StringWriter();
                        Marshaller.marshal(menu, sw);
                        //$NON-NLS-1$
                        encodedID = URLEncoder.encode(menu.getName(), "UTF-8");
                        //$NON-NLS-1$
                        writeString(sw.toString(), TreeObject.MENU_ + "/" + encodedID);
                        //$NON-NLS-1$
                        items.add(TreeObject.MENU_ + "/" + encodedID);
                        obj.setItems(items.toArray(new String[items.size()]));
                        exports.add(obj);
                    } catch (Exception e) {
                    }
                    monitor.worked(1);
                    break;
                case TreeObject.PICTURES_RESOURCE:
                    monitor.subTask(Messages.ExportItemsWizard_7);
                    // ExportItem exportItem=new ExportItem();
                    items = new ArrayList<String>();
                    // picture
                    try {
                        String endpointIpAddress = obj.getEndpointIpAddress();
                        //$NON-NLS-1$
                        int index = endpointIpAddress.indexOf("/services/soap");
                        if (index != -1) {
                            endpointIpAddress = endpointIpAddress.substring(0, index);
                        }
                        String picUrl = endpointIpAddress + ResourcesUtil.getResourcesMapFromURI(endpointIpAddress + TreeObject.PICTURES_URI, objs[0]).get(obj.getDisplayName());
                        // Marshal
                        sw = new StringWriter();
                        byte[] content = HttpClientUtil.getByteArrayContentByHttpget(picUrl);
                        Marshaller.marshal(content, sw);
                        //$NON-NLS-1$
                        encodedID = URLEncoder.encode(obj.getDisplayName(), "UTF-8");
                        //$NON-NLS-1$
                        writeInputStream(new ByteArrayInputStream(content), TreeObject.PICTURES_ + "/" + encodedID);
                        //$NON-NLS-1$
                        items.add(TreeObject.PICTURES_ + "/" + encodedID);
                        obj.setItems(items.toArray(new String[items.size()]));
                        exports.add(obj);
                    } catch (Exception e) {
                        log.error(e.getMessage(), e);
                    }
                    monitor.worked(1);
                    break;
                case TreeObject.ROUTING_RULE:
                    monitor.subTask(Messages.ExportItemsWizard_10);
                    // ExportItem exportItem=new ExportItem();
                    items = new ArrayList<String>();
                    // routing rule
                    try {
                        WSRoutingRule RoutingRule = service.getRoutingRule(new WSGetRoutingRule((WSRoutingRulePK) obj.getWsKey()));
                        // Marshal
                        sw = new StringWriter();
                        Marshaller.marshal(RoutingRule, sw);
                        //$NON-NLS-1$
                        encodedID = URLEncoder.encode(RoutingRule.getName(), "UTF-8");
                        //$NON-NLS-1$
                        writeString(sw.toString(), TreeObject.ROUTINGRULE_ + "/" + encodedID);
                        //$NON-NLS-1$
                        items.add(TreeObject.ROUTINGRULE_ + "/" + encodedID);
                        obj.setItems(items.toArray(new String[items.size()]));
                        exports.add(obj);
                    } catch (Exception e) {
                    }
                    monitor.worked(1);
                    break;
                case TreeObject.STORED_PROCEDURE:
                    monitor.subTask(Messages.ExportItemsWizard_11);
                    items = new ArrayList<String>();
                    // stored procedure
                    try {
                        WSStoredProcedure StoredProcedure = service.getStoredProcedure(new WSGetStoredProcedure((WSStoredProcedurePK) obj.getWsKey()));
                        // Marshal
                        sw = new StringWriter();
                        Marshaller.marshal(StoredProcedure, sw);
                        //$NON-NLS-1$
                        encodedID = URLEncoder.encode(StoredProcedure.getName(), "UTF-8");
                        //$NON-NLS-1$
                        writeString(sw.toString(), TreeObject.STOREDPROCEDURE_ + "/" + encodedID);
                        //$NON-NLS-1$
                        items.add(TreeObject.STOREDPROCEDURE_ + "/" + encodedID);
                        obj.setItems(items.toArray(new String[items.size()]));
                        exports.add(obj);
                    } catch (Exception e) {
                    }
                    monitor.worked(1);
                    break;
                case TreeObject.TRANSFORMER:
                    monitor.subTask(Messages.ExportItemsWizard_13);
                    items = new ArrayList<String>();
                    // TODO:check the pk
                    try {
                        WSTransformerV2 transformer = service.getTransformerV2(new WSGetTransformerV2(new WSTransformerV2PK(((WSTransformerV2PK) obj.getWsKey()).getPk())));
                        // Marshal
                        sw = new StringWriter();
                        Marshaller.marshal(transformer, sw);
                        //$NON-NLS-1$
                        encodedID = URLEncoder.encode(transformer.getName(), "UTF-8");
                        //$NON-NLS-1$
                        writeString(sw.toString(), TreeObject.TRANSFORMER_ + "/" + encodedID);
                        //$NON-NLS-1$
                        items.add(TreeObject.TRANSFORMER_ + "/" + encodedID);
                        obj.setItems(items.toArray(new String[items.size()]));
                        exports.add(obj);
                    } catch (Exception e) {
                    }
                    monitor.worked(1);
                    break;
                case TreeObject.VIEW:
                    monitor.subTask(Messages.ExportItemsWizard_15);
                    items = new ArrayList<String>();
                    // view
                    try {
                        WSView View = service.getView(new WSGetView((WSViewPK) obj.getWsKey()));
                        // Marshal
                        sw = new StringWriter();
                        Marshaller.marshal(View, sw);
                        //$NON-NLS-1$
                        encodedID = URLEncoder.encode(View.getName(), "UTF-8");
                        //$NON-NLS-1$
                        writeString(sw.toString(), TreeObject.VIEW_ + "/" + encodedID);
                        //$NON-NLS-1$
                        items.add(TreeObject.VIEW_ + "/" + encodedID);
                        obj.setItems(items.toArray(new String[items.size()]));
                        exports.add(obj);
                    } catch (Exception e) {
                    }
                    monitor.worked(1);
                    break;
                default:
                    IExportItemsWizardAdapter exAdapter = ExAdapterManager.getAdapter(this, IExportItemsWizardAdapter.class);
                    if (exAdapter != null) {
                        exAdapter.doexport(service, obj.getType(), exports, obj, monitor);
                    }
                    break;
            }
        }
        // store the content xml
        eps.setItems(exports.toArray(new TreeObject[exports.size()]));
        eps.setSchemas(LocalTreeObjectRepository.getInstance().outPutSchemas());
        // export autoincrement
        try {
            WSAutoIncrement auto = service.getAutoIncrement(null);
            if (auto != null && auto.getAutoincrement() != null) {
                eps.setAutoIncrement(auto.getAutoincrement());
            }
        } catch (Exception e) {
        }
        StringWriter sw = new StringWriter();
        try {
            Marshaller.marshal(eps, sw);
            //$NON-NLS-1$
            writeString(sw.toString(), "exportitems.xml");
        } catch (Exception e) {
        }
        monitor.done();
    } catch (Exception e) {
    }
}
Example 12
Project: acs-master  File: ACSAlarmDAOImpl.java View source code
public void addFaultFamily(FaultFamily ff) {
    if (conf == null || !conf.isWriteable())
        throw new IllegalStateException("no writable configuration accessor");
    if (ff == null)
        throw new IllegalArgumentException("Null FaultFamily argument");
    StringWriter FFWriter = new StringWriter();
    Marshaller FF_marshaller;
    try {
        FF_marshaller = new Marshaller(FFWriter);
    } catch (IOException e) {
        e.printStackTrace();
        return;
    }
    FF_marshaller.setValidation(false);
    try {
        FF_marshaller.marshal(ff);
    } catch (MarshalException e) {
        e.printStackTrace();
        return;
    } catch (ValidationException e) {
        e.printStackTrace();
        return;
    }
    String path = ALARM_DEFINITION_PATH + "/" + ff.getName();
    try {
        conf.addConfiguration(path, FFWriter.toString().replaceFirst("xsi:type=\".*\"", ""));
    } catch (Exception e) {
        throw new IllegalStateException("FaultFamily already exists");
    }
    Vector<FaultFamily> ffs = new Vector<FaultFamily>();
    ffs.add(ff);
    generateAlarmsMap(ffs);
}
Example 13
Project: openelisglobal-core-master  File: SampleXMLByTestProcessAction.java View source code
protected ActionForward performAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    String forward = FWD_SUCCESS;
    BaseActionForm dynaForm = (BaseActionForm) form;
    ActionMessages errors = null;
    request.setAttribute(ALLOW_EDITS_KEY, "false");
    request.setAttribute(PREVIOUS_DISABLED, "true");
    request.setAttribute(NEXT_DISABLED, "true");
    request.setAttribute(IAuthorizationActionConstants.UPDATE_TESTCOMPONENT_TESTRESULT, "true");
    // CHANGED
    // String selectedTestId = (String) request.getParameter("Test");
    String xmlString = null;
    // get transmission resources properties
    ResourceLocator rl = ResourceLocator.getInstance();
    // Now load a java.util.Properties object with the
    // properties
    transmissionMap = new Properties();
    try {
        propertyStream = rl.getNamedResourceAsInputStream(ResourceLocator.XMIT_PROPERTIES);
        transmissionMap.load(propertyStream);
    } catch (IOException e) {
        LogEvent.logError("SampleXMLByTestProcessAction", "performAction()", e.toString());
        throw new LIMSRuntimeException("Unable to load transmission resource mappings.", e);
    } finally {
        if (null != propertyStream) {
            try {
                propertyStream.close();
                propertyStream = null;
            } catch (Exception e) {
                LogEvent.logError("SampleXMLByTestProcessAction", "performAction()", e.toString());
            }
        }
    }
    List methods = new ArrayList();
    MethodDAO methodDAO = new MethodDAOImpl();
    methods = methodDAO.getAllMethods();
    //Get tests/testsections by user system id
    //bugzilla 2160
    UserTestSectionDAO userTestSectionDAO = new UserTestSectionDAOImpl();
    List testSections = userTestSectionDAO.getAllUserTestSections(request);
    //bugzilla 2291
    List tests = userTestSectionDAO.getAllUserTests(request, true);
    // get 3 drop down selections so we can repopulate
    String selectedTestSectionId = (String) dynaForm.get("selectedTestSectionId");
    String selectedMethodId = (String) dynaForm.get("selectedMethodId");
    String selectedTestId = (String) dynaForm.get("selectedTestId");
    // PROCESS
    String humanDomain = SystemConfiguration.getInstance().getHumanDomain();
    String animalDomain = SystemConfiguration.getInstance().getAnimalDomain();
    if (!StringUtil.isNullorNill(selectedTestId)) {
        Test test = new Test();
        test.setId(selectedTestId);
        TestDAO testDAO = new TestDAOImpl();
        testDAO.getData(test);
        try {
            List analyses = new ArrayList();
            AnalysisDAO analysisDAO = new AnalysisDAOImpl();
            //bugzilla 2227
            analyses = analysisDAO.getAllMaxRevisionAnalysesPerTest(test);
            SampleDAO sampleDAO = new SampleDAOImpl();
            ResultDAO resultDAO = new ResultDAOImpl();
            PatientDAO patientDAO = new PatientDAOImpl();
            PersonDAO personDAO = new PersonDAOImpl();
            ProviderDAO providerDAO = new ProviderDAOImpl();
            SampleItemDAO sampleItemDAO = new SampleItemDAOImpl();
            TypeOfSampleDAO typeOfSampleDAO = new TypeOfSampleDAOImpl();
            SourceOfSampleDAO sourceOfSampleDAO = new SourceOfSampleDAOImpl();
            SampleHumanDAO sampleHumanDAO = new SampleHumanDAOImpl();
            SampleOrganizationDAO sampleOrganizationDAO = new SampleOrganizationDAOImpl();
            OrganizationDAO organizationDAO = new OrganizationDAOImpl();
            TestTrailerDAO testTrailerDAO = new TestTrailerDAOImpl();
            TypeOfTestResultDAO typeOfTestResultDAO = new TypeOfTestResultDAOImpl();
            // for overall message portion of message
            MessageXmit message = new MessageXmit();
            // for UHL portion of message
            UHLXmit uhl = new UHLXmit();
            Organization organization = new Organization();
            TestingFacilityXmit uhlFacility = new TestingFacilityXmit();
            //bugzilla 2069
            organization.setOrganizationLocalAbbreviation(SystemConfiguration.getInstance().getMdhOrganizationIdForXMLTransmission());
            organization = organizationDAO.getOrganizationByLocalAbbreviation(organization, true);
            StringBuffer orgName = new StringBuffer();
            orgName.append(organization.getOrganizationName());
            orgName.append(SystemConfiguration.getInstance().getDefaultTransmissionTextSeparator());
            orgName.append(organization.getStreetAddress());
            orgName.append(SystemConfiguration.getInstance().getDefaultTransmissionTextSeparator());
            orgName.append(organization.getCity());
            orgName.append(SystemConfiguration.getInstance().getDefaultTransmissionTextSeparator());
            orgName.append(organization.getState());
            orgName.append(SystemConfiguration.getInstance().getDefaultTransmissionTextSeparator());
            orgName.append(organization.getZipCode());
            orgName.append(SystemConfiguration.getInstance().getDefaultTransmissionTextSeparator());
            orgName.append(SystemConfiguration.getInstance().getMdhPhoneNumberForXMLTransmission());
            uhl.setId(SystemConfiguration.getInstance().getMdhUhlIdForXMLTransmission());
            uhlFacility.setOrganizationName(orgName.toString());
            uhlFacility.setUniversalId(SystemConfiguration.getInstance().getMdhUniversalIdForXMLTransmission());
            uhlFacility.setUniversalIdType(SystemConfiguration.getInstance().getMdhUniversalIdTypeForXMLTransmission());
            uhl.setFacility(uhlFacility);
            uhl.setApplicationName(SystemConfiguration.getInstance().getDefaultApplicationName());
            uhl.setMessageTime((new Timestamp(System.currentTimeMillis())).toString());
            uhl.setProcessingId(SystemConfiguration.getInstance().getDefaultProcessingIdForXMLTransmission());
            uhl.setTransportMethod(SystemConfiguration.getInstance().getDefaultTransportMethodForXMLTransmission());
            PatientXmit patient = new PatientXmit();
            Person person = new Person();
            ProviderXmit provider = new ProviderXmit();
            FacilityXmit facility = new FacilityXmit();
            Person providerPerson = new Person();
            SampleHuman sampleHuman = new SampleHuman();
            SampleOrganization sampleOrganization = new SampleOrganization();
            List analysesBySample = null;
            SourceOfSample sourceOfSample = new SourceOfSample();
            TypeOfSample typeOfSample = new TypeOfSample();
            for (int i = 0; i < analyses.size(); i++) {
                Analysis analysis = (Analysis) analyses.get(i);
                SampleItem sampleItem = (SampleItem) analysis.getSampleItem();
                sampleItemDAO.getData(sampleItem);
                sourceOfSample.setId(sampleItem.getSourceOfSampleId());
                if (!StringUtil.isNullorNill(sourceOfSample.getId())) {
                    sourceOfSampleDAO.getData(sourceOfSample);
                }
                typeOfSample.setId(sampleItem.getTypeOfSampleId());
                if (!StringUtil.isNullorNill(typeOfSample.getId())) {
                    typeOfSampleDAO.getData(typeOfSample);
                }
                // System.out.println("This is sampleItem " + sampleItem);
                if (sampleItem != null) {
                    //bugzilla 1773 need to store sample not sampleId for use in sorting
                    String sampleId = sampleItem.getSample().getId();
                    SampleXmit sample = new SampleXmit();
                    sample.setId(sampleId);
                    sampleDAO.getData(sample);
                    // marshall to XML
                    Mapping castorMapping = new Mapping();
                    String castorMappingName = transmissionMap.getProperty("SampleToXmlMapping");
                    InputSource source = getSource(castorMappingName);
                    // bugzilla #1346 add ability to hover over accession
                    // number and
                    // view patient/person information (first and last name
                    // and external id)
                    String domain = sample.getDomain();
                    if (domain != null && domain.equals(humanDomain)) {
                        if (!StringUtil.isNullorNill(sample.getId())) {
                            sampleHuman.setSampleId(sample.getId());
                            sampleHumanDAO.getDataBySample(sampleHuman);
                            sampleOrganization.setSample(sample);
                            sampleOrganizationDAO.getDataBySample(sampleOrganization);
                            patient.setId(sampleHuman.getPatientId());
                            patientDAO.getData(patient);
                            person.setId(patient.getPerson().getId());
                            personDAO.getData(person);
                            //do we need to set id on patient to be externalId?
                            patient.setLastName(person.getLastName());
                            patient.setFirstName(person.getFirstName());
                            patient.setStreetAddress(person.getState());
                            patient.setCity(person.getCity());
                            patient.setState(person.getState());
                            patient.setZipCode(person.getZipCode());
                            patient.setHomePhone(person.getHomePhone());
                            provider.setId(sampleHuman.getProviderId());
                            providerDAO.getData(provider);
                            providerPerson = provider.getPerson();
                            personDAO.getData(providerPerson);
                            Organization o = sampleOrganization.getOrganization();
                            if (o != null) {
                                PropertyUtils.copyProperties(facility, provider);
                                // have added null check
                                if (!StringUtil.isNullorNill(o.getCliaNum())) {
                                    facility.setId(o.getCliaNum());
                                }
                                facility.setOrganizationName(o.getOrganizationName());
                                facility.setDepartment(o.getOrganizationName());
                                facility.setStreetAddress(o.getStreetAddress());
                                facility.setCity(o.getCity());
                                facility.setState(o.getState());
                                facility.setZipCode(o.getZipCode());
                            }
                            provider.setWorkPhone(providerPerson.getWorkPhone());
                            provider.setLastName(providerPerson.getLastName());
                            provider.setFirstName(providerPerson.getFirstName());
                            if (StringUtil.isNullorNill(sample.getRevision())) {
                                sample.setRevision("0");
                            }
                            sample.setExternalId(patient.getExternalId());
                            if (StringUtil.isNullorNill(sample.getStatus())) {
                                sample.setStatus("THIS IS SAMPLE STATUS - IF BLANK SHOULD WE SEND DEFAULT");
                            }
                            sample.setPatient(patient);
                            sample.setProvider(provider);
                            sample.setFacility(facility);
                            // get all tests for this sample
                            //bugzilla 2227
                            analysesBySample = analysisDAO.getMaxRevisionAnalysesBySample(sampleItem);
                            ArrayList sampleTests = new ArrayList();
                            // assemble Test Elements
                            for (int j = 0; j < analysesBySample.size(); j++) {
                                TestXmit sampleTest = new TestXmit();
                                Analysis a = (Analysis) analysesBySample.get(j);
                                Test t = a.getTest();
                                sampleTest.setMethod(t.getMethodName());
                                sampleTest.setReleasedDate(a.getReleasedDate());
                                if (sourceOfSample != null && !StringUtil.isNullorNill(sourceOfSample.getDescription())) {
                                    sampleTest.setSourceOfSample(sourceOfSample.getDescription());
                                }
                                if (typeOfSample != null && !StringUtil.isNullorNill(typeOfSample.getDescription())) {
                                    sampleTest.setTypeOfSample(typeOfSample.getDescription());
                                }
                                CodeElementXmit testName = new CodeElementXmit();
                                // do we need go to receiver_xref to get
                                // their test name? identifier, codesystem
                                // type,
                                testName.setIdentifier(TestService.getUserLocalizedTestName(a.getTest()));
                                testName.setCodeSystemType("L");
                                testName.setText("This is some kind of text");
                                sampleTest.setName(testName);
                                TestTrailer testTrailer = t.getTestTrailer();
                                CommentXmit testComment = new CommentXmit();
                                if (testTrailer != null) {
                                    testComment.setComment(testTrailer.getText());
                                    testComment.setCommentSource("");
                                }
                                sampleTest.setComment(testComment);
                                sampleTest.setStatus("This could be analysis status");
                                // NOW GET THE RESULTS FOR THIS TEST
                                TestResultDAO testResultDAO = new TestResultDAOImpl();
                                DictionaryDAO dictDAO = new DictionaryDAOImpl();
                                // load collection of
                                // TestAnalyte_TestResults for the
                                // test
                                TestAnalyteDAO testAnalyteDAO = new TestAnalyteDAOImpl();
                                List testAnalytes = testAnalyteDAO.getAllTestAnalytesPerTest(t);
                                ArrayList testResults = new ArrayList();
                                for (int k = 0; k < testAnalytes.size(); k++) {
                                    TestAnalyte testAnalyte = (TestAnalyte) testAnalytes.get(k);
                                    Result result = new Result();
                                    ResultXmit resultXmit = new ResultXmit();
                                    resultDAO.getResultByAnalysisAndAnalyte(result, analysis, testAnalyte);
                                    if (result != null && !StringUtil.isNullorNill(result.getId())) {
                                        // we have at least one result so
                                        // add this
                                        TestResult testResult = result.getTestResult();
                                        String value = null;
                                        if (testResult.getTestResultType().equals(SystemConfiguration.getInstance().getDictionaryType())) {
                                            // get from dictionary
                                            Dictionary dictionary = new Dictionary();
                                            dictionary.setId(testResult.getValue());
                                            dictDAO.getData(dictionary);
                                            // System.out.println("setting
                                            // dictEntry "
                                            // + dictionary.getDictEntry());
                                            value = dictionary.getDictEntry();
                                        } else {
                                            value = testResult.getValue();
                                        }
                                        // now create other objects
                                        // within the result
                                        ObservationXmit observationXmit = new ObservationXmit();
                                        CodeElementXmit observationIdentifier = new CodeElementXmit();
                                        Analyte analyte = testAnalyte.getAnalyte();
                                        if (!StringUtil.isNullorNill(analyte.getExternalId())) {
                                            observationIdentifier.setIdentifier(analyte.getExternalId());
                                        } else {
                                            observationIdentifier.setIdentifier(analyte.getId());
                                        }
                                        observationIdentifier.setText(analyte.getAnalyteName());
                                        observationIdentifier.setCodeSystemType(SystemConfiguration.getInstance().getDefaultTransmissionCodeSystemType());
                                        observationXmit.setIdentifier(observationIdentifier);
                                        observationXmit.setValue(value);
                                        //bugzilla 1866
                                        TypeOfTestResult totr = new TypeOfTestResult();
                                        totr.setTestResultType(testResult.getTestResultType());
                                        totr = typeOfTestResultDAO.getTypeOfTestResultByType(totr);
                                        observationXmit.setValueType(totr.getHl7Value());
                                        //end bugzilla 1866
                                        resultXmit.setObservation(observationXmit);
                                        //bugzilla 1867 remove empty tags
                                        //resultXmit.setReferenceRange("UNKNOWN");
                                        resultXmit.setReferenceRange(null);
                                        /*CodeElementXmit unitCodeElement = new CodeElementXmit();
											unitCodeElement
													.setIdentifier("UNKNOWN");
											unitCodeElement.setText("UNKNOWN");
											unitCodeElement
													.setCodeSystemType(SystemConfiguration
															.getInstance()
															.getDefaultTransmissionCodeSystemType());*/
                                        //resultXmit.setUnit(unitCodeElement);
                                        resultXmit.setUnit(null);
                                    //end bugzilla 1867
                                    }
                                    testResults.add(resultXmit);
                                }
                                // END RESULTS FOR TEST
                                sampleTest.setResults(testResults);
                                sampleTest.setReleasedDate(analysis.getReleasedDate());
                                //there is a requirement that there is at least one result for a test
                                if (testResults.size() > 0) {
                                    sampleTests.add(sampleTest);
                                }
                            }
                            sample.setTests(sampleTests);
                            message.setSample(sample);
                            message.setUhl(uhl);
                            try {
                                // castorMapping.loadMapping(url);
                                castorMapping.loadMapping(source);
                                // Marshaller marshaller = new Marshaller(
                                // new OutputStreamWriter(System.out));
                                Marshaller marshaller = new Marshaller();
                                marshaller.setMapping(castorMapping);
                                Writer writer = new StringWriter();
                                marshaller.setWriter(writer);
                                marshaller.marshal(message);
                                xmlString = writer.toString();
                                xmlString = convertToDisplayableXML(xmlString);
                            } catch (Exception e) {
                                LogEvent.logError("SampleXMLByTestProcessAction", "performAction()", e.toString());
                            }
                        // this writes a default mapping to oc4j's
                        // j2ee/home directory
                        /*
								 * try { MappingTool tool = new MappingTool();
								 * tool.setForceIntrospection(false);
								 * tool.addClass("us.mn.state.health.lims.patient.valueholder.Patient");
								 * tool.write(new
								 * FileWriter("XMLTestMapping.xml")); }
								 * catch(MappingException ex){
								 * System.out.println("Error" +
								 * ex.getLocalizedMessage());} catch(IOException
								 * ex){ System.out.println("Error" +
								 * ex.getLocalizedMessage());}
								 */
                        }
                    } else if (domain != null && domain.equals(animalDomain)) {
                    // go to animal view
                    // System.out.println("Going to animal view");
                    } else {
                    // go toother view
                    }
                }
            }
        } catch (LIMSRuntimeException lre) {
            LogEvent.logError("SampleXMLByTestProcessAction", "performAction()", lre.toString());
            errors = new ActionMessages();
            ActionError error = null;
            error = new ActionError("errors.GetException", null, null);
            errors.add(ActionMessages.GLOBAL_MESSAGE, error);
            saveErrors(request, errors);
            request.setAttribute(Globals.ERROR_KEY, errors);
            request.setAttribute(ALLOW_EDITS_KEY, "false");
            return mapping.findForward(FWD_FAIL);
        }
    }
    // END PROCESS
    // initialize the form
    dynaForm.initialize(mapping);
    PropertyUtils.setProperty(dynaForm, "testSections", testSections);
    PropertyUtils.setProperty(dynaForm, "methods", methods);
    PropertyUtils.setProperty(dynaForm, "tests", tests);
    PropertyUtils.setProperty(dynaForm, "selectedTestSectionId", selectedTestSectionId);
    PropertyUtils.setProperty(dynaForm, "selectedMethodId", selectedMethodId);
    PropertyUtils.setProperty(dynaForm, "selectedTestId", selectedTestId);
    // PropertyUtils.setProperty(dynaForm, "xmlString",
    // "<ajdf>asdfasdf</ajdf>");
    PropertyUtils.setProperty(dynaForm, "xmlString", xmlString);
    return mapping.findForward(forward);
}
Example 14
Project: opennms_dashboard-master  File: UserManager.java View source code
/**
     * Saves into "users.xml" file
     */
private void _saveCurrent() throws Exception {
    final Users users = new Users();
    for (final User user : m_users.values()) {
        users.addUser(user);
    }
    final Userinfo userinfo = new Userinfo();
    userinfo.setUsers(users);
    final Header header = oldHeader;
    if (header != null) {
        header.setCreated(EventConstants.formatToString(new Date()));
        userinfo.setHeader(header);
    }
    oldHeader = header;
    // marshal to a string first, then write the string to the file. This
    // way the original configuration
    // isn't lost if the XML from the marshal is hosed.
    final StringWriter stringWriter = new StringWriter();
    Marshaller.marshal(userinfo, stringWriter);
    final String writerString = stringWriter.toString();
    saveXML(writerString);
}
Example 15
Project: platform2-master  File: LI_Innheimta_fyrirspurn_krofur.java View source code
//-- boolean isValid() 
/**
     * Method marshal
     * 
     * 
     * 
     * @param out
     */
public void marshal(java.io.Writer out, String noNamespaceSchemaLocation) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
    try {
        Marshaller marshaller = new Marshaller(out);
        marshaller.setNoNamespaceSchemaLocation(noNamespaceSchemaLocation);
        marshaller.setSuppressXSIType(true);
        marshaller.marshal(this);
    } catch (MarshalException e) {
        e.printStackTrace();
    } catch (ValidationException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Example 16
Project: wsrp4cxf-master  File: PersistentHandlerImpl.java View source code
/**
     * Store a single XML file, contained in the persistentDataObject to
     * the persistent file store via the marshalFile method of the input
     * object. The filename of the object is collected with it's hashcode
     * internally.
     *
     * @param persistentDataObject
     *
     * @throws WSRPException
     */
public void store(PersistentDataObject persistentDataObject) throws WSRPException {
    String MN = "store";
    if (log.isDebugEnabled()) {
        log.debug(Utility.strEnter(MN));
    }
    Mapping mapping = null;
    Marshaller marshaller = null;
    FileWriter fileWriter = null;
    String filename = null;
    try {
        PersistentInformationXML persistentInformation = (PersistentInformationXML) persistentDataObject.getPersistentInformation();
        Object o = persistentDataObject.getLastElement();
        int hashCode = o.hashCode();
        String code = new Integer(hashCode).toString();
        filename = (String) _filenameMap.get(code);
        if (filename == null) {
            persistentInformation.updateFileName(code);
            filename = persistentInformation.getFilename();
            _filenameMap.put(code, filename);
        }
        File file = new File(filename);
        if (log.isDebugEnabled()) {
            log.debug("Filename for store: " + filename + " with code: " + code);
        }
        fileWriter = new FileWriter(file);
        if (persistentInformation.getMappingFileName() != null) {
            mapping = new Mapping();
            mapping.loadMapping(persistentInformation.getMappingFileName());
            marshaller = new Marshaller(fileWriter);
            marshaller.setMapping(mapping);
        }
        ((PersistentDataObjectXML) persistentDataObject).marshalFile(fileWriter, marshaller);
        fileWriter.close();
    } catch (Exception e) {
        WSRPXHelper.throwX(log, ErrorCodes.STORE_OBJECT_ERROR, e);
    }
    if (log.isDebugEnabled()) {
        log.debug(Utility.strExit(MN));
    }
}
Example 17
Project: aipo-master  File: PsmlManagerAction.java View source code
/**
     * Save the PSML document on disk to the specififed fileOrUrl
     * 
     * @param fileOrUrl a String representing either an absolute URL
     *                  or an absolute filepath
     * @param doc       the document to save
     * @return 
     */
private boolean saveDocument(String fileOrUrl, PSMLDocument doc) {
    boolean success = false;
    if (doc == null)
        return false;
    File f = new File(fileOrUrl);
    File d = new File(f.getParent());
    d.mkdirs();
    FileWriter writer = null;
    try {
        writer = new FileWriter(f);
        // create the serializer output format
        OutputFormat format = new OutputFormat();
        format.setIndenting(true);
        format.setIndent(4);
        Serializer serializer = new XMLSerializer(writer, format);
        Marshaller marshaller = new Marshaller(serializer.asDocumentHandler());
        marshaller.setMapping(this.loadMapping());
        marshaller.marshal(doc.getPortlets());
        success = true;
    } catch (MarshalException e) {
        logger.error("PsmlManagerAction: Could not marshal the file " + f.getAbsolutePath(), e);
    } catch (MappingException e) {
        logger.error("PsmlManagerAction: Could not marshal the file " + f.getAbsolutePath(), e);
    } catch (ValidationException e) {
        logger.error("PsmlManagerAction: document " + f.getAbsolutePath() + " is not valid", e);
    } catch (IOException e) {
        logger.error("PsmlManagerAction: Could not save the file " + f.getAbsolutePath(), e);
    } catch (Exception e) {
        logger.error("PsmlManagerAction: Error while saving  " + f.getAbsolutePath(), e);
    } finally {
        try {
            writer.close();
        } catch (IOException e) {
        }
    }
    return success;
}
Example 18
Project: camel-master  File: AbstractCastorDataFormat.java View source code
public void marshal(Exchange exchange, Object body, OutputStream outputStream) throws Exception {
    Writer writer = new OutputStreamWriter(outputStream, encoding);
    Marshaller marshaller = createMarshaller(exchange);
    marshaller.setWriter(writer);
    marshaller.marshal(body);
    if (contentTypeHeader) {
        if (exchange.hasOut()) {
            exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "application/xml");
        } else {
            exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/xml");
        }
    }
}
Example 19
Project: ConcesionariaDB-master  File: XmlChartTheme.java View source code
/**
	 *
	 */
public static void saveSettings(ChartThemeSettings settings, Writer writer) {
    InputStream mis = null;
    try {
        mis = JRLoader.getLocationInputStream(MAPPING_FILE);
        Marshaller marshaller = new Marshaller(writer);
        Mapping mapping = new Mapping();
        mapping.loadMapping(new InputSource(mis));
        marshaller.setMapping(mapping);
        marshaller.marshal(settings);
    } catch (IOException e) {
        throw new JRRuntimeException(e);
    } catch (MappingException e) {
        throw new JRRuntimeException(e);
    } catch (MarshalException e) {
        throw new JRRuntimeException(e);
    } catch (ValidationException e) {
        throw new JRRuntimeException(e);
    } catch (JRException e) {
        throw new JRRuntimeException(e);
    } finally {
        if (mis != null) {
            try {
                mis.close();
            } catch (IOException e) {
            }
        }
    }
}
Example 20
Project: hale-master  File: CastorAlignmentIO.java View source code
/**
	 * Save a default alignment to an output stream.
	 * 
	 * @param alignment the alignment to save
	 * @param out the output stream
	 * @param pathUpdate to update relative paths in case of a path change
	 * @throws MappingException if the mapping could not be loaded
	 * @throws ValidationException if the mapping is no valid XML
	 * @throws MarshalException if the alignment could not be marshaled
	 * @throws IOException if the output could not be written
	 */
public static void save(Alignment alignment, OutputStream out, PathUpdate pathUpdate) throws MappingException, MarshalException, ValidationException, IOException {
    AlignmentBean bean = new AlignmentBean(alignment, pathUpdate);
    Mapping mapping = new Mapping(AlignmentBean.class.getClassLoader());
    mapping.loadMapping(new InputSource(AlignmentBean.class.getResourceAsStream("AlignmentBean.xml")));
    XMLContext context = new XMLContext();
    // enable
    context.setProperty("org.exolab.castor.indent", true);
    // indentation
    // for
    // marshaling as
    // project files
    // should be
    // very small
    context.addMapping(mapping);
    Marshaller marshaller = context.createMarshaller();
    //		marshaller.setEncoding("UTF-8"); XXX not possible using the XMLContext but UTF-8 seems to be default, see http://jira.codehaus.org/browse/CASTOR-2846
    Writer writer = new BufferedWriter(new OutputStreamWriter(out, "UTF-8"));
    try {
        marshaller.setWriter(writer);
        marshaller.marshal(bean);
    } finally {
        try {
            writer.close();
        } catch (IOException e) {
        }
    }
}
Example 21
Project: infoglue-master  File: ExportImportController.java View source code
public String exportContent(List contentIdList, String path, String fileNamePrefix, boolean includeContentTypes, boolean includeCategories) throws Exception {
    VisualFormatter vf = new VisualFormatter();
    fileNamePrefix = vf.replaceNonAscii(fileNamePrefix, '_');
    String fileName = null;
    Database db = CastorDatabaseService.getDatabase();
    try {
        Mapping map = new Mapping();
        String exportFormat = CmsPropertyHandler.getExportFormat();
        map.loadMapping(CastorDatabaseService.class.getResource("/xml_mapping_content_2.5.xml").toString());
        db.begin();
        List contents = new ArrayList();
        Iterator i = contentIdList.iterator();
        while (i.hasNext()) {
            Integer contentId = (Integer) i.next();
            Content content = ContentController.getContentController().getContentWithId(contentId, db);
            contents.add(content);
        }
        List contentTypeDefinitions = new ArrayList();
        if (includeContentTypes)
            contentTypeDefinitions = ContentTypeDefinitionController.getController().getContentTypeDefinitionList(db);
        List categories = new ArrayList();
        if (includeCategories)
            categories = CategoryController.getController().getAllActiveCategories();
        InfoGlueExportImpl infoGlueExportImpl = new InfoGlueExportImpl();
        String filePath = CmsPropertyHandler.getDigitalAssetPath();
        String tempFileName = "Export_tmp_" + Thread.currentThread().getId() + "_" + fileNamePrefix + ".xml";
        String tempFileSystemName = filePath + File.separator + tempFileName;
        String encoding = "UTF-8";
        File tempFile = new File(tempFileSystemName);
        FileOutputStream fos = new FileOutputStream(tempFile);
        OutputStreamWriter osw = new OutputStreamWriter(fos, encoding);
        Marshaller marshaller = new Marshaller(osw);
        marshaller.setMapping(map);
        marshaller.setEncoding(encoding);
        DigitalAssetBytesHandler.setMaxSize(-1);
        infoGlueExportImpl.getRootContent().addAll(contents);
        infoGlueExportImpl.setContentTypeDefinitions(contentTypeDefinitions);
        infoGlueExportImpl.setCategories(categories);
        marshaller.marshal(infoGlueExportImpl);
        osw.flush();
        osw.close();
        fileName = fileNamePrefix + "_" + tempFile.length() + ".xml";
        String fileSystemName = filePath + File.separator + fileName;
        File file = new File(fileSystemName);
        tempFile.renameTo(file);
        db.rollback();
    } catch (Exception e) {
        logger.error("An error was found exporting a repository: " + e.getMessage(), e);
        db.rollback();
    } finally {
        db.close();
    }
    return fileName;
}
Example 22
Project: orbeon-forms-master  File: ScopeGenerator.java View source code
protected static void readBean(Object bean, Mapping mapping, ContentHandler contentHandler) {
    try {
        contentHandler.startDocument();
        // Initialize Castor
        ParserAdapter adapter = new ParserAdapter(XMLParsing.newSAXParser(XMLParsing.ParserConfiguration.PLAIN).getParser());
        adapter.setContentHandler(contentHandler);
        Marshaller marshaller = new Marshaller(adapter);
        marshaller.setMarshalAsDocument(false);
        marshaller.setMapping(mapping);
        // Serialize with Castor
        marshaller.marshal(bean);
        contentHandler.endDocument();
    } catch (Exception e) {
        throw new OXFException(e);
    }
}
Example 23
Project: VUE-master  File: ActionUtil.java View source code
/**
     * @param file - if null, map state is untouched, otherwise, map state is updated
     */
private static void marshallMapToWriter(final Writer writer, final LWMap map, final File targetFile, final File tmpFile) throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, org.exolab.castor.mapping.MappingException {
    map.makeReadyForSaving(targetFile);
    Log.info("marshalling " + map + " to: " + tmpFile);
    Marshaller marshaller = null;
    String name = "";
    if (targetFile != null)
        name = targetFile.getName();
    else
        name = map.getLabel();
    if (name == null)
        name = "";
    final java.util.Date date = new java.util.Date();
    final String today = new java.text.SimpleDateFormat("yyyy-MM-dd").format(date);
    String headerText = VueResources.getString("vue.version") + " concept-map (" + name + ") " + today;
    headerText = org.apache.commons.lang.StringEscapeUtils.escapeXml(headerText);
    writer.write("<!-- Tufts VUE " + headerText + " -->\n");
    writer.write("<!-- Tufts VUE: http://vue.tufts.edu/ -->\n");
    writer.write(VUE_COMMENT_START + " VUE mapping " + "@version(" + XML_MAPPING_CURRENT_VERSION_ID + ")" + " " + XML_MAPPING_DEFAULT + " -->\n");
    writer.write(VUE_COMMENT_START + " Saved date " + date + " by " + VUE.getSystemProperty("user.name") + " on platform " + VUE.getSystemProperty("os.name") + " " + VUE.getSystemProperty("os.version") + " in JVM " + VUE.getSystemProperty("java.runtime.version") + " -->\n");
    writer.write(VUE_COMMENT_START + " Saving version " + tufts.vue.Version.WhatString + " -->\n");
    if (DEBUG.CASTOR || DEBUG.IO)
        Log.debug("Wrote VUE header to " + writer);
    marshaller = new Marshaller(writer);
    //marshaller.setDebug(DEBUG.CASTOR);
    marshaller.setEncoding(OUTPUT_ENCODING);
    // marshaller.setEncoding("UTF-8");
    // marshal as document (default): make sure we add at top: <?xml version="1.0" encoding="<encoding>"?>
    marshaller.setMarshalAsDocument(true);
    marshaller.setNoNamespaceSchemaLocation("none");
    marshaller.setMarshalListener(new VueMarshalListener());
    // setting to "none" gets rid of all the spurious tags like these:
    // xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    //marshaller.setDoctype("foo", "bar"); // not in 0.9.4.3, must wait till we can run 0.9.5.3+
    /*
          marshaller.setMarshalListener(new MarshalListener() {
          public boolean preMarshal(Object o) {
          System.out.println(" preMarshal " + o.getClass().getName() + " " + o);
          return true;
          }
          public void postMarshal(Object o) {
          System.out.println("postMarshal " + o.getClass().getName() + " " + o);
          }
          });
        */
    //marshaller.setRootElement("FOOBIE"); // overrides name of root element
    marshaller.setMapping(getDefaultMapping());
    //----------------------------------------------------------------------------------------
    // 
    // 2007-10-01 SMF -- turning off validation during marshalling now required
    // w/castor-1.1.2.1-xml.jar, otherwise, for some unknown reason, LWLink's
    // with any connected endpoints cause validation exceptions when attempting to
    // save.  E.g, from a map with one node and one link connected to it:
    //
    // ValidationException: The following exception occured while validating field: childList of class:
    // tufts.vue.LWMap: The object associated with IDREF "LWNode[2         "New Node"  +415,+24 69x22]" of type
    // class tufts.vue.LWNode has no ID!;
    // - location of error: XPATH: /LW-MAP
    // The object associated with IDREF "LWNode[2         "New Node"  +415,+24 69x22]" of type class tufts.vue.LWNode has no ID!
    //
    // Even tho the node's getID() is correctly returning "2"
    //
    marshaller.setValidation(false);
    //----------------------------------------------------------------------------------------
    // todo: deprecated; now uses commons-logging
    marshaller.setLogWriter(new PrintWriter(System.err));
    // Make modifications to the map at the last minute, so any prior exceptions leave the map untouched.
    final int oldModelVersion = map.getModelVersion();
    final File oldSaveFile = map.getFile();
    if (targetFile != null) {
        map.setModelVersion(LWMap.getCurrentModelVersion());
        // note that if this file is different from it's last save file, this
        // operation may cause any/all of the resources in the map to be
        // updated before returning.
        map.setFile(targetFile);
    }
    // map.addNode(new tufts.vue.LWNode("Hello "+((char)15)+((char)23)));
    //if (DEBUG.CASTOR || DEBUG.IO) System.out.println("Marshalling " + map + " ...");
    Log.debug("marshalling " + map + " ...");
    writer.flush();
    //map.addNode(new tufts.vue.LWNode("Hello World:"+((char)11)));
    try {
        //-----------------------------------------------------------------------------
        //-----------------------------------------------------------------------------
        // try the test map first
        // TODO: DOES NOT ACTUALLY DO A TEST WRITE FIRST
        // It will still completely blow away the user's map if there is any kind of error.
        // Was this ever tested?
        //-----------------------------------------------------------------------------
        //-----------------------------------------------------------------------------
        marshaller.marshal(map);
        writer.flush();
        if (DEBUG.Enabled)
            Log.debug("marshalled " + map + " to " + writer + "; file=" + tmpFile);
    } catch (Throwable t) {
        Log.error(tmpFile + "; " + map, t);
        VueUtil.alert(VueResources.getString("actionutil.filecorrupted.error") + "\n\n" + VueResources.getString("actionutil.filecorrupted.description") + "\n" + Util.formatLines(t.toString(), 80), VueResources.getString("actionutil.rename.title"));
        try {
            if (targetFile != null) {
                map.setModelVersion(oldModelVersion);
                map.setFile(oldSaveFile);
            }
        } catch (Throwable tx) {
            VueUtil.alert(Util.formatLines(tx.toString(), 80), VueResources.getString("actionutil.internalsave.title"));
            Util.printStackTrace(tx);
        } finally {
            throw new WrappedMarshallException(t);
        }
    }
    if (tmpFile != null) {
        try {
            // should never fail, but if it does, the save itself has still worked
            map.markAsSaved();
        } catch (Throwable t) {
            Log.error(t);
        }
        try {
            Log.info("wrote " + map + " to " + tmpFile);
        } catch (Throwable t) {
            Log.error("debug", t);
        }
    }
}
Example 24
Project: gda-common-master  File: XMLHelpers.java View source code
private static void writeToXMLInternal(URL mappingURL, Object object, Writer writer) throws Exception {
    try {
        if (urlResolver != null)
            mappingURL = urlResolver.resolve(mappingURL);
        if (mappingURL != null) {
            XMLContext context = createXMLContext(mappingURL, object.getClass().getClassLoader());
            Marshaller marshaller = context.createMarshaller();
            marshaller.setWriter(writer);
            marshaller.marshal(object);
        } else
            Marshaller.marshal(object, writer);
    } finally {
        if (writer != null)
            writer.flush();
        if (writer != null)
            writer.close();
    }
}
Example 25
Project: Keel3.0-master  File: Experiments.java View source code
/**
     * Stores the experiment to disk
     * @return the user's option (if accepted to save or declined to save) 
     */
public int saveExperiment(int option) {
    experimentGraph.objective = this.objType;
    int opcion = 0;
    Mapping mapping = new Mapping();
    try {
        if ((experimentGraph.getName() == null) || (option == 1)) {
            JFileChooser f;
            if (lastDirectory == null) {
                f = new JFileChooser();
            } else {
                f = new JFileChooser(lastDirectory);
            }
            f.setDialogTitle("Save experiment");
            String exten[] = { "xml" };
            f.setFileFilter(new ArchiveFilter2(exten, "Experiments (.xml)"));
            opcion = f.showSaveDialog(this);
            if (opcion == JFileChooser.APPROVE_OPTION) {
                lastDirectory = f.getCurrentDirectory().getAbsolutePath();
                String nombre = f.getSelectedFile().getAbsolutePath();
                if (!nombre.toLowerCase().endsWith(".xml")) {
                    // Add correct extension
                    nombre += ".xml";
                }
                File tmp = new File(nombre);
                if (!tmp.exists() || JOptionPane.showConfirmDialog(this, "File " + nombre + " already exists. Do you want to replace it?", "Confirm", JOptionPane.YES_NO_OPTION, 3) == JOptionPane.YES_OPTION) {
                    experimentGraph.setName(nombre);
                }
            }
        }
        if (experimentGraph.getName() != null) {
            try {
                File f = new File(experimentGraph.getName());
                if (f.exists()) {
                    f.delete();
                }
                if (objType == LQD) {
                    mapping.loadMapping(this.getClass().getResource("/mapping/mapeoExperimentoLQD.xml"));
                } else {
                    mapping.loadMapping(this.getClass().getResource("/mapping/mapeoExperimento.xml"));
                }
                FileOutputStream file = new FileOutputStream(f);
                Marshaller marshaller = new Marshaller(new OutputStreamWriter(file));
                marshaller.setMapping(mapping);
                marshaller.marshal(experimentGraph);
                experimentGraph.setModified(false);
                status.setText("Experiment saved successfully");
                if (objType == LQD) {
                    JOptionPane.showMessageDialog(this, "Experiment saved successfully", "Saved", JOptionPane.INFORMATION_MESSAGE);
                }
            } catch (Exception e) {
                JOptionPane.showMessageDialog(this, "Error saving experiment", "Error", JOptionPane.ERROR_MESSAGE);
                System.err.println(e);
            }
        }
    } catch (Exception e) {
        System.err.println(e);
        return 1;
    }
    return opcion;
}
Example 26
Project: alvsanand-master  File: Article.java View source code
/**
     * 
     * 
     * @param out
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     */
public void marshal(final java.io.Writer out) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
    org.exolab.castor.xml.Marshaller.marshal(this, out);
}
Example 27
Project: cts2-framework-master  File: PatchedCastorMarshaller.java View source code
/* (non-Javadoc)
	 * @see org.springframework.oxm.castor.CastorMarshaller#customizeMarshaller(org.exolab.castor.xml.Marshaller)
	 */
@Override
protected void customizeMarshaller(Marshaller marshaller) {
    super.customizeMarshaller(marshaller);
    marshaller.setInternalContext(marshaller.getInternalContext());
}
Example 28
Project: gvtools-master  File: Extension.java View source code
// -- boolean isValid()
/**
	 * Method marshal
	 * 
	 * @param out
	 */
public void marshal(java.io.Writer out) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
    Marshaller.marshal(this, out);
}
Example 29
Project: JSqlIde-master  File: BrowserPlugin.java View source code
//-- boolean isValid() 
/**
     * 
     * 
     * @param out
    **/
public void marshal(java.io.Writer out) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
    Marshaller.marshal(this, out);
}
Example 30
Project: codehaus-mojo-master  File: Action.java View source code
//-- boolean isValid() 
/**
     * Method marshal
     * 
     * 
     * 
     * @param out
     */
public void marshal(java.io.Writer out) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
    Marshaller.marshal(this, out);
}
Example 31
Project: ralasafe-master  File: BinaryExpr.java View source code
/**
     * 
     * 
     * @param out
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     */
public void marshal(final java.io.Writer out) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
    Marshaller.marshal(this, out);
}