Tuesday 15 December 2015

Ques: How to display information  regarding Maximo Outage on Maximo Login Screen.

Ans :Modify the login JSP file located in SMP folder and make the changes in JSP highlighted.

<%--
* Licensed Materials - Property of IBM
*
* 5724-U18
*
* (C) COPYRIGHT IBM CORP. 2006,2014 All Rights Reserved.
*
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with
* IBM Corp.
--%><%@ page contentType="text/html;charset=UTF-8" buffer="128kb" autoFlush="true" import="psdi.util.*,psdi.webclient.system.runtime.*,psdi.webclient.system.session.*,psdi.webclient.system.websession.*,psdi.webclient.system.dojo.*,psdi.server.*,java.util.*,java.rmi.RemoteException" %><%!
private static class Labels
{
private static final String group = "login";

final String welcome;
final String welcomeToMaximo;
final String enterInfo;
final String username;
final String password;
final String loginButton;
final String selectLanguage;
final String onLanguageSelection;
final String forgotPassword;
final String newUserLabel;
final String newUserLink;
final String mobileLoginLink;
final String standardLoginLink;
final String adminLoginLink;

final String Maximounavailable;
final String starttime;
final String endtime;
final String copyright;
final String tenantId;
final String federalNotice;
final String nonFederalNotice;

Labels(String langCode) throws MXException, RemoteException
{
MXServer server = MXServer.getMXServer();

welcome = server.getMessage(group, "welcome", langCode);
welcomeToMaximo = server.getMessage(group, "welcomemaximomessage", langCode);
enterInfo = server.getMessage(group, "enterinfo", langCode);
username = server.getMessage(group, "username", langCode);
password = server.getMessage(group, "password", langCode);
loginButton = server.getMessage(group, "loginbutton", langCode);
selectLanguage = server.getMessage(group, "languages", langCode);
onLanguageSelection = server.getMessage(group, "onlanguageselection", langCode);
forgotPassword = server.getMessage(group, "forgotpassword", langCode);
newUserLabel = server.getMessage(group, "newuserlabel", langCode);
newUserLink = server.getMessage(group, "newuserlink", langCode);
mobileLoginLink = server.getMessage(group, "mobileloginlink", langCode);
standardLoginLink= server.getMessage(group, "standardloginlink", langCode);
copyright = server.getMessage(group, "copyright", langCode);
tenantId  = server.getMessage(group,"tenant",langCode);
federalNotice = server.getMessage(group, "federalNotice", langCode);
nonFederalNotice = server.getMessage(group, "nonFederalNotice", langCode);
adminLoginLink = server.getMessage(group, "adminLogin", langCode);

Maximounavailable = server.getMessage(group, "Maximounavailable", langCode);
starttime = server.getMessage(group, "starttime", langCode);
endtime = server.getMessage(group, "endtime", langCode);
}
}
%><%
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Cache-Control", "no-store");
response.setDateHeader("Expires", 0);
response.setHeader("Pragma", "no-cache");

WebClientSessionManager wcsm = WebClientSessionManager.getWebClientSessionManager(session);
if (wcsm != null && wcsm.getSessionInvalidated())
{
session.removeAttribute("MXSession");
}

MXSession s = WebClientRuntime.getMXSession(session);
String skin = WebClientRuntime.getWebClientSystemProperty("mxe.webclient.skin");
String isFederal = WebClientRuntime.getWebClientSystemProperty("mxe.isFederal", "0");
String isSaasEnabled = WebClientRuntime.getWebClientSystemProperty("mxe.isSaasEnabled", "0");

boolean mtEnabled = WebClientRuntime.isMTEnabled();

if(skin==null || skin.length()==0) {
skin="classic";
}
if (!WebClientSessionFactory.getWebClientSessionFactory().hasAvailableSessions())
{
String url = new java.net.URL(new java.net.URL(WebClientRuntime.getMaximoRequestURL(request)), "loginerror.jsp").toString() + "?unavailable=true";
if (!WebClientRuntime.send503Error(response, s, url))
{
response.sendRedirect(url);
}
return;
}

s.setClientHost(request.getRemoteHost());
s.setClientAddr(request.getRemoteAddr());

Object[] settings = WebClientRuntime.getLocaleFromRequest(request);
String langcode;
if (settings[0] instanceof String)
{
langcode = (String)settings[0];
}
else
{
langcode = MXServer.getMXServer().getBaseLang();
}
Map<String,String> langNameToCodeMap = null;
String[][] langs = s.getLanguageList();
if(langs != null)
{
if(langs.length == 1)
{
langcode = langs[0][0];
}
else if(langs.length > 1)
{
langNameToCodeMap = new HashMap<String,String>();
for(int i = 0; i < langs.length; i++)
{
langNameToCodeMap.put(langs[i][1], langs[i][0]);
}
}
}
s.setLangCode(langcode);
session.setAttribute("langcode", langcode);

Locale locale = null;
if (settings[1] instanceof Locale)
{
locale = (Locale)settings[1];
session.setAttribute("_locale_", locale);
}
if (locale != null)
{
session.removeAttribute("locale");
s.setLocale(locale);
}

if (request.getParameter("langchanged") != null)
{
session.setAttribute("_langchanged", "1");
}

boolean isMobile = false;

boolean everyplace = WebClientRuntime.getWebClientRuntime().hasLicenseAccess("EVERYPLACE");
if(everyplace)
{
String mobile = request.getParameter("mobile");
if(WebClientRuntime.isNull(mobile))
{
String userAgent = request.getHeader("User-Agent").toUpperCase();
if(userAgent.contains("MOBILE") || userAgent.contains("IPHONE") || userAgent.contains("IPOD") || userAgent.contains("PLAYBOOK") || userAgent.contains("ANDROID"))
{
isMobile = true;
}
}
else if(mobile.equals("true"))
{
isMobile = true;
}
if(isMobile) {
skin = "mobile";
}
}
request.setCharacterEncoding("UTF-8");

String debug = request.getParameter("debug");
if(debug == null || debug.length() == 0)
{
debug = "0";
}

boolean formAuth = request.getParameter("appservauth") != null;
String allowInSubFrame = request.getParameter("allowinsubframe");
if (formAuth)
{
session.setAttribute("formAuth", "true");
}
String url = WebClientRuntime.getMaximoRequestContextURL(request)+"/ui/login";

String queryString = request.getQueryString();
if(queryString != null)
{
url += "?" + HTML.encode(queryString);
}
int branding = s.getBranding();
if(branding == MXServerRemote.BRAND_NONE)
{
branding = MXServerRemote.BRAND_MAXIMO_AND_TIVOLI;
}
WebClientSession wcs = null;
if(wcsm != null)
{
wcs = wcsm.getWebClientSession(request);
if(wcs != null)
{
if(wcs.usingContextInterval())
{
s.disconnect();
}
}
}
if(s.isConnected() && s.getUserName().equalsIgnoreCase(s.getProperty("mxe.system.reguser")))
{
s.disconnect();
}
if(!formAuth && (WebAppEnv.useAppServerSecurity() || s.isConnected()))
{
response.sendRedirect(url);
return;
}

String userFieldName = "username";
String passwordFieldName = "password";
String tenantFieldName = "tenant";
boolean tokenExpire = false;
if(WebAppEnv.useAppServerSecurity())
{
userFieldName = "j_" + userFieldName;
passwordFieldName = "j_" + passwordFieldName;
url="../../j_security_check";

if (s.isConnected()) // This is possible cause for Appserver token expiry
{
tokenExpire = true;
}
}

String userName = request.getParameter("username");
if(userName == null)
{
userName = "";
}


String tenant = request.getParameter(tenantFieldName);
if(tenant == null)
{
tenant = "";
}

Labels labels = new Labels(langcode);

String reverseAlign = "right";
String direction = "ltr";
if(BidiUtils.isGUIMirrored(langcode))
{
reverseAlign = "left";
direction = "rtl";
}

String timestamp = Long.toString(System.currentTimeMillis());
session.setAttribute("allowlogin", timestamp);

String message;
MXException loginException = (MXException)session.getAttribute("loginexception");
if (loginException != null)
{
//Issue 10-12120
message = s.getTaggedMessage(loginException);
message = WebClientRuntime.replaceString(message,"\"","\\\"");
session.removeAttribute("loginexception");
}
else
{
message = (String)request.getAttribute("signoutmessage");
if (message == null)
{
message = (String)session.getAttribute("signoutmessage");
if (message != null)
{
session.removeAttribute("signoutmessage");
}
}
else
{
request.removeAttribute("signoutmessage");
}
}
if (message != null)
{
message = WebClientRuntime.removeQuotes(message);
message = message.replace("\\n"," ");
}
//HTML 5 doctype
%><!DOCTYPE html>
<html lang="<%=langcode.toLowerCase()%>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Expires" content="0" />
<meta name="viewport" content="width=320, initial-scale=1.0" />
<meta name="format-detection" content="telephone=no" />


<link rel="apple-touch-icon" href="../images/maximo-icon.png"/>
<link rel="shortcut icon" href="../images/maximo-icon.ico"/>
<% if(branding == MXServerRemote.BRAND_MAXIMO || branding == MXServerRemote.BRAND_MAXIMO_AND_TIVOLI)
{
%> <title><%=labels.welcomeToMaximo%></title>
<% }
else
{
%> <title><%=labels.welcome%></title>
<% }
%> <link href="css/login.css" rel="stylesheet" type="text/css" />
<link href="css/<%=skin%>/login.css" rel="stylesheet" type="text/css" />
<% if(isMobile)
{
%> <link href="css/mobilelogin.css" rel="stylesheet" type="text/css" />
<% }
if(direction.equals("rtl"))
{
%> <link href="css/RTLlogin.css" rel="stylesheet" type="text/css" />
<% }
%></head>

<body <%=(tokenExpire?"":"onload=\"checkForRefresh()\"")%>>
<div role="main">
  <% if(labels.Maximounavailable.equals("10")) 
{
 %> <h4><font size="4.5" color="white"><center><%=labels.starttime%></center></font></h4>
 <% }
%>
<table id="main_tbl" class="main_tbl" cellpadding="0" cellspacing="3" role="presentation">
<tr role="banner">
<td>
<% //Branding image
if(branding == MXServerRemote.BRAND_TIVOLI || branding == MXServerRemote.BRAND_MAXIMO_AND_TIVOLI)
{
%> <img class="defaultbrandinglogo" src="images/tivoli_brandmark.png" alt="Tivoli" />
<% }
%> </td>
<td align="<%=reverseAlign%>">
<img class="defaultibmlogo" src="images/ibm-logo-white.gif" alt="IBM" />
</td>
</tr>
<tr>
<td class="dialog" colspan="2">
<% if(branding == MXServerRemote.BRAND_MAXIMO || branding == MXServerRemote.BRAND_MAXIMO_AND_TIVOLI)
{
//  Welcome to MAXIMO
%> <h1 class="prod_name"><%=labels.welcomeToMaximo%></h1>
<% }
else
{
// Welcome,
%> <h1 class="prod_name"><%=labels.welcome%></h1>
<% }
if(!isMobile && message != null)
{
%> <div class="errorText">
<img id="error_img" src="images/st16_critical_24.png" alt="Error" align="absmiddle"/>
<%=message%>
</div>
<% }
%> <table cellpadding="0" cellspacing="0" role="presentation">
<tr>
<td colspan="5" align="<%=reverseAlign%>">
<% if(branding == MXServerRemote.BRAND_MAXIMO || branding == MXServerRemote.BRAND_MAXIMO_AND_TIVOLI)
{
//  Welcome to MAXIMO
%> <h1 class="prod_name ext_prod_name" style="display:none"><%=labels.welcomeToMaximo%></h1>
<% }
else
{
// Welcome,
%> <h1 class="prod_name ext_prod_name" style="display:none"><%=labels.welcome%></h1>
<% } %>
</td>
</tr>
<tr>
<td valign="top"><img src="images/mx_icon<%=isMobile?"_ev":""%>.png" alt="" /></td>
<td class="input_pad">
<form id="loginform" name="loginform" method="post" action="<%=url%>" onsubmit="loginSetup();">
<input type="hidden" name="allowinsubframe" value="<%=HTML.encode(allowInSubFrame)%>"/>
<input type="hidden" name="mobile" id="mobile" value="<%=isMobile%>"/>
<input type="hidden" name="login" id="loginjsp" value="jsp"/>
<input type="hidden" name="localStorage" id="localStorage" value=""/>
<input type="hidden" name="loginstamp" id="loginstamp" value="<%=timestamp%>" /><% if (wcs != null)
{
%> <input type="hidden" name="<%=WebClientSessionManager.CSRFTOKEN%>" id="csrftoken" value="<%=wcs.getCSRFToken()%>" />
<% }
if(Integer.parseInt(debug) > 0)
{
%> <input type="hidden" name="debug" value="<%=debug%>"/>
<% }
%><label for="<%=userFieldName%>" dir="<%=direction%>"><%=labels.username%></label><br />
<% String attrs = "";
if(BidiUtils.isBidiEnabled())
{
attrs = BidiUtils.buildTagAttribute("",BidiUtils.getMboTextDirection("MAXUSER","LOGINID",true),"",true);
attrs += "onkeyup='processBidiKeys(null,this)' onfocus='input_bidi_onfocus(null, this)' onblur='input_bidi_onblur(null, this)' onchange='input_bidi_onfocus(null, this)' ";
}
%> <input <%=attrs%> style="width:<%=isMobile?145:195%>px" name="<%=userFieldName%>" id="<%=userFieldName%>" langcode="<%=langcode%>" type="text" value="<%=HTML.encode(userName)%>"  onchange="document.getElementById('forgot_<%=userFieldName%>').value = this.value;"/>
<br /><br />
<label for="<%=passwordFieldName%>" dir="<%=direction%>"><%=labels.password%></label><br />
<input style="width:<%=isMobile?145:195%>px" name="<%=passwordFieldName%>" id="<%=passwordFieldName%>" type="password"  value=""/>
<br /><br />
<%  if(mtEnabled)
{ %>
<div id="tenantinfo" style="display:none" aria-hidden="true">
<label for="<%=tenantFieldName%>"><%=labels.tenantId%></label>
<br />
<input <%=attrs%> style="width:<%=isMobile?145:195%>px" name="<%=tenantFieldName%>" id="<%=tenantFieldName%>" langcode="<%=langcode%>" type="text" value="<%=HTML.encode(tenant)%>"/>
<br /><br />
</div>
<% } %>
<div style="text-align: <%=reverseAlign%>">
<button class="tiv_btn" type="submit" id="loginbutton" value="1"><%=labels.loginButton%></button>
</div>
</form>
</td>
</tr>
<%
if ("1".equals(s.getProperty(WebClientConstants.WEBCLIENT_GUEST_LOGIN)) && !mtEnabled)        
{
String guestLoginLabel = MXServer.getMXServer().getMessage("login", "guestloginlabel", langcode);
String guestLoginURL = s.getProperty(WebClientConstants.WEBCLIENT_GUEST_LOGIN_URL);
%>
<tr>
<td align="<%=reverseAlign%>" colspan="2">
<div style="text-align: <%=reverseAlign%>">
<form name="guestform" method="get" action="<%=guestLoginURL%>" onsubmit="showWait()">
<button class="tiv_btn" type="submit" id="guestloginlink" value="1"><%=guestLoginLabel%></button>
</form>
</div>
<br />
</td>
</tr>
<% }
if(mtEnabled){ %>
<tr>
<td align="<%=reverseAlign%>" height="18" colspan="2">
<button id="adminlink" class="link" onclick="var tInfo = document.getElementById('tenantinfo'); tInfo.style.display=''; tInfo.setAttribute('aria-hidden', 'false');"><span><%=labels.adminLoginLink%></span></button>
</td>
</tr>
<% }
if((!formAuth || "1".equals(s.getProperty("mxe.AllowUserMgmt"))) && isMobile)
{
%> <tr>
<td align="<%=reverseAlign%>" height="18" colspan="2">
<form name="mobileform" method="get" action="<%=url%>" onsubmit="showWait()">
<input type="hidden" name="mobile" value="<%=!isMobile%>" />
<button id="mobilelink" class="link" type="submit" value="1"><span><%=labels.standardLoginLink%></span></button>
</form>
</td>
</tr>
<tr>
<td align="<%=reverseAlign%>" height="18" colspan="2">
<form name="selfregform" method="post" action="<%=url%>" onsubmit="showWait()">
<input type="hidden" name="event" value="loadapp" />
<input type="hidden" name="value" value="forgotpswd" />
<input type="hidden" name="login" value="selfreg" />
<input type="hidden" name="username" id="forgot_<%=userFieldName%>" />
<% if(langNameToCodeMap != null)
{
%> <input type="hidden" name="langcode" value="<%=langcode%>" />
<% }
%> <button id="forgotpwdlink" class="link" type="submit" value="1"><span><%=labels.forgotPassword%></span></button>
</form>
</td>
</tr>
<% }
if(langNameToCodeMap != null)
{
String[] langNames = langNameToCodeMap.keySet().toArray(new String[langNameToCodeMap.size()]);
Arrays.sort(langNames);
%> <tr height="<%=isMobile?"104":"30"%>px">
<td nowrap="nowrap" align="<%=reverseAlign%>" colspan="2">
<form name="langform" method="post" id="langform" >
<input type="hidden" id="languser" name="username"  value=""/>
<% if(formAuth)
{
%> <input type="hidden" name="langchanged" value="1" />
<% }
%> <label for="langselect"><%=labels.selectLanguage%>
</label>

<select id="langselect" name="langcode" onchange="selectLanguage()" title="<%=labels.onLanguageSelection%>">
<% for(int i = 0; i < langNames.length; i++)
{
String code = langNameToCodeMap.get(langNames[i]);
if(code.equals(langcode))
{
%> <option value="<%=code%>" selected="selected"><%=langNames[i]%></option>
<% }
else
{
%> <option value="<%=code%>"><%=langNames[i]%></option>
<% }
}
%> </select>
</form>
</td>
</tr>
<% }
else if(isMobile)
{
%> <tr height="104px"><td colspan="2">&nbsp;</td></tr>
<% }
if((!formAuth || "1".equals(s.getProperty("mxe.AllowUserMgmt"))) && !isMobile)
{
if(everyplace)
{
%> <tr>
<td align="<%=reverseAlign%>" height="18" colspan="2">
<form name="mobileform" method="get" action="<%=url%>" onsubmit="showWait()">
<input type="hidden" name="mobile" value="<%=!isMobile%>" />
<button id="mobilelink" class="link" type="submit" value="1"><span><%=labels.mobileLoginLink%></span></button>
</form>
</td>
</tr>
<% }
%> <tr>
<td align="<%=reverseAlign%>" height="18" colspan="2">
<form name="selfregform" method="post" action="<%=url%>" onsubmit="showWait()">
<input type="hidden" name="event" value="loadapp" />
<input type="hidden" name="value" value="forgotpswd" />
<input type="hidden" name="login" value="selfreg" />
<input type="hidden" name="username" id="forgot_<%=userFieldName%>" />
<% if(langNameToCodeMap != null)
{
%> <input type="hidden" name="langcode" value="<%=langcode%>" />
<% }
%> <button id="forgotpwdlink" class="link" type="submit" value="1"><span><%=labels.forgotPassword%></span></button>
</form>
</td>
</tr>
<tr>
<td align="<%=reverseAlign%>" height="18" colspan="2">
<form name="selfregform" method="post" action="<%=url%>" onsubmit="showWait()">
<input type="hidden" name="event" value="loadapp" />
<input type="hidden" name="value" value="selfreg" />
<input type="hidden" name="login" value="selfreg" />
<input type="hidden" name="username" id="forgot_<%=userFieldName%>" />
<% if(langNameToCodeMap != null)
{
%> <input type="hidden" name="langcode" value="<%=langcode%>" />
<% }
%>
<% if(!mtEnabled)
{
%> <%=labels.newUserLabel%> <button id="selfreglink" class="link" type="submit" value="1"><span><%=labels.newUserLink%></span></button>
<% }
%> </form>
</td>
</tr>
<% }
%> </table>
</td>
</tr>
<%
if (MXFormat.stringToBoolean(isSaasEnabled))
{
%>
<tr style="height:10px;">
</tr>
<tr>
<td colspan="2" style="text-align:justify;" >
<% if(MXFormat.stringToBoolean(isFederal)){ %>
<span><%=labels.federalNotice%></span>
<%} else {%>
<span><%=labels.nonFederalNotice%></span>
<%
}
%>
</td>
</tr>
<%
}
%>
<tr>
<td colspan="2" class="copyright" role="contentinfo"><img alt="IBM" src="images/ibm-logo-white.gif" style="display: none"><p><%=labels.copyright%></p></td>
</tr>
</table>
</div>
<% if(BidiUtils.isBidiEnabled())
{
%> <script type="text/javascript" src="../javascript/<%=Dojo.getMaximoJavascriptDirectory(request)%>bidi_library.js"></script>
<% }

if(tokenExpire)
{
%> <script type="text/javascript" src="../javascript/<%=WebClientRuntime.getDojoDirectory(request)%>/dojo/dojo.js"></script>
<script type="text/javascript" src="../javascript/tokenrelog.js"></script>
<% }

%> <script language="JavaScript" type="text/javascript">
var MAINDOC=document;
function checkForRefresh()
{
<% if (BidiUtils.isBidiEnabled())
{
%> setTimeout("document.getElementById('username').blur(); document.getElementById('username').focus()",100);
<% }
%> document.cookie = "TJE= ; expires=-1; path=/";
document.cookie = "TE3= ; expires=-1; path=/";
if (MAINDOC.location != document.location)
{
var hiddenFrame = parent.document.getElementById("commframe");
if (hiddenFrame != null)
{
var debugwindow = parent.document.getElementById("dockedHiddenFrame");
var hdrRow = parent.document.getElementById("debugHeaderRow");
hdrRow.style.display="none";
debugwindow.style.display="";
debugwindow.style.visibility="visible";
debugwindow.style.position="absolute";
debugwindow.style.top = -16 + "px";
debugwindow.style.left = -18 + "px";
debugwindow.style.opacity=1;
debugwindow.style.filter="alpha(opacity=100)";
debugwindow.style.width=parent.document.body.clientWidth +19 + "px";
debugwindow.style.height=parent.document.body.clientHeight + 16 + "px";
hiddenFrame.style.width=parent.document.body.clientWidth +19 + "px";
hiddenFrame.style.height=parent.document.body.clientHeight + 16 + "px";
debugwindow.style.zIndex=1001
hiddenFrame.style.display="inline";
parent.hideWait();
}
}
if(document.documentMode && (document.documentMode < 8))
alert("Either Compatibility View is turned on or you are using an unsupported browser version which can affect the performance of the product. Ensure that Compatibility View is turned off. If the issue continues, ensure that you are not using an unsupported browser version.");

<% if (message != null && isMobile)
{
%> alert("<%=message%>");
<% }

%> var userField = document.getElementById("<%=userFieldName%>");
if (<%=loginException != null%> || userField.value == "")
{
userField.focus();
userField.select();
}
else
{
var pWordField = document.getElementById("<%=passwordFieldName%>");
if (pWordField.value == "")
{
pWordField.focus();
pWordField.select();
}
else
{
document.getElementById("loginbutton").focus();
}
}
window.setTimeout("document.location='exit.jsp?logintimeout=1'", <%=(session.getMaxInactiveInterval() - 10) * 1000%>);

if (navigator.userAgent.toLowerCase().indexOf("iphone") > -1)
{
setTimeout(hideURLbar, 0);
}
}

function loginSetup()
{
showWait();
<% if (s.isConnected())
{
%> hiddenFrame = parent.document.getElementById("commframe");
if (hiddenFrame != null)
{
var debugwindow = parent.document.getElementById("dockedHiddenFrame");
debugwindow.style.width=50 + "px";
debugwindow.style.height=50 + "px";
hiddenFrame.style.width=50 + "px";
hiddenFrame.style.height=50 + "px";
debugwindow.style.visibility="hidden";
hiddenFrame.style.display="none";
parent.showWait();
}
<% }
%> }
document.getElementById("localStorage").value = ('localStorage' in window && window['localStorage'] !== null);
function selectLanguage()
{
var langform = document.getElementById("langform");
var username = document.getElementById("<%=userFieldName%>");
if(username && username.value)
{
langform.languser.value = username.value;
}
langform.submit();
}

function showWait()
{
document.body.style.cursor="wait";
document.body.onkeydown = noKeys;

var lb = document.getElementById("loginbutton");
if (lb)
{
lb.disabled = true;
lb.setAttribute("aria-disabled", "true");
}

var main_tbl = document.getElementById("main_tbl");
if (main_tbl)
{
main_tbl.style.display = "none";
main_tbl.setAttribute("aria-hidden", "true");
}
}

function noKeys(event)
{
event = event || window.event;
event.cancelBubble = true;
event.returnValue = false;
return false;
}

function hideURLbar()
{
window.scrollTo(0, 1);
}
</script>
</body>
<%@ include file="../common/webreplayLogin.jsp" %>
</html>

Saturday 10 October 2015

How to Turn off Admin Mode in Maximo 7

Question

How to Turn off Admin Mode in Maximo 7

Answer

Admin Mode is Maximo 7.5 allows you to configure your database configuration changes without having to shut down Maximo server like in Maximo 6.
Having the Admin Mode on will have impact on our areas of Maximo. You should ALWAYS turn it off once the changes have been carried out.

Do these steps to turn off Admin mode:
1) Log in as a user who has full access to the Database Configuration application.
2) Go To -> System Configuration -> Platform Configuration -> Database Configuration
3) Select Action -> Manage Admin Mode
4) Click on the "Turn Admin Mode OFF" button.
It should be noted that the permission required to set Admin Mode are not the same as the permission required for admin login security authorization, which lets you to log in when the server is in admin mode. It is possible to have Admin users who can turn admin mode on but are not be able to login once Admin Mode has started.
You grant the authorization to logon while in Admin Mode from the Security Groups application:

1 In the Security Groups application, click the Applications tab.
2 In the Applications table window, search for Start Center.
3 In the Options for Start Center table window, select Identifies whether the user is permitted to login when
server is in Admin Mode.
If you have Admin Mode ON but do not have a user who can login to turn it off, you may be able to reset it via using SetAdminMode.bat C:\ibm\SMP\maximo\tools\maximo\internal\SetAdminMode.bat
Please see the comments below on the syntax for using SetAdminMode.bat
REM Command line parameter must be one or both of the following:
REM -m (mode) Set AdminMode. The value of mode must be ON or OFF.
REM For example, -mON sets AdminMode ON.
REM -n (num sessions) Set value for mxe.adminmode.numsessions property.
REM Num sessions must be an integer.
REM For example, -n8 sets the value to 8. 

Ref :http://www-01.ibm.com/support/docview.wss?uid=swg21329036


How to Turn off Admin Mode in Maximo 7 if unable to do so through Maximo Front End through Manage Admin Mode.


Receiving errors on the Database Configuration screen when shutting down Admin Mode:

BMXAA4030I - Starting to set Admin Mode ON.
BMXAA4004I - Admin Mode is pending (turning on) for this server.
BMXAA4013I - Setting maxvar ADMINRESTART to ON.
BMXAA4008I - Notifying users to sign out.
BMXAA4036W - All users will be logged out in 1 minutes!
BMXAA4007I - Administratively logging out all remaining users.
BMXAA4011I - Waiting until all cron tasks are sleeping...
BMXAA4010I - Preventing events from firing.
BMXAA4014I - Setting this server's maxsession active flag to 0.
BMXAA4032I - Successfully set Admin Mode ON.
system#AdminModeIsConfiguring
system#AdminModeIsConfiguring
system#AdminModeIsConfiguring
system#AdminModeIsConfiguring
system#AdminModeIsConfiguring

Cause
Database in a state of configuring.

Diagnosing the problem
Run this statement on the database: select * from maxvars where varname='CONFIGURING';

Resolving the problem
If the value is 1


Run this update statement below to set the value to 0

update MAXVARS set varvalue='0' where varname='CONFIGURING';

This will reset the flag and will allow Admin Mode to be shut down.


Ref : http://www-01.ibm.com/support/docview.wss?uid=swg21473106

"Admin Mode" function in Maximo 7.x

Question

What happens in Maximo when "Admin Mode" is ON?

Answer

There is an "Admin Mode" function in Maximo 7.x. That function enables the system administrator to configure the database without having to shut the Maximo server down temporarily.
This function exists in the Database Configuration application.

When setting Admin Mode to ON, there are some limitations that the users and system administrator may run into.

1) It blocks users from the product applications. Only users with the privilege "'Can Log In During Admin Mode" can log in to Maximo.
The SQL statement below shows groups with the privilege "'Can Log In During Admin Mode" :
SELECT * FROM APPLICATIONAUTH WHERE OPTIONNAME ='ADMINMODELOGIN'

If no one can log in to Maximo, please check if "Admin Mode" is on and who has "Can Log In During Admin Mode" privileges.


2) It suspends crontasks.
Only the BBCron instance will run. You can check when each crontask instance runs last with this SQL query:
SELECT * FROM TASKSCHEDULER

If you meet the problem "crontasks are not running" without any reason, you can check "Admin Mode" and If "Admin Mode" is set to ON, change it to OFF.
The crontasks will then run again.

Below is the SQL command to check the "Admin Mode" setting":
SELECT * FROM MAXVARS WHERE VARNAME = 'ADMINRESTART'

cf ) Using a back-end SQL script , you can change "Admin Mode" setting:
UPDATE MAXVARS SET VARVALUE = 'OFF' WHERE VARNAME = 'ADMINRESTART' ; COMMIT;


3) It disables all event listeners.
When the Maximo application server starts (when services are loaded), all event listeners will be loaded . For example: PMListener, MatUseTransListener , AssetListener etc.
If "Admin Mode" is "ON", all event listeners are disabled even if they are initialized when the Maximo application server starts.
At that time, if you try to do some business processes such as Asset creation, PM creation or issue/return Inventory items, data integrity would be broken.
For example: inventory balances/cost are not updated or asset data is not inserted in ASSETANCESTOR, etc.
Also, due to broken data integrity , some unexpected errors or results will happen, for example: PM Wogen error.

* Check "Admin Mode" first when you get any unexpected result or errors.


Ref : https://www-304.ibm.com/support/docview.wss?uid=swg21377175

Sunday 8 March 2015

Year Comparison using Automation Script

from java.util import Calendar

cal = Calendar.getInstance()
cal.setTime(actcomdateloc)
locactcomyear = cal.get(Calendar.YEAR)
currentyear = Calendar.getInstance().get(Calendar.YEAR);
val = currentyear-locactcomyear
return val
Automation Script to throw warning message for issuing items against asset under warranty:

from java.util import Calendar
from psdi.server import MXServer
from psdi.util import MXApplicationException
if mbo.getOwner().getString('WARRANTYEXPDATE') =='':
 errorgroup = ""  
 errorkey = ""
else:
 if(mbo.getOwner().getDate('warrantyexpdate') >= (Calendar.getInstance().getTime())):
  msgparams = [mbo.getOwner().getString('ASSETNUM')];
  mxae = MXApplicationException("workorder","AssetWarrantyNotice",msgparams)
  mbo.getThisMboSet().addWarning(mxae)



Steps to throw warning message using automation script

Add the line below to the imports:


from psdi.util import MXApplicationException

then add the following:


mxae = MXApplicationException(msggroup, msgkey, msgparams)
mbo.getThisMboSet().addWarning(mxae)


Choose the desired msggroup ,msgkey and pass appropriate value of msgparams

Thursday 15 January 2015

Setting up Maximo 7.x in a WebLogic v9 Cluster using JMS queues for Integration

When using the Maximo Integration Framework (IF) in a clustered environment the following should be considered.

For best performance with minimal impact to users, the Maximo Integration Framework (IF) can be configured to run on a single WebLogic application server instance of Maximo while users log in and work with a User Interface (UI) cluster of Maximo instances.

In the below example, you will need 4 WebLogic application servers.

One application server will serve as the Administration console for the rest of the "managed" servers.

One application server will be used for the stand-alone Maximo application used specifically for inbound IF transaction processing. 

The other two application servers will be used to set up a cluster of application servers for use as the UI cluster.  All outbound transactions will be generated by the UI cluster members running Maximo. 

In the sample configuration below, there are 2 application servers in the UI cluster and 1 application server in the stand-alone application server.

Below you will find instructions for configuring JMS resources for the IF instance and the UI cluster.

Before you begin:

Below are the names used in the rest of this document:

Name the Admin server AdminMAXSERV
Name the first Maximo application server for the UI cluster MAXIMOUI1
Name the second Maximo application server for the UI cluster MAXIMOUI2
Name the stand-alone Maximo application server MAXIMOIF

It is best to have two Maximo installation folders that are identical, since there will be a need for 2 different maximo.ear files, one with the Message Driven Bean enabled for inbound transaction processing on the MAXIMOIF application server, and one for the Maximo cluster where no inbound transaction processing will occur, this will eliminate confusion as to which ear file has this module enabled.

Creating your application servers
This document assumes you already have WebLogic 9.x installed and that you have an Administration server, and one managed server used for the Maximo application.

If you do not have a separate Administration server instance, create a new application server specifically for this purpose which will have a unique port.
You will need to modify the start script of your original application server and change the ADMIN_URL variable to point to the correct hostname and port of your new Administration server.
i.e. set ADMIN_URL=http://localhost:7001

Maximo will not be deployed to the administration server, it will be used only to manage all other application server instances.

Your original application server instance can be designated as your IF server.  However, if you prefer to have it named according to this document, you will need to delete and recreate this server with the name MAXIMOIF.

You will also need to create 2 new managed application servers, belonging to a new cluster.
You can name them MAXIMOUI1 and MAXIMOUI2.



Configuring your startup scripts
See guide for your application server to complete the configuration of the startup scripts.

NOTE:  When setting the maximum heap size for the MAXIMOIF application server JVM, the admin guide says to set this to 1024MB, however, since this application server will not be used by users directly, the memory size can be increased to 2048MB so that it can handle a larger volume of messages without running out of memory.

Refer to this BEA web site for general information on load balancing in a cluster.

Defining the jdbc data source for use with JMS resources

Click the “lock and edit” button

1)  log in to the WebLogic console and navigate to services/jdbc/data sources
2)  click "create a new jdbc data source"
3)  enter the name and JNDI name as follows:
                        jmsqueuedatasource
           
4)  select the type as your database platform type such Oracle thin or sql server driver etc, click next  - NOTE:  this must be a non-XA driver
5)  turn off “supports global transaction” because feature is not supported for jms stores, then click next
6)  configure the correct database name, hostname, port and user information, click next
7)  confirm the information and click the “test connection” button.
8)  If successful click next
9)  select all 3 servers (IF, UI1 and UI2) as the targets for this data source
10)  click “finish”

Click “Activate Changes”

Creating your data stores for use with JMS resources
NOTE:  the prefix values are very important, if you do not have unique names for prefix values on each store, messages can become corrupt as they will all use the same store files.

In the WebLogic console, navigate in the left pane services/JDBC/persistent stores

Click the “lock and edit” button

1)  click the link "create a new JMS jdbc store"
2)  enter the name as mxintcqinstore
3)  select the target for this store as MAXIMOIF
4)  select the data source created above
5)  enter a prefix value of "mxintcqin", then click "finish"

6)  create another new JMS jdbc store
7)  enter the name as mxintsqinstore
8)  select the target for this store as MAXIMOIF
9)  select the data source created above
10)  enter a prefix value of "mxintsqin", then click "finish"
           
11)  create a third JMS jdbc store
12)  enter the name as mxintsqoutstore
13)  select the target for this store as MAXIMOUI1(migrateable)
14)  select the data source created above
15)  enter a prefix value of "mxintsqout", then click "finish"

16)  create a fourth JMS jdbc store
17)  enter the name as mxintcqinerrstore
18)  select the target for this store as MAXIMOIF
19)  select the data source created above
20)  enter a prefix value of "mxintcqinerr", then click "finish"

Click “Activate Changes”


           
Creating your JMS resources for use in a clustered environment

Click the “lock and edit” button

1. Create three JMS servers with the following configuration parameters:

Parameter Value Properties

Name:                                                   Target:
sqinserver                                             MAXIMOIF
sqoutserver                                           MAXIMOUI1(Migrateable)
cqinserver                                             MAXIMOIF
cqinerrserver                                        MAXIMOIF

2. Create a JMS system module named ifjmsmodule with MAXIMOIF as the target server.

3. Add a connection factory resource to the JMS module:

Parameter Value

Name:
intjmsconfact

JNDI Name:
jms/maximo/int/cf/intcf

Target:
MAXIMOIF

7. Add three queue resources to the JMS Module:

a. Create the queue resource type.
b. Create a new subdeployment with the same name as the queue, click next.
c. select the radio button for the JMS server you are creating this subdeployment for.

Parameter Value

Queue 1

Name:
sqin

JNDI Name:
jms/maximo/int/queues/sqin

Subdeployment name:
sqin

JMS server name:
mxintsqin

Queue 2

Name:
cqin

JNDI Name:
jms/maximo/int/queues/cqin

Subdeployment name:
cqin

JMS server name:
mxintcqin


Queue 3

Name:
cqinerr

JNDI Name:
jms/maximo/int/queues/cqinerr

Subdeployment name:
cqinerr

JMS server name:
mxintcqinerr


Template:
None

8. Enable the JMS connection factory for XA:

a. Select the intjmsconfact link.
b. From the Transactions tab, check the XA Connection Factory Enabled checkbox
c. Set the Maximum Messages per Session to -1.

9. Save and activate the changes.

10. Create a second JMS system module named uijmsmodule with MAXIMOUI1 as the target server.

11. Add a connection factory resource to the JMS module:

Parameter Value

Name:
intjmsconfact

JNDI Name:
jms/maximo/int/cf/intcf

Target:
MAXIMOUI1(migrateable)

12. Add one queue resource to the JMS Module:

a. Create the queue resource type.
b. Create a new subdeployment with the same name as the queue, click next.
c. select the radio button for the JMS server you are creating this subdeployment for.

Parameter Value

Queue 1

Name:
sqout

JNDI Name:
jms/maximo/int/queues/sqout

Template:
None

13. Enable the JMS connection factory for XA:

a. Select the intjmsconfact link.
b. From the Transactions tab, check the XA Connection Factory Enabled checkbox
c. Set the Maximum Messages per Session to -1.

14. Save and activate the changes.

Restart the WebLogic Admin, IF and UI application servers 

NOTE:  For each JDBC data store created above, a table will automatically be created in your MAXIMO schema with the prefix names you entered when you created the new stores and will be created in the database when the application servers are restarted:

            MXINTCQINWLSTORE

            MXINTCQINERRWLSTORE
           
            MXINTSQINWLSTORE
           
            MXINTSQOUTWLSTORE


Preparing the Maximo application for deployment to the IF application server

To make sure that the MDB used by the IF application is deployed correctly, edit the following file and make sure the MDBs are uncommented:

1.  locate the file under Maximo/applications/maximo/mboejb/ejbmodule/META-INF/ejb-jar.xml

Open the file using a text editor and uncomment the following:

Make sure the following 4 sections look like this:

<!-- MEA MDB  -->

    <message-driven id="MessageDriven_JMSContQueueProcessor_1">
      <ejb-name>JMSContQueueProcessor-1</ejb-name>
      <ejb-class>psdi.iface.jms.JMSContQueueProcessor</ejb-class>
      <transaction-type>Container</transaction-type>
      <message-destination-type>javax.jms.Queue</message-destination-type>
      <env-entry>
        <env-entry-name>MESSAGEPROCESSOR</env-entry-name>
            <env-entry-type>java.lang.String </env-entry-type>
            <env-entry-value>psdi.iface.jms.QueueToMaximoProcessor</env-entry-value>
      </env-entry>
    </message-driven>



<!-- MEA MDB for error queue -->

    <message-driven id="MessageDriven_JMSContQueueProcessor_2">
      <ejb-name>JMSContQueueProcessor-2</ejb-name>
      <ejb-class>psdi.iface.jms.JMSContQueueProcessor</ejb-class>
      <transaction-type>Container</transaction-type>
      <message-destination-type>javax.jms.Queue</message-destination-type>
      <env-entry>
        <env-entry-name>MESSAGEPROCESSOR</env-entry-name>
            <env-entry-type>java.lang.String </env-entry-type>
            <env-entry-value>psdi.iface.jms.QueueToMaximoProcessor</env-entry-value>
      </env-entry>
      <env-entry>
        <env-entry-name>MDBDELAY</env-entry-name>
            <env-entry-type>java.lang.Long </env-entry-type>
            <env-entry-value>30000</env-entry-value>
      </env-entry>     
      
    </message-driven>

<!-- MEA MDB -->

    <container-transaction>
            <method>
               <ejb-name>JMSContQueueProcessor-1</ejb-name>
               <method-name>*</method-name>
            </method>
   
            <trans-attribute>Required</trans-attribute>
   
    </container-transaction>

<!-- MEA MDB for error queue -->

    <container-transaction>
            <method>
               <ejb-name>JMSContQueueProcessor-2</ejb-name>
               <method-name>*</method-name>
            </method>
   
            <trans-attribute>Required</trans-attribute>
   
    </container-transaction>

2.  Save and close the file.

3.  Locate the Maximo/applications/maximo/properties/maximo.properties file and change the mxe.name property to a name that represents that this is the ear file for the IF instance, i.e. MXServerIF.

4.  Add the line mxe.crontask.donotrun if it does not already exist in the properties files so that all crontasks except for the JMSQSEQCONSUMER.SEQQOUT crontask will run on this server:
e.g.
              mxe.crontask.donotrun=JMSQSEQCONSUMER.SEQQOUT

This will be the only crontask entry because this is the only crontask that we do not want to run.

5.  Save and close the file

6.  Build the maximo.ear

7.  Deploy the maximo.ear to the MAXIMOIF application server (refer to the system administrator's guide for deployment information)

8.  Restart the MAXIMOIF application server



Preparing the Maximo application for deployment to the UI cluster

To make sure that the MDB used by the IF application does not run in the UI cluster, edit the following files and make sure the MDBs are commented out:

1.  locate the file under maximo/applications/maximo/mboejb/ejbmodule/META-INF/ejb-jar.xml

2.  Open the file using a text editor and comment out the following

Make sure the following 4 entries look like this:

<!-- MEA MDB 

    <message-driven id="MessageDriven_JMSContQueueProcessor_1">
      <ejb-name>JMSContQueueProcessor-1</ejb-name>
      <ejb-class>psdi.iface.jms.JMSContQueueProcessor</ejb-class>
      <transaction-type>Container</transaction-type>
      <message-destination-type>javax.jms.Queue</message-destination-type>
      <env-entry>
        <env-entry-name>MESSAGEPROCESSOR</env-entry-name>
            <env-entry-type>java.lang.String </env-entry-type>
            <env-entry-value>psdi.iface.jms.QueueToMaximoProcessor</env-entry-value>
      </env-entry>
    </message-driven>
-->

<!-- MEA MDB for error queue
    <message-driven id="MessageDriven_JMSContQueueProcessor_2">
      <ejb-name>JMSContQueueProcessor-2</ejb-name>
      <ejb-class>psdi.iface.jms.JMSContQueueProcessor</ejb-class>
      <transaction-type>Container</transaction-type>
      <message-destination-type>javax.jms.Queue</message-destination-type>
      <env-entry>
        <env-entry-name>MESSAGEPROCESSOR</env-entry-name>
            <env-entry-type>java.lang.String </env-entry-type>
            <env-entry-value>psdi.iface.jms.QueueToMaximoProcessor</env-entry-value>
      </env-entry>
      <env-entry>
        <env-entry-name>MDBDELAY</env-entry-name>
            <env-entry-type>java.lang.Long </env-entry-type>
            <env-entry-value>30000</env-entry-value>
      </env-entry>     
     
    </message-driven>
-->


<!-- MEA MDB

    <container-transaction>
            <method>
               <ejb-name>JMSContQueueProcessor-1</ejb-name>
               <method-name>*</method-name>
            </method>
   
            <trans-attribute>Required</trans-attribute>
   
    </container-transaction>
-->

<!-- MEA MDB for error queue

    <container-transaction>
            <method>
               <ejb-name>JMSContQueueProcessor-2</ejb-name>
               <method-name>*</method-name>
            </method>
   
            <trans-attribute>Required</trans-attribute>
   
    </container-transaction>
-->


3.  Save the close the file.

4.  Locate the maximo/applications/maximo/properties/maximo.properties file and change the mxe.name property to a name that represents that this is the ear file for the UI cluster, i.e. MXServerUI.

5.  Add the line mxe.crontask.donotrun if it is does not already exist in the properties file
so that no crontasks except for the JMSQSEQCONSUMER.SEQQOUT crontask will run on this server:
e.g.
              mxe.crontask.donotrun=JMSQSEQCONSUMER.SEQQIN,IFACETABLECONSUMER.IFACEIN,BBcron.BBCRON1,......

Since we want all crontasks to run in the IF instance, all crontasks will be listed here except for the JMSQSEQCONSUMER.SEQQOUT.  This crontask will need to run in the cluster.

Crontasks are cluster aware as long as they are specified where to run using the maximo.properties.  If using the Target Enable feature to force the IF crontasks to run in specific servers, they are not cluster aware and no failover will occur if the server running a specific IF crontask fails.

Be sure to go through your list of crontasks and note each instance in the correct case and add it to the mxe.crontask.donotrun parameter in the maximo.properties file, each separated by a comma.


6.  Save and close the file.

7.  Build the maximo.ear

8.  Deploy this maximo.ear to the cluster (refer to the system administrator's guide for deployment information)

9.  Restart the cluster


Web services:

When deploying web services, you will need to set up the web service administration URL and port to point to the MAXIMOIF application server IP address and port. 
When sending transactions to these interfaces, you will need to point your web service client to the IP address and port of the MAXIMOIF application server IP address and port, not the cluster address for the UI instances.
This is to prevent any inbound transaction processing from web service invocation from taking place on the UI cluster.  It is also important to make sure that the Integration Global Directory is in a location that all application servers in a multi-node environment can access.  See the next section for information on the Integration Global Directory.

The Integration Global Directory:

When you deploy a web service, all wsdl and schema files are written with the service you have just deployed.  These file will be written to the Integration Global Directory.  If WebLogic application servers will be distributed in a multi-node environment, the integration global directory must exist in a shared location that all application servers can access. 

This shared location can be either a mapped drive or UNC share (Windows), or a mount point (Unix).  The user specified to run the WebLogic services must have access to read and write to this share or mount point.  This includes the node manager if in use.  In Windows, do not use a local system account but rather a domain account as local system accounts to not have access to mapped drives or UNC shares.

You set the integration global directory path in the System Properties application, the property is called mxe.int.globaldir.

Important note:

Importing data can only be performed while logged into the IF instance where the Message Driven Bean is deployed.  Exporting data can only be performed while logged into one of the UI cluster members.

If you need to be able to perform outbound transactions for any reason from the IF instance such as due to recurrence or crontasks that update data causing events to be fired, you will need to add another jms server to the MAXIMOIF application server, and create another queue with the same jndi name jms/maximo/int/queues/sqout as exists in the first jms uijmsmodule in the ifjmsmodule.

This configuration will require that you duplicate the JMSQSEQCONSUMER.SEQQOUT crontask instance so you will have two instances running for the same queue jndi name.
The first instance will need to be forced to run in the UI cluster and the second forced to run in the IF instance.
This is accomplished using the donotrun property.
These instructions work with both WebLogic v9 and v10.

Reference : 
https://www.ibm.com/developerworks/community/blogs/a9ba1efe-b731-4317-9724-a181d6155e3a/entry/setting_up_maximo_7_x_in_a_weblogic_v9_cluster_using_jms_queues_for_integration?lang=en