Hi,
thanks for your reply! :-) After studying and testing your suggestion I wasn't not able to automatically build some relationships. Maybe I didn't get the point in the right syntax. Now I'm starting with two new Classes, Views (based on OCS) and I hope you can show me the mistake. :)
Class 1: "MasterCard" only with Code and Description
Class 2: "SlaveCard" only with Code and Description
Domain: "MasterSlave" (1:N) from MasterCard to SlaveCard
View MasterCard:
CREATE OR REPLACE VIEW CMDBuild_mastercard (DEVICE, CMDBUILD, TAG) as select ID, CONCAT(hardware.ID, '#', accountinfo.TAG, '#ocs), TAG from hardware, accountinfo;
select * from CMDBuild_mastercard;
173 | 173#CUSTOMER#ocs | CUSTOMER
View SlaveCard:
CREATE OR REPLACE VIEW CMDBuild_slavecard as select hardware.ID, CONCAT(hardware.ID, '#', accountinfo.TAG, '#ocs) AS CMDBUILD, MANUFACTURER from monitors, hardware where hardware.id=monitors.hardware_id;
select * from CMDBuild_slavecard;
173 | 173#CUSTOMER#ocs.ica-net.de | Samtron
Connector for MasterCard
:
cat cmdbuild-schema.xml
<?xml version="1.0"?>
<CMDBUILD>
<MasterCard>
<Code />
<Description />
</MasterCard>
</CMDBUILD>
cat transform.xsl
[...]
<xsl:template match="/inventory/mastercard">
<MasterCard key="Code">
<Code>
<xsl:value-of select="./CMDBUILD" />
</Code>
<Description>
<xsl:value-of select="./TAG" />
</Description>
</MasterCard>
</xsl:template>
<xsl:template match="/CMDBUILD/MasterCard">
<MasterCard key="Code" >
<xsl:attribute name="objid">
<xsl:value-of select="./@objid" />
</xsl:attribute>
<Code>
<xsl:value-of select="./Code" />
</Code>
<Description>
<xsl:value-of select="./Description" />
</Description>
</MasterCard>
</xsl:template>
</xsl:stylesheet>
Connector for SlaveCard
:
cat cmdbuild-schema.xml
<?xml version="1.0"?>
<CMDBUILD>
<SlaveCard>
<Code />
<Description />
</SlaveCard>
</CMDBUILD>
cat transform.xsl
[...]
<xsl:template match="/inventory/slavecard">
<SlaveCard key="Code" domain="MasterSlave" domaindirection="directed" identify="Code">
<xsl:attribute name="objid">
<xsl:value-of select="./@objid"/>
</xsl:attribute>
<Code>
<xsl:value-of select="./CMDBUILD" />
</Code>
<Description>
<xsl:value-of select="./MANUFACTURER" />
</Description>
</SlaveCard>
</xsl:template>
<xsl:template match="/CMDBUILD/SlaveCard">
<SlaveCard key="Code" domain="MasterSlave" domaindirection="directed" identify="Code">
<xsl:attribute name="objid">
<xsl:value-of select="./@objid" />
</xsl:attribute>
<Code>
<xsl:value-of select="./Code" />
</Code>
<Description>
<xsl:value-of select="./Description" />
</Description>
</SlaveCard>
</xsl:template>
</xsl:stylesheet>
The import of SlaveCard's and MasterCard's works perfectly, but now relationsship between them is generated. What is wrong? ;)
Thanks!
Cheers
Sebastian