Friday, July 25, 2008

Documentum BizTalk Adapter

EMC Documentum (for those who don't know) is a great enterprise content management system which I started working with about two years ago.

I have to say that I'm a lucky that I started with Documentum in this specific period as Documentum is entering the SOA world with wide steps, recently they released the Documentum Foundations Services (DFS) which is their SOA Development Framework for Documentum. they are also developing a new Client for Information Workers (Code name Magellan) that contains the Web 2.0 functionality (wikis, blogs, social networking, RSS feeds, tagging and more)

For a quick info in Magellan Read the FAQ

You may know that I love BizTalk Server, I decided that I should develop a Custom Documentum BizTalk Adapter, I know that there may be simpler solutions to do this like creating a web service on top of Documentum (Like FirstDoc web service) but this will be a good way to practice creating a custom adapter for BizTalk Server 2006.

Here is my plan for the features to be implemented:

- Develop the send adapter that allows the user to specify the Docbase, Cabinet and File where the document will be saved

- Enhance the send adapter to support generating a schema for a custom document type.

- Develop the receive adapter (I haven't thought about this yet, any suggestions will be appreciated)

To accelerate things, I started with the good old Sample File Adapter provided with the BizTalk SDK as a sample for the Adapter Framework, changed the schema of transmit location to allow the user to enter the docbase, username, password, cabinet and folder where the document will be saved, over the past weekend i implemented the send port (currently I'm sending only xml files).

I will post my progress on the adapter here on my blog.

1ntitled

2Untitled

Thursday, July 03, 2008

Accessing the Properties of a Web User Control from JavaScript

I ran into this situation where I have a web user control (*.ascx file), in this control I defined some properties that will control the appearance and the logic of the user control

public partial class WebUserControl : System.Web.UI.UserControl
{

protected void Page_Load(object sender, EventArgs e)
{
}
public string Address
{ get; set; }
}


I wanted to be able access this property from JavaScript from the web page that hosts the user control like this

document.getElementById('<%=WebUserControl1.ClientID %>').Address

My idea is as follows:

- Add a hidden input control to the user control

- Override the ClientID property of the user control to return the ClientID of the hidden input, so when you write the following JavaScript in the page hosting the user control

document.getElementById('<%=WebUserControl1.ClientID %>').Address

what will happen is that you will set the value of an attribute on the hidden input

this will allow us to access the user controls properties from the JavaScript, but there will be a problem : these attributes that are set on the client side will not be posted back to the server

we need to take these values from the attributes and put them in the "value" field of this hidden input control because we can read the "value" field at the server. so i added the following JavaScript function that reads the attributes values of the hidden input and puts these values in the "value" field of the hidden input


function ReadAttributedProperties(objID)
{
if (document.getElementById(objID)==null)
return;
var atts=document.getElementById(objID).attributes;
var value='';
for(var j=0;j<atts.length;j++)
{
if (atts[j].specified)
{
if (atts[j].nodeName!='id' && atts[j].nodeName!='name'
&& atts[j].nodeName!='type' && atts[j].nodeName!='value' )
{
value+= atts[j].nodeName+ ':' + atts[j].nodeValue;
if (j!= (atts.length-1))value += ',';
}
}
}
document.getElementById(objID).value=value;
}

To make things simpler i created a class that inherits UserControl and do all of this for you, all you have to do is to create a user control that inherits this class and define your properties as follows


public partial class WebUserControl : ScriptedUserControl.ScriptedServerControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string Address
{
get
{
return GetPropertyValue("Address");
}
set
{
SetPropertyValue("Address", value);
}
}
}

You can download the source code and a sample web site from here

My Blogs

I will dedicate the blog http://mosalem.blogspot.com to the technical posts and the personal posts will be posted to my windows live space http://mmosalem.spaces.live.com