Adding New Artifact Types and New Record to Artifact Types in WSO2 Gov. Reg 4.6 - wso2

I am getting an error when adding a new record to a new artifact type I created. The error is as follows
failed to add/edit artifact details. A valid qualified name was not set for this artifact
I created a new artifact type called 'Domain'. The artifact type was added but I cannot add new records to it. Get the same error as above when I add new record to Domain artifact type. My xml is attached.
<?xml version="1.0"?>
<artifactType type="application/vnd.wso2-domain+xml" shortName="domain" singularLabel="Domain" pluralLabel="Domains" hasNamespace="false" iconSet="9">
<storagePath>/domains/#{overview_domain}/#{overview_parentname}/domain</storagePath>
<nameAttribute>overview_domain</nameAttribute>
<ui>
<list>
<column name="Domain">
<data type="text" value="overview_domain"/>
</column>
<column name="Parent Domain">
<data type="text" value="overview_parentname"/>
</column>
</list>
</ui>
<content>
<table name="Domain">
<field type="options" required="true">
<name label="Domain Name">Domain Name</name>
<values>
<value>Research</value>
<value>Development</value>
<value>Medicine</value>
<value>Marketing and Sales</value>
<value>Operations</value>
<value>Enabling Functions</value>
<value>Communications</value>
<value>Human Resources</value>
<value>Finance</value>
<value>Legal</value>
<value>Purchasing</value>
<value>Information Systems</value>
</values>
</field>
<field type="options">
<name label="Parent Domain Name">Parent Domain Name</name>
<values>
<value/>
<value>Research</value>
<value>Development</value>
<value>Medicine</value>
<value>Marketing and Sales</value>
<value>Operations</value>
<value>Enabling Functions</value>
<value>Communications</value>
<value>Human Resources</value>
<value>Finance</value>
<value>Legal</value>
<value>Purchasing</value>
<value>Information Systems</value>
</values>
</field>
</table>
</content>
</artifactType>
Also I want to know if there is a thorough document describing how to add artifact types and records. As an example I added a storage path called
/domains/#{overview_domain}/#{overview_parentname}/domain
but I do not know where this points to and if this is even valid or not. The documentation in the online help is not adequate enough to add new artifact structures and records.
Thanks

Under the <ui> tag you have listed two columns. The value attribute given to each column must be in the format {basetable}_{fieldname}
Therefor the names given under each <field> must match with the value <data attribute= of corresponding <column> under <ui>.
To get rid of the error, change the name of the first field to be "Domain" so that it matches with the name that you have given in the column(i.e. overview_domain). So that the tag of the first should look like
<name label="Domain Name">Domain</name>
You should do the same for the second field too, so that the of second field must look as follows
<name label="Parent Domain Name">ParentName</name>

Kindly find the corrected domain.rxt.
To create your own RXTs please find this article.
<?xml version="1.0"?>
<artifactType type="application/vnd.wso2-domain+xml" shortName="domain" singularLabel="Domain" pluralLabel="Domains" hasNamespace="false" iconSet="9">
<storagePath>/domains/#{overview_domain}/#{overview_parentname}/domain</storagePath>
<nameAttribute>overview_domain</nameAttribute>
<ui>
<list>
<column name="Domain">
<data type="text" value="overview_domain"/>
</column>
<column name="Parent Domain">
<data type="path" value="overview_parentname" href="#{storagePath}"/>
</column>
</list>
</ui>
<content>
<table name="Overview">
<field type="options" required="true">
<name label="Domain Name">domain</name>
<values>
<value>Research</value>
<value>Development</value>
<value>Medicine</value>
<value>Marketing and Sales</value>
<value>Operations</value>
<value>Enabling Functions</value>
<value>Communications</value>
<value>Human Resources</value>
<value>Finance</value>
<value>Legal</value>
<value>Purchasing</value>
<value>Information Systems</value>
</values>
</field>
<field type="options">
<name label="Parent Domain Name">parentname</name>
<values>
<value/>
<value>Research</value>
<value>Development</value>
<value>Medicine</value>
<value>Marketing and Sales</value>
<value>Operations</value>
<value>Enabling Functions</value>
<value>Communications</value>
<value>Human Resources</value>
<value>Finance</value>
<value>Legal</value>
<value>Purchasing</value>
<value>Information Systems</value>
</values>
</field>
</table>
</content>
</artifactType>

Related

Customizing WSO2 Governance Registry 4.6.0 - Service List

I'm trying to customizing in WSO2 Governance Registry 4.6.0 (G-Reg) the "Service List" table (Home > Metadata > List > Services) adding two column from "Service detail view": "Overview - Description" and "Endpoints - URL"
I've edited the "Services Artifacts" (Home > Extensions > Configure > Artifact Types > Artifact Source) with the following lines:
<artifactType type="application/vnd.wso2-service+xml" shortName="service" singularLabel="Service" pluralLabel="Services" hasNamespace="false" iconSet="27">
<storagePath>/trunk/services/#{namespace}/#{name}</storagePath>
<nameAttribute>overview_name</nameAttribute>
<!--<endpoint1Attribute>endpointstext_endpoint1</endpoint1Attribute>-->
<namespaceAttribute>overview_namespace</namespaceAttribute>
<lifecycle>ServiceLifeCycle</lifecycle>
<ui>
<list>
<column name="Service Name B">
<data type="text" value="overview_name"/>
</column>
<!-- NEW Description -->
<column name="Description">
<data type="text" value="overview_description"/>
</column>
<!-- NEW Endpoints -->
<column name="Endpoints">
<!-- <data type="text" value="endpoints_endpoint1"/> -->
<!-- <data type="text" value="endpointmgt_endpointstext_endpoint1"/> -->
<data type="text" value="endpoints_endpointstext_endpoint1"/>
</column>
<column name="Service Version">
<data type="path" value="overview_version" href="#{storagePath}"/>
</column>
<column name="Service Namespace">
<data type="text" value="overview_namespace"/>
</column>
</list>
</ui>
<content>
......
</content>
</artifactType>
The column "Descrition" is filled properly, while column "Endpoints" is empty.
How to value the tag value?(data type="text" value="???????"/>) ??
You can not add unbounded table values to list view. But if you really want see the endpoint value in the list create a new text filed and replicate the same value.
<list>
<column name="Service Name">
<data type="text" value="overview_name"/>
</column>
<column name="Service Version">
<data type="path" value="overview_version" href="#{storagePath}"/>
</column>
<column name="Service Namespace">
<data type="text" value="overview_namespace"/>
</column>
<column name="Endpoint">
<data type="text" value="endpoints_endpoint"/>
</column>
</list>
and update the endpoints table like below
<table name="Endpoints">
<subheading>
<heading>Environments</heading>
<heading>URL</heading>
</subheading>
<field type="option-text" maxoccurs="unbounded" url="true">
<name label="Endpoint">Endpoint</name>
<values>
<value>None</value>
<value>Unknown</value>
<value>Dev</value>
<value>Test</value>
<value>Stag</value>
<value>Prod</value>
</values>
</field>
<field type="text">
<name label="Endpoint">Endpoint</name>
</field>
</table>
Now you can see endpoint value in the list.
To create your own RXTs please find this article.

Can not edit Doctrine ArrayCollection

I have a problem with editing an Doctrine2 ArrayCollection of a many-to-many assosciation.
Persisting an new entity is no problem and works fine. But if I would like to persist an entity with new added CollectionItems I got an
Doctrine\ORM\ORMInvalidArgumentException
I use the xml-mapping, the mapping files are the following:
receipt:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Application\Entity\Receipt" table="receipt" repository-class="Application\Repositories\ReceiptRepository">
<indexes>
<index name="FK_receipt_profession" columns="professsion"/>
<index name="FK_receipt_items_needed" columns="items"/>
</indexes>
<id name="rId" type="integer" column="r_id">
<generator strategy="IDENTITY"/>
</id>
<field name="name" type="string" column="name" length="100" nullable="false"/>
<many-to-one field="profession" target-entity="Application\Entity\Profession">
<join-columns>
<join-column name="profession" referenced-column-name="p_id"/>
</join-columns>
</many-to-one>
<many-to-many field="items" target-entity="Application\Entity\ItemsNeeded" inversed-by="receipt">
<!--<cascade><cascade-all/></cascade>-->
<join-table name="receipt_x_items_needed">
<join-columns>
<join-column name="receipt" referenced-column-name="r_id"/>
</join-columns>
<inverse-join-columns>
<join-column name="itemNeeded" referenced-column-name="in_id"/>
</inverse-join-columns>
</join-table>
</many-to-many>
</entity>
</doctrine-mapping>
ItemsNeeded:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Application\Entity\ItemsNeeded" table="items_needed" repository-class="Application\Repositories\ItemsneededRepository">
<indexes>
<index name="FK_items_needed_receipt" columns="receipt_id"/>
<index name="item_id" columns="item_id"/>
</indexes>
<id name="inId" type="integer" column="in_id">
<generator strategy="IDENTITY"/>
</id>
<field name="count" type="integer" column="count" nullable="false"/>
<many-to-one field="item" target-entity="Application\Entity\Items">
<join-columns>
<join-column name="item_id" referenced-column-name="i_id"/>
</join-columns>
</many-to-one>
<many-to-many field="receipt" target-entity="Application\Entity\Receipt" mapped-by="items"/>
</entity>
</doctrine-mapping>
and items:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Application\Entity\Items" table="items" repository-class="Importer\Repository\ItemRepository">
<unique-constraints>
<unique-constraint name="buffed_id" columns="buffed_id"/>
</unique-constraints>
<id name="iId" type="integer" column="i_id">
<generator strategy="IDENTITY"/>
</id>
<field name="name" type="string" column="name" length="100" nullable="false"/>
<field name="buffedId" type="integer" column="buffed_id" nullable="false"/>
</entity>
</doctrine-mapping>
The receipt table has an many-to-many relation through the crosstable "receipt_x_items_needed".
If I call $receipt->addItem($item); and $item is an already existing item from the itemtable I got the following error:
A new entity was found through the relationship 'Application\Entity\ItemsNeeded#item' that was not configured to cascade persist operations for entity: Application\Entity\Items#0000000041f6e49000000000651183aa. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example #ManyToOne(..,cascade={"persist"}). If you cannot find out which entity causes the problem implement 'Application\Entity\Items#__toString()' to get a clue.
But this is no new entity. All data are correctly set and as I wrote, if I add e new receipt all works fine.

How to Add a Default Image to SharePoint 2010 Custom List Instance Image Column

I'm creating a custom list definition in Visual Studio for SharePoint 2010. In the list definition elements file, I've provided some default values for the list instance as below:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListInstance Title="News"
OnQuickLaunch="FALSE"
TemplateType="10000"
Url="Lists/News"
Description="Contains news articles related to happenings at Corporate.">
<Data>
<Rows>
<Row>
<!-- Default list data -->
<Field Name="Photo">http://myserver/sites/foobar/Style%20Library/Images/Custom/myimage.png</Field>
<Field Name="Title">My Title</Field>
<Field Name="Body">My article.</Field>
<Field Name="Modified">12-21-2012</Field>
<Field Name="Author">99;#mydomain\bsmith</Field>
<Field Name="Expires">01-22-2013</Field>
</Row>
</Rows>
</Data>
The default list is successfully created with the values above, except that the Photo and Author columns are displaying as blank. Any ideas on how I can populate those columns correctly? I know the photo URL is valid as I can browse to it. And another posting pointed me to the "99;#" prefix for the author column--without the prefix, every column in the list displays as blank.
Also, here are the list schema fields, if it matters:
<Field ID="{d3a92d97-2b77-4a25-9698-3ab54874bc17}"
Name="Photo" ShowInNewForm="TRUE" ShowInEditForm="TRUE"
Type="Image" DisplayName="Photo"
Required="TRUE"></Field>
<Field ID="{d3a92d97-2b77-4a25-9698-3ab54874bc11}"
Name="Title"
Type="Text" DisplayName="Title"
Required="TRUE"></Field>
<Field ID="{d3a92d97-2b77-4a25-9698-3ab54874bc16}"
Name="Body"
Type="Note" DisplayName="Body"
Required="TRUE" NumLines="100"></Field>
<Field ID="{d3a92d97-2b77-4a25-9698-3ab54874bc13}"
Name="Modified"
Type="DateTime" DisplayName="Modified"
Required="TRUE"></Field>
<Field ID="{d3a92d97-2b77-4a25-9698-3ab54874bc14}"
Name="Author"
Type="Text" DisplayName="Author"
Required="FALSE"></Field>
<Field ID="{d3a92d97-2b77-4a25-9698-3ab54874bc15}"
Name="Expires"
Type="DateTime" DisplayName="Expires"
Required="FALSE"></Field>
Try provisioning your field data like this in your list instance.
<Field Name="Photo"><![CDATA[<IMG SRC="/sites/foobar/Style%20Library/Images/Custom/myimage.png"></IMG>]]></Field>

WS02 G-REG new metadata type

We're testing G-Reg for use of a SOA repository. The default types are Services, WSDL's, Schemas and WS Policies, we're triying to add a new type (Persons for example).
Once added, we want to create a xml to specify the fields that needs to be filled to upload a new resource of the "Persons" type, (like the Services type actual funcionality).
We've followed the guide on http://docs.wso2.org/wiki/display/Governance411/Configurable+Governance+Artifacts, but with no success of creating the example named "Events", because there exists contradictory information, the path "/_system/governance/repository/components/org.wso2.carbon.governance/types", doesn't exists on GREG 4.1.1, so where is supposed the content to be uploaded?
And, the guide explains about a "registry extension file" and a "content", which is the difference between them?, they need a name?, content.xml and extfile.xml perhaps?
Any orientation will be greatly appreciated
Thanks,
Gabriel.
Here is a sample server.rxt file I have created.
<artifactType type="application/vnd.wso2-server+xml" shortName="server" singularLabel="Server" pluralLabel="Servers" hasNamespace="false" iconSet="5">
<storagePath>/servers/#{overview_name}/</storagePath>
<ui>
<list>
<column name="Name">
<data type="path" value="overview_name" href="#{storagePath}"/>
</column>
</list>
</ui>
<content>
<table name="Overview">
<field type="text" required="true">
<name label="name">Name</name>
</field>
<field type="text" required="true">
<name label="url">url</name>
</field>
<field type="text" required="true">
<name label="username">username</name>
</field>
<field type="text" required="true">
<name label="password">password</name>
</field>
</table>
</content>
</artifactType>
you need to save this under the directory you have mentioned.
/_system/governance/repository/components/org.wso2.carbon.governance/types
this location is not exits. But you need to create this directory and save.
After restart you should see the new type under meta data list

how to get only the children nodelist using getElementByTagName?

I have this XML File from which I want to extract my message children fields
<message name="IOI" >
<field number="23" name="IOIID" type="STRING" required="Y" />
<field number="28" name="IOITransType" type="CHAR" required="Y" >
<value enum="C" description="CANCEL" />
<value enum="N" description="NEW" />
<value enum="R" description="REPLACE" />
</field>
<field number="26" name="IOIRefID" type="STRING" required="N" />
<component name="SecAltIDGrp" required="N" >
<field number="454" name="NoSecurityAltID" type="NUMINGROUP" required="N" >
<field number="455" name="SecurityAltID" type="STRING" required="N" />
<field number="456" name="SecurityAltIDSource" type="STRING" required="N" />
</field>
</component>
so I used getElementsByTagName() but it gave me all children with their children, so how could I only get my message fields without my fields's fields ??
DOMNodeList* fieldsNodeList = MessageElement->getElementsByTagName(xmlStrVar);
Xerces C++ provides partial XPath implementation. And here's an SO question with more details about it. With that said, depending on the version of Xerces C++ you're using, you should be able to run simple XPath expressions like /message/field.
Another option is to stay with the DOM API and just iterate through the child nodes using getChildNodes() available on the DOMNode looking for field elements.
Last but not the least, if you liked the XPath idea but your Xerces C++ version is not up to it, consider stepping out of your "comfort zone" and look at Xalan C++ or libxml2. Both should have full XPath 1.0 support.