Quantcast
Channel: PTC Community: Message List - Windchill
Viewing all articles
Browse latest Browse all 8876

Re: Current Active Users List

$
0
0

FYI...

I have modified my customization.  I have been doing a lot of restarting of my 10.2 test system and did not want to keep clicking into Master Server Manager hyperlink, and do a Find for "ActiveUsers".  Too many clicks.  I decided to implement my customization for good, so that I can simply navigate to http://<host>/Windchill/wtcore/jsp/jmx/serverStatus.jsp and immediately see who is using Windchill.  A benefit is that this URL is bookmarkable, whereas the URL to the Master Server Manager is not.

 

Futhermore, I decided to take things a step further and return the email address of the users currently using Windchill.  That way I can copy and paste into the TO field of an email if I need to send them an email for some reason.

 

Modified Procedure for customizing the <WT_HOME>/codebase/wtcore/jsp/jmx/serverStatus.jsp file:

 

CAUTION:

I have done this on a test site thus far.  I have not done any types of verifications.  Also, I'm just a beginner.  I appreciate any corrections to the procedure below.

 

NOTE:

When modifying /codebase files, reference the Windchill Customization Guide with respect to the wtSafeArea.

 

1.  Open the <WT_HOME>/wtSafeArea/siteMod/... .../serverStatus.jsp file in a text editor.  Per the Customization Guide, use wtSafeArea instead of modifying the file in /codebase directly.  There is a command that will copy the modified file in the proper location in /codebase.

 

2.  Find

Integer  activeUsers = null;

Below that, add 2 lines to instantiate 2 arrays for the active users.

String[] activeUserArray = null;
String[] activeUserArrayEmails = null;

 

3.  Find

activeUsers = (Integer) mbeanServer.getAttribute( activeUsersMBeanName, "TotalActiveUserCount" );

Below that, add some lines to populate the activeUserArray and activeUserArrayEmails arrays.

       activeUserArray = (String[]) mbeanServer.getAttribute( activeUsersMBeanName, "TotalActiveUsers" );       activeUserArrayEmails = new String[activeUserArray.length];       for (int z=0; z<activeUserArray.length; z++) {         wt.org.WTUser user;         wt.query.QuerySpec qspec=new wt.query.QuerySpec(wt.org.WTUser.class);         qspec.appendWhere(new wt.query.SearchCondition(wt.org.WTUser.class,wt.org.WTUser.NAME,wt.query.SearchCondition.LIKE,activeUserArray[z],false),newint[]{0});         wt.fc.QueryResult qresult=wt.fc.PersistenceHelper.manager.find((wt.pds.StatementSpec)qspec);         while(qresult.hasMoreElements()){           user=(wt.org.WTUser) qresult.nextElement();           activeUserArrayEmails[z]=user.getEMail();         }       }

4.  You might need or desire to add an entry to the catch block for activeUserArray and/or activeUserArrayEmails.

5.  Add the display of the variable anywhere in the page.  Look for the screenshot as to where I added it.  Code for my addition of the variables is listed below.  I added it as the last table on the page, right before the closing </body> and </html> tags.

<%= MBeanUtilities.formatMessage( RB.getString( serverStatusResource.DATA_COLLECTED_BETWEEN_MSG ),                                  dateFormat.format( new Date( dataCollectionStart ) ),                                  dateFormat.format( new Date( dataCollectionEnd ) ) ) %></i></td></tr></tbody></table><%-- Custom table for displaying usernames --%><table>  <tbody>    <tr>      <td>        <b>Ben's list of all Active Users:</b>      </td>    </tr>    <tr>      <td>        <%          int i=0;          for (i=0;i<activeUserArray.length;i++) {            out.print(activeUserArray[i] + "<br />);          }        %>      </td>      <td>        <%          int j=0;          for (j=0;j<activeUserArrayEmails.length;j++) {            out.print(activeUserArrayEmails[j] + "<br />);          }        %>      </td>    </tr>  </tbody></table></body></html>

 

serverStatus.png


Viewing all articles
Browse latest Browse all 8876

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>