Archive for March, 2010

Including Sub-project in Eclipse Maven

Try running first mvn install in the sub project (in order to put the sub-project in your local maven repository), and then add the dependency to Parent project’s pom.xml.

,

No Comments

Setup JDK in Maven Project in Eclipse

Change the POM.xml


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Test</groupId>
<artifactId>test</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>test</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<span style="color: #3366ff;"><strong><configuration>
<source>1.5</source>
<target>1.5</target>
</configuration></strong></span>
</plugin>
</plugins>
</build>
</project>

,

No Comments

Delegation of the SharePoint out-of-box approval workflow

WfAssociation.AssociationData = WfAssociation.AssociationData.Replace(“<my:DisplayName>” + OrgApproverUser.Name + “</my:DisplayName>”, “<my:DisplayName>” + StandInUser.Name + “</my:DisplayName>”);
WfAssociation.AssociationData = WfAssociation.AssociationData.Replace(OrgApproverUser.LoginName, StandInUser.LoginName);

In order to extending the out-of-box approval workflow, we can have 2 approaches.

1.  Use event receive to wrap the workflow,  create the workflow association object and start the workflow using the created workflow association. Ref: http://www.rightpointconsulting.com/community/blogs/viewpoint/archive/2009/12/30/test.aspx

2. Change the approver after the workflow is kicked off using event receiver. The event receiver is monitoring the “Tasks” list, change the workflow history and workflow association accordingly. Following is the demonstration this approach.

i. Change the “assigned to” value during “ItemAdding” event for the “task” object.

ii. Update the workflow association data, workflow history during “ItemAdded” event.


String WfInstanceId = "{" + properties.AfterProperties["WorkflowInstanceID"].ToString() + "}";

SPWorkflow Wf = new SPWorkflow(properties.OpenWeb(), new Guid(WfInstanceId));

SPList WfList = properties.OpenWeb().Lists[new Guid(properties.AfterProperties["WorkflowListId"].ToString())];

SPWorkflowAssociation WfAssociation = WfList.WorkflowAssociations[Wf.AssociationId];

// in order to change the correct approver, change the workflow association object

WfAssociation.AssociationData = WfAssociation.AssociationData.Replace("<my:DisplayName>" + OrgApproverUser.Name + "</my:DisplayName>", "<my:DisplayName>" + StandInUser.Name + "</my:DisplayName>");

WfAssociation.AssociationData = WfAssociation.AssociationData.Replace(OrgApproverUser.LoginName, StandInUser.LoginName);

No Comments