BPM Objects to XML
Hello everyone,
this could seem simple but even for me is not. I want obtain XML data coming out from my BPM Object. Basically what I want is something like the XML Object can do: use some sort of generateXMLFor() method but I cannot figure how to realize it without doing a lot of work that is just customized on my object structure.
I've some database tables catalogued into ALBPM, for which I've created heirs objects. These objects are actually "contained" into a main object as attributes of it. In my obj I've some method that does some work on the tables heirs in order to manage data. Do not mind on how the data will be read or written, let's suppose we have the big object filled with data. I want to convert data into XML generating tags named as the relative attribute and containing the attribute's values. How this can be done?
Any kind of hint will be really apreciated.
Thanks a lot
G
Thanks! It was appliable for me!
Just to add some information if someone will need something similar: there is also the inverse method that creates your object from an XML source. The thing that is not relly obvious is that you have to pass the type of your destination object to the method. :)
Bye
Similar Messages
-
XML Object to BPM Object, is possible?
My process consumes a Web Service that returns a Object (XSD).
When I catalog this Web Service in the BPM catalog, BPM saves the return of Web Service as a XML Object.
The problem is that I use JSP in my application, so when I need to show this object in JSP, I need to create a BPM Object similar to XML Object and map the values of the XML Object to Object BPM, then if I need change the Web Service returns (XML object) I also need to change the BPM Object. This is very annoying.
Exists a way to convert a XML Object to BPM Object? BPM provides some API to make this?Yo can create a BPM Object that inherits from an XML Object.
Hope it helps -
How to invoke BPM object instance variable from interactive activity?
I have a screenflow with an automatic activity "A" followed by an interactive activity "B". "B" calls a BPM object "X" and uses a JSP presentation to show its attributes. Is there a way to use another BPM object, say type "Y", create an instance variable of that type inside "A", and get its attributes values from the JSP page associated to "B"?
Edited by: user6473912 on 20/07/2010 03:37 PMTry this. It assumes you have:
<li> a user named "auto"
<li> a project variable named "customerType"
<li> an instance variable named "orderAmount" that is a decimal
<li> an instance variable named "order" that is a BPM Object that has attributes named "customerName" and "amount"
ps as ProcessService
xmlObject as Fuego.Xml.XMLObject
do
connectTo ps
using url = Fuego.Server.directoryURL,
user = "auto",
password = "auto"
instF as InstanceFilter
create(instF, processService : ps)
addAttributeTo(instF, variable : "customerType", comparator : IS, value : "Gold")
instF.searchScope = SearchScope(participantScope : ParticipantScope.ALL, statusScope : StatusScope.ONLY_INPROCESS)
for each inst in getInstancesByFilter(ps, filter : instF) do
// here's how to get the value inside a primitive instance variable
orderAmtObj as Object = getVar(inst, var : "orderAmount")
// here's how to get the value of attributes inside a complex BPM Object instance variable
// - in this case this is an "order" object with two attributes (customerName and amount)
orderObj as Object = (getVar(inst, var : "order"))
xmlObject = Fuego.Xml.XMLObject(createXmlTextFor(DynamicXml, object : orderObj, topLevelTag : "xsi"))
logMessage "The value of the order object's customer name is: " +
selectString(xmlObject, xpath : "customerName")
logMessage "The value of the order object's order amount is: " +
selectNumber(xmlObject, xpath : "amount")
// here's a rather uninspired way to retrieve who the participant is that was assigned the instance
logMessage "The participant assigned to this instance is: " + inst.participantId
end
on exit
disconnectFrom ps
endDan -
Fuego BPM object mapping in PAPI
I am currently using ALBPM 5.7 version. My ALBPM process is using one Fuego BPM Objects as instance variables. I need to access the process via PAPI. What is the equivalent Java object type for typical Fuego BPM objects, per say that has few attributes with String, Time and Int types in order to pass that Fuego Object type from instance arguments.
-- Deha Peker
Edited by dpeker at 05/07/2008 11:05 PMHi Avishek,
There is workaround for this...you can save the instance as Object/DynaObj then go for toString() call that will give your biusiness object as XML msg in string format..from there you can extract a xml node value using x-path....i tried this once and worked for me....but i m not getting the code snipetnow ..else i would have pasted here....:(
Rgds,
Biltu -
'fuego.xobject.util.InvalidContextKey: Invalid BPM Object context key'
Hi ,
i am trying to integrate the JSP in ALBPM studio 6.0
while running the application i am getting the following error.
Unexpected error during interactive component execution.
Unexpected error during interactive component execution. Caused by: This Execution is not waiting for a result Caused by: The task could not be successfully executed. Reason: 'fuego.xobject.util.InvalidContextKey: Invalid BPM Object context key'. Caused by: Invalid BPM Object context key fuego.web.execution.exception.UnexpectedExecutionException: Unexpected error during interactive component execution. at fuego.web.papi.TaskExecutor.execute(TaskExecutor.java:187) at fuego.workspace.servlet.ExecutorServlet.doAction(ExecutorServlet.java:117) at fuego.workspace.servlet.BaseServlet.doPost(BaseServlet.java:228) at fuego.workspace.servlet.BaseServlet.doGet(BaseServlet.java:219) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at fuego.workspace.servlet.AuthenticatedServlet.service(AuthenticatedServlet.java:61) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAsPrivileged(Unknown Source) at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275) at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245) at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50) at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156) at java.security.AccessController.doPrivileged(Native Method) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152) at fuego.web.filter.SingleThreadPerSessionFilter.doFilter(SingleThreadPerSessionFilter.java:64) at fuego.web.filter.BaseFilter.doFilter(BaseFilter.java:63) at sun.reflect.GeneratedMethodAccessor123.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAsPrivileged(Unknown Source) at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275) at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:217) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:197) at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50) at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156) at java.security.AccessController.doPrivileged(Native Method) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152) at fuego.web.filter.CharsetFilter.doFilter(CharsetFilter.java:48) at fuego.web.filter.BaseFilter.doFilter(BaseFilter.java:63) at sun.reflect.GeneratedMethodAccessor123.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAsPrivileged(Unknown Source) at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275) at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:217) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:197) at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50) at
Any clue regarding this will be highly appreciated ..
Thanks in advance
regards
LalatenduHi ,
i got the answer finally !! :))
there was one small block missing from my engine.xml file in side package *<Workspace><Project Name>\config\engine.xml*
that is
*<node name="startPapiWs">*
*<map/>*
*</node>*
but i couldn't figure out where i missed out the steps for configuration because of which the proper xml generation didn't happened.
After this my application started working ..if any one facing similar problem may be helpful
Thanks
Lalatendu -
Regarding BPM Object Retrieval in PAPI API
Hi,
I am using Oracle BPM10gR3 to develop BPM processes. I am having external connectivity of BPM processes with external Java application through PAPI API. I am having a BPM Object defined as "ApplicationObject" under Module which consists of instanceID and activityID. A instance variable is defined of this BPMObject type with Array i.e. insAppObject of type ApplicationObject[]. I have now loaded this instance variable with array length 5.
Now, I need to retrieve BPMObject[] in PAPI API which I am unable to perform. Usually, we do the following to load a BPM Object in PAPI API.
Class c = Class.forName("xobject.Module.BPMObject");
instanceinfo.getData("instanceVariableID");
To Retrieve BPMObject[], I have tried this but no luck.
Class c = Class.forName("[Lxobject.Module.BPMObject;");
Using this class, I am getting "Class Not Found Exception".
Can anyone suggest on the above.
Thanks in advance,
AbhishekHi Avishek,
There is workaround for this...you can save the instance as Object/DynaObj then go for toString() call that will give your biusiness object as XML msg in string format..from there you can extract a xml node value using x-path....i tried this once and worked for me....but i m not getting the code snipetnow ..else i would have pasted here....:(
Rgds,
Biltu -
Is it possible to use reflection on BPM object?
Gil, thanks for your enlightenment.
My AComponentCollection class will have variable number of AComponent, maybe also some BComponent or CComponent. The instance names and Component types are read from an XML file. Do you think it is practical to use Java Reflection to realize this?
Can I reference an Object instance according to avariable String
Not in the static context. Neither for local
variables declared within a method. You can access
variables of a class instance (object) though. Eg.
class AComponentCollection{
AComponent aComponent = new AComponent(2);
AComponent bComponent = new AComponent(3);
public static void main(String[] args){
AComponentCollection aCollection=new
aCollection=new AComponentCollection();
String aInstance = args[0];
Field[]
Field[]
Field[]
fields=aCollection.getClass().getDeclaredFields();
for(int i=0; i<fields.length; i++){
if(aInstance.equals(fields.getName()){
//Found your object!
AComponent
AComponent
AComponent
foundComponent=(AComponent)fields[i].get(aCollection)
Gil -
How can I invoke web service in BPM Object's method?
In ALBPM 5.7,AJaX can code by Call BPM Object's method.So I want to invoke web service via AJaX by BPM method.
My sample code is:
1: HelloWorldWebService ws = HelloWorldWebService();
2: String param = "John";
3: String retresult = "";
4: ws.sayHello(name : parame; out result : retresult);
and,I have import HelloWorldWebService by wsdl into catalog.
In fact,at line 1 there is a error(fuego.connector.ConnectorRuntimeException: session is not started). Web service's instance is not created.
Anybody can help me? thanks.Hi,
I tried calling a simple webservice deployed in weblogic 8.1(see code) and it was working fine for me.
Code for WS
package service;
import com.bea.control.JwsContext;
import com.bea.jws.Protocol;
import org.xmlsoap.schemas.soap.envelope.HeaderDocument;
import com.bea.xml.XmlException;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class CheckCredit implements com.bea.jws.WebService
* @common:context
JwsContext context;
static final long serialVersionUID = 1L;
* @common:operation
* @jws:protocol form-get="false" form-post="false"
public boolean getCreditRating(String cardNumber)
System.out.println("Card number is: " + cardNumber );
boolean result = ((int)(Math.random() *100)) % 2 == 0?true:false;
return result;
Code from ALBPM Object method
creditRatingResult as Bool
getCreditRating CheckCreditService
using cardNumber = "1234-5567-4667-4566"
returning creditRatingResult = creditRatingResult
logMessage "Result is: " + creditRatingResult
What I suggest for you problem is:
1. Check the server on which you have deployed the WS. Does it require any sort of authentication prior to connecting to the WS
2. It seems you are using Java style in ALBPM. Try switching to PBL. I don't know how it makes a difference, but sometimes it helps
Thanks and Regards
Vivek Nandey
BEA Certified Developer for Integration Solutions
[email protected] -
Error while creating Attribute In BPM Object
Hi,
I am getting error while creating attributes in BPM Object.I am not able to open BPm object. while opening I am getting Below error.
Please suggest.
java.lang.StringIndexOutOfBoundsException: String index out of range: 28
at java.lang.String.charAt(Unknown Source)
at fuego.type.TypeFactory.createFromName(TypeFactory.java:482)
at fuego.type.TypeFactory.forNameLazy(TypeFactory.java:263)
at fuego.lang.CollectionTypeDescription.getIndexTypeRef(CollectionTypeDescription.java:146)
at fuego.compiler.type.TypeRenderer.renderArrayType(TypeRenderer.java:355)
at fuego.compiler.type.TypeRenderer.renderType(TypeRenderer.java:261)
at fuego.compiler.type.TypeRenderer.renderArrayType(TypeRenderer.java:344)
at fuego.compiler.type.TypeRenderer.renderType(TypeRenderer.java:261)
at fuego.compiler.type.TypeRenderer.render(TypeRenderer.java:106)
at fuego.compiler.type.TypeRenderer.render(TypeRenderer.java:94)
at fuego.compiler.type.TypeRenderer.render(TypeRenderer.java:78)
at fuego.designer.XObjectComponentStructurePanel$CellTypeRenderer.getText(XObjectComponentStructurePanel.java:612)
at fuego.designer.XObjectComponentStructurePanel$CellTypeRenderer.getText(XObjectComponentStructurePanel.java:605)
at fuego.ui.peer.swt.SwtTable$SwtTableModel.getColumnText(SwtTable.java:956)
at org.eclipse.jface.viewers.TableColumnViewerLabelProvider.update(TableColumnViewerLabelProvider.java:70)
at org.eclipse.jface.viewers.ViewerColumn.refresh(ViewerColumn.java:135)
at org.eclipse.jface.viewers.AbstractTableViewer.doUpdateItem(AbstractTableViewer.java:386)
at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:466)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:857)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:46)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:199)
at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:2026)
at org.eclipse.jface.viewers.AbstractTableViewer.internalRefreshAll(AbstractTableViewer.java:695)
at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:633)
at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:620)
at org.eclipse.jface.viewers.StructuredViewer$7.run(StructuredViewer.java:1433)
at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1368)
at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1330)
at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1431)
at org.eclipse.jface.viewers.ColumnViewer.refresh(ColumnViewer.java:536)
at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1390)
at fuego.ui.peer.swt.SwtViewer.repaint(SwtViewer.java:59)
at fuego.ui.peer.swt.SwtColumn.setLabelProvider(SwtColumn.java:89)
at fuego.ui.Column.setLabelProvider(Column.java:82)
at fuego.designer.XObjectComponentStructurePanel.buildUI(XObjectComponentStructurePanel.java:299)
at fuego.designer.AbstractEditor.build(AbstractEditor.java:542)
at fuego.designer.AbstractEditor.init(AbstractEditor.java:133)
at fuego.designer.XObjectComponentStructurePanel.<init>(XObjectComponentStructurePanel.java:126)
at fuego.eclipse.studio.multipageeditor.BPMObjectMultipartEditor.createStructurePage(BPMObjectMultipartEditor.java:581)
at fuego.eclipse.studio.multipageeditor.BPMObjectMultipartEditor.addDefaultPages(BPMObjectMultipartEditor.java:464)
at fuego.eclipse.studio.multipageeditor.ExtendedMultiPageEditorPart.createPages(ExtendedMultiPageEditorPart.java:399)
at fuego.eclipse.studio.multipageeditor.eclipse.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:253)
at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:661)
at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:426)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:592)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:299)
at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:179)
at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:268)
at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:400)
at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1256)
at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1209)
at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1604)
at org.eclipse.ui.internal.PartStack.add(PartStack.java:499)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103)
at org.eclipse.ui.internal.PartStack.add(PartStack.java:485)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112)
at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:63)
at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:217)
at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:207)
at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:774)
at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:673)
at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:634)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2737)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2651)
at org.eclipse.ui.internal.WorkbenchPage.access$13(WorkbenchPage.java:2643)
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2595)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2590)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2574)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2557)
at fuego.eclipse.ui.DefaultEditor.open(DefaultEditor.java:65)
at fuego.eclipse.studio.EclipseWorkbench.createEditorFromResource(EclipseWorkbench.java:529)
at fuego.eclipse.studio.EclipseWorkbench.createEditor(EclipseWorkbench.java:297)
at fuego.designer.action.OpenCatalogNodeAction.open(OpenCatalogNodeAction.java:91)
at fuego.designer.action.OpenCatalogNodeAction.run(OpenCatalogNodeAction.java:55)
at fuego.eclipse.ui.EclipseAction.run(EclipseAction.java:180)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:546)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)When you say you're having trouble "opening" the BPM Object, is it possible you instead mean you're having trouble expanding the BPM Object?
Just a guess, but if you're having trouble expanding the BPM Object I'd suspect that the object's xcdl contents might be corrupted. You might want to consider exporting and saving a backup of the project and then try deleting the object from the Project Navigator. Rebuild the BPM Object once you've deleted it.
Dan -
How do I add a variable into an object as xml
I have a xml document with 2 protection order numbers. I want to get the information for one of them which is **protectionOrderNumber="1400042"**. I would like to add strPoNumber variable to the object objXmlCaseDoc. Inside this object is the xml
that was read and put inside the object. I want at the beginning of the xml code inside the objXmlCaseDoc to add the protectionOrderNumber at the end of the first line. This should be added at the beginning of the xml document. In my object (objXmlCaseDoc)
there is no variable strPoNumber. This is why I want to add it at the top. The object has xml document in it.
It should look like this:
<Integration xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:tsg="http://tsgweb.com" xmlns:IXML="http://tsgweb.com" xmlns:CMCodeQueryHelper="urn:CMCodeQueryHelper" protectionOrderNumber="1400042">
My vb code: I have the variable strPoNumber and the object where the xml document is. Object name is objXmlCaseDoc
I want to add the line of code where I have comment Tranform case information into the output format near the bottom of the code.
Option Strict On
Option Explicit On
Imports System.Xml
Public Class BcaPoRequests
Shared Sub Main()
Dim objMessageProcessor As New MessageProcessor
Dim objSchemasCollection As New Msc.Integration.MessageBroker.Library.v4.SchemasCollection
Dim objTransformsCollection As New Msc.Integration.MessageBroker.Library.v4.TransformsCollection
objMessageProcessor.ProcessInputQueue(False, False, objSchemasCollection, objTransformsCollection)
End Sub
Private Class MessageProcessor
Inherits Msc.Integration.ServiceCatalog.Library.v4.SoapMessageProcessor
Protected Overrides Sub ProcessMessage(ByRef aobjBroker As ServiceCatalog.Library.v4.Broker, ByRef aobjXMLInputSoapEnvelopeDoc As System.Xml.XmlDocument, ByRef aobjInstantiatedObjectsCstrollection As Microsoft.VisualBasic.Collection, ByRef aobjConsumer As ServiceCatalog.Library.v4.Consumer)
MyBase.ProcessMessage(aobjBroker, aobjXMLInputSoapEnvelopeDoc, aobjInstantiatedObjectsCollection, aobjConsumer)
Dim objXmlMessageDoc As XmlDocument
Dim objXmlMessageNode As XmlNode
Dim objNameTable As NameTable
Dim objXMLNameSpaceManager As XmlNamespaceManager
Dim objXMLSchemaException As Xml.Schema.XmlSchemaException
Dim strCaseNumber As String
Dim strPoNumber As String
Dim objXmlCaseDoc As XmlDocument
'create a namespace manager used for queries into inputmessage (because of namespace)
objNameTable = New NameTable
objXMLNameSpaceManager = New XmlNamespaceManager(objNameTable)
objXMLNameSpaceManager.AddNamespace("ext", "http://www.courts.state.mn.us/ProtectionOrderExtension/1.0")
objXMLNameSpaceManager.AddNamespace("exc", "http://www.courts.state.mn.us/ProtectionOrderQuery/1.0")
objXMLNameSpaceManager.AddNamespace("soap", "http://www.w3.org/2003/05/soap-envelope")
objXMLNameSpaceManager.AddNamespace("wsa", "http://schemas.xmlsoap.org/ws/2004/08/addressing")
objXmlMessageNode = aobjXMLInputSoapEnvelopeDoc.DocumentElement.SelectSingleNode("soap:Body/exc:ProtectionOrderQueryRequest", objXMLNameSpaceManager)
objXmlMessageDoc = New XmlDocument
objXmlMessageDoc.LoadXml(objXmlMessageNode.OuterXml)
'Check authorization
'Validate the input message
objXMLSchemaException = aobjBroker.ValidateXmlDocument(objXmlMessageDoc, "ProtectionOrderQuery_1_0.xsd", "NiemExchanges\ProtectionOrders\Exchange", , False)
If Not objXMLSchemaException Is Nothing Then
'return fault if invalid
aobjBroker.Reply(aobjBroker.CreateSoapFault(Msc.Integration.Utility.Library.v4.Soap.udtSoapCodes.Sender, Msc.Integration.Utility.Library.v4.Xml.FormatXmlSchemaValidationErrorText(objXMLSchemaException), Msc.Integration.Utility.Library.v4.Soap.udtSoapRoles.RoleUltimateReceiver, aobjXMLInputSoapEnvelopeDoc, "soap:InvalidMessage", "soap:Body", Msc.Integration.Utility.Library.v4.Soap.GetReplyEndpointReference(aobjXMLInputSoapEnvelopeDoc), aobjXMLInputSoapEnvelopeDoc.DocumentElement.SelectSingleNode("soap:Header/wsa:MessageID", objXMLNameSpaceManager).InnerText, aobjConsumer))
Exit Sub
End If
'Get the case number and the PO number from the input message
strCaseNumber = objXmlMessageDoc.DocumentElement.SelectSingleNode("ext:CourtFileNumber", objXMLNameSpaceManager).InnerText
strPoNumber = objXmlMessageDoc.DocumentElement.SelectSingleNode("ext:ProtectionOrderID", objXMLNameSpaceManager).InnerText
'Get the case information from Mncis
'Code for calling the case
objXmlCaseDoc = Msc.Integration.Mncis.Library.v4.Case.GetIxmlForCaseNumber(strCaseNumber, "CourtCaseHeader,ProtectionOrder,SubjectParties,HearingTrialSetting", False)
'Tranform case information into the output format
End Sub
End Class
End Class
xslt code
<?xml version="1.0" encoding="UTF-8"?>
<?altova_samplexml file:///Z:/Training%20with%20Tim%20XML%20code%20various/BcaRequestIxml.xml?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:poq="http://www.courts.state.mn.us/ProtectionOrderQuery/1.0" xmlns:ext="http://www.courts.state.mn.us/ProtectionOrderExtension/1.0" xmlns:nc="http://niem.gov/niem/niem-core/2.0" xmlns:j="http://niem.gov/niem/domains/jxdm/4.1" xmlns:mscef="courts.state.mn.us/extfun" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:exsl="urn:schemas-microsoft-com:xslt" extension-element-prefixes="exsl" exclude-result-prefixes="mscef msxsl exsl">
<xsl:import href="../General/ExtensionFunctions.xsl"/>
<xsl:import href="MNCIS_PO_BCA_ProtectionOrder_1_0.xsl"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<!-- Path to environment folder used by document function. Relative to location of stylesheet. -->
<xsl:param name="gEnvPath">../..</xsl:param>
<xsl:template match="/">
<xsl:variable name="vPoNumber">
<xsl:value-of select="Integration/@protectionOrderNumber"/>
</xsl:variable>
<poq:ProtectionOrderQueryResponse>
<xsl:for-each select="//Integration/ProtectionOrder[ProtectionOrderNumber=$vPoNumber]">
<xsl:call-template name="ProtectionOrder"/>
</xsl:for-each>
</poq:ProtectionOrderQueryResponse>
</xsl:template>
</xsl:stylesheet>
XML document output from my xslt code
<?xml version="1.0" encoding="UTF-8"?>
<poq:ProtectionOrderQueryResponse xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:poq="http://www.courts.state.mn.us/ProtectionOrderQuery/1.0" xmlns:ext="http://www.courts.state.mn.us/ProtectionOrderExtension/1.0" xmlns:nc="http://niem.gov/niem/niem-core/2.0" xmlns:j="http://niem.gov/niem/domains/jxdm/4.1">
<ext:ProtectionOrder xmlns:exc="http://www.courts.state.mn.us/ProtectionOrderServiceExchange/1.0" xmlns:s="http://niem.gov/niem/structures/2.0" xmlns:usps="http://niem.gov/niem/usps_states/2.0">
<j:CourtOrderEnforcementAgency>
<nc:OrganizationIdentification>
<nc:IdentificationID>MN0700000</nc:IdentificationID>
</nc:OrganizationIdentification>
</j:CourtOrderEnforcementAgency>
<ext:ForeignOrderIdentification>
<nc:IdentificationID/>
<ext:ForeignOrderIdentificationTypeCode/>
</ext:ForeignOrderIdentification>
<ext:HearingHeldIndicator>false</ext:HearingHeldIndicator>
<nc:Location s:id="DB1618611387">
<nc:LocationAddress>
<nc:StructuredAddress>
<nc:LocationStreet>
<nc:StreetFullText>3434 Bohnsack Way</nc:StreetFullText>
<nc:StreetFullText>Unit 75 B</nc:StreetFullText>
<nc:StreetFullText/>
</nc:LocationStreet>
<nc:LocationCityName>New Prague</nc:LocationCityName>
<nc:LocationStateUSPostalServiceCode>MN</nc:LocationStateUSPostalServiceCode>
<nc:LocationPostalCode>56071</nc:LocationPostalCode>
</nc:StructuredAddress>
</nc:LocationAddress>
</nc:Location>
<ext:ProtectedParty>
<ext:PersonBirthDate ext:approximateDateIndicator="false" ext:currentIndicator="true">1987-11-21</ext:PersonBirthDate>
<nc:PersonName>
<nc:PersonGivenName>Jennifer</nc:PersonGivenName>
<nc:PersonMiddleName>Marie</nc:PersonMiddleName>
<nc:PersonSurName>O'Brien</nc:PersonSurName>
<nc:PersonNameSuffixText/>
<nc:PersonFullName>O'Brien, Jennifer Marie</nc:PersonFullName>
</nc:PersonName>
<ext:PersonRaceCode/>
<nc:PersonSexCode>F</nc:PersonSexCode>
<ext:PetitionerIndicator>true</ext:PetitionerIndicator>
</ext:ProtectedParty>
<ext:ProtectedParty>
<ext:PersonBirthDate ext:approximateDateIndicator="false" ext:currentIndicator="true">2008-03-24</ext:PersonBirthDate>
<nc:PersonName>
<nc:PersonGivenName>Eli</nc:PersonGivenName>
<nc:PersonMiddleName>Rose</nc:PersonMiddleName>
<nc:PersonSurName>Noir</nc:PersonSurName>
<nc:PersonNameSuffixText/>
<nc:PersonFullName>Noir, Eli Rose</nc:PersonFullName>
</nc:PersonName>
<ext:PersonRaceCode/>
<nc:PersonSexCode>F</nc:PersonSexCode>
<ext:PetitionerIndicator>false</ext:PetitionerIndicator>
</ext:ProtectedParty>
<ext:ProtectionOrderBradyIndicator>N</ext:ProtectionOrderBradyIndicator>
<ext:ProtectionOrderCondition>
<ext:ConditionText>Respondent must not have any contact with the Protected Person(s) whether in person, with or through other persons, by telephone, mail, e-mail, through electronic devices, social media, or by any other means except as follows: [] </ext:ConditionText>
<ext:ConditionCode>08</ext:ConditionCode>
</ext:ProtectionOrderCondition>
<ext:ProtectionOrderCondition>
<ext:ConditionText>Respondent must stay a reasonable distance away from the residence(s) of the Protected Person(s), specifically as follows: [distance]; and Respondent must stay a reasonable distance away from ANY FUTURE RESIDENCES of the Protected Person(s). </ext:ConditionText>
<ext:ConditionCode>04</ext:ConditionCode>
</ext:ProtectionOrderCondition>
<ext:ProtectionOrderCondition>
<ext:ConditionText>Respondent shall not call or enter Petitioner's place of employment which includes all land, parking lots, and buildings at: </ext:ConditionText>
<ext:ConditionCode>04</ext:ConditionCode>
</ext:ProtectionOrderCondition>
<ext:ProtectionOrderExpirationDate>2015-12-22</ext:ProtectionOrderExpirationDate>
<ext:ProtectionOrderFinding>
<ext:FindingText>Respondent personally appeared or had reasonable notice and opportunity to be heard. The procedures for service upon Respondent set forth in the Minnesota Domestic Abuse Act (Minn.Stat. 518B.01) were followed, and the court has jurisdiction over the parties and subject matter. </ext:FindingText>
<ext:FindingCode>OAH1</ext:FindingCode>
</ext:ProtectionOrderFinding>
<ext:ProtectionOrderFinding>
<ext:FindingText>Acts of domestic abuse have occurred, including the following: [] </ext:FindingText>
<ext:FindingCode>OAH4A</ext:FindingCode>
</ext:ProtectionOrderFinding>
<ext:ProtectionOrderID>1400042</ext:ProtectionOrderID>
<ext:ProtectionOrderIssuingCourt>
<nc:OrganizationIdentification>
<nc:IdentificationID>MN070015J</nc:IdentificationID>
</nc:OrganizationIdentification>
<ext:CourtFaxNumber>
<nc:TelephoneNumberFullID>952-496-8211</nc:TelephoneNumberFullID>
</ext:CourtFaxNumber>
<ext:CourtTelephoneNumber>
<nc:TelephoneNumberFullID>952-496-8200</nc:TelephoneNumberFullID>
<nc:TelephoneSuffixID/>
</ext:CourtTelephoneNumber>
</ext:ProtectionOrderIssuingCourt>
<ext:ProtectionOrderIssuingDate>2014-12-22</ext:ProtectionOrderIssuingDate>
<ext:ProtectionOrderIssuingJudicialOfficial>
<nc:PersonName>
<nc:PersonGivenName>Do</nc:PersonGivenName>
<nc:PersonMiddleName>P.</nc:PersonMiddleName>
<nc:PersonSurName>Ande</nc:PersonSurName>
<nc:PersonNameSuffixText/>
<nc:PersonFullName>Ande, Do P.</nc:PersonFullName>
</nc:PersonName>
</ext:ProtectionOrderIssuingJudicialOfficial>
<ext:ProtectionOrderOtherIdentification>
<nc:IdentificationID>12345</nc:IdentificationID>
<ext:ProtectionOrderOtherIdentificationTypeCode>NCICNUM</ext:ProtectionOrderOtherIdentificationTypeCode>
</ext:ProtectionOrderOtherIdentification>
<ext:ProtectionOrderService>
<ext:ProtectionOrderServiceAgency>
<nc:OrganizationIdentification>
<nc:IdentificationID>MN0191000</nc:IdentificationID>
</nc:OrganizationIdentification>
</ext:ProtectionOrderServiceAgency>
<ext:ProtectionOrderServiceDate>2015-01-10</ext:ProtectionOrderServiceDate>
<ext:ProtectionOrderServiceTime>16:25:00-06:00</ext:ProtectionOrderServiceTime>
<ext:ProtectionOrderServiceToCode>Respondent</ext:ProtectionOrderServiceToCode>
<ext:ProtectionOrderServiceTypeCode>BYPUB</ext:ProtectionOrderServiceTypeCode>
</ext:ProtectionOrderService>
<ext:ProtectionOrderService>
<ext:ProtectionOrderServiceAgency>
<nc:OrganizationIdentification>
<nc:IdentificationID>MN0191000</nc:IdentificationID>
</nc:OrganizationIdentification>
</ext:ProtectionOrderServiceAgency>
<ext:ProtectionOrderServiceDate>2015-01-10</ext:ProtectionOrderServiceDate>
<ext:ProtectionOrderServiceTime>16:25:00-06:00</ext:ProtectionOrderServiceTime>
<ext:ProtectionOrderServiceToCode>Respondent</ext:ProtectionOrderServiceToCode>
<ext:ProtectionOrderServiceTypeCode>BYPUB</ext:ProtectionOrderServiceTypeCode>
</ext:ProtectionOrderService>
<ext:ProtectionOrderService>
<ext:ProtectionOrderServiceAgency>
<nc:OrganizationIdentification>
<nc:IdentificationID>MN0191000</nc:IdentificationID>
</nc:OrganizationIdentification>
</ext:ProtectionOrderServiceAgency>
<ext:ProtectionOrderServiceDate>2015-01-10</ext:ProtectionOrderServiceDate>
<ext:ProtectionOrderServiceToCode>Respondent</ext:ProtectionOrderServiceToCode>
<ext:ProtectionOrderServiceTypeCode>BYPUB</ext:ProtectionOrderServiceTypeCode>
</ext:ProtectionOrderService>
<ext:ProtectionOrderService>
<ext:ProtectionOrderServiceAgency>
<nc:OrganizationIdentification>
<nc:IdentificationID>MN0250800</nc:IdentificationID>
</nc:OrganizationIdentification>
</ext:ProtectionOrderServiceAgency>
<ext:ProtectionOrderServiceDate>2015-01-09</ext:ProtectionOrderServiceDate>
<ext:ProtectionOrderServiceToCode>Respondent</ext:ProtectionOrderServiceToCode>
<ext:ProtectionOrderServiceTypeCode>BYMAIL</ext:ProtectionOrderServiceTypeCode>
</ext:ProtectionOrderService>
<ext:ProtectionOrderService>
<ext:ProtectionOrderServiceAgency>
<nc:OrganizationIdentification>
<nc:IdentificationID>MN0720100</nc:IdentificationID>
</nc:OrganizationIdentification>
</ext:ProtectionOrderServiceAgency>
<ext:ProtectionOrderServiceDate>2014-12-22</ext:ProtectionOrderServiceDate>
<ext:ProtectionOrderServiceToCode>Respondent</ext:ProtectionOrderServiceToCode>
<ext:ProtectionOrderServiceTypeCode>BYPUB</ext:ProtectionOrderServiceTypeCode>
</ext:ProtectionOrderService>
<ext:ProtectionOrderStatus>
<ext:ProtectionOrderStatusCode>SBJO</ext:ProtectionOrderStatusCode>
<ext:ProtectionOrderStatusDate>2014-12-22</ext:ProtectionOrderStatusDate>
</ext:ProtectionOrderStatus>
<ext:ProtectionOrderTypeCode>OFP</ext:ProtectionOrderTypeCode>
<ext:QualifyingRelationship>
<ext:QualifyingRelationshipCode>LIVTOGTHR</ext:QualifyingRelationshipCode>
<ext:QualifyingRelationshipText>Lived Together</ext:QualifyingRelationshipText>
</ext:QualifyingRelationship>
<ext:Respondent>
<nc:PersonEthnicityCode/>
<nc:PersonEyeColorCode/>
<nc:PersonHairColorCode>XXX</nc:PersonHairColorCode>
<nc:PersonHeightMeasure>
<nc:MeasureText>71</nc:MeasureText>
<nc:MeasureUnitText>inches</nc:MeasureUnitText>
<nc:LengthUnitCode>INH</nc:LengthUnitCode>
</nc:PersonHeightMeasure>
<ext:PersonRaceCode>W</ext:PersonRaceCode>
<nc:PersonSexCode>M</nc:PersonSexCode>
<nc:PersonWeightMeasure>
<nc:MeasureText>210</nc:MeasureText>
<nc:MeasureUnitText>pounds</nc:MeasureUnitText>
<nc:WeightUnitCode>LBR</nc:WeightUnitCode>
</nc:PersonWeightMeasure>
<ext:AddressReference ext:currentIndicator="true">
<nc:LocationReference s:ref="DB1618611387"/>
</ext:AddressReference>
<ext:PersonBirthDate ext:approximateDateIndicator="true" ext:currentIndicator="false">1990-12-23</ext:PersonBirthDate>
<ext:PersonBirthDate ext:approximateDateIndicator="false" ext:currentIndicator="false">1989-12-23</ext:PersonBirthDate>
<ext:PersonBirthDate ext:approximateDateIndicator="false" ext:currentIndicator="true">1991-12-23</ext:PersonBirthDate>
<ext:PersonName ext:currentIndicator="true">
<nc:PersonGivenName>Guy</nc:PersonGivenName>
<nc:PersonMiddleName>Andr</nc:PersonMiddleName>
<nc:PersonSurName>Noir</nc:PersonSurName>
<nc:PersonNameSuffixText>Jr.</nc:PersonNameSuffixText>
<nc:PersonFullName>Noir Jr , Guy Andr</nc:PersonFullName>
</ext:PersonName>
</ext:Respondent>
<ext:RespondentPresentAtHearingIndicator>false</ext:RespondentPresentAtHearingIndicator>
</ext:ProtectionOrder>
<ext:SupersededProtectionOrderID xmlns:exc="http://www.courts.state.mn.us/ProtectionOrderServiceExchange/1.0" xmlns:s="http://niem.gov/niem/structures/2.0" xmlns:usps="http://niem.gov/niem/usps_states/2.0"/>
<ext:Hearing xmlns:exc="http://www.courts.state.mn.us/ProtectionOrderServiceExchange/1.0" xmlns:s="http://niem.gov/niem/structures/2.0" xmlns:usps="http://niem.gov/niem/usps_states/2.0">
<ext:HearingDateTime>2015-01-20T09:00:00-06:00</ext:HearingDateTime>
<ext:HearingLocationText>Scott County</ext:HearingLocationText>
</ext:Hearing>
</poq:ProtectionOrderQueryResponse>Inert to root as first nood.
http://msdn.microsoft.com/en-us/library/system.xml.xmlnode.insertbefore(v=vs.110).aspx
Dim doc As New XmlDocument()
doc.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" & _
"<title>Pride And Prejudice</title>" & _
"</book>")
Dim root As XmlNode = doc.DocumentElement
'Create a new node.
Dim elem As XmlElement = doc.CreateElement("price")
elem.InnerText = "19.95"
'Add the node to the document.
root.InsertBefore(elem, root.FirstChild)
Console.WriteLine("Display the modified XML...")
doc.Save(Console.Out)
remember make the reply as answer and vote the reply as helpful if it helps. -
How can I use XStream to persist complicated Java Object to XML & backward
Dear Sir:
I met a problem as demo in my code below when i use XTream to persist my Java Object;
How can I use XStream to persist complicated Java Object to XML & backward??
See
[1] main code
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
public class PhoneList {
ArrayList<PhoneNumber> phones;
ArrayList<Person> person;
private PhoneList myphonelist ;
private LocationTest location;
private PhoneList(String name) {
phones = new ArrayList<PhoneNumber>();
person = new ArrayList<Person>();
public ArrayList<PhoneNumber> getphones() {
return phones;
public ArrayList<Person> getperson() {
return person;
public void addPhoneNumber(PhoneNumber b1) {
this.phones.add(b1);
public void removePhoneNumber(PhoneNumber b1) {
this.phones.remove(b1);
public void addPerson(Person p1) {
this.person.add(p1);
public void removePerson(Person p1) {
this.person.remove(p1);
public void BuildList(){
location = new LocationTest();
XStream xstream = new XStream();
myphonelist = new PhoneList("PhoneList");
Person joe = new Person("Joe, Wallace");
joe.setPhone(new PhoneNumber(123, "1234-456"));
joe.setFax(new PhoneNumber(123, "9999-999"));
Person geo= new Person("George Nixson");
geo.setPhone(new PhoneNumber(925, "228-9999"));
geo.getPhone().setLocationTest(location);
myphonelist.addPerson(joe);
myphonelist.addPerson(geo);
public PhoneList(){
XStream xstream = new XStream();
BuildList();
saveStringToFile("C:\\temp\\test\\PhoneList.xml",convertToXML(myphonelist));
public void saveStringToFile(String fileName, String saveString) {
BufferedWriter bw = null;
try {
bw = new BufferedWriter(
new FileWriter(fileName));
try {
bw.write(saveString);
finally {
bw.close();
catch (IOException ex) {
ex.printStackTrace();
//return saved;
public String getStringFromFile(String fileName) {
BufferedReader br = null;
StringBuilder sb = new StringBuilder();
try {
br = new BufferedReader(
new FileReader(fileName));
try {
String s;
while ((s = br.readLine()) != null) {
// add linefeed (\n) back since stripped by readline()
sb.append(s + "\n");
finally {
br.close();
catch (Exception ex) {
ex.printStackTrace();
return sb.toString();
public String convertToXML(PhoneList phonelist) {
XStream xstream = new XStream(new DomDriver());
xstream.setMode(xstream.ID_REFERENCES) ;
return xstream.toXML(phonelist);
public static void main(String[] args) {
new PhoneList();
}[2].
import java.io.Serializable;
import javax.swing.JFrame;
public class PhoneNumber implements Serializable{
private String phone;
private String fax;
private int code;
private String number;
private String address;
private String school;
private LocationTest location;
public PhoneNumber(int i, String str) {
setCode(i);
setNumber(str);
address = "4256, Washington DC, USA";
school = "Washington State University";
public Object getPerson() {
return null;
public void setPhone(String phone) {
this.phone = phone;
public String getPhone() {
return phone;
public void setFax(String fax) {
this.fax = fax;
public String getFax() {
return fax;
public void setCode(int code) {
this.code = code;
public int getCode() {
return code;
public void setNumber(String number) {
this.number = number;
public String getNumber() {
return number;
public void setLocationTest(LocationTest bd) {
this.location = bd;
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(location);
f.getContentPane().add(location.getControls(), "Last");
f.setSize(400,400);
f.setLocation(200,200);
f.setVisible(true);
public LocationTest getLocationTest() {
return location;
}[3].
package test.temp;
import java.io.Serializable;
public class Person implements Serializable{
private String fullname;
@SuppressWarnings("unused")
private PhoneNumber phone;
@SuppressWarnings("unused")
private PhoneNumber fax;
public Person(){
public Person(String fname){
fullname=fname;
public void setPhone(PhoneNumber phoneNumber) {
phone = phoneNumber;
public void setFax(PhoneNumber phoneNumber) {
fax = phoneNumber;
public PhoneNumber getPhone() {
return phone ;
public PhoneNumber getFax() {
return fax;
public String getName() {
return fullname ;
public void setName(String name) {
this.fullname = name;
public String toString() {
return getName();
}[4]. LocationTest.java
package test.temp;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;
import javax.swing.event.*;
public class LocationTest extends JPanel implements ChangeListener
Ellipse2D.Double ball;
Line2D.Double line;
JSlider translate;
double lastTheta = 0;
public void stateChanged(ChangeEvent e)
JSlider slider = (JSlider)e.getSource();
String name = slider.getName();
int value = slider.getValue();
if(name.equals("rotation"))
tilt(Math.toRadians(value));
else if(name.equals("translate"))
moveBall(value);
repaint();
protected void paintComponent(Graphics g)
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
if(ball == null)
initGeom();
g2.setPaint(Color.green.darker());
g2.draw(line);
g2.setPaint(Color.red);
g2.fill(ball);
private void initGeom()
int w = getWidth();
int h = getHeight();
int DIA = 30;
int padFromEnd = 5;
line = new Line2D.Double(w/4, h*15/16, w*3/4, h*15/16);
double x = line.x2 - padFromEnd - DIA;
double y = line.y2 - DIA;
ball = new Ellipse2D.Double(x, y, DIA, DIA);
// update translate slider values
int max = (int)line.getP1().distance(line.getP2());
translate.setMaximum(max);
translate.setValue(max-padFromEnd);
private void tilt(double theta)
// rotate line from left end
Point2D pivot = line.getP1();
double lineLength = pivot.distance(line.getP2());
Point2D.Double p2 = new Point2D.Double();
p2.x = pivot.getX() + lineLength*Math.cos(theta);
p2.y = pivot.getY() + lineLength*Math.sin(theta);
line.setLine(pivot, p2);
// find angle from pivot to ball center relative to line
// ie, ball center -> pivot -> line end
double cx = ball.getCenterX();
double cy = ball.getCenterY();
double pivotToCenter = pivot.distance(cx, cy);
// angle of ball to horizon
double dy = cy - pivot.getY();
double dx = cx - pivot.getX();
// relative angle phi = ball_to_horizon - last line_to_horizon
double phi = Math.atan2(dy, dx) - lastTheta;
// rotate ball from pivot
double x = pivot.getX() + pivotToCenter*Math.cos(theta+phi);
double y = pivot.getY() + pivotToCenter*Math.sin(theta+phi);
ball.setFrameFromCenter(x, y, x+ball.width/2, y+ball.height/2);
lastTheta = theta; // save theta for next time
private void moveBall(int distance)
Point2D pivot = line.getP1();
// ball touches line at distance from pivot
double contactX = pivot.getX() + distance*Math.cos(lastTheta);
double contactY = pivot.getY() + distance*Math.sin(lastTheta);
// find new center location of ball
// angle lambda = lastTheta - 90 degrees (anti-clockwise)
double lambda = lastTheta - Math.PI/2;
double x = contactX + (ball.width/2)*Math.cos(lambda);
double y = contactY + (ball.height/2)*Math.sin(lambda);
ball.setFrameFromCenter(x, y, x+ball.width/2, y+ball.height/2);
JPanel getControls()
JSlider rotate = getSlider("rotation angle", "rotation", -90, 0, 0, 5, 15);
translate = getSlider("distance from end", "translate", 0, 100, 100,25, 50);
JPanel panel = new JPanel(new GridLayout(0,1));
panel.add(rotate);
panel.add(translate);
return panel;
private JSlider getSlider(String title, String name, int min, int max,
int value, int minorSpace, int majorSpace)
JSlider slider = new JSlider(JSlider.HORIZONTAL, min, max, value);
slider.setBorder(BorderFactory.createTitledBorder(title));
slider.setName(name);
slider.setPaintTicks(true);
slider.setMinorTickSpacing(minorSpace);
slider.setMajorTickSpacing(majorSpace);
slider.setPaintLabels(true);
slider.addChangeListener(this);
return slider;
}OK, My questions are:
[1]. what I generated XML by XSTream is very complicated, especially for object LocationTest, Can we make it as simple as others such as Person object??
[2]. after I run it, LocationTest will popup and a red ball in a panel will dsiplay, after I change red ball's position, I hope to persist it to xml, then when I read it back, I hope to get same picture, ie, red ball stiil in old position, How to do that??
Thanks a lot!!Positive feedback? Then please take this in a positive way: if you want to work on persisting Java objects into XML, then GUI programming is irrelevant to that goal. The 1,000 lines of code you posted there appeared to me to have a whole lot of GUI code in it. You should produce a smaller (much smaller) example of what you want to do. Calling the working code from your GUI program should come later.
-
Unable assign a BPM Object field value to a JSP Variable using "invoke"
Hi,
I'm unable to retrieve a value returned by a BPM Object Method and use it in JSP. Here is what I'm trying to achieve:
BPM object named : "myObject" has a method "getRequiredValue" which returns a "String". I want to assign the value returned by "getRequiredValue" to a JSP Variable "myVariable" using invoke method as below:
<% String myVariable = ""; %>
<f:invoke var="${myObject}" methodName="getRequiredValue" retAttName="myVariable"/>
<% out.println ("myVariable: " + myVariable); %>
When I execute the above code I don't get the value being returned by "getRequiredValue" into "myVariable".
Any help would be highly appreciated!
regards,
MK1. Make sure you mark the "Server Side Method" property of the getRequiredValue method to "Yes".
2. I guess you dont need to specify "<% String myVariable = ""; %>". Try removing it.
3. Replace "<% out.println ("myVariable: " + myVariable); %>" by <c:out value="${myVariable}"/> just in case!
4. Lastly, I hope "myObject" is the name of the instance variable in your screenflow, and not the BPM object name.
Hope this helps
-Hemant -
Calling a method in BPM Object from jsp page
hi all,
I try to call a method from BPM Object using <f:invokeUrl >
I change server side method properties to yes.
and then how can i get request and response object inside the BPM method.
Thanks.Thanks for ur response,
But i mention about BPM method inside BPM Object.
i found this inside the documentation.
methodName(Fuego.Net.HttpRequest request, Fuego.Net.HttpResponse response)
i need to match above BPM method and <f:invokeUrl > tag. am i right?
But i don't know how to create method with argument "Fuego.Net.HttpRequest request, Fuego.Net.HttpResponse response" inside BPM Object.
I can't find any place to define method argument inside Oracle BPM studio.
I don't know how to parse argument like "Fuego.Net.HttpRequest request, Fuego.Net.HttpResponse response"
With Regards,
Wai Phyo
Edited by: user8729650 on Sep 9, 2009 7:03 PM
Edited by: user8729650 on Sep 9, 2009 9:20 PM -
Calling a method in BPM Object from jsf page
Hi All,
How do I call a method in BPM object from JSF page? Is it possible to invoke it in a manner similar to invoking a method from managed bean in JSF application?
Please help.
Thanks and Regards,
VeronicaYou can use f:invoke (or f:invokea to with parameters)
For ajax calls, you can use f:invokeUrl to get the URL to a particular method within your BPM object, although make sure the Server-Side Method property is set to Yes.
http://download.oracle.com/docs/cd/E13154_01/bpm/docs65/taglib/index.html -
Dynamically create Value Objects from XML file
Hi
I want to create a value object from Xml file dynamically,like in the xml file i have the name of the variable and the datatype of the variable.is it possible do that,if so how.Read about apache's Digester tool. This is part of the Jakartha project. This tool helps in creating java objects from the XML files. I am not sure, if that is what u r looking for.
Maybe you are looking for
-
In safari when I click on something, it opens up an ad in new tab
I have an iMac, 2013 model. operating on OS X 10.9.4 and whenever I click on just about everything in safari it opens a new tab with an ad on it. sometimes the ads are mackeeper or video hosting sites but they are just so annoying! I'm wondering weat
-
Hi all. SRM 4.0, backend ECC 6.0. Extended classic scenario. I need information from other wise men, thus I turn to this forum. I have several situations where my SC is created in 1 currency, but on PO creation the PO is switched to another currency,
-
Which Camera Raw functions are in Photoshop Elements?
At times I'll suggest something to do in ACR in conversations with other photographers. Sometimes I get a response that they can't find what I referred to in ACR. Usually turns out they are using Elements (PSE), which has a subset of ACR function.
-
Not getting sound AT ALL in iTunes 7 on WINDOWS
Contrary to what it says in the model/OS fields, I also own a PC desktop machine running Windows XP Pro SP2. It is my desktop machine and thus has a much better speaker system than my MacBook, and I don't have to unplug a million things when I take m
-
SRM 7.0 Copy customer data in follow on documents
Dear Gurus, I have same set of field extension in shopping cart and RFx. When I create an RFx from an SC, I want that the data filled in the custom fields in SC be copied to corresponding fields in RFx. How can i achieve this? Do i need to activate a