Thursday 22 December 2016

Difference between Alfresco Community edition and Enterprise edition

It's a very basic question. Isn't it? If you would have just started with learning about Alfresco, you may have been trying to find out what are the key differences between the different editions of Alfresco. If you would have been a seasoned professional who has spent years working on Alfresco, you may have come across situations where the prospect/client would have been asking about differences between community and enterprise edition. Also, in technical round of interview as well, you may have come across this question at some point of time. 

So, what would be your answer when someone asks you this question about differences between Alfresco Community edition and Alfresco Enterprise edition? It may sound a very basic question yet it's a significant one and you should be able to clearly differentiate the key points between the two. In this blog post, I will try to answer this question to provide key points about differences based on my understanding and knowledge. I hope you may find it helpful.

Let's start with Alfresco One enterprise edition first.It's an enterprise ready edition which is extensively tested by Alfresco with different configurations across both open source as well as commercial technology stack of supported databases/operating systems/application servers. Range of different modules available for Alfresco One Enterprise edition which provides additional capabilities such as seamless integration with outlook, effective desktop sync functionality, analytics module to provide complete visibility over the content, Salesforce connector to bridge CRM and ECM world, media management and so on. Supports clustering to achieve enterprise level scalability and reliable high availability. It also provides cloud sync capability of on premise content, basically a hybrid ECM approach. It is fully supported by Alfresco and one can get different options for availing commercial support. Also, a wider partner network is also present. 

Let's talk few points about Alfresco Community edition now. There are periodically stable releases of Alfresco Community edition are being released by Alfresco. It is designed to work effectively on the open source technology stack of database/operating systems/application servers and it is automated tested on a single stack per my understanding. It needs to be self supported using community resources as there will not be official support available by Alfresco. Also, it includes community driven development and contributions. Clustering capabilities are not available as default with community edition. Hence, it is best suited for small scale deployments.

In Summary, if you need to have an ECM system which caters to mission-critical requirement and requires enterprise integrations then your preference would be to go for Alfresco One Enterprise edition. However, if you just want to have a small sized in-house ECM for which you have required resources to support then Alfresco Community edition is the most suitable choice.

That's it. I have tried to share the key points of differences based on my understanding here. If you have anything additional to share then kindly do drop in your comments. 



Saturday 10 September 2016

Top 15 most common development tasks you will have in almost all of your Alfresco projects

In any of your alfresco projects, based on your project requirement there would be number of different development tasks you will carry out ranging from customizing some of the things available out-of-the-box to adding the new things per your implementation. Out of them, here I have tried to list out the most common items that you will find in almost all of your Alfresco development projects. There would be many more as well however, I have just tried to put up the most common ones related to development front, based on my opinion.

If you are a beginner who have just started with development in Alfresco and are curious to know what are all the common things you must learn in order to be productive from day-one in your assigned alfresco projects then you should try to explore and learn how to achieve below things in Alfresco. That would surely help you in my opinion.

Let's take a look at them.

1. Creating custom content types in your custom content model
2. Adding a form configuration to create/edit the custom content type
3. Adding a new option in the document library view to create your custom content type i.e. adding a menu item to the "Create.." menu in document library
4. Starting a workflow as soon as a new content of your custom content type is created
5. Creating a new workflow and integrating it with Alfresco Share
6. In a workflow task view, display transition buttons instead of a list view.
7. Creating custom control for your workflow task form for example, to select an assignee, instead of searching for a user, you want to pre-populate all the users from some specific group and then select assignee from it.
8. Adding a custom action for your content in document library
9. Writing an evaluator to show the custom action to only specific type of user
10. Creating a custom page for example, to display a list to show the contents created for your content type and providing actions such as edit/delete and so on.
11. Creating a Dashlet to display and list out the contents in some specific state such as all the contents in review process and so on.
12. Automatically creating a default folder structure when a new site is created
13. Displaying create site link to only specific users
14. Adding your custom page to the site navigation menu (by default you only see document library there)
15. Customizing File Upload dialog

Hope this helps.

Monday 22 August 2016

Get to know about how to switch back to flash uploader in Alfresco 5.0.x community versions

While uploading the content in the latest versions of Alfresco, you must have observed that, it always displays the file uploader different than it generally used to show in the earlier versions of Alfresco. Yes, That is correct. In the latest versions of Alfresco, it displays the dnd (drag-and-drop) uploader instead of the flash uploader in the earlier version.  Let me help you with the visuals so that it would be easy for you to understand what I am talking about, if you are new to Alfresco.
Following is the dnd uploader which you will find as the default uploader in latest Alfresco versions.
dnd uploader

Now, following is the flash uploader which used to be default uploader in the earlier versions of Alfresco.
flash-uploader

Now, what if you want to switch back to flash uploader as default? Here, I would be sharing my understanding, if you want explicitly switch back to flash upload then how you can do that in the latest 5.0.x Alfresco versions.

Kindly take a note that, flash uploader seemed to be deliberately changed from being the default uploader in Alfresco share as a part of Tomcat 7 security fixes. Hence, if you still want to make flash uploader as the default uploader for the newer versions of Alfresco as a part of your Alfresco implementation then you should take the above point into consideration before finalizing your decision.

Now, let's take a look how we can switch back to flash uploader in 5.0.x Alfresco Community versions.

1. In file-upload.js at the location tomcat\webapps\share\components\upload inside your Alfresco installed directory, the order is explicitly specified as dnd uploader, flash uploader and simple html uploader inside show: function FU_show(config)function using if-else conditions. Modify it to change the order as following.
              var uploadType;
      if (this.hasRequiredFlashPlayer)
      {
         uploadType = this.options.flashUploader;
      } else if (this.browserSupportsHTML5)
      {
         uploadType = this.options.dndUploader;
      } else
      {
         uploadType = this.options.htmlUploader;
      }
Also, make sure that the corresponding minified js is also updated with this change.
2. Also, modify context.xml file, located at tomcat\conf inside your alfresco installed directory.
            <Context useHttpOnly="false"
3. Restart alfresco server and test the file upload now. It should now show the flash uploader back if your browser has flash plugin installed. If it still shows the dnd upload, you may try clearing out browser cache and test again.
         
I hope this quick information will help you out if you are stretching your head to find out where has flash upload gone and how to get it back. Hope it helps.

Saturday 13 August 2016

Knowledge byte to validate content model without restarting Alfresco server

In any of your alfresco project, the first and very basic task that you do as a part of your technical implementation is, to start writing your content model as per your business requirement. Now, while doing so, there would be a point where you want to test if the content model xml that you have written is valid and are you able to successfully deploy it or not.

Generally, the common approach that you will take up is, deploy the content model xml and restart the alfresco server. While starting up the alfresco server, if there are any syntactical/schema errors, you will get to see those errors. Now, again you will make changes and again deploy it and restart the server until all the errors are gone and content model is successfully deployed and server is started. If you are a new developer to Alfresco, I am sure this is going to be the part of your story as I have seen many new developers facing this issue and spending their time there.

If you are seasoned alfresco professional, you must be already aware that there is a way to up-front test your content model without need of restarting server.

Let's take a look at how to validate your content model without the need to restart the alfresco server.

For example, you have created a content model named myContentModel.xml at the location
\tomcat\shared\classes\alfresco\extension inside your alfresco installed directory (We will take C:\Alfresco as an installed directory for example).

I am using windows OS and Alfresco Community edition 5.0.d.

Now, in order to test your content model, all you need to do is, Open command prompt, and execute the following command.

C:>java -cp "C:\Alfresco\tomcat\shared\classes;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\*;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes" org.alfresco.repo.dictionary.TestModel alfresco\extension\myContentModel.xml

Once you execute the command, it will give the following result if the content model is valid, otherwise it will display the errors if its not valid.
Testing dictionary model definitions...
 alfresco/model/dictionaryModel.xml
 alfresco/model/systemModel.xml
 org/alfresco/repo/security/authentication/userModel.xml
 alfresco/model/contentModel.xml
 alfresco/model/applicationModel.xml
 alfresco/model/bpmModel.xml
 alfresco\extension\myContentModel.xml

Models are valid.

This way you should be able to test your content model without the need of starting up the server and you will save a lot of time trial-and-error  making some minor changes to content model and restarting the server.

If you have not yet created your content model and you want to still test how the above command works then you can use an example content model shipped out-of-the-box by alfresco. It would be at
\tomcat\shared\classes\alfresco\extension\exampleContentModel.xml. It would be named as exampleContenteModel.xml.sample, you will have to just remove .sample and make it exampleModel.xml. In the above command, change the model file name at the end instead of myContentModel.xml to exampleContentModel.xml

While executing the command, If you face an error about log4j file then make sure you have given the appropriate permission. Another option is to run the command prompt as an administrator or another thing that you can try is give the absolute path to alfresco.log file in log4j.properties. I am not going into the details here and just provided the few pointers you can try if you face log4j file related error. I am sure you must be able to figure it out based on it. If not, do drop a comment and I will help you solve that.

If you are using Linux then while specifying classpath use : instead of ; (I am sure as a first timer, you may spend a bit of time there as well in order to make a windows command work for linux)

Note : You may not find org.alfresco.repo.dictionary.TestModel class in some 4.x versions of Alfresco as it was accidentally removed from the relevant jar and later on was added back in the later versions.

Hope this blog will help you.


Sunday 5 June 2016

Fast facts about alf_ticket for hassle free integration with Alfresco using REST API

Web scripts in alfresco allows you to easily integrate your custom front-end application with alfresco repository. One of the key thing to understand for such integration using REST API is, how do you establish the user authentication and execute each web script request to the repository in the respective user context. If you have been working on Alfresco for quite a long time then you must be knowing that with the help of alf_ticket, it is easily achievable. If you are new to Alfresco and have just the preliminary information about web scripts then you may be wondering what is this alf_ticket and how it is useful while invoking the web scripts in Alfresco. Let's take a look at some of the key facts you must know about it.

How to obtain alf_ticket?
There is an out-of-the-box login web script available in Alfresco wherein you can provide username and password and in return this web script will return you the ticket information for user's established authenctiated session against the alfresco repository. Following are the details about the login web script.
Login web script url - http://localhost:8080/alfresco/service/api/login?u=admin&pw=admin
Login web script response - <ticket>TICKET_1f80f5e7bcdad060f7c0de95889541f704979f10</ticket>
By default the webscript returns the XML response, however, you can get the JSON response as well. Just modify the web script URL above with login.json instead of login to get the JSON response back.
For login web script, both GET and POST methods are supported. Ideally, it is preferable to invoke login web script with POST method.

How to use the alf_ticket?
Once you have obtained the alf_ticket for a user then while invoking any further web scripts (which have authentication attribute setup as user in the web script description document), you need to pass the alf_ticket information in order to let the Alfresco repository know that it needs to execute the requested web script code in the context of a user whose authentication ticket information has been passed using alf_ticket.
Following is one example about how you pass alf_ticket to execute the get content web script run in the context for the admin user's authentication session for which we just obtained alf_ticket above.
http://localhost:8080/alfresco/service/api/node/content/workspace/SpacesStore/18d2fa04-70ba-4865-afe6-e097b75f0576?alf_ticket=TICKET_1f80f5e7bcdad060f7c0de95889541f704979f10
If web script itself is expecting some other querystring parameters then you can append alf_ticket at the end using &alf_ticket.

Does the alf_ticket expire?
By default, it is pre-configured in Alfresco that authentication tickets do get expired. The following configuratoin property takes care of setting up whether authentication tickets will expire or not. You can set this property to false in alfresco-global.properties file, if you do not want the alf_ticket to get expired. However, you may not want to do that in regular scenarios.
authentication.ticket.ticketsExpire=true

What is the expiry mode for alf_ticket?
If ticket expiry mode is set as true as mentioned in above configuration property then you can also configure when should alf_ticket get expired. The following configuration property takes care of it.
authentication.ticket.expiryMode=AFTER_INACTIVITY
By default, it is set to AFTER_INACTIVITY (we will see in next section how does it is determined that user is inactive). You can configure this property's value in alfresco-global.preoprties file.
The other two possible values for this configuration property are AFTER_FIXED_TIME and DO_NOT_EXPIRE.
When authentication.ticket.ticketsExpire is set to true, you should either set this property to AFTER_INACTIVITY or AFTER_FIXED_TIME. When authentication.ticket.ticketsExpire is set to false then use DO_NOT_EXPIRE as the value.

When does alf_ticket expire?
When authentication.ticket.ticketsExpire is set as true and authentication.ticket.expiryMode is set as AFTER_INACTIVITY or AFTER_FIXED_TIME then you can configure what is the valid duration for alf_ticket validity using the following property authentication.ticket.validDuration in alfresco-global.properties file.
By default, it is configured to be valid for PT1H i.e. valid for one hour.
The way it works is, if expiryMode is set as AFTER_INACTIVITY then if user does not do any activity during one hour then ticket automatically gets expired.
If expiryMode is set as AFTER_FIXED_TIME then if user do or don't do any activity then still the ticket gets expired after one hour.

How to invalidate alf_ticket explicitly?
For example, when user logs out you may want to invalidate the user ticket at the same time as soon as user is logged out. In order to do so, you can use out-of-the-box Alfresco web script.
Web script URL http://localhost:8080/alfresco/service/api/login/ticket/TICKET_1f80f5e7bcdad060f7c0de95889541f704979f10?alf_ticket=TICKET_1f80f5e7bcdad060f7c0de95889541f704979f10.
It uses the HTTP method DELETE. Also, note that we also have explicitly provided alf_ticket querystring parameter as well.

How to validate if alf_ticket is still valid or not?
If at any point of time, you want to find out if alf_ticket for the user is still valid or not, you can use the following out-of-the-box Alfresco web script. It is basically the same web script url we used in above section however, it is invoked using HTTP GET method instead of DELETE.
http://localhost:8080/alfresco/service/api/login/ticket/TICKET_1f80f5e7bcdad060f7c0de95889541f704979f10?alf_ticket=TICKET_1f80f5e7bcdad060f7c0de95889541f704979f10
Note here that, we have to also explicitly pass alf_ticket querystring parameter as well in order to execute the web script.
If the ticket is valid for the given user, it will return 200 OK as the response. If the ticket is already expired or belongs to some other user then it will return 404 NOT FOUND as the response.

Hope this fast facts will be helpful to you.











Friday 20 May 2016

Nine Things You Must Know about Alfresco - an Open Source ECM System

As mentioned earlier in my post that I have contributed an introductory article about Alfresco on Open Source For You which is a complete magazine on Open Source and plays an important part of Open Source culture in India.The article has got published in Open Source for You print magazine for May-2016 edition.



Tuesday 17 May 2016

Book Review - Alfresco for Administrators


I have just completed reading the recently published book on Alfresco titled Alfresco for Administrators authored by Vandana Pal, published by Packt publishing. This book is a fast paced guide providing details about various things you should know while administering Alfresco. In general, it is a good book and I thought to share my review here with you. Hope it would be useful to you.

In summary
A quick read and handy book focusing on administration part of Alfresco primarily the enterprise version. This book will make you familiar with the various aspects of administration part of Alfresco. Author has done a good job to keep the things simple and explain the details in simple and easy to understand way. For example, some details such as clustering, search, various consoles in Alfresco, upgrade process, roles and permissions and so on are explained nicely in very simple words that will surely help someone new to Alfresco to understand these concepts. For best practices or tips and tricks, this book will give you pointers at high-level and you may have to explore them based on your application scenario. From the execution part of the book, I found some typo errors, inconsistencies in mentioning the same thing at various places and some text formatting issues, which as a reader I do not like while reading the book. Overall I would give 3.5 stars to this book out of 5. Good one for newbies to Alfresco and quick fast paced reference guide to seasoned Alfresco professionals. 

If you are interested in chapter by chapter review, following is the chapter wise review in full length.

Chapter-1 - Understanding Alfresco - provides an overview of Alfresco and mentions some of the key features of Alfresco, describes about Alfresco architecture and how alfresco can be used in ECM requirements.
  • The way chapter goes step-by-step from overview to features to architecture to business use cases is really good. However, in my opinion, some details should have been presented in more appropriate way so as readers can benefit more. For example, it says that "Alfresco Community Edition is only for small-scale development or research purposes. It is not recommended for production systems as there are certain functional differences." Instead, it could have been represented in a better way, such as - "Any small to medium businesses can use Alfresco Community Edition in production in non-critical applications considering in mind that it needs to be self-supported with the help of community resources."
  • It points to the following link - https://wiki.alfresco.com/wiki/Enterprise_EditionAlfresco for differences between community and enterprise editions. However, this wiki page is outdated and does not have any content.
  • The feature section does not specifically describes the new features available in Alfresco 5. However, it provides the generic features of Alfresco as an ECM, that is good so as user can know the overall features in Alfresco. In features section, Transformation capabilities of Alfresco could also have been added.
  • Under external integration section, it is only mentioned about Java based portal such as Liferay. However, you can have any custom front-end which can invoke REST calls and connect to alfresco using REST APIs.
  • Alfresco architecture diagram is at very high-level. "Rest" should have been mentioned as REST I think. If you are a newbie to Alfresco then from Alfresco documentation, you will get the more appropriate and detailed understanding of Alfresco architecture. I will prefer to use that for getting Alfresco architecture understanding if you are a newbie.
  • I really like the way business use case for Document management is explained with Contract Management example which gives good insight about how Alfresco can be used as Document management system.
Chapter-2 - Setting Up the Alfresco Environment - takes you through installing alfresco through an installer wizard on windows, then installing alfresco manually in Linux with MySQL database and Tomcat server. Next, it explains installing alfresco with postgreSQL database on JBoss server. You may be already familiar with all of it if you are experienced working with Alfresco. However, new comer may find the details provided here as useful.

I was very excited when I read the section header - Troubleshooting tips and best practices. This section does provide some very good tips and tricks. However, there weren't any supporting examples there. It is pretty much describing the tips in very generic way. For example it says that, Based on your application needs, there should be enough memory allocated on the server. It would have been great if an example would have been provided which describes memory allocation requirement for a sample use case application. For most of the tips, I found supporting examples missing. If there would have been example with each tip (where possible), it would have added a great value to the book and would have been very useful for the readers.

Chapter-3 - Alfresco Configuration - covers the various configurations in Alfresco. Although this chapter is having some good information, I found typo errors and formatting oversights here and there in the whole chapter as following
  • Typo on first page, <TOMbCAT_HOME>
  • Somewhere the paths to location of files in Alfresco are referenced using <TOMCAT_HOME>, somewhere they are referenced using <install_folder>. Consistency here would make reading easier from reader's perspective. 
  • Formatting of entire XML code snippet was having extra double quotes as following <bean id=""googledocs""...which does not help to make the reading experience better. 
  • Another, formatting related issue was about, Fonts are of code style for description of content store related properties. It should have been regular text there. Same thing goes for search engine related properties and for properties of other sections as well for making it is easy to read. 
  • Another one is, In Auditig section - "Using audit, trail administrators..." should be "Using audit trail, administrators..."
  • It is mentioned that - repository.properties is moved to a JAR file. Name of the JAR file could have been provided for easy read and would have surely helped.
  • Then to a surprise, under Auditing section, location of repository.properties file is provided which is not a correct location. As described earlier, It is in the JAR file.
I really like the explanation of category and type for subsystems and how the folder structure looks based on the sub-system category and type name and it is very clear to understand.

Chapter-4 - Administration of Alfresco - talks about Administration of Alfresco. You will find some useful information about administering alfresco using different consoles available. I am not sure why Alfresco web client is covered here as it has already been deprecated and overall the book mainly focuses on Alfresco 5. Along with useful information, I again came across some typo/formatting issues as following.
  • There is a sentence - "let's say the marketing team is your Alfresco repository" under Model and Messages Console section does not make any sense. Looks like some meaningful sentence has been formatted while editing.
  • Also, the admin group name is specified wrongly under section Admin console in Alfresco Share. It should be ALFRESCO_ADMINISTRATORS instead of Alfresco_Administrator.
  • Again while pointing to the code location in alfresco installed directory, I found <Alfresco_Home> is used. In earlier chapter it was used as either <TOMCAT_HOME> or <install_folder>. It should have been consistent everywhere.
If we ignore these minor mistakes then this chapter is certainly having very useful information you must know.

Chapter-5 - Search - is all about search using solr in Alfresco starting from installing solr separately, understanding the folder structure, configuring it, administering using the search admin console. I have stopped looking at the typo errors now and focusing more onto the content only. This is a good chapter and helps you understand how search works using solr in Alfresco in a better way. In my opinion, Full re-indexing process in solr could have been explained in a better way as for a newbie to follow the present way it has been explained may be bit time consuming and bit difficult to follow.

Chapter-6 - Permissions and Security - Really a very good chapter. Roles in Alfresco are explained very nicely and very easy to understand. As compared to earlier chapters, here OOTB file placed in a jar is mentioned with appropriate JAR name which is really helpful. However, there is a repetitive 
section for permissionDefinitions.xml mentioning its JAR file location. 
Also, to access alfresco server, somewhere it is mentioned as hostname:port and somewhere ipaddress:port. Even though both leads to the same, however consistency would surely have helped reader. (I mentioned I stopped looking at typo/formatting, but as these one were came across straight to my eyes so thought to add here)

Chapter-7 - High Availability in Alfresco - explains about the basics of clustering and how to achieve it in Alfresco in very simple words and you can easily understand the concept. Backup and restore process are also nicely explained. As an administrator, you will find this chapter very useful.

Chapter-8 - The Basics of the Alfresco Content Store - describes all the required details about content store such as the important directories, caching, encrypted content stores and so on. It also then provides a walk through about some of the key tables in Alfresco database schema. Any quick examples would have been great here if provided such as in which scenario you may want to troubleshoot from database and how you will do it. Later in the chapter, content life cycle in Alfresco is explained very nicely. Easy to read and understand. In my perspective, This chapter could have been placed after chapter-4.

Chapter-9 - Maintenance and Troubleshooting - provides an overview on how to monitor/configure Alfresco using JMX without server restart. Some useful points about JVM tunning, disk space maintenance, database tuning and monitoring are provided which are helpful to know for every administrator. Later in the chapter you will find details about how to get audited entries from Alfresco which is also useful.

Chapter-10 - Upgrade - explains about the upgrade path you should follow when moving to the newer version of Alfresco from the earlier version. A diagram would have added more value and could have helped reader understand the upgrade path easily. You will find the upgrade guidelines provided here as useful. Overall good and informative chapter to get introduced to upgrade process in Alfresco.


Saturday 14 May 2016

2 out-of-the-box repository REST APIs you must keep handy while working with content in Alfresco

As an Alfresco developer, you should always know some of the basic things about content, such as - How to view a content? How to download a content? How to list down all the content from a folder and so on. In Alfresco, you have out-of-the-box repository web scripts available which takes care of all of the above. You must keep yourself familiar with these web scripts.

Let's take a look at 2 very useful content related repository web scripts (which basically are useful for 4 things). In my opinion, you must keep these 2 web scripts handy with you while working on any alfresco implementation. I have used Alfresco 5.1 Community Edition here.

1. View Content

In order to view a content, you should make a GET request to the following URL.

http://localhost:8080/alfresco/service/api/node/content/workspace/SpacesStore/18d2fa04-70ba-4865-afe6-e097b75f0576
Note:You must replace server, port and nodeid in the above URL as per your implementation.

When you hit the above URL, it will display the content in your browser. You may use it for previewing the content.

You can take a look at the description document of this web script at the following URL and can also try out the different URL options supported for viewing a content as mentioned there.
http://localhost:8080/alfresco/service/description/org/alfresco/content/content.get

2. Download Content

To download a content, you will be using the same web script we used above however only additional option that you will provide is a querystring parameter a=true

http://localhost:8080/alfresco/service/api/node/content/workspace/SpacesStore/18d2fa04-70ba-4865-afe6-e097b75f0576?a=true

When you hit the above URL, it will download the content.

3. Get list of contents from a specific folder

To  get a list of all the contents of a folder, you can hit the following web script.

http://localhost:8080/alfresco/service/slingshot/doclib/doclist/documents/node/workspace/SpacesStore/e0856836-ed5e-4eee-b8e5-bd7e8fb9384c

As highlighted in above URL, when you specify documents, it fetches all the documents for a given folder.

Description document for this web script can be found at
http://localhost:8080/alfresco/service/script/org/alfresco/slingshot/documentlibrary/doclist.get

3. Get list of  the contents & folders from a specific folder

To get a list of both contents & folders from a specific folder, you can hit the following web script. It is basically the same web script we used in #3. Only difference is, instead of specifying documents we will specify all there. If you specify anything except documents then it will list down both content & folders.

http://localhost:8080/alfresco/service/slingshot/doclib/doclist/all/node/workspace/SpacesStore/e0856836-ed5e-4eee-b8e5-bd7e8fb9384c
OR
http://localhost:8080/alfresco/service/slingshot/doclib/doclist/both/node/workspace/SpacesStore/e0856836-ed5e-4eee-b8e5-bd7e8fb9384c

One important thing to take a note over here is that both the above web scripts have lifecycle mentioned as internal. Hence, they are for alfresco internal use only and there may be the chances that it may get changed in future versions of alfresco. Hence, if you want to use them for integration purpose in your project then you must keep this point in consideration before using them. However, from a developer perspective it is a must to know about these web scripts available in Alfresco so as it will be helpful to you while working on any content related issue.

Hope this will be useful to you.

Saturday 30 April 2016

Quick way to disable upload file button for a specific folder in Alfresco Share

We all like to develop based on the best practices and that is what I recommend as well. However, sometimes in the interest of time, we may have to go for a quick solution considering the practical situation. For example, think of a scenario where you are preparing for a demo and at last moment you realize that you need to take care of some specific use case. I am sure, you must be looking forward to know how quickly and easily you can achieve it. That's where quick solutions would be very helpful. Here I am going to share with you one such quick trick which may be helpful to you somewhere sometime.

While working on Alfresco you may have come across a use case that, you want to disable upload file button in Alfresco Share for some specific folder and all folders under it.

Here is how you can have it working just in 5 minutes for your Alfresco Community 5.1 installation.

1. In your Alfresco installed directory, copy code from toolbar.js to toolbar-min.js at the location tomcat/webapps/share/components/documentlibrary/
[Note : It is always recommended to have your client side JS files minified for having a better page load performance. Although we are knowing that, however in order to get the things ready in the interest of time, we are not minifying the JS here]

2. Add following code snippet under onFilterChanged function in toolbar-min.js.Provide the folder name for which you want to hide the upload button.

//Custom start
if(this.doclistMetadata.parent.properties["cm:name"] == "Folder Name|| this.currentPath.indexOf("Folde Name") !== -1) {                       
        this.widgets.fileUpload.set("disabled", true);
} else {
        this.widgets.fileUpload.set("disabled", false); 
}
//Custom end

Above change in toolbar-min.js, will appear as shown in the following screenprint. Highlighted in blue is the custom code we have added to disable the upload file button for a folder named MyFolder and all its subfolder.

code snippet to disable upload file button for a specific folder and its subfolders
Hope this would be helpful.


Monday 4 April 2016

I have contributed an article about Alfresco on Open Source For You

Pleased to share with you that I have recently contributed an article on Open Source For You (OSFY) which talks about some of the basic key capabilities everyone must know about Alfresco. Take a look at 9 Things you must know about Alfresco – An Open Source ECM on OSFY which was formerly known as Linux For You. It has been Asia's first publication about Linux and Open Source Software. It's a complete magazine on Open Source and plays an important part of Open Source culture in India.

Friday 1 April 2016

3 Alfresco Share add-on topics to enhance user experience with Alfresco

Add-on is a great way to have additional functionalities/features/customization added on top of out-of-the-box Alfresco. Having the add-on with great functionalities which is freely available adds a lot of value for anyone using Alfresco.

I have 3 topics in my mind for Alfresco Share add-on and I think once implemented they surely will be useful for the users using Alfresco and will enrich their experience using Alfresco.

The list goes as following.

1. Workflow routing when user is out-of-office
Workflows are the integral part of any business solution implemented using Alfresco. Think of a scenario where a user is going on vacation and he wants to set someone else as an approver on his behalf for that specific duration. Hence, during his vacation period all the workflow tasks those are going to be assigned to him, should be sent to the approver he has setup. This seems to me a very generic functionality and having it implemented will surely complement out-of-the-box Alfresco Share workflow functionality and will help end users to have a simplified process.

2. Workflow assignees from a specific group
Sometimes in a workflow process, it may happen that you want to assign task to some users from some specific group only (not want to assign workflow task to entire group) and not want to search for users from the entire repository while selecting the assignee for the task. Instead you just want to have the select assignee popup pre-populated on the left hand side with users from the specific group for the workflow task and from this list user can select assignees. This will make it very easy for the end user to select the next approver and need not to worry about searching specific user from the repository in such scenarios.

3. Enhanced view of document details
Presently, from the document library, user clicks on a document which opens up document details screen and from there if user wants to take a look at another document, he has to come back to document library folder again. What if we have an additional view where the document/folder tree would be on the left hand side on document details page and click on it and the document details get updated with the newly selected document. Hence, from a single screen user can take a look at details of document without going back. I think this will be very useful.

These are the topics at high-level and if I get time would like to work on it to get them implemented and available as freely available add-on. If you have any comments to share on this ideas or any thoughts you have on this ideas, do share your thoughts. Also, if you would be interested to develop and contribute them as freely available add-on you are most welcome.

Another one topic that is not related to user experience however, it can help while working on some production issues. Sometimes it may happen that some functionality is not working for some XYZ user in production environment. While solving the functionality, only the issue description would not suffice and you may have to do followups with user in order to understand the problem. What if there is an option, wherein admin user has privilege after login to alfresco to run as other user. For example, admin user selects to run the present session as XYZ user to see what is going wrong and later on switch back from this context to his own. Just an idea and not sure how feasible it is, however I think could be a great help while solving/debugging some critical issues.

Wednesday 23 March 2016

Get to know the technology stack used by Alfresco...

While working on Alfresco, Have you ever wondered what are the different open source modules or underlying technologies used in Alfresco?

Everyone of us must be knowing about the technologies at a high-level such as spring, acitiviti, solr and so on. However, that is not the complete list of technology stack. There is more to it.

For your knowledge and reference, If you are interested to know the details on the underlying technologies and open source modules used by Alfresco then you can easily find about it from your Alfresco installation. Just navigate to the file called notice.txt at the location {Alfresco_installed_directory}\licenses folder and it lists out everything you should know. 

In my view, it seems to be the best place where all the information about technology stack used in Alfresco is collectively available at a single place. Hope you find this information useful.

Note : I used Alfresco Community 5.0.d as reference Alfresco version for this post as I am having it installed presently on my machine.

Thursday 10 March 2016

2 Quick & Easy ways to know your Alfresco version details...

With each new release of Alfresco, there are many new features getting added to Alfresco which are really useful and makes Alfresco product really cool. The most recent release was Alfresco 5.1. Hope you have checked about the new features of the latest release Alfresco 5.1 Community Edition and Alfresco One 5.1 (Enterprise Edition)

Now, while working on Alfresco and especially if you are new to Alfresco, it may sometimes happen that you want to know the details about the exact version of your Alfresco in order to refer to the appropriate documentation link and even to ask the question in Alfresco forum with specific Alfresco version details.

I am sure you must also have had figured it out as well. However, here are the two quick and easy ways you can easily find your Alfresco version detail when your Alfresco is up and running and even when your Alfresco is not running.

Know Alfresco version details when Alfresco is NOT running

You need not to wait for your Alfresco to be up and running in order to know the Alfresco version details. You can get to know the details even when Alfresco is not running. Following is how you can know it. Inside your Alfresco installed directory, you can find version.properties at the location \tomcat\webapps\alfresco\WEB-INF\classes\alfresco.This file contains all the required details about the alfresco version as shown in the following screen-print. It contains all the details you should know about your Alfresco.
Alfresco version details


Know Alfresco version details when Alfresco is up and running

When Alfresco is up and running, it is even simpler to know the version details. Simply hit the url http://localhost:8080/alfresco (modify the host and port as per your installation) and you will be shown with the following screen. You get to know Alfresco version details such as label, edition and version build number as highlighted below.
Alfresco version details

These are the 2 quick and easy ways to find your Alfresco version details.


Saturday 5 March 2016

Behind the scenes of Alfresco Share Login page...

Alfresco Share Login page is the first screen you get to see when you access the Alfresco Share URL. As soon as you provide valid credentials, you are logged into the Alfresco Share, having access to the alfresco repository. Entering wrong credentials on login page displays an error message and doesn't allow you to login.

While working on the projects, you may have come across the scenarios wherein you need to modify the login page look and feel as per the client requirements. You may sometimes want to perform some logic on completion of successful login and so on...

Here is alfresco documentation link about how you can override the default login page in Alfresco Share. It's an excellent resource and provides step by step instructions to get the job done easily. If you are interested to understand how this happened so easily then you may be interested to find out how it works out-of-the-box. As a developer my viewpoint is always that, In order to do any customization,  it is essential to understand how it is working out-of-the-box. This will help you have a good understanding about how to easily customize it.

Let's have a quick look and get to know about behind the scenes working of Alfresco Share login page.

How Alfresco Share Login page gets displayed?

Alfresco Share is a web application. Once successfully deployed on Tomcat server, As soon as you hit http://localhost:8080/Share, it looks for the entries defined under <welcome-file-list> in  web.xml.It is the core file for any web application.
1

It defines index.jsp as the welcome file as shown in the code snippet here in the right side. Hence, this is the first page which should get rendered.


Note: The code snippets I have taken from my local alfresco installation. C:\Alfresco is the alfresco installed directory.
2


If we take a look at the code inside index.jsp, it simply does a redirection to the URL "page/".


3



Now, in order to process the request, the appropriate servlet needs to be invoked. Servlet mapping for above URL can be found in web.xml file as shown
in the code snippet here.


The corresponding servlet is org.springframework.web.servlet.DispatcherServlet and it's entry is defined in web.xml.

During the request processing, when there is no page included in the request, such as we saw above like page/, Spring MVC request dispatcher by default tries to render the default configured landing page for the site.

Default site configuration is specified in surf.xml as highlighted in the code snippet below. surf.xml is a key file which contains the default configurations for the surf application.

4

You should be able to find the above mentioned site configuration file slingshot.site.configuration.xml at the location \tomcat\webapps\share\WEB-INF\classes\alfresco\site-data\configurations inside your alfresco installed directory.

Now, here starts the interesting stuff. If you go through the above configuration file code, it specifies the <root-page>site-index</root-page>.That is basically the surf page-definition name. Inside the location \tomcat\webapps\share\WEB-INF\classes\alfresco\site-data\pages, You should be able to locate site-index.xml file.
5
As highlighted in the code-snippet above, it specifies the authentication as user. This is the point where Share application identifies that in order to access the default landing page, user must be authenticated. Hence, now it tries to redirect the user to the login page. Now, let's understand how it does this.

6
The default configuration for login page is specified in the surf.xml as shown in the code snippet. Here, basically the login page-type mapping is specified for surf page instance id
slingshot-login.
Now, there are corresponding surf components for this page instance id such as related page definition, template instance, template type and related presentation tier web script. Following is the details about it.

Login page related Surf Components
  1. The corresponding page definition slingshot-login.xml for login page type mentioned above can be located at tomcat\webapps\share\WEB-INF\classes\alfresco\site-data\pages.It  basically specifies the corresponding template-instance as simple-guest and also it specifies the corresponding presentation web script at share tier.
  2. Template instance simple-guest.xml is located at \tomcat\webapps\share\WEB-INF\classes\alfresco\site-data\template-instances. It refers to the template-type org/alfresco/simple-guest
  3. Template type simple-guest.ftl is located at \tomcat\webapps\share\WEB-INF\classes\alfresco\templates\org\alfresco
Presentation-Tier web script

Nicely looking login page of out-of-the-box Alfresco Share is displayed using the presentation tier web script residing at the location tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\guest inside of your Alfresco installed directory. Following are the web script documents for this web script.
  • Web script description document - login.get.desc.xml
  • Server side JavaScript controller - login.get.js
  • Response template - login.get.html.ftl
  • CSS dependency - login.css 
  • Client side JavaScript - login.js
The last two files above can be located at tomcat\webapps\share\components\guest in Alfresco installed directory.

The controller of this web script primarily sets up the essential details for the login form such as form submit action URL, url to redirect to on successful login and also for failure on login.

Response template login.get.html.ftl specifies the complete Login form that gets rendered on the screen.

This is how the login page gets displayed on the screen. Now what next? 

What happens when you submit the Login button?

When login page is submitted, POST request gets triggered to the url /page/dologin. If you take a look at login.get.html.ftl,you should be able to easily find it. This basically references a SpringSurf controller whose id would be dologin.There will be a corresponding bean which would be having the implementation to handle the login request,which we will see in the next section.
Inside share-security-config.xml located at tomcat\webapps\share\WEB-INF\classes\alfresco, a rule is setup as a part of CSRF filter config to not require any token for the request.

Login Form Submission URL Mapping

As we discussed above, Inside slingshot-application-context.xml located at tomcat\webapps\share\WEB-INF\classes\alfresco, url mapping has been specified for /dologin url pattern which maps to a bean id loginController in order to get the authentication done.

Login Class

loginController bean id is mapped to the back-end class org.alfresco.web.site.servlet.SlingshotLoginController which extends org.springframework.extensions.surf.mvc.LoginController.
In SlingshotLoginController class, once user authentication is successful then corresponding group memberships for the authenticated user are retrieved. Actual authentication is performed inside the handleRequestInternal() method of 
org.springframework.extensions.surf.mvc.AbstractLoginController 
class,which is a parent class of org.springframework.extensions.surf.mvc.LoginController.

Okay, that is good enough, we got to know that which method performs the actual authentication, 
But how the actual login happens? How Share connects to Alfresco repository and authenticates the 
given user?

How user is authenticated actually?

The controller defined above uses the user factory. Default user factory is specified in surf.xml.

7

It uses the user factory bean id specified in surf.xml as shown in the code snippet.

The corresponding bean definition for above mentioned id is 
org.alfresco.web.site.SlingshotUserFactory and is specified in 
slingshot-application-context.xml.

To connect to alfresco repository and authenticate the user, it uses the alfresco endpoint 
which is bind to use the alfresco-ticket authenticator. The relevant class for this authenticator is 
org.springframework.extensions.webscripts.connector.AlfrescoAuthenticator, 
which basically invokes api/login web script and authenticates the user. 

The above mentioned endpoint configurations can be found in the file spring-webscript-config.xml 
that can be located at org\springframework\extensions\webscripts inside 
spring-webscripts-*.jar in tomcat\webapps\share\WEB-INF\lib.
This is how it does the authentication against the alfresco repository. 
We went too much technical...isn't it?

Now, if the authentication is successful then based on the success url we specified in our presentation
tier web scripts controller implementation, it navigates to the default landing page.
If user credentials are invalid then using the failure URL, user will be redirected back to the login 
page itself.

That's it...! We have just deep dived into the technical details about understanding the out-of-the-box
login page internals. Hope you find this information useful for your reference.