$ thought | blog

Place to serialize my thoughts…

Archive for the ‘Personal’ Category

Alfresco: Workflow managed by JavaScript

with 4 comments

If you are a regular reader of this blog, you might have figured out that I am currently working on a project involving alfresco at the center and it's a content management system. Earlier I have worked with Content repository (Apache Jackrabbit) and that was a good experience. Alfresco is next step of a content repository which extends it into a full blown content management system and much more. I was working on a problem where we defined a custom (Advanced workflow) to be precise in Alfresco lingo. This workflow was needed to be monitored, managed and accessed only via a webscript as we have used webscripts to do almost everything in our project. I was very pleased to see this, but that is only available in 2.9 labs release (as of now). We are using alfresco 2.2.0 version for our development and that is production stable version, so I have very little choice but go with production version. Alfresco has very limited JavaScript API support for workflow manipulation and that was difficult job for manage. There was no other option than writing custom JavaScript API which allows to manage workflow in Alfresco. We did that and it was very powerful and easy! :) I wanted following features for JavaScript API -

  • Easy to extend
  • Can handle any workflows
  • Provides easy ways to retrieve tasks, definitions, paths etc.
  • Provides as much functionality possible which is available in Alfresco Workflow Console.

Alfresco workflow console is command line interaction component which allows you to manipulate, get information about workflows using simple commands and I wanted to do all that using JavaScript. I started exploring the source code and found a class 'org.alfresco.service.cmr.workflow.WorkflowService'. This class has generic API which allows you to do all the operations possible through workflow console. This bean is used for workflow console operations. So all I needed was expose this bean in JavaScript as root object and start using it. That simple! I wrote a simple java class to expose the bean as follows:

package com.xxxx.yyyy.workflow;
 
import java.util.List;
 
import org.alfresco.repo.processor.BaseProcessorExtension;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.workflow.WorkflowService;
 
public class WorkflowManager extends BaseProcessorExtension {
	private ServiceRegistry services;
 
	public void setServiceRegistry(ServiceRegistry serviceRegistry) {
		this.services = serviceRegistry;
	}
 
	public WorkflowService getWorkflowService(){
		return services.getWorkflowService();
	}
}

The method getWorkflowService() exposes the workflow service to the JavaScript calls. To expose the Workflow Manager as root object in JavaScript create WEB-INF/classes/alfresco/extension/custom-script-context.xml and you will be good! (If you don't know how to do that, read this) Now, you can get the handle of workflow service in JavaScript code. Yet, we need to write a small component which will allow us to retrieve the active workflows, tasks etc. To do so, I wrote a small JavaScript object which provides those functionality to the user.

var workflowService = workflow.getWorkflowService();
 
var W = {
	transitions: function(noderef){
		var task = W._currentTask(noderef);
		var trans = [];
		try{
		var tasks = task && task.path.node.transitions;
		for(var index=0; index < tasks.length; index++){
			trans[trans.length] = tasks[index].id;
		}
		}catch(error){
			// Ignore error
		}
		return trans;
	},
 
	move: function(noderef, command){
		workflowService.endTask(W._currentTask(noderef).id
                , command);
	},
 
	_workflowPath: function(noderef){
		var workFlows = workflow.getWorkflows
                      ("workspace://SpacesStore/" + noderef, true);
		if(workFlows.size()>0){
			return workFlows.get(0).id + "-@";
		}
		return "";
	},
 
	_currentTask: function(noderef){
		var curTask;
		var tasks;
		try{
		tasks = workflowService.getTasksForWorkflowPath
                           (W._workflowPath(noderef));
		if(tasks.size() > 0)
		      curTask = tasks.get(0);
		} catch(Error){
			// Ignore error
		}
		return curTask;
	}
}
 
function initWorkflow(noderef)
{
	var wflow = actions.create("start-workflow");
	wflow.parameters.workflowName
             = "jbpm$xxxxyyyy:abc"; // your workflow name
	wflow.parameters["bpm:assignee"]
             = person.properties.userName;
	wflow.parameters["bpm:workflowDescription"]
             = "Put your description";
	wflow.execute(noderef_for_which_workflow_will_associate);
}

Thats it! The initiate workflow method is used to apply a workflow to a node. Once that is done, the W object can be used to do operations like retrieving the active tasks, ending the workflow and making the workflow transition. Hope that helps. If you need more workflow related information and reading material you can visit following places:

  • JBPM jPDL Documentation (here)
  • Alfresco workflow wiki (here)
  • ECMArchitect Advance Workflow Guide (here)

Written by Sachin

May 29th, 2008 at 10:35 am

Bollywood is Bollywood!

with 4 comments

Today, after watching 'Shootout at Lokhandwala' (SAL), I realized that there is huge difference in the quality of movies produced in Hollywood and Bollywood. Directors like Quentin Tarantino, Woody Allen and Steven Spielberg make movies which has lots of research and study. Not only the shot but the finest detail of shot gets enough attention. Movies which are having based on past events are shot with great precision to make sure that they don't have any present day detail.

In SaL I found few blunt mistakes which could have been fixed while shooting or at least at the editing time. On the top of mind few things come are -

  • Tata Indigo! - The movie is shot in 1989-1992 timeframe. When Sunil Shetty makes a blank call to his wife, I could see a white colored Tata Indigo car passing by. Its impossible to see that car in 1991! The car was launched in India in year 2002. Strange to see that car in 1991. :)
  • AA Group posters! - In the song 'Ganpat' when group of people are dancing on the top of a bus, we could easily see 'Anil Dhirubhai Ambani' Group advertisements on the light poles. This group was founded in 2005 after division of Ambani group of companies. I thought roots of this group were founded in 1992 :)

In addition to that, there are other small mistakes too. Which you can easily find like the bikes which were not present in movie time line etc.

Looks like Indian directors have to put little more efforts in research and analysis to make movie more authentic and real. Movies like Hollywood ending, Schindler's List were based on past events. They were so real that you will believe those were produced from original footage which was conceived in the movie timeline.

Off to see Shrek 3! :)

Written by Sachin

June 2nd, 2007 at 8:51 pm

Posted in Personal

Tagged with , , ,

“I don’t agree with you! How about that?”

with 4 comments

I recently completed my one month in my new company. I hold my temptation to express my first impression of company for more than three weeks. I believe, to be fair you should spend at least a month before writing about new company. I was new to concepts of “Flat Organization”, “Agile Practices”, “Stand-ups” and “Sign-ups”. I was hoping to spend a fair amount of time in learning this process and be a part of it. Surprisingly I found it very easy to learn basics of that. Practicing them was even easier because of “Pair Programming” and other similar approaches.
I am not Odd man standing out anymore. I am a thoughtworker! (Somebody at my work will ‘disagree’ with that! :) )
ThoughtWorks, is amazingly different than other organizations I have seen, visited or been. Following are the things which come on top of mind when I compare ThoughtWorks with any other companies.

  1. No cubicles! – This is a blessing! Everyone sits around tables which mostly look like dining tables. All of your team members, are at a proximity where you can directly call him and have a discussion across tables! This increases a little noise in office but it’s worth it. I learned to work in that now.
  2. Very energetic team which is very rare to see. In a technical discussion we always run out of time because of overwhelming ideas to discuss on table.
  3. Agile at its core which is practiced very religiously!
  4. Resources availability. Company which provides high-end latitudes to everybody for personal use. There are virtually not restrictions for personal / technical growth.
  5. Every ThoughtWorker is passionate about what he/she is doing!

Comparing ThoughtWorks with any other company is like comparing apples and oranges! Their fundamental structure is different.
I met few of very interesting people in new workplace. I had lots of technical discussions. The very strange thing was, in ThoughtWorks one of my friends opens and closes the discussions with only single phrase –

“Hey, I don’t agree with you! How about that?”

Written by Sachin

February 20th, 2007 at 4:28 pm

Posted in Personal

Tagged with , ,

Last day in Hyderabad…

with 3 comments

As I announced earlier, I am going to join ThoughtWorks, Pune development center. For past 18 months, I lived in Hyderabad. This was a wonderful experience. People of different language, culture and attire! One of the best times of my life!

For all the good time I had, I owe thank to following list of people. Shriram (raamya) for his coffee breaks and wonderful thought experiments. You're the man! Akshay and group for helping me in first days @ Hyderabad. Madan and Surabh for providing occasional company! :)

At last my crew from Akanksha; Rambabu for wonderful political, regional and personal views, movies and entertainment. I had lots of good discussion with you. Kameshwar for his humor and enjoyable discussions. Sridevi, Padmavati for their co-operation and fun. Sneha for her brain biting discussions! ;) Manoj for wonderful times having technical discussion and countless fun parties!

Radio City 106.4 / 91.1 FM for their wonderful music! Aparna (RJ for 'Chalo Chalte Raho' show) for her wonderful talks and entertainment. Thank you for giving me opportunity to speak me on Radio for 90 seconds on 6th December, 2006. I specially enjoyed your show everyday on the way to office. You are my favorite RJ for the year 2006! Gautami (RJ for 'Nato Vastara' show) for her sweet talks and cute behavior. You are a wonderful person with a great smile. I don't know Telugu but just your show taught me to understand some of words! Being a Marathi person, I enjoyed your show everyday on way back to home!

Thanks to Sify for providing me internet services for whole year. Not the best, but you are good provider. Without you, this was impossible to have wonderful discussion with my loving friend Neelesh in USA.

Thanks to Neelesh for talking me almost everyday and talking on lots of topics. Great company dude! Hope to continue same discussions from Pune.

Final thanks go to my movie library person (Anna) who provided me hundreds of movies throughout the year! You made my holidays enjoyable! Thanks to Prasads IMAX, PVR Cinemas, Sangeet, and Raja for showing me great movies for the weekends and holidays.

Altogether, the stay at Hyderabad was wonderful and definitely added lots of memories to my personal life. I learned lots of things which will help me through the rest of time. Tonight I start my final journey towards Pune. Given a chance, will love to be a Hyderabadi! Again!

Thank you for the all persons who became part of life in Hyderabad. I always owe a big Thank to you.

Good bye Hyderabad!

Written by Sachin

January 13th, 2007 at 2:29 pm

Posted in Personal

Tagged with , ,

Need for Speed: Carbon – What’s next?

with 7 comments

Need for Speed: Carbon is the latest release from EA. This game is way ahead of its predecessors in physics and modeling. The stunning graphics, great music and nicely arranged plot made my day.
I have been playing NFS since NFS 2. Since then I played every release and my all time favorite is Need For Speed Porsche Unleashed. That game was something really stunning graphics, Porsche theme and way too real than its competitors!
I was wondering, what will be the next version of NFS: Carbon? If we see the trend of games, it can be categorized as follows:

  • NFS 2 - Plain racing
  • NFS 3 - Pursuit
  • NFS 4 - Racing with better physics and realism
  • NFS 5 - Theme based game (Porsche lineup)
  • NFS 6 - Pursuit (Reloaded version of NFS 3)
  • NFS 7 - Underground theme
  • NFS 8 - Underground theme reloaded in much better way
  • NFS 9 - Mix n' match of pursuit and career mode
  • NFS 10 - Underground theme revisited again with strong pursuit and territory based career mode

EA has always tried to put new race modes and latest cars. A constant effort to make NFS more than just racing can be observed in previous games. So what can be the next theme? I think a more realistic betting could be another option. Player earns and bets in racing. If you loose all the money, you are out of the career mode and your cars will be lost.
The customization is the key now. Autosculpt in NFS carbon has done a great job. NFS carbon was having many other things such as crew members and some racing modes. I miss drag racing though! :(

What you think?

Written by Sachin

December 21st, 2006 at 8:16 pm

Posted in Personal

Tagged with