Integrating with Hansen (Update)

There's a newer Hansen bundle available, com.cohga.weave.hansen version 5, that contains a major update to the way the integration is configured.

com.cohga.weave.hansen_5.0.1.jar - Updated Hansen integration bundle

The new bundle supports the same functionality as the older versions, along with some new functionality, but the configuration must be changed to use the newer version.

Previously the configuration for Hansen used the viewer items to configure the link between the viewer types in Hansen and entity types in Weave, but now the viewer items only configure the link between Weave and Hansen when using the Send to Hansen button in Weave.

When sending from Hansen to Weave a new mapping item is defined, for the generic Hansen display option, along with some specific mapping types, for creating groups, updating work orders and creating project groups (the last two are new functions that have been added in this update).

The Hansen configuration in Weave is now made up of multiple parts:

  • viewer and url
    • Creates a link between Weave entity types and the viewer type to be displayed in Hansen using the provided url.
  • mapping
    • Created a link between Hansen viewer types and the entity types to be displayed in Weave.
  • filter
    • Associates a filter to be used with the id's send to/from Weave when passing a list of id's between Weave and Hansen.
  • group
    • Provides the Hansen URL to open when creating a group plus the entities that can be used to create a group.
  • project
    • Provides the Hansen URL to open when creating a project group plus the entities that can be used to create a project group.
  • {{workorder}
    • Provides the Hansen URL to open when creating/updating a work order plus the entities that can be used to create/update a work order.

The namespace for the updated configuration should be changed to urn:com.cohga.weave.hansen#5.0, e.g.

<config xmlns="urn:com.cohga.server.config#1.0" 
	xmlns:hansen="urn:com.cohga.weave.hansen#5.0">

The following sections show example configurations as separate hansen:config items, but when configuring Hansen they must be conbined into a single hansen:config item.

Send to Hansen (com.cohga.hansen.Send)

To configure the Send to Hansen button you must create at least one viewer item and set the url value, e.g.

<hansen:config id="prod">
	<url>http://wrath:8080/InformationViewer.aspx</url>
	<viewer id="PROP">
		<entity>property</entity>
		<entity>parcels</entity>
	</viewer>
	<viewer id="BLDG">
		<entity>council_buildings</entity>
	</viewer>
</hansen:config>

The url contains the base URL used to open Hansen.
Each viewer item describes the viewer type, which is appended to the Hansen URL, and the entity types and 1) are available to be sent to Hansen, and 2) link to the viewer type.
So, using the above example, the only entity types for which the Send to Hansen button will be enabled for are the property, parcels and council_buildings entities (and only when there's at least one entity selected).
And, when the button is pressed the URL opened for Hansen will be:

http://wrath:8080/InformationViewer.aspx?viewertype=<vt>&srcid=<ids>

where <vt> will be replaced with the viewertype that corresponds to the currently active entity, and <ids> will be the list of id's of the selected entities (after any filters have been applied)

By creating more than one viewer item you can specify different viewers to be opened in Hansen depending upon the source entity.

The complete list of entities listed in all of the viewer items must be unique, so that there is only even one viewer type that corresponds to a given entity.

Previously the viewer items also configured the link from Hansen to Weave between the viewer type and entity type, but this is now done with the mapping item

Send to Weave

To configure the link from Hansen to Weave you must create at least one mapping item.
The mapping item creates a link between the Hansen viewer type and the entity types that should be updated when a list of id's of a particular viewer type is sent from Hansen to Weave.
The id of the mapping corresponds to the viewer type send from Hansen, if no id is set for a mapping then that mapping wil be used if there is no matching mapping to the viewer type sent from Hansen.

<hansen:config id="prod">
	<mapping id="PROP">
		<entity>property</entity>
		<entity>parcels</entity>
	</viewer>
	<mapping id="BLDG">
		<entity>council_buildings</entity>
	</viewer>
</hansen:config>

When Hansen opens a link to Weave it will include the viewer type in the URL along with a list of id's, Weave will use the viewer type in the URL to find the corresponding mapping and then update the entities using the list if id's based on the entities listed in the mapping.
In the above example there will be an error if Hansen sends a viewer type to Weave that it doesn't know about, you can handle this with a mapping without an id, e.g.

<hansen:config id="prod">
	<mapping id="PROP">
		<entity>property</entity>
		<entity>parcels</entity>
	</mapping>
	<mapping id="BLDG">
		<entity>council_buildings</entity>
	</mapping>
	<mapping>
		<entity>property</entity>
		<entity>parcels</entity>
		<entity>council_buildings</entity>
	</mapping>
</hansen:config>

In this case if Hansen calls Weave with the viewer type "ASSET" then the property, parcels and council_buildings entities will be updated based on the list of id's sent from Hansen.
But if the viewer type is "PROP" then only property and parcels will be udpated, likewise council_buildings for the "BLDG" viewer type.
The entity does not have to be unique across all mappings, as is the case for the viewer items, since a given viewer type from Hansen may apply to the same entity.

You could just set a single mapping with no id to catch everything, but be careful if you have the same keys in multiple entities, since that will update the selection for all entities which probably isn't what you want.
It's better to specify the mappings for the correct viewertypes, if you know all of the viewer types sent from Hansen (I don't).

Filtering

Occasionally the id's that use in Weave to uniquely identify an entity is different from what is used in Hansen, in these cases you can setup a filter then add a filter item to the Weave configuration for Hansen.
This filter will then be applied to the id's sent from Hansen to Weave and the reverse used when sending from Weave to Hansen.

<config xmlns="urn:com.cohga.server.config" xmlns:trim="urn:com.cohga.weave.hansen#5.0" xmlns:filter="urn:com.cohga.selection.filter#1.0">

	<filter:db id="hansen.property">
		<datasource>main</datasource>
		<table>GEMS_LINK</table>
		<keycolumn>PID</keycolumn> <!-- column used in spatial database -->
		<idcolumn>PRUPI</idcolumn> <!-- column required for trim -->
	</filter:db>

	<hansen:config id="prod">
		<filter id="property" filter="hansen.property"/>
	</hansen:config>

</config>

The above example defines a filter, hansen.property, and then uses that to filter any property related id's sent to/from Weave.

Create Group (com.cohga.hansen.Group)

The create group button no longer uses the viewer items for configuration as it did before, there is now a separate group configuration item that sent the URL and entities that should be enabled for creating a group.
If the url is not set for the project then the global url value will be used.

<hansen:config id="prod">
	<group url="http://wrath:8080/HansenInterface/CreateAssetGroup.aspx">
		<entity>property</entity>
		<entity>parcel</entity>
	</group>
</hansen:config>

There should be only one group item set in the Hansen configuration, as opposed to the viewer, mapping and filter items which can be repeated.
The above example will enable the Create Group button for the property and parcel entities (when something is selected) and will open the provided URL with the id's of the selected entities (after applying any filters)

Create Project Group (com.cohga.hansen.ProjectGroup)

This is a new function provided in this update and is a modification of the above Create Group button.
The configuration is vistually identical to the Create Group function, but name is project and the URL will be different, and in fact is optional and the existing <url> attibute will be used.
If the url is not set for the project then the global url value will be used.

<hansen:config id="prod">
	<project url="http://wrath:8080/InformationViewer.aspx">
		<entity>property</entity>
		<entity>parcel</entity>
	</project>
</hansen:config>

Again the entity list determines what entities the button will be enabled for.

Update Work Order (com.cohga.hansen.WorkOrder)

Another new function provided with this udpate is the Work Order Update support.
The configuration for this is similar to the group and project, e.g.

<hansen:config id="prod">
	<workorder url="http://wrath:8080/InformationViewer.aspx">
		<entity>sw_pits</entity>
		<entity>sw_pipes</entity>
		<entity>sw_nodes</entity>
	</workorder>
</hansen:config>

Unlike the group and project items the configuration for work orders describes the link from Hansen to Weave and the link from Weave to Hansen.
That is when Hansen initiates a work order update with Weave, Weave will update the entities listed in the workorder, not the entities listed in a mapping.
Similarly, when Weave then sends the update back to Hansen it will only send one of the entities listed in the workorder, not those listed in mapping or viewer.

Complete example

<config xmlns="urn:com.cohga.server.config" xmlns:trim="urn:com.cohga.weave.hansen#5.0" xmlns:filter="urn:com.cohga.selection.filter#1.0">

	<filter:db id="hansen.property">
		<datasource>main</datasource>
		<table>GEMS_LINK</table>
		<keycolumn>PID</keycolumn> <!-- column used in spatial database -->
		<idcolumn>PRUPI</idcolumn> <!-- column required for trim -->
	</filter:db>

	<hansen:config id="prod">
		<url>http://wrath:8080/InformationViewer.aspx</url>

		<filter id="property" filter="hansen.property"/>

		<viewer id="PROP">
			<entity>property</entity>
			<entity>parcels</entity>
		</viewer>
		<viewer id="BLDG">
			<entity>council_buildings</entity>
		</viewer>
		<viewer id="ASSET">
			<entity>sw_pits</entity>
			<entity>sw_pipes</entity>
			<entity>sw_nodes</entity>
		</viewer>

		<mapping id="PROP">
			<entity>property</entity>
			<entity>parcels</entity>
		</mapping>
		<mapping id="BLDG">
			<entity>council_buildings</entity>
		</mapping>
		<mapping id="ASSET">
			<entity>sw_pits</entity>
			<entity>sw_pipes</entity>
			<entity>sw_nodes</entity>
		</mapping>
		<mapping>
			<entity>property</entity>
			<entity>parcels</entity>
			<entity>council_buildings</entity>
		</mapping>

		<group url="http://wrath:8080/HansenInterface/CreateAssetGroup.aspx">
			<entity>property</entity>
			<entity>parcel</entity>
		</group>

		<project> <!-- url not set since it's the same as the base url above -->
			<entity>property</entity>
			<entity>parcel</entity>
		</project>

		<workorder> <!-- url not set since it's the same as the base url above -->
			<entity>sw_pits</entity>
			<entity>sw_pipes</entity>
			<entity>sw_nodes</entity>
		</workorder>
	</hansen:config>

</config>