ServiceObjects in K2[blackpearl]

SmartObjects are cool by themselves. They become cooler when you write your own service objects and hook them up to SmartObjects.

K2[blackpearl] comes with a set of AD service objects which allows you to query AD objects. I wanted to build a service object that would allow me to write to AD.

Firstly, As any good coder would do, You write your code and get that tested for functionality 🙂 My ADUserCreator class was tested for the basic functionality it is providing – creating AD user accounts. This is the feature I want to expose to the K2 world. When wrapped as a service object it becomes a reusable artifact.

I then create a Service Object. This wrapper included definitions of properties and the methods which exposes my AD creation code. These props and methods must be decorated with Attributes. So that I can pass in the values to these properties and get values back out through these properties from my SmartObjects. Using these attributes the K2 designers know what configuration UI to present at design time.

I also need a Service broker object which allows the K2 configuration system to be used to configure this service – So that I can configure the default AD domain to connect to, etc. I placed all these classes in the same namespace and in a single assembly to keep things simple.

I then copy the DLL in to the HostServer install directory. Use K2 service manager to add a service type and create a service instance. Now if I go and look in the k2 object browser my service object is ready to be used in SmartObject methods!

I create my SmartObject and deploy it -bingo I can now create user accounts in AD from my processes, from my ASP.NET apps, from my windows apps, from my custom events, etc, etc using the SmartObject. Awesome.

Published by jeylabs

Are you ready to Transform your Enterprise?

%d bloggers like this: