Retrieving choice vlues from xsd - collections

here is the part of xsd-scheme:
<xsd:complexType name="TGroups">
<xsd:choice>
<xsd:element name="GROUP1"/>
<xsd:element name="GROUP2"/>
</xsd:choice>
</xsd:complexType>
Is there any way to get all TGroups values ("GROUP1", "GROUP2") from xsd as collection (Set, List, String[], ...) using JAXB or something else?
Thank you for reply.

Related

How to retrieve Itinerary remarks with GetReservationsRQ Api?

Running the command I¥ command returns:
2 AA1579X 16SEP 5 DFWORD HF1 0625 0846 /DCBA*SDAZXT /E
I have successfully sent a request using GetReservationRQ. Asking for the remarks sections but I am getting the result above which I would expect. (I assumed this is the right section and have tried Itinerary too, see below)
<GetReservationRQ version="1.1.0" xmlns="http://services.sabre.com/sp/updatereservation/v1_1">
<Profile>
<UniqueID id="......."/>
</Profile>
<SubjectAreas>
<SubjectArea>REMARKS</SubjectArea>
</SubjectAreas>
<ReturnOptions>
<ViewName>Default</ViewName>
<ResponseFormat>STL</ResponseFormat>
</ReturnOptions>
</GetReservationRQ>
Which returns 2 remarks as part of the response:
<Remarks>
<Remark id="44" index="1" type="HS">
<RemarkLines>
<RemarkLine>
<Text>POSSIBLE DUPE BOOKING. SEE PNR JZXWEI JBVFYC HUSTLM</Text>
</RemarkLine>
</RemarkLines>
</Remark>
<Remark id="45" index="2" type="HS">
<RemarkLines>
<RemarkLine>
<Text>POSSIBLE DUPE BOOKING. SEE PNR KDCFKD KQLLXF</Text>
</RemarkLine>
</RemarkLines>
</Remark>
</Remarks>
However as you can see they are not the same remark as when I run the command I¥. What am I doing wrong?
Here are links to the sabre documentation:
https://developer.sabre.com/docs/soap_apis/management/itinerary/Retrieve_Itinerary/help_doc?page=get-reservation-request-and-response-structure
Which says:
REMARKS Allows to display remark information (supported types: REG, HD, HS, CLIADR, DELADR, INVOICE, ITINERARY, INTERFACE, CODED_A, PRTONTKT, CORPORATE, FOP, QQ, FILLER, ITINSEGASSOC)

Get elements value by xquery on extended xsd

I have this canonical structure:
<xsd:complexType name="Document">
<xsd:attribute name="ID" use="optional" type="cdpscm:IDDocument"/>
</xsd:complexType>
<xsd:element name="NationalID" type="cdpscm:NationalID"/>
<xsd:complexType name="NationalID">
<xsd:complexContent>
<xsd:extension base="cdpscm:Document">
<xsd:sequence>
<xsd:element name="Number"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="Passaport" type="cdpscm:Passaport"/>
<xsd:complexType name="Passaport">
<xsd:complexContent>
<xsd:extension base="cdpscm:Document">
<xsd:sequence>
<xsd:element name="Number"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
Who calls my OSB service will cast if the document is a Passaport or a NationalID, but how I get the number value to pass to another service, for example, if I only have the Document element type which doesn't has the number element.
This is the supossed input:
<v24:Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="v2:TouristPerson" ID="5772893">
<v2:Documents>
<v2:Document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="v2:Passport">
<v2:Number>03070</v2:Number>
</v2:Document>
</v2:Documents>
</v24:Person>
The real structure is more complex than this, so probably will need to know if I'm working with NationalID or Passaport, a Tourist or a Native Person.
Using Oracle 11g, Eclipse OEPE.
Thanks for the help!
Something like this should work.
declare namespace xsi = "http://www.w3.org/2001/XMLSchema-instance";
let $documents := $body//v24:Person/v2:Documents/v2:Document
for $passport in $documents[#xsi:type="v2:Passport"]
return data($passport/v2:Number)
(: similarly for national IDs :)

How to resolve this error - Uncaught Error: '2016-' is not a correct date, datetime nor time

I got the following part of code from Odoo community reference website for creating birthday calendar mark ups
.PY file
class birthday_report(osv.osv):
_name = "birthday.report"
_auto = False
_columns = {
'name': fields.many2one('hr.employee','Employee', readonly=True),
'dob' : fields.date('Birthday', readonly=True),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'birthday_report')
cr.execute("""
create or replace view birthday_report as (
select
h.id as id,
h.id as name,
concat(concat(date_part('Year',current_date),'-'),to_char(h.birthday, 'mm-dd')) as dob
from
hr_employee as h
join
resource_resource as r
on
h.resource_id=r.id
where r.active ='t'
)
""")
birthday_report()
.XML file
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_birthday_report_calendar" model="ir.ui.view">
<field name="name">Employee Birthday</field>
<field name="model">birthday.report</field>
<field name="arch" type="xml">
<calendar string="Birthday" color="name"
date_start="dob"
quick_add="False" avatar_model="hr.employee">
<field name="name"/>
</calendar>
</field>
</record>
<record model="ir.actions.act_window" id="action_birthday_view">
<field name="name">Birthday</field>
<field name="res_model">birthday.report</field>
<field name="view_type">form</field>
<field name="view_mode">calendar</field>
<field name="view_id" eval="view_birthday_report_calendar"/>
<field name="domain">[]</field>
</record>
<menuitem id="menu_birthday" name="Birthday" parent="hr.menu_hr_root" groups="base.group_user"/>
<menuitem id="menu_view_birthday" parent="menu_birthday" action="action_birthday_view" groups="base.group_user"/>
</data>
</openerp>
Error shows up when I navigate to January or previous year December, the following error occurs :
Uncaught Error: '2016-' is not a correct date, datetime nor time.
I am new to sql queries in Odoo, Anyone with suggestions on this would be really grateful. Thanks !!
First, I recommend using || instead of concat. That allows you to do multiple concatenations.
date_part('Year',current_date) || '-' || to_char(h.birthday, 'mm-dd')
Secondly I recommend casting to date, so
(date_part('Year',current_date) || '-' || to_char(h.birthday, 'mm-dd'))::date
Third, what happens if you just use psql and select from the view? Are there malformed dates? Or is something else happening elsewhere in your Python code?

The adapter "WCF-OracleDB" raised an error message.Unexpected start node with namespace "" found

I am facing this issue since couple of days.
My requirement is to execute a stored procedure and if data found run the orchestration every 10-15 min.
for that i using polling approach with Oracle.
I have below stored procedure,
create or replace procedure BTS_RAD_PollManageStateDOCAMD( p_rc out sys_refcursor) is
begin
for rec in (
SELECT * FROM RAD_BTS_MANAGE_DOCAMS
WHERE MESSAGE_STATE='CREATED')
loop
dbms_output.put_line(
rec.CORRELATION_ID || ',' || rec.MESSAGE_KEY || ',' ||rec.MESSAGE_FILENAME || ',' ||rec.MESSAGE_ROOTNODE
||',' ||rec.MESSAGE_ELIMINATEDFLAG || ',' ||rec.MESSAGE_CONTENT || ',' ||rec.MESSAGE_STATE );
end loop;
end;
I have genarated the below schemas via consume adapter services method.
I got three schemas
OracleDBBindingGenericOperation.xsd
OracleDBBindingRADAR.PollingProcedure.xsd
OracleDBBindingRADAR.Procedure.xsd
in that i am using the
OracleDBBindingRADAR.PollingProcedure.xsd as my message in orch.
<?xml version="1.0" encoding="utf-16" ?>
- <xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:ns3="http://Microsoft.LobServices.OracleDB/2007/03" elementFormDefault="qualified" targetNamespace="http://Microsoft.LobServices.OracleDB/2007/03/RADAR/PollingProcedure" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import schemaLocation=".\OracleDBBindingGenericOperation.xsd" namespace="http://Microsoft.LobServices.OracleDB/2007/03" />
- <xs:annotation>
- <xs:appinfo>
<fileNameHint xmlns="http://schemas.microsoft.com/servicemodel/adapters/metadata/xsd">RADAR.PollingProcedure</fileNameHint>
- <references xmlns="http://schemas.microsoft.com/BizTalk/2003">
<reference targetNamespace="http://Microsoft.LobServices.OracleDB/2007/03" />
</references>
</xs:appinfo>
</xs:annotation>
- <xs:element name="BTS_RAD_POLLMANAGESTATEDOCAMD">
- <xs:annotation>
- <xs:documentation>
<doc:action xmlns:doc="http://schemas.microsoft.com/servicemodel/adapters/metadata/documentation">http://Microsoft.LobServices.OracleDB/2007/03/RADAR/PollingProcedure/BTS_RAD_POLLMANAGESTATEDOCAMD</doc:action>
</xs:documentation>
</xs:annotation>
- <xs:complexType>
- <xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="P_RC" nillable="true" type="ns3:ArrayOfGenRecordRow" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
now at adminstration level i have made below config setting at receive location, please help where i am doing wrong.
Trasport Type : WCF-OracleDB
EnableBiztalkcompatibilityMode : True
PollDataAvilableStatment : SELECT count(*) FROM RAD_BTS_MANAGE_DOCAMS WHERE MESSAGE_STATE='CREATED'
Polling Action : http://Microsoft.LobServices.OracleDB/2007/03/RADAR/PollingProcedure/BTS_RAD_POLLMANAGESTATEDOCAMD
polling Statement :
use ambient Transaction : False
I doubt there is someprob with polling Statement .
Could you some one suggest, in my SP its not in out Courser, its just out. How should i write or let me know where it might be going wrong.
Error I am getting:
The adapter "WCF-OracleDB" raised an error message.
Details "Microsoft.ServiceModel.Channels.Common.XmlReaderParsingException: Unexpected start node "BTS_RAD_POLLMANAGESTATEDOCAMD" with namespace "http://Microsoft.LobServices.OracleDB/2007/03/RADAR/PollingProcedure/BTS_RAD_POLLMANAGESTATEDOCAMD" found.
at Microsoft.ServiceModel.Channels.Common.Design.AdapterAsyncResult.End()
at Microsoft.ServiceModel.Channels.Common.Channels.AdapterInputChannel.EndTryReceive(IAsyncResult result, Message& message)
at System.ServiceModel.Dispatcher.InputChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext& requestContext)".
You should import the binding file generated by the Wizard.
The Assembly with the Schema has to be Deployed.
Finally i could sort out the ans,
I have done some of the mistakes which i corrected,
Trasport Type : WCF-OracleDB
EnableBiztalkcompatibilityMode : True
PollDataAvilableStatment : SELECT count(*) FROM RAD_BTS_MANAGE_DOCAMS WHERE MESSAGE_STATE='CREATED' Polling Action : http://Microsoft.LobServices.OracleDB/2007/03/RADAR/PollingProcedure/BTS_RAD_POLLMANAGESTATEDOCAMD polling Statement :
<ns0:BTS_RAD_POLLMANAGESTATEDOCAMD xmlns:ns0="http://Microsoft.LobServices.OracleDB/2007/03/RADAR/Procedure">
<ns0:P_RC_IN>OPEN ? FOR SELECT * FROM RAD_BTS_MANAGE_DOCAMS WHERE MESSAGE_STATE='CREATED';</ns0:P_RC_IN>
</ns0:BTS_RAD_POLLMANAGESTATEDOCAMD>
use ambient Transaction : False
my mistake was i was calling url of polling action in Polling statement at xmlns. Where here the URL is suppose to be from of different Schema.
the other mistake is in my statement i didnt include ;.

Spring Webflow - How to Get List of FLOW IDs

What is the best way to get the full list of FLOW IDs generated by Spring Webflow?
Here is my configuration:
<webflow:flow-registry id="flowRegistry"
flow-builder-services="flowBuilderServices"
base-path="/WEB-INF/pageFlows">
<webflow:flow-location-pattern value="/**/*-flow.xml"/>
</webflow:flow-registry>
[UPDATE 1] I should clarify that I want to do this in Java code, not by inspecting my configuration.
[UPDATE 2] answer: requestContext.getActiveFlow().getApplicationContext()
List of flow ids can be identified by the way they are defined in flow-registry. By default, flows will be assigned registry identifiers equal to their filenames minus the file extension, unless a registry base path is defined.
Let me explain this with examples:
Scenario 1:
flow-location and base-path is not specified:
<webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices">
<webflow:flow-location path="/WEB-INF/pageFlows/example.xml" />
</webflow:flow-registry>
Flow id: example
Scenario 2:
flow-location-pattern and base-path is not specified :
<webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices">
<webflow:flow-location-pattern value="/WEB-INF/pageFlows/**/*-flow.xml"/>
</webflow:flow-registry>
If you have flows like /WEB-INF/pageFlows/example1-flow.xml, /WEB-INF/pageFlows/example2-flow.xml, flow ids are: example1-flow, example2-flow respectively.
Scenario 3:
Your own id is specified:
<webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices">
<webflow:flow-location path="/WEB-INF/pageFlows/example.xml" id="myExampleId" />
</webflow:flow-registry>
Flow id: myExampleId
Scenario 4:
base-path is specified:
<webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF">
<webflow:flow-location path="/pageFlows/example.xml" />
</webflow:flow-registry>
Flows will now be assigned registry identifiers equal to the the path segment between their base path and file name.
Flow id: pageFlows
Scenario 5:
flow-location-pattern and base-path is specified:
<webflow:flow-registry id="flowRegistry" base-path="/WEB-INF">
<webflow:flow-location-pattern value="/**/*-flow.xml" />
</webflow:flow-registry>
Flows will now be assigned registry identifiers equal to the the path segment between their base path and file name.
So if you have flows located in /pageFlows1/example1, /pageFlows2/example2 directories within WEB-INF, flow ids are: pageFlows1, pageFlows2 respectively.
EDIT :
To get flow ids programmatically:
Assuming your flow controller and flowexecutor definitions as below in webflow-config xml file:
<bean name="flowController" class="org.springframework.webflow.executor.mvc.FlowController">
<property name="flowExecutor" ref="flowExecutor" />
</bean>
//flowRegistry is alredy mentioned in your question
<flow:executor id="flowExecutor" registry-ref="flowRegistry">
<flow:repository type="continuation" max-conversations="1" max-continuations="30" />
</flow:executor>
You can retrieve flow definition ids registered as below:
(I am calling this from a Controller which extends AbstractController, thats why you see getServletContext() method)
ApplicationContext context =
(ApplicationContext)getServletContext().getAttribute(
DispatcherServlet.SERVLET_CONTEXT_PREFIX + "yourWebContextName");
FlowController controller = (FlowController)context.getBean("flowController");
FlowExecutorImpl flowExecutorImpl = (FlowExecutorImpl)controller.getFlowExecutor();
FlowDefinitionRegistryImpl flowDefinitionRegistryImpl = (FlowDefinitionRegistryImpl)flowExecutorImpl.getDefinitionLocator();
//Assuming you have log configured
log.info("Registered Flow Ids are:"+flowDefinitionRegistryImpl.getFlowDefinitionIds());
FlowController has access to FlowExecutor(initial point of entry for webflow). FlowExecutor has access to flowDefinitionRegistry where all flows are registered before being served to requests.
Hope this helps.

Resources