At several ocassions while XOG'ing between environments, you face an issue of XOG returning an error because of special characters inside the XOG XML file being pushed. Mostly these are special characters that XOG doesn't like and those are mostly not detected via Visual inspection. For quite some time, I have been using simple but effective method to Remove those special characters from XOG file(s).
Step 1 : Open XOG file in TextPad (or any Text editor supporting Regular Expression Search/Replace feature)
Step 2 : Press F8 to open Replace window and Do Find/Replace as :-
Find : [^&;:()a-zA-Z0-9" =./><_-~-]
Note : If you find any other character which should be there but found in search, include in above expression after &. Be careful if you are choosing "Replace All" option as you may blank out character(s) which were actually needed to be XOG file. Secondly, if you have many files to 'Sanitize' then load all those document in Textpad and set the 'Scope' to 'All documents' in Find/Replace search dialog box.
As per Martti's question/suggestion I am sharing method for removing Non-English Language codes from XOG file.
Step 1 : In Textpad > Configure > Preferences .. > Editor > Check "Use POSIX Regular Expression Syntax"
Step 2 : Search and Replace blank for .*<nls.*languageCode="([^e].|.[^n]).*\n (This will remove languageCode appearing in Single line)
Step 3 : Search and Replace blank for .*<nls.*\n.*languageCode="([^e].|.[^n]).*\n (This will remove languageCode appearing in 2 lines)
Step 4 : Search and Replace blank for .*<nls.*\n.*\n.*languageCode="([^e].|.[^n]).*\n (This will remove languageCode appearing in 3 lines)
To Test you can try this sample XOG file. These regular expression examples above are for "en" languageCode and include/exclude other Language codes by making changes in above regular expressions. Explaining these expression would be lengthy so just leave your comments if you have any specific question or need, I would reply your queries.
Saturday, December 6, 2008
Sunday, November 30, 2008
[9] Admin Logging in as Different user
This one is my favorite ...
Many a times it is needed that 'Admin' ( or Support Staff ) needs to login as different user in Clarity. Primarily it's Support/Admin person's perspective to login as User who is facing some issue(s) and attempt to resolve it. So far it has been bit lengthy process of Disabling the ldap and changing the password of user in database and reverse the process after 'troubleshooting' is done.
I faced this problem initially ( after my bootcamp ) and thought to evolve a easy solution where 'Admin' should be able to log in as any user with ease.. Many thoughts came in mind like creating a SP based Clarity job or a Web page to creating a user Session through Web service and redirect to Overview page using that Session ID and many others... but then finally came up with workaround which according to me was less hassle when compared to other ones...
Workaround : Admin user ( cmn_sec_users.user_name = 'admin' ) can now login as other user ( say williamR ) from Clarity Login page itself. What Admin user would need to do is simple... In Login field ( of Clarity login page ) type Admin/williamR and supply Admin's own password ( Like Screenshot below ) and Hit 'Login' button to login as williamR user.
Solution : Download. This zip file contains instruction for Both SQL Server and Oracle based Clarity instances. Take the backup of the file which is being changed to some safe location, should there be need to revert for any reasons. ( I have tested it on Clarity 7.5.x, 8.x & 12.x versions )
* Post your comments or email the blog's email id, if you face any issues or this doesn't work for you.
Many a times it is needed that 'Admin' ( or Support Staff ) needs to login as different user in Clarity. Primarily it's Support/Admin person's perspective to login as User who is facing some issue(s) and attempt to resolve it. So far it has been bit lengthy process of Disabling the ldap and changing the password of user in database and reverse the process after 'troubleshooting' is done.
I faced this problem initially ( after my bootcamp ) and thought to evolve a easy solution where 'Admin' should be able to log in as any user with ease.. Many thoughts came in mind like creating a SP based Clarity job or a Web page to creating a user Session through Web service and redirect to Overview page using that Session ID and many others... but then finally came up with workaround which according to me was less hassle when compared to other ones...
Workaround : Admin user ( cmn_sec_users.user_name = 'admin' ) can now login as other user ( say williamR ) from Clarity Login page itself. What Admin user would need to do is simple... In Login field ( of Clarity login page ) type Admin/williamR and supply Admin's own password ( Like Screenshot below ) and Hit 'Login' button to login as williamR user.
Solution : Download. This zip file contains instruction for Both SQL Server and Oracle based Clarity instances. Take the backup of the file which is being changed to some safe location, should there be need to revert for any reasons. ( I have tested it on Clarity 7.5.x, 8.x & 12.x versions )
* Post your comments or email the blog's email id, if you face any issues or this doesn't work for you.
Thursday, November 27, 2008
[8] CA World 2008
Thanks for Attending my Session on "Integration with Clarity using Web Services" at CA World 08 at Las Vegas.
For those who attended, Here is the code that I used in Live Demo. This basically tells the steps to follow if you want to call an External Web Service from Clarity (Say Google's Search Web Service ) using GEL Scripts.
In this Example, A Custom Object instance is created and any google Search string is provided in "Name" field of the instance. When Save/Submit is clicked, a Process runs which calls a Gel script. Gel Script then calls Google Web Service and gets the data in XML format. Gel Script breaks the XML, Loops through, extracts required data elements, stores them in variables and then finally Inserts them into a Custom Table. Portlet is created and NSQL query based on that Custom Table displays the Google Search Result data.
In this Example, for simplicity Google Search Web Service is used, but in Real life scenarios you can pull Stock/Currency Exchange etc information on Periodic basis through Clarity job. Likewise you can also pull and use other Web Services provided by Internal applications like SAP, .NET/Java Applications, CA Service Desk, HR/Asset Management applications or product Suites.
In similar fashion, Other Internal Apps can also access Clarity's data through Web service. Clarity exposes it's Web Services at http://clarity-server-name/niku/xog that others can use.
Post a comment or mail me if you need some other/related examples or have any specific query.
Friday, August 29, 2008
[7] ASP.NET Calling Clarity Web Services - Code Example
Here is an Example of ASP.NET calling Clarity Web Services ( Here ASP.NET Calls Project XOG to get properties of a Particular Project )
Steps :-
1. Add Web reference http://localhost/niku/wsdl/Object/Projects and name it as PRJ
2. Create a New "ASP.NET Web application Project". Create a Multiline Textbox in it say Textbox1 ( To display XOG output )
3. On the PageLoad event add following :-
Dim PS As New PRJ.ProjectsService
Dim Log As New PRJ.Login
Dim Auth As New PRJ.Auth
Dim SoapXML As New System.Xml.XmlDocument
Dim DataBus As System.Xml.XmlElement
Dim XOGOutput As System.Xml.XmlElement
Dim sessionId As String
Log.Password = "admin"
Log.Username = "admin"
sessionId = PS.Login(Log)
Auth.SessionID = sessionId
PS.AuthValue = Auth
SoapXML.Load("c:\xog\Read_project.xml")
XOGOutput = PS.ReadProject(SoapXML.DocumentElement)
TextBox1.Text = XOGOutput.InnerXml
PS.Logout(sessionId)
4. Read_Project.xml looks like as below :-
---------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<NikuDataBus xmlns:xsi="http:// www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd">
<Header version="6.0.11" action="read" objectType="project" externalSource="NIKU">
<!-- you change the order by simply swap 1 and 2 number in the name attribute -->
<args name="order_by_1" value="name"/>
<args name="order_by_2" value="projectID"/>
<args name="include_tasks" value="false"/>
<args name="include_resources" value="false"/>
<args name="include_custom" value="false"/>
<args name="include_dependencies" value="false"/>
</Header>
<Query>
<Filter name="projectID" criteria="EQUALS">Clarity_test</Filter>
</Query>
</NikuDataBus>
------------------------------------------------------------------------------
* This was tested on Clarity 7.5.3.
Steps :-
1. Add Web reference http://localhost/niku/wsdl/Object/Projects and name it as PRJ
2. Create a New "ASP.NET Web application Project". Create a Multiline Textbox in it say Textbox1 ( To display XOG output )
3. On the PageLoad event add following :-
Dim PS As New PRJ.ProjectsService
Dim Log As New PRJ.Login
Dim Auth As New PRJ.Auth
Dim SoapXML As New System.Xml.XmlDocument
Dim DataBus As System.Xml.XmlElement
Dim XOGOutput As System.Xml.XmlElement
Dim sessionId As String
Log.Password = "admin"
Log.Username = "admin"
sessionId = PS.Login(Log)
Auth.SessionID = sessionId
PS.AuthValue = Auth
SoapXML.Load("c:\xog\Read_project.xml")
XOGOutput = PS.ReadProject(SoapXML.DocumentElement)
TextBox1.Text = XOGOutput.InnerXml
PS.Logout(sessionId)
4. Read_Project.xml looks like as below :-
---------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<NikuDataBus xmlns:xsi="http:// www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd">
<Header version="6.0.11" action="read" objectType="project" externalSource="NIKU">
<!-- you change the order by simply swap 1 and 2 number in the name attribute -->
<args name="order_by_1" value="name"/>
<args name="order_by_2" value="projectID"/>
<args name="include_tasks" value="false"/>
<args name="include_resources" value="false"/>
<args name="include_custom" value="false"/>
<args name="include_dependencies" value="false"/>
</Header>
<Query>
<Filter name="projectID" criteria="EQUALS">Clarity_test</Filter>
</Query>
</NikuDataBus>
* This was tested on Clarity 7.5.3.
Friday, July 25, 2008
[6] SQL Server 2005 configuration for Clarity
SQL Server 2005 Database configuration for Clarity :-
1. Login as sa
2. [ For 8.1 and below only ] Databases > New Database > Database Name : Niku > Options > Compatibility Level : SQL Server 2000 (80) ( Check installation Guide to confirm compatibility level for the version being installed )
3. Security > Create Login > niku ( Select SQL Server Login and give niku password )
4. Database > Niku > Security > Users > Create User > user Name : niku ; Login : niku
5. Database > Niku > Security > Schema > Create Schema > Schema Name : niku ; Schema Owner : niku
6. Security > Logins > Niku > Properties > User Mapping > Select Niku database Row > For Niku Database change 'Default Schema' to niku > In Below Pane check the role membership for 'db_owner'. 7. In Master database execute following commands :
ALTER DATABASE niku SET ARITHABORT ON
ALTER DATABASE niku SET ANSI_NULLS ON
ALTER DATABASE niku SET QUOTED_IDENTIFIER ON
ALTER DATABASE niku SET READ_COMMITTED_SNAPSHOT ON
GRANT VIEW SERVER STATE to niku
8. Install database from Clarity NSA.
* If you are restoring SQL Server database from Backup then run following command to fix niku login. (If there are more database users repeat this command for each user)
sp_change_users_login 'Auto_fix' , 'niku'
1. Login as sa
2. [ For 8.1 and below only ] Databases > New Database > Database Name : Niku > Options > Compatibility Level : SQL Server 2000 (80) ( Check installation Guide to confirm compatibility level for the version being installed )
3. Security > Create Login > niku ( Select SQL Server Login and give niku password )
4. Database > Niku > Security > Users > Create User > user Name : niku ; Login : niku
5. Database > Niku > Security > Schema > Create Schema > Schema Name : niku ; Schema Owner : niku
6. Security > Logins > Niku > Properties > User Mapping > Select Niku database Row > For Niku Database change 'Default Schema' to niku > In Below Pane check the role membership for 'db_owner'. 7. In Master database execute following commands :
ALTER DATABASE niku SET ARITHABORT ON
ALTER DATABASE niku SET ANSI_NULLS ON
ALTER DATABASE niku SET QUOTED_IDENTIFIER ON
ALTER DATABASE niku SET READ_COMMITTED_SNAPSHOT ON
GRANT VIEW SERVER STATE to niku
8. Install database from Clarity NSA.
* If you are restoring SQL Server database from Backup then run following command to fix niku login. (If there are more database users repeat this command for each user)
sp_change_users_login 'Auto_fix' , 'niku'
Tuesday, July 22, 2008
[5] Change default Timezone
Sometimes it is required to change the "Default timezone" of Resources when they are added through Studio or XOG/WebServices. Here is the way :-
Step 1 : Open C:\Niku\Clarity\config\i18n.xml
Step 2 : Change defaultTimeZoneId at Line #3
Tip : To find the timezone code, Open Account Settings page in Clarity and find it by looking into HTML Source of the webpage..
Note : Changes may need to re-applied after any Fixpack or version upgrade..
Step 1 : Open C:\Niku\Clarity\config\i18n.xml
Step 2 : Change defaultTimeZoneId at Line #3
Tip : To find the timezone code, Open Account Settings page in Clarity and find it by looking into HTML Source of the webpage..
Note : Changes may need to re-applied after any Fixpack or version upgrade..
[4] IE Developer Toolbar - A must have
Microsoft IE Developer Toolbar is great tool when it comes to Clarity Development & Support. I use it quite frequently primarily to identify Display field's internal database name, find lookup name, lookup values etc.. It eliminates the need of doing "view source" of Web page and digging into HTML code to extract relevant info ..
Step 1 : Install Microsoft IE Toolbar and it will added as add-in in IE.
Step 2 : Open any Clarity page.
Step 3: Click on IE Toolbar icon in toolbar (It shows up in lower pan)
Step 4: Click Find > 'Select Element by Click'
Step 5: Click on desired display field and it will show it's internal name.
Step 6. After having done with that Click Find > 'Select Element by Click' option to uncheck it (This will return webpage to normal display mode)
Tip : You can also click the first icon in place of Find > 'Select element by click'
Step 1 : Install Microsoft IE Toolbar and it will added as add-in in IE.
Step 2 : Open any Clarity page.
Step 3: Click on IE Toolbar icon in toolbar (It shows up in lower pan)
Step 4: Click Find > 'Select Element by Click'
Step 5: Click on desired display field and it will show it's internal name.
Step 6. After having done with that Click Find > 'Select Element by Click' option to uncheck it (This will return webpage to normal display mode)
Tip : You can also click the first icon in place of Find > 'Select element by click'
Monday, July 21, 2008
[3] Display logged in user name in Clarity Studio
Displaying logged in user name in Clarity Studio is a kludge. Implementing it in 8.1 is different than in 7.5.x. User Name can be displayed on top of Left Menu Navigation bar. Lets see how they can be implemented in both 7.5.x and 8.1 :-
Clarity 7.5.x
--------------
Steps :-
Step 1 : Open/Edit : C:\Niku\clarity\META-INF\union\xbl\menu\getMenu.xbl. Add following line just above the last line ( which contains says “</xbl:template>”)
<user userName = "{$userName}" userFirstName = "{$userFirstName}" userLastName = "{$userLastName}" />
Step 2 : Open/Edit C:\NIKU\clarity\META-INF\union\vxsl\menu.xsl. Add following after around 6th line and above line which says “<view type=navigation>”
<xsl:value-of select="concat(user/@userFirstName,' ',user/@userLastName)" />
Step 3 : Restart/Refresh app service and Refresh the page
Clarity 8.1
------------
Step 1 : Create Portlet Page (say Name: "My page", id:my_page)
Step 2 : Create Application Menu > Create Section (Name:Welcome, id:welcome_home) > Create Link (LinkName: USERNAME, PageName: My Page, ParentMenuItem:Welcome) > Reorder Menu items and Push "Welcome" to top.
Step 3 : If you wish to show User Name is Administration Menu, then repeat Step 2 for Administration Menu as well. Only difference keep Section id as 'welcome_admin'.
Step 4 : Open C:\Niku\Clarity\META-INF\union\pmd\personalization.xml. Locate "union.getMenuItems" SQL Statement (approx Line# 102). Be careful here... This SQL statement contains 2 Select statements separated by UNION. We need to focus on Second one (which is below '<!--Second half is for custom pages, including custom object lists-->' comment)
In Second SQL :-
REPLACE : ac.name
WITH : CASE WHEN ac.name = 'USERNAME' THEN </text></sql>
<sql dbVendor="oracle">
<text>
(Select First_name || ' ' || Last_name from srm_resources where user_id = ?)
</text>
</sql>
<sql dbVendor="mssql"> <text>
(Select First_name + ' ' + Last_name from srm_resources where user_id = ?)
</text>
</sql><sql><text>
ELSE ac.name
END name
Add following parameter as 9th parameter in list (after param replace="language" one which is 8th parameter)
<param replace="userId"/>
Verify if changes done looks like below (click to enlarge) :-
Step 5 : Give "My Page" access to all the resources by either setting as group or OBS global right. This is required to display Welcome menu section. [ As an alternative to giving Rights to all users, I updated POLICY_ID to NULL for "My Page" in CMN_ACTIONS table and it did work for me, though I am still testing this alternative..]
Step 6 : Restart/Refresh App to reflect the change..
------------------------------------------------------------------------------------------
Note : Intended for Testing/Research purpose only. New Fixpack/upgrade may overwrite these changes which may require to reapply these changes.
* It was the time when I was just new to Clarity and attending Bootcamp class.. I asked instructor if there is anyway to display logged in User name on Clarity Studio screen. I was told that it only displays in About window when it is Clicked. I researched a bit looked into Clarity XML code and thought I will try that tonight and it should not be tough.. That night when I started looking into things then it appeared that it was not that easy that I initially thought... After many failures and spending two sleepless nights, finally it was SUCCESS.. Next day in class I was quite sleepy but was excited to tell instructor that it's 'done'. It was 2 lines of codes in 2 files but it took 2 days for me.. It was also probably my first post at Clarity Forum (support.niku.com). This worked well in 7.5.x but it didn't work in 8.1. After some digging, kludge for 8.1 also evolved. Approach of which is different than 7.5.x and involves more number of steps.
Clarity 7.5.x
--------------
Steps :-
Step 1 : Open/Edit : C:\Niku\clarity\META-INF\union\xbl\menu\getMenu.xbl. Add following line just above the last line ( which contains says “</xbl:template>”)
<user userName = "{$userName}" userFirstName = "{$userFirstName}" userLastName = "{$userLastName}" />
Step 2 : Open/Edit C:\NIKU\clarity\META-INF\union\vxsl\menu.xsl. Add following after around 6th line and above line which says “<view type=navigation>”
<xsl:value-of select="concat(user/@userFirstName,' ',user/@userLastName)" />
Step 3 : Restart/Refresh app service and Refresh the page
Clarity 8.1
------------
Step 1 : Create Portlet Page (say Name: "My page", id:my_page)
Step 2 : Create Application Menu > Create Section (Name:Welcome, id:welcome_home) > Create Link (LinkName: USERNAME, PageName: My Page, ParentMenuItem:Welcome) > Reorder Menu items and Push "Welcome" to top.
Step 3 : If you wish to show User Name is Administration Menu, then repeat Step 2 for Administration Menu as well. Only difference keep Section id as 'welcome_admin'.
Step 4 : Open C:\Niku\Clarity\META-INF\union\pmd\personalization.xml. Locate "union.getMenuItems" SQL Statement (approx Line# 102). Be careful here... This SQL statement contains 2 Select statements separated by UNION. We need to focus on Second one (which is below '<!--Second half is for custom pages, including custom object lists-->' comment)
In Second SQL :-
REPLACE : ac.name
WITH : CASE WHEN ac.name = 'USERNAME' THEN </text></sql>
<sql dbVendor="oracle">
<text>
(Select First_name || ' ' || Last_name from srm_resources where user_id = ?)
</text>
</sql>
<sql dbVendor="mssql"> <text>
(Select First_name + ' ' + Last_name from srm_resources where user_id = ?)
</text>
</sql><sql><text>
ELSE ac.name
END name
Add following parameter as 9th parameter in list (after param replace="language" one which is 8th parameter)
<param replace="userId"/>
Verify if changes done looks like below (click to enlarge) :-
Step 5 : Give "My Page" access to all the resources by either setting as group or OBS global right. This is required to display Welcome menu section. [ As an alternative to giving Rights to all users, I updated POLICY_ID to NULL for "My Page" in CMN_ACTIONS table and it did work for me, though I am still testing this alternative..]
Step 6 : Restart/Refresh App to reflect the change..
------------------------------------------------------------------------------------------
Note : Intended for Testing/Research purpose only. New Fixpack/upgrade may overwrite these changes which may require to reapply these changes.
* It was the time when I was just new to Clarity and attending Bootcamp class.. I asked instructor if there is anyway to display logged in User name on Clarity Studio screen. I was told that it only displays in About window when it is Clicked. I researched a bit looked into Clarity XML code and thought I will try that tonight and it should not be tough.. That night when I started looking into things then it appeared that it was not that easy that I initially thought... After many failures and spending two sleepless nights, finally it was SUCCESS.. Next day in class I was quite sleepy but was excited to tell instructor that it's 'done'. It was 2 lines of codes in 2 files but it took 2 days for me.. It was also probably my first post at Clarity Forum (support.niku.com). This worked well in 7.5.x but it didn't work in 8.1. After some digging, kludge for 8.1 also evolved. Approach of which is different than 7.5.x and involves more number of steps.
Sunday, July 20, 2008
[2] Secrets behind debug=1
Ever tried appending &debug=1 to Clarity URL in Web browser's address bar.. If not yet done, just try and see what it brings for you ...
Like appending it to Project Listing URL you see something like below (Click image to Enlarge) :-
* I sometimes use it for XML level debugging/research activity. Like which queries are being fired, which XML or Java modules are called by any particular action or while displaying a page. Here in this debug page we can get some unique keywords and search it in META-INF or Webroot folder files. This sometimes helps in reaching to page/module which is controlling Clarity action/page. From there you can dig into XML/XBL/XSL files and get the logic there..
Like appending it to Project Listing URL you see something like below (Click image to Enlarge) :-
This is for 8.1 while 7.5.x output will not be that elaborative. Using debug=1 option you can see XML version of that Clarity page. In 8.1 you will also see list of Rights user have for that object/portlet. Like you can know whether user has "Create Project" rights or not, what are the hidden values in the page that you don't see on the screen...
You will also find internal id's of portlets, objects etc which you may like to query in database... similarily there are many more pieces of information that you can use to troubleshoot technical issues.* I sometimes use it for XML level debugging/research activity. Like which queries are being fired, which XML or Java modules are called by any particular action or while displaying a page. Here in this debug page we can get some unique keywords and search it in META-INF or Webroot folder files. This sometimes helps in reaching to page/module which is controlling Clarity action/page. From there you can dig into XML/XBL/XSL files and get the logic there..
Saturday, July 19, 2008
[1] Clarity 8.1 on Weblogic 9.2 Walkthrough
Here is Clarity 8.1 on Weblogic 9.2 installation walkthrough. A Powerpoint presentation containing following contents..
• Clarity installation.
• WebLogic Configuration
• Deployment of Clarity .ear files to WebLogic
• Appendix (Things to know, Tips, Best Practices, Troubleshooting)
Click here to download the PPT file...
* I was installing it first time and had very basic document in hand which was based on Weblogic 8.x. After having spent almost 2 days on this, I was still not able to bring up Clarity app home page. (though NSA deployment was success). Everytime deployment of jar file took considerable time (10-15 mins) and different combinations were yielding different errors. Googled a lot, tried many options... but still far from success. I was trying with SQL Server 2005. Next morning I started it on this again .. Thought of giving try with Oracle 10g ... and Voila .. it was SUCCESS... I digged back to SQL Server 2005 setup and discovered that it was driver issue (see Appendix section of PPT file for details). I must thank to this driver issue, otherwise I couldn't have learned many other things. I mentioned most of those learnings in Appendix section, don't miss that. Rather I would suggest to have quick look at that before starting installation..
• Clarity installation.
• WebLogic Configuration
• Deployment of Clarity .ear files to WebLogic
• Appendix (Things to know, Tips, Best Practices, Troubleshooting)
Click here to download the PPT file...
* I was installing it first time and had very basic document in hand which was based on Weblogic 8.x. After having spent almost 2 days on this, I was still not able to bring up Clarity app home page. (though NSA deployment was success). Everytime deployment of jar file took considerable time (10-15 mins) and different combinations were yielding different errors. Googled a lot, tried many options... but still far from success. I was trying with SQL Server 2005. Next morning I started it on this again .. Thought of giving try with Oracle 10g ... and Voila .. it was SUCCESS... I digged back to SQL Server 2005 setup and discovered that it was driver issue (see Appendix section of PPT file for details). I must thank to this driver issue, otherwise I couldn't have learned many other things. I mentioned most of those learnings in Appendix section, don't miss that. Rather I would suggest to have quick look at that before starting installation..
Subscribe to:
Posts (Atom)