Alfresco-Integeration-PRPC - PDN

Installation and configuration of Alfresco Server
We are choosing 4.2 version of 32 bit.
Default user name is “admin” and password of your choice. This credential is used to manage alfresco server.
Then installation continues.
Alfresco server installs its own Tomcat server and Postgres data base to use. It also installs a manager tool to start
and stop tomcat and data base.
Login to Alfresco Explorer from start menu with admin user name password you gave during installation
Click on Company home then create -> Create Space. This space is nothing but a folder to store PRPC attachment.
We will mention this space name in PRPC configuration as well.
PRPC Configuration
Login to PRPC developer studio and go to application rule form.
Select advanced tab in application rule page. This tab has setting to connect to Alfresco server. Click “Enable for
attachment:” check box. This will present a warning; this warning says that if you disable this option later, then all
work attachment will failed to open as they are stored in content management.
For connecting alfresco server we need to create a CMIS Connector rule. Enter any name in “Connector Name”
text field and click on edit rule button beside it.
Enter the name of connector and class name where this connector will belong
Click on Create button, it will show below rule creation form. Here you need to create an Afresco Server rule which
will establish connectivity with server. To do so, enter a name in “Server Instance” text field and click edit rule
button located beside.
Clicking Edit rule button will open Alfresco Server creation form as shown below. Enter URL and user/pass as
shown below and fist save the rule then click on Test Connectivity button. The rule should able connect to server.
Go back to Connector rule form and select repository name as “main repository” and save it first then click on Test
connectivity button. Connectivity should be fine otherwise check server rule and its connectivity for errors.
Go back to Application rule form and click on “Browse” button to select the Space name (directory we created in
configuration section of this document) for storing attachments. Don’t try to save the application before selecting
the space name, it will fail.
After saving application rule, it will look as shown in below figure.
NOTE – JUST AVOID THE WARNING MESSAGE YOU ARE GETTING AFTER SAVING THE APP RULE. THIS
WARNING WILL BE GONE, WHEN YOU CONFIGURE THE ALFRESCO FOR STORING META DATA
INFORMATION.
To test the application for attachment, close all open tabs and log out from current session and log in
again.
Open any work item and attach a document as shown in below figure.
Note – don’t get confused with “TestFile”, this is description you gave wile uploading the file in work item.
Open Alfresco explorer and click on “Pega Document” Space. You should see an entry for the file you uploaded
from PRCPC, then click on “View Detail” option for the same file.
Providing Meta data about PRPC with attachment in
alfresco
If you carefully look at the properties of file attached in alfresco server, you would notice that there is hardly any
information about the work item to which file belongs to. This section is about attaching PRPC information with
file. The information which can be attached with files is PRPC specific only, like
pxAttachKey (mapped to PRPC work object attachment creation timestamp)
pxRefObjectKey (mapped to PRPC work object ID)
To do this we need to do some configuration at alfresco server so that it should accept above information along
with actual file and show them to properties panel of file. Below are three configuration files, needs to be placed in
ALFRESCO_HOME/tomcat/shared/classes/alfresco/extension directory.
.
Pega-model.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Definition of new Model -->
<model name="pega:pegaModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Optional meta-data about the model -->
<description>Pega Model</description>
<author>Praneeth</author>
<version>1.0</version>
<!-- Imports are required to allow references to definitions in other models -->
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
</imports>
<!-- Introduction of new namespaces defined by this model -->
<namespaces>
<namespace uri="http://www.pega.com/model/content/1.0" prefix="pega" />
</namespaces>
<types>
<type name="pega:workObjectAttachment">
<title>work object attachment</title>
<parent>cm:content</parent>
<properties>
<property name="pega:pxAttachKey">
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="pega:pxRefObjectKey">
<type>d:text</type>
<mandatory>true</mandatory>
</property>
</properties>
</type>
</types>
</model>
pega-model-context.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!-- Registration of new models -->
<bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" dependson="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/pega-model.xml</value>
</list>
</property>
</bean>
</beans>
web-client-config-custom.xml [This file would be there with .sample extension , you need change the extension
to xml and place below content under <alfresco-config> tag]
<config evaluator="node-type" condition="pega:workObjectAttachment">
<property-sheet>
<show-property name="name" show-in-edit-mode="false" />
<show-property name="mimetype" display-label-id="mimetype"
converter="org.alfresco.faces.MimeTypeConverter"
show-in-edit-mode="false" />
<show-property name="title" show-in-edit-mode="false" />
<show-property name="description" show-in-edit-mode="false" />
<show-property name="size" display-label-id="size"
converter="org.alfresco.faces.ByteSizeConverter"
show-in-edit-mode="false" />
<show-property name="pega:pxAttachKey" display-label-id="Attach Key" show-in-editmode="false" />
<show-property name="pega:pxRefObjectKey" display-label-id="Reference Object Key" show-inedit-mode="false" />
</property-sheet>
</config>
<config evaluator="string-compare" condition="Content Wizards">
<content-types>
<type name="pega:workObjectAttachment" display-label="Pega WO" display-label-id="pwo" />
</content-types>
</config>
Restart the server after placing all these files to change configuration in server. Once server is restarted, go to
PegaDocuments-> AddContent -> Upload any file.
You will see below page, notice the value of Type property it should show a value $$PWO$$. This type is added to
server for Pega specific properties. PWO stands for Pega Work Object. If you do not see this type then check xml
file content and its location and make sure you restart the server [including all nodes, if server is in cluster] and try
again.
If you remember we talked about a warning with Application rule in this document which we ignored last time. The
purpose of that warning to inform you that Alfresco is not configured for attaching meta-data. Since we have done
all configurations at alfresco for meta-data, so if you save the application rule now the warning should disappear
now. Go to application rule page and save the application rule, the warning will disappear now. DO NOT MISS this
step otherwise meta-data will not be passed to alfresco server.
Attaching Meta-data with Work Item attachment
Open any work item and attach a file and check the detail of the file in alfresco server. This time you will find two
extra properties as shown in below figure.