How to retrieve Itinerary remarks with GetReservationsRQ Api? - sabre

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)

Related

Gracenote eyeQ GNIDs changed over time

On August 6th, I made a TVGRID_LOOKUP request with the gracenote eyeQ API.
The response returned an Episode of "The Big Bang Theory - The Zazzy Substitution" (airing-time 21:45).
The TVPROGRAM GNID was 442470733-5294AFF66A2B66D6CF9368BCE777839F.
Today I made the same request and got a different GNID (445129959-C521A678BE53213977744678C90B202C).
What happend? I thought GNIDs are unique?
Just in case, here's my request:
<?xml version="1.0"?>
<QUERIES>
<AUTH>
<CLIENT>__CLIENT_ID__</CLIENT>
<USER>__USER_ID__</USER>
</AUTH>
<QUERY CMD="TVGRID_LOOKUP">
<TVCHANNEL>
<GN_ID>251533333-26F45A038CFBD8323F70D3944EB16008</GN_ID>
</TVCHANNEL>
<DATE TYPE="START">2014-08-11T20:00</DATE>
<DATE TYPE="END">2014-08-11T20:10</DATE>
</QUERY>
</QUERIES>
TVPROGRAM's are unique within the TVGRID, but are not guaranteed to be consistent from day to day. However, if you do a follow up query, you can get a unique GN_ID of the AV_WORK that represents the show/episode. For example:
<QUERIES>
<AUTH>
<CLIENT>_your_client_id_</CLIENT>
<USER>_your_user_id_</USER>
</AUTH>
<LANG>eng</LANG>
<COUNTRY>usa</COUNTRY>
<QUERY CMD="TVPROGRAM_FETCH">
<GN_ID>445129959-C521A678BE53213977744678C90B202C</GN_ID>
</QUERY>
</QUERIES>
Returns:
...
<AV_WORK>
<GN_ID>240234711-A3BEDE6BF00D48B35FAE5F0E66305B30</GN_ID>
</AV_WORK>
...
This AV_WORK GN_ID will be the same between the different TVPROGRAM GN_IDs you received.

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.

How to make dexterity modifications available to other clients?

The modified model_source of a dexterity type is not available for other clients until the other client restarts.
Invalidating or clearing the SCHEMA_CACHE is not a working solution: every client seems to have its own SCHEMA_CACHE which afik cannot be cleared or invalidated from another client.
Is there any solution to solve this problem?
The scenario presented here uses ipython as second client. The same can be reproduced through the web by starting two clients: (1) create a dexterity type in client1, and (2) edit the XML Field Model in client2.
I'd like to put this as an issue on https://github.com/plone/plone.dexterity but as for today issues seem not to be available in the plone.dexterity github project
utils.sync()
from Products.CMFCore.utils import getToolByName
from plone.dexterity.fti import DexterityFTI
id = 'mydexteritytype'
plone_site = app.Plone
tool_portal_types = getToolByName(plone_site, 'portal_types')
if tool_portal_types.hasObject(id): tool_portal_types.manage_delObjects(id)
utils.commit()
utils.sync()
fti = DexterityFTI(id)
fti.id = id
data = {}
data['title'] = id
data['i18n_domain'] = 'plone'
data['behaviors'] = "\n".join([
'plone.app.dexterity.behaviors.metadata.IDublinCore',
'plone.app.content.interfaces.INameFromTitle',
])
data['model_source'] = '''
<model xmlns:security="http://namespaces.plone.org/supermodel/security"
xmlns:marshal="http://namespaces.plone.org/supermodel/marshal"
xmlns:form="http://namespaces.plone.org/supermodel/form"
xmlns="http://namespaces.plone.org/supermodel/schema">
<schema>
<field name="original" type="zope.schema.TextLine">
<default>original</default>
<description/>
<title>original</title>
</field>
</schema>
</model>'''
data['klass'] = 'plone.dexterity.content.Container'
data['filter_content_types'] = True
data['icon_expr'] = 'string:${portal_url}/document_icon.png'
fti.manage_changeProperties(**data)
tool_portal_types._setObject(fti.id, fti)
utils.commit()
After running the code above, the new created mydexteritytype is available for all other clients.
The modifications produced by the following code will be only available in the client running the code. All other clients are not aware of the changes.
utils.sync()
from plone.dexterity.interfaces import IDexterityFTI
from zope.component import getUtility
fti = getUtility(IDexterityFTI, name=id)
model_source = '''
<model xmlns:security="http://namespaces.plone.org/supermodel/security"
xmlns:marshal="http://namespaces.plone.org/supermodel/marshal"
xmlns:form="http://namespaces.plone.org/supermodel/form"
xmlns="http://namespaces.plone.org/supermodel/schema">
<schema>
<field name="modified" type="zope.schema.TextLine">
<default>modified</default>
<description/>
<title>modified</title>
</field>
</schema>
</model>'''
fti.manage_changeProperties(model_source=model_source)
from plone.dexterity.schema import SCHEMA_CACHE
SCHEMA_CACHE.invalidate(fti)
SCHEMA_CACHE.clear()
utils.commit()
This pull-request is supposed to fix this issue:
https://github.com/plone/plone.dexterity/pull/137

"XMLCommand.initialize failed: java.lang.NullPointerException" when using dataset-proxy in a workflow databroker

I'm creating a workflow databroker, and in the pre-workflow I am using a dataset-proxy to iterate over the populate-dataset. However I get the following error when I compile:
XMLCommand.initialize failed: java.lang.NullPointerException
at nz.co.aviarc.xml.command.dataset.DatasetProxy.initialize(DatasetProxy.java:35)
at com.aviarc.framework.xml.command.XMLCommandElementImpl.finalize(XMLCommandElementImpl.java:90)
at com.aviarc.framework.xml.compilation.XMLSAXHandler.endElement(XMLSAXHandler.java:336)
at net.sf.saxon.event.ContentHandlerProxy.endElement(ContentHandlerProxy.java:391)
at net.sf.saxon.event.NamespaceReducer.endElement(NamespaceReducer.java:213)
at net.sf.saxon.event.ReceivingContentHandler.endElement(ReceivingContentHandler.java:443)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:598)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:673)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1645)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:875)
at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:798)
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1198)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:564)
at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:404)
at net.sf.saxon.event.Sender.send(Sender.java:193)
at net.sf.saxon.IdentityTransformer.transform(IdentityTransformer.java:30)
at com.aviarc.framework.xml.compilation.AviarcXMLResourceCompiler.compile(AviarcXMLResourceCompiler.java:137)
...
I get exactly the same error even when I use the code example straight out of the documentation (com.aviarc.dataset:1.1.0):
<workflow xmlns:ds="urn:aviarc:xmlcommand:com.aviarc.dataset">
<ds:dataset-proxy dataset="ds" proxyname="dsproxy">
<set-current-row dataset="dsproxy" position="2" />
<set-field field="dsproxy.email" value="test#test.com" />
</ds:dataset-proxy>
</workflow>
Turns out that the documentation is wrong, as proxyname is not a valid attribute on dataset-proxy. I didn't see it at first (because of the huge stack trace) but I was also getting this warning:
Unknown attribute 'proxyname'
The correct attribute is name, not proxyname. Changing this resolved the error.

Generating XML dynamically from the data entered on UI

I have a xml file which is currently made manually and I have to make a functionality(UI) where user can enter the data and I have to store the data and generate the xml file dynamically in .NET.
Problem is the format of the xml file. I am not able to decide how I am going to store that data and then dynamically generate xml from that.
Please find the some of the extract of the code from the xml file below:
<?xml version="1.0" encoding="UTF-8"?>
<DATA>
<SDACTS>
<SDACT TYPE="Economy" COLOUR="0xff0000"/>
<SDACT TYPE="Environment" COLOUR="0x00ff00"/>
<SDACT TYPE="People" COLOUR="0x0000ff"/>
<SDACT TYPE="Society" COLOUR="0xff00ff"/>
</SDACTS>
<INDUSTRIES>
<INDUSTRY TYPE="Platinum" COLOUR="0x0094B1">
<PRODUCT>Platinum</PRODUCT>
<PRODUCT>Palladium</PRODUCT>
<PRODUCT>Rhodium</PRODUCT>
<PRODUCT>Gold</PRODUCT>
</INDUSTRY>
<INDUSTRY TYPE="Diamonds" COLOUR="0x652382">
<PRODUCT>Diamonds</PRODUCT>
</INDUSTRY>
<INDUSTRY TYPE="Metallurgical Coal" COLOUR="0x999a8f">
<PRODUCT>Metallurgical Coal</PRODUCT>
</INDUSTRY>
</INDUSTRIES>
<LOCATIONS>
<CONTINENT TITLE="South America">
<COUNTRY TITLE="Brazil">
<HEADOFFICE>So Paulo</HEADOFFICE>
<ADDRESS>
Sau, polo, ambikaui
</ADDRESS>
<LATITUDE>-23.571157</LATITUDE>
<LONGITUDE>-46.644146</LONGITUDE>
<BUSINESSUNITS>Nickel; Iron ore and manganese</BUSINESSUNITS>
<DESCRIPTION>Anglo American has been operating in Brazil since 1973. Our core operations are involved in the production of nickel, iron ore and maganese, while our interests in the production of phosphates and niobium at Copebras and Catalo respectively have been identified for divestment. Nickel projects in the pipeline include Barro Alto.</DESCRIPTION>
<EMPLOYEES/>
<NUMBEROFBUSINESS>2</NUMBEROFBUSINESS>
<!--New project added - 12/02/2010 start -->
<PROJECT>
<TYPE>Greenfield</TYPE>
<NAME>Minas Rio expansion</NAME>
<UNITTYPE>Iron Ore and Manganese</UNITTYPE>
<RELATEDOPERATION>Greenfield</RELATEDOPERATION>
<LATITUDE>-18.92814</LATITUDE>
<LONGITUDE>-43.42562</LONGITUDE>
<STATUS>Future unapproved</STATUS>
<DESCRIPTION/>
<FULLPRODUCTIONDATE>TBD</FULLPRODUCTIONDATE>
<PRODUCTIONVOLUME>Up to 53 Mtpa iron ore pellet feed (wet basis)</PRODUCTIONVOLUME>
<!-- <ESTIMATEDCAPEX>TBD</ESTIMATEDCAPEX>-->
<FOOTNOTES>
<![CDATA[1. Capital expenditure shown on 100% basis in nominal terms. Platinum projects reflect approved capex.<br><br>2. Production volume represents 100% of average incremental or replacement production, at full production, unless otherwise stated.]]>
</FOOTNOTES>
</PROJECT>
<SDACTIVITY>
<ID>3.2.4.20</ID>
<TYPE>Society</TYPE>
<BUSINESS>Nickel</BUSINESS>
<RELATEDOPERATION/>
<HEADING>Listening - and acting - in Brazil</HEADING>
<SUBHEADING>SEAT community engagement session in Brazil</SUBHEADING>
<COPY>
local government.
</COPY>
<IMAGE>3.2.4.20.jpg</IMAGE>
<LINKCAPTION>Read more about SEAT in Brazil</LINKCAPTION>
<LINKURL>http://www.angloamerican.co.uk/aa/development/case-studies/society/society01/</LINKURL>
</SDACTIVITY>
</COUNTRY>
</CONTINENT>
</LOCATIONS>
</DATA>
You could just store it directly in the DOM, and serialise when desired.
If I were you I would just store the data in a db and then use an xmltexwriter to write it to where ever.
using (XmlTextWriter writer = new XmlTextWriter(OutputStream, Encoding.UTF8)) {
writer.Formatting = Formatting.Indented;
writer.WriteStartDocument();
writer.WriteStartElement("DATA");
writer.WriteStartElement("SDACTS");
foreach ( SDACT in SDACTs) {
writer.WriteStartElement("SDACT");
writer.WriteAttributeString("TYPE", SDACT.Type);
writer.WriteAttributeString("COLOUR", SDACT.COLOUR);
writer.WriteEndElement();
}
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteEndDocument();
}
You could also take advantage of using .nets XML serialization see http://msdn.microsoft.com/en-us/library/ms950721.aspx

Resources