How to Delete resources using Transaction - hl7-fhir

I would like to delete multiple resources by using a transaction, but I can't find any example nor information how resources should be marked in the bundle for delete.
Thank you.

This is done by adding a <deleted-entry> Atom entry to the transaction Bundle, much like it's done when returning a Resource's history (which can contain deletions as well).
You can find information about it here: http://www.hl7.org/implement/standards/fhir/xml.html#atom-deleted. It's actually a pretty recent addition to the Atom specification (see http://www.rfc-base.org/rfc-6721.html for more information).
The Java reference implementation has a setDeleted() on AtomEntry to make that work.

Thank you for your answer.
I've managed to delete my posted Composition resource by using such code:
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Delete in Transaction</title>
<id>1181060367157445874</id>
<updated>2014-04-28T15:48:16.863+03:00</updated>
<deleted-entry xmlns="http://purl.org/atompub/tombstones/1.0" ref="http://spark.furore.com/fhir/Composition/19843313"/>
</feed>
`

Related

Dynamic File Outbound Gateway based on header

I'd like to archive files that come in on a directory based on \name\date structure - so even every day the directory will change. Any suggestions appreciate.
I'm was on track to create a file outbound-gateway where the directory is dynamic, where the header is enriched with a method that generates the path of the directory.
I was thinking of something like this
<file:outbound-gateway id="archive" request-channel="input"
reply-channel="channel" directory="#Header[archiveLocation]}"
mode="REPLACE" delete-source-files="true">
</file:outbound-gateway>
But it doesn't seem to be the way to do it.
Based on previous related answers, I'm familiar with the samples at
https://github.com/spring-projects/spring-integration-samples/blob/master/advanced/dynamic-ftp/src/main/resources/META-INF/spring/integration/dynamic-ftp-outbound-adapter-context.xml
My concern of doing it this way is, would there be any resource issues if I need to create tens, or hundreds of different outbound-gateway?
Since I can put the data in the header, is there an easier way to do it. Or is the directory field set at context initialization, and cannot be dynamic?
Thanks
After finally creating an account on Stack Overflow all these years to post a question, found the answer later. I can use directory-expression.
<file:outbound-gateway id="archive" request-channel="input"
reply-channel="channel" directory-expression="headers.archiveLocation"
mode="REPLACE" delete-source-files="true">
</file:outbound-gateway>

Validate format and content of XSD file

I searched under and over for this, but I think I am not using the correct words for my query.
I need to validate the format and content of an XML Schema (xsd) file. I also need to do this by command line. To give more guidance, I would like something like the Eclipse schema editor as an example (but by command line).
Let's say I have this schema:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.org/ExampleXMLSchema"
xmlns:tns="http://www.example.org/ExampleXMLSchema"
xmlns:external="http://www.example.org/ExternalXMLSchema"
elementFormDefault="unqualified">
<import schemaLocation="ExternalXMLSchema.xsd"
namespace="http://www.example.org/ExternalXMLSchema">
</import>
<complexType name="ExampleComplexType">
<sequence>
<element name="ExternalElement"
type="external:ExternalComplexType"></element>
</sequence>
</complexType>
</schema>
I want a tool that validate the format (no missing brackets, no missing end tags, etc), but also make sure that external references are correct. In this example, it would fail if the validator could not find the ExternalXMLSchema.xsd file and its types.
The eclipse editor gives this error for this situation:
src-resolve: Cannot resolve the name 'external:ExternalComplexType' to a(n) 'type definition' component.
Thanks for taking a look at this! Sorry if something is not clear, first post here, trying my best.
Any schema validator will have the schema for schema documents built in, so any schema validator should be in a position to validate a schema document.
Checking for bad external references goes beyond checking the schema-validity of the schema document; with some validators I have used, the validator checks external references if you ask it to validate a schema document; with others, it doesn't.
So in general the most reliable way of getting a validator to check a schema document is to attempt to use it to validate an XML instance. I find it convenient to have an instance with a well understood validity error. If the validator issues an error message concerning that problem in the XML instance, the schema is OK; if the validator issues no error messages at all, it's not building the schema or something else is wrong. If it issues a list of complaints about problems in the schema, well, that's what you were looking for, wasn't it?
Among schema validators which can be invoked from the command line are Xerces-J, Xerces-C, Saxon, msv, and libxml (but n.b. libxml's support for XSD is incomplete).

Sitecore Overriding Content Tree

Can't seem to to find this posted online anywhere - excuse me if it is!
I am looking for an event/pipeline that one can override for the main content tree in the CMS. I need to hide/disable items in the tree according to user roles so they will not be able to select or view them.
Thanks!
Dan
You should be using access rights for it. It would fit your needs.
You basically need to select the item you need to limit access, then got to the Security>Assign.
Break inheritance to Everyone, then set Allow Read for a specifc role you want to allow. That will hide the items in the tree for the users which are not in the specified role.
Yes, there are situations where access filtering might not be a very good solution, so you should probably go with a custom DataView instead. Override the default Sitecore.Web.UI.HtmlControls.MasterDataView class and override the GetChildItems like this:
protected override void GetChildItems (ItemCollection children, Item parent)
{
base.GetChildItems(children, parent);
YourFilteringMethod(children); // Let this method remove unwanted items
}
Then replace the master data view in your sitecore config file, such as using a patch file like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:x="http://www.sitecore.net/xmlconfig/">
<sitecore>
<dataviews>
<dataview name="Master">
<patch:attribute name="assembly">YourAssembly</patch:attribute>
<patch:attribute name="type">YourNamespace.MasterDataView</patch:attribute>
</dataview>
</dataviews>
</sitecore>
</configuration>
Here's a post about it where it's being used for language filtering (it goes a bit further as well), but you can implement it for doing access filtering that suits your needs instead:
http://mikael.com/2014/10/sitecore-dataviews/
/ Mikael

Examining Magento's final XML structure

Anyway to examine the final XML structure magento comes up with after parsing & combining all the different XML files?
There is nothing of that sort which turned up on searching on the internet and I think for someone like me, magento layouts were a bit too much in the beginning & I would try to do everything on the code side.
Another thing which will help in picking up the name of different nodes that we can use, right away from the final XML structure.
Never ran into this but I believe we will have a better picture of what's overriding what.
The following will get you the merged configuration from app/etc/*.xml, app/etc/modules/*.xml, as well as each (active) module's config.xml file; when retrieving the config though there is no indication of what was overwritten, as the merges happen as each config file is being parsed:
Mage::getConfig()->getNode()->asNiceXml(); // or asXML() | asArray() | etc.
However, you seem to be asking about how the application makes use of this information. This is a function of application design.
Also, you mention "all of the different XML files." It's worth noting that these are not maintained in one massive object instance. For example, layout XML is accessed using the layout update object Mage_Core_Model_Layout_Update and can be accessed meaningfully after it's been loaded and manipulated for a given rendering scope (e.g. loadLayout() in a controller action):
Mage::app()->getLayout()->getUpdate()->asString(); // or asSimplexml() or asArray()
Yes - Commercebug. As well as a whole load of other useful features, you can also view the entire XML structure that Magento has produced.
http://store.pulsestorm.net/products/commerce-bug-2
I believe the following will output the XML: echo Mage::getConfig()->getXmlString();
You can create a script with something like this:
header("Content-Type:text/xml");
require_once '../app/Mage.php';
Mage::app();
echo Mage::getConfig()->getXmlString();
based on answer from benmarks I did
echo "<pre>".htmlspecialchars(Mage::getConfig()->getNode()->asNiceXml())."</pre>";
If you want for example to see the blocks configuration in Magento 1 you can put this in a file, place the file at the root of the site and navigate to it in a browser:
<?php
include("app/Mage.php");
Mage::app();
//just see blocks...
echo "<pre>".htmlspecialchars(Mage::getConfig()->getNode()->global->blocks->asNiceXml())."</pre>";
die();

How to detect "for internal use only" entities from Dynamics CRM metadata

I am trying to read (FetchXml) the content of all the readable attributes of all the entities based on the list I get using the metadata webservice.
This works fine except for 3 entities ("resourcegroupexpansion", "workflowwaitsubscription" and "interprocesslock") for which I systematically get the following error:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Server was unable to process request.</faultstring>
<detail>
<error>
<code>0x80040216</code>
<description>An unexpected error occurred.</description>
<type>Platform</type>
</error>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
According to this http://msdn.microsoft.com/en-us/library/gg328086.aspx those 3 entities are for internal use only which might explain why I get an error (having said that I’m able to read other “internal use only” entities).
So my question is this: how can I detect from the metadata which entities are “for internal use only” and which are not ?
Of course, I could hard-code the list of entities based on the documentation but I don’t find it very satisfying.
Unfortunately there is No flag to identify the "for Internal use only" entities.
But one thing I noticed from XrmToolbox Metadata browser - the description column of entity is having "for Internal use only" text for ~15 entities.
We can leverage the same by identifying & updating this field with unique values for internal system entities (thru some unsupported way like export solution, modify & reimport). Then description field text can be used to filter out these internal entities.
I never tried this. Will try & update my answer soon.

Resources