Java Code Examples for javax.xml.soap.SOAPElement#getAttributeValue()

The following examples show how to use javax.xml.soap.SOAPElement#getAttributeValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JRXmlaQueryExecuter.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void parseAxesInfoElement(SOAPElement axesInfoElement) throws SOAPException
{
	// Cycle over AxisInfo-Elements
	Name axisInfoName = sf.createName("AxisInfo", "", MDD_URI);
	Iterator<?> itAxis = axesInfoElement.getChildElements(axisInfoName);
	while (itAxis.hasNext())
	{
		SOAPElement axisElement = (SOAPElement) itAxis.next();
		Name name = sf.createName("name");
		String axisName = axisElement.getAttributeValue(name);
		if (axisName.equals(SLICER_AXIS_NAME))
		{
			continue;
		}

		JRXmlaResultAxis axis = new JRXmlaResultAxis(axisName);
		xmlaResult.addAxis(axis);
		
		if (log.isDebugEnabled())
		{
			log.debug("adding axis: " + axis.getAxisName());
		}
		
		// retrieve the hierarchies by <HierarchyInfo>
		name = sf.createName("HierarchyInfo", "", MDD_URI);
		Iterator<?> itHierInfo = axisElement.getChildElements(name);
		while (itHierInfo.hasNext())
		{
			SOAPElement eHierInfo = (SOAPElement) itHierInfo.next();
			handleHierInfo(axis, eHierInfo);
		}
	}
}
 
Example 2
Source File: JRXmlaQueryExecuter.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void parseAxesElement(SOAPElement axesElement) throws SOAPException
{
	// Cycle over Axis-Elements
	Name aName = sf.createName("Axis", "", MDD_URI);
	Iterator<?> itAxis = axesElement.getChildElements(aName);
	while (itAxis.hasNext())
	{
		SOAPElement axisElement = (SOAPElement) itAxis.next();
		Name name = sf.createName("name");
		String axisName = axisElement.getAttributeValue(name);

		if (axisName.equals(SLICER_AXIS_NAME))
		{
			continue;
		}

		// LookUp for the Axis
		JRXmlaResultAxis axis = xmlaResult.getAxisByName(axisName);

		// retrieve the tuples by <Tuples>
		name = sf.createName("Tuples", "", MDD_URI);
		Iterator<?> itTuples = axisElement.getChildElements(name);
		if (itTuples.hasNext())
		{
			SOAPElement eTuples = (SOAPElement) itTuples.next();
			handleTuplesElement(axis, eTuples);
		}
	}
}
 
Example 3
Source File: JRXmlaQueryExecuter.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void handleHierInfo(JRXmlaResultAxis axis, SOAPElement hierInfoElement) throws SOAPException
{
	Name name = sf.createName("name");
	String dimName = hierInfoElement.getAttributeValue(name); // Get the Dimension Name

	if (log.isDebugEnabled())
	{
		log.debug("Adding hierarchy: " + dimName);
	}

	JRXmlaHierarchy hier = new JRXmlaHierarchy(dimName);
	axis.addHierarchy(hier);
}
 
Example 4
Source File: JRXmlaQueryExecuter.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
protected void parseCellDataElement(SOAPElement cellDataElement) throws SOAPException
{
	Name name = sf.createName("Cell", "", MDD_URI);
	Iterator<?> itCells = cellDataElement.getChildElements(name);
	while (itCells.hasNext())
	{
		SOAPElement cellElement = (SOAPElement) itCells.next();
		
		Name errorName = sf.createName("Error", "", MDD_URI);
		Iterator<?> errorElems = cellElement.getChildElements(errorName);
		if (errorElems.hasNext())
		{
			handleCellErrors(errorElems);
		}
		
		Name ordinalName = sf.createName("CellOrdinal");
		String cellOrdinal = cellElement.getAttributeValue(ordinalName);

		Object value = null;
		Iterator<?> valueElements = cellElement.getChildElements(sf.createName("Value", "", MDD_URI));
		if (valueElements.hasNext())
		{
			SOAPElement valueElement = (SOAPElement) valueElements.next();
			String valueType = valueElement.getAttribute("xsi:type");
			if (valueType.equals("xsd:int"))
			{
				value = Long.valueOf(valueElement.getValue());
			}
			else if (
				valueType.equals("xsd:double")
				|| valueType.equals("xsd:decimal")
				)
			{
				value = Double.valueOf(valueElement.getValue());
			}
			else
			{
				value = valueElement.getValue();
			}
		}

		String fmtValue = "";
		Iterator<?> fmtValueElements = cellElement.getChildElements(sf.createName("FmtValue", "", MDD_URI));
		if (fmtValueElements.hasNext())
		{
			SOAPElement fmtValueElement = ((SOAPElement) fmtValueElements.next());
			fmtValue = fmtValueElement.getValue();
		}

		int pos = Integer.parseInt(cellOrdinal);
		JRXmlaCell cell = new JRXmlaCell(value, fmtValue);
		xmlaResult.setCell(cell, pos);
	}
}
 
Example 5
Source File: JRXmlaQueryExecuter.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
protected void handleTupleElement(JRXmlaResultAxis axis, SOAPElement tupleElement) throws SOAPException
{
	JRXmlaMemberTuple tuple = new JRXmlaMemberTuple(axis.getHierarchiesOnAxis().length);
	
	Name memName = sf.createName("Member", "", MDD_URI);
	Iterator<?> itMember = tupleElement.getChildElements(memName);
	int memNum = 0;
	while (itMember.hasNext())
	{
		SOAPElement memElement = (SOAPElement) itMember.next();
		
		Name name = sf.createName("Hierarchy", "", "");
		String hierName = memElement.getAttributeValue(name);
		
		String uName = "";
		Iterator<?> uNameElements = memElement.getChildElements(sf.createName("UName", "", MDD_URI));
		if (uNameElements.hasNext())
		{
			uName = ((SOAPElement) uNameElements.next()).getValue();
		}
		String caption = "";
		Iterator<?> captionElements = memElement.getChildElements(sf.createName("Caption", "", MDD_URI));
		if (captionElements.hasNext())
		{
			caption = ((SOAPElement) captionElements.next()).getValue();
		}
		String lName = "";
		Iterator<?> lNameElements = memElement.getChildElements(sf.createName("LName", "", MDD_URI));
		if (lNameElements.hasNext())
		{
			String levelUniqueName = ((SOAPElement) lNameElements.next()).getValue();
			Matcher matcher = LEVEL_UNIQUE_NAME_PATTERN.matcher(levelUniqueName);
			if (matcher.matches())
			{
				lName = matcher.group(LEVEL_UNIQUE_NAME_PATTERN_NAME_GROUP);
			}
			else
			{
				matcher = HIERARCHY_LEVEL_UNIQUE_NAME_PATTERN.matcher(levelUniqueName);
				if (matcher.matches())
				{
					lName = matcher.group(HIERARCHY_LEVEL_UNIQUE_NAME_PATTERN_NAME_GROUP);
				}
				else
				{
					throw 
						new JRRuntimeException(
							EXCEPTION_MESSAGE_KEY_XMLA_NO_LEVEL_NAME,
							new Object[]{levelUniqueName});
				}
			}
		}
		
		int lNum = 0;
		Iterator<?> lNumElements = memElement.getChildElements(sf.createName("LNum", "", MDD_URI));
		if (lNumElements.hasNext())
		{
			lNum = Integer.parseInt(((SOAPElement) lNumElements.next()).getValue());
		}
		JRXmlaMember member = new JRXmlaMember(caption, uName, hierName, lName, lNum);
		
		if (log.isDebugEnabled())
		{
			log.debug("Adding member: axis - " + axis.getAxisName() + " hierName - " + hierName  + " lName - " + lName + " uName - " + uName);
		}
		tuple.setMember(memNum++, member);
	}

	axis.addTuple(tuple);
}