MBO TR270-JNQP-Max6-Customization-Exercises-SE PDF
MBO TR270-JNQP-Max6-Customization-Exercises-SE PDF
Student Exercises
S150-2638-00
May 2007
Copyright Notice
Copyright © 2007 IBM Corporation, including this documentation and all software. All rights
reserved. May only be used pursuant to a Tivoli Systems Software License Agreement, an IBM Soft-
ware License Agreement, or Addendum for Tivoli Products to IBM Customer or License Agreement.
No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system,
or translated into any computer language, in any form or by any means, electronic, mechanical,
magnetic, optical, chemical, manual, or otherwise, without prior written permission of IBM Corpora-
tion. IBM Corporation grants you limited permission to make hardcopy or other reproductions of any
machine-readable documentation for your own use, provided that each such reproduction shall carry
the IBM Corporation copyright notice. No other rights under copyright are granted without prior writ-
ten permission of IBM Corporation. The document is not intended for production and is furnished “as
is” without warranty of any kind. All warranties on this document are hereby disclaimed, including the
warranties of merchantability and fitness for a particular purpose.
Note to U.S. Government Users—Documentation related to restricted rights—Use, duplication or
disclosure is subject to restrictions set forth in GSA ADP Schedule Contract with IBM Corporation.
Trademarks
The following are trademarks of IBM Corporation or Tivoli Systems Inc.: IBM, Tivoli, AIX, Cross-Site,
NetView, OS/2, Planet Tivoli, RS/6000, Tivoli Certified, Tivoli Enterprise, Tivoli Ready, TME. In Den-
mark, Tivoli is a trademark licensed from Kjøbenhavns Sommer - Tivoli A/S.
Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in
the United States, other countries, or both.
UNIX is a registered trademark of The Open Group in the United States and other countries.
C-bus is a trademark of Corollary, Inc. in the United States, other countries, or both.
Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States,
other countries, or both.
Lotus is a registered trademark of Lotus Development Corporation.
PC Direct is a trademark of Ziff Communications Company in the United States, other countries, or
both and is used by IBM Corporation under license.
ActionMedia, LANDesk, MMX, Pentium, and ProShare are trademarks of Intel Corporation in the
United States, other countries, or both.
SET and the SET Logo are trademarks owned by SET Secure Electronic Transaction LLC. For fur-
ther information, see http://www.setco.org/aboutmark.html.
Other company, product, and service names may be trademarks or service marks of others.
Notices
References in this publication to Tivoli Systems or IBM products, programs, or services do not imply
that they will be available in all countries in which Tivoli Systems or IBM operates. Any reference to
these products, programs, or services is not intended to imply that only Tivoli Systems or IBM prod-
ucts, programs, or services can be used. Subject to valid intellectual property or other legally pro-
tectable right of Tivoli Systems or IBM, any functionally equivalent product, program, or service can
be used instead of the referenced product, program, or service. The evaluation and verification of
operation in conjunction with other products, except those expressly designated by Tivoli Systems or
IBM, are the responsibility of the user. Tivoli Systems or IBM may have patents or pending patent
applications covering subject matter in this document. The furnishing of this document does not give
you any license to these patents. You can send license inquiries, in writing, to the IBM Director of
Licensing, IBM Corporation, North Castle Drive, Armonk, New York 10504-1785, U.S.A.
Printed in Ireland.
Customizing Business Components in IBM Maximo 6 (Exercises)
Objectives
Upon completion of this unit, you will be able to:
• Customize Maximo Business Components.
– Use customizable methods.
• Init()
• Add()
• Delete()
• Save()
• Etc.
– Work with GL Accounts
– Work with change of status.
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 1
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
Agenda
Development Environment
Remote Access
Error Processing
Component
Component
Shared Directory
Windows Explorer/Tools/Map Network Drive
\\10.10.10.150\IBMTrain
click
IBMTRAIN/maximo6train
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 2
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
Development Environment
Eclipse.exe
www.eclipse.org
Eclipse Set up
Eclipse.exe
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 3
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
Window/Preferences
2- Expand the
Output folder
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 4
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
10
Development Environment Directories
company
deployment
default
show
Uses *.jar
add businessobjects.jar
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 5
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
11
Eclipse Set up
MXES-Remote
12
2- Select Project
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 6
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
13
2- Click on Next
14
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 7
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
15
16
1-Expand Project
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 8
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
17
businessobject.jar must be
there.
It was extracted from the
maximo.ear file
18
Notice that the project in the classroom has been setup already.
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 9
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
19
20
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 10
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
21
22
Exercise 1 package company.show
For Companies
Display
Displayfields
fieldsCompany
Companyid id(company),
(company),description
description(name)
(name)and
and
Organization Id (orgid) in the following format:
Organization Id (orgid) in the following format:
All
AllCompanies
Companies
Company
Company Description
Description OrgId
OrgId
-------------
------------- -------------------------------
------------------------------- ----------
----------
length(8)
length(8) length(30)
length(30) length(8)
length(8)
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 11
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
23
Exercise 1 package company.show
public
publicclass
classTestCompShow
TestCompShow
{{ Class: TestCompShow
////
////main
mainprogram
programtotoreceive
receive33arguments
arguments
////
//// -- host
host e.g.
e.g.localhost
localhost
//// -- username
username e.g.
e.g.wilson
wilson
//// -- password
password e.g.
e.g.wilson
wilson
////
public
publicstatic
staticvoid
voidmain(String[]
main(String[]args)
args)
{{
}}
////
////method
methodto
toprint
printall
allthe
thecompanies
companiesin
inthe
theMboSet
MboSet
////
public
publicstatic
staticvoid
voidprintCompany(MboSetRemote
printCompany(MboSetRemotecoset,
coset,String
Stringtitle)
title)
{{
}}
}}
24
Exercise 1 package company.show
Get Arguments
Get session
Connect to session
Get MboSet for Companies
Call method printCompany
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 12
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
25
Exercise 1 package company.show
Print title
26
2- Select
Class
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 13
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
27
Create TestCompShow Class (cont)
1- Type package
company.show
2- Type classname
TestCompShow
4- Click on Finish
28
Class
TestCompShow
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 14
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
29
30
1- If we type:
MXSession session …
It does not know where the
MXSession class is.
It is underlined in red
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 15
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
31
2-Click on import
MXSession
32
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 16
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
33
34
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 17
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
35
2- Error line
36
Exercise 1 package company.show
For Companies
Display
Displayfields
fieldsCompany
Companyid id(company),
(company),description
description(name)
(name)and
and
Organization Id (orgid) in the following format:
Organization Id (orgid) in the following format:
All
AllCompanies
Companies
Company
Company Description
Description OrgId
OrgId
-------------
------------- -------------------------------
------------------------------- ----------
----------
length(8)
length(8) length(30)
length(30) length(8)
length(8)
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 18
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
37
38
2- Click on New
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 19
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
39
1- Eclipse created a
configuration
TestCompShow
40
2- Click on Run
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 20
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
41
2- Double click on
Console
42
Output
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 21
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
43
system/notboundexception
44
Running
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 22
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
45
46
Exercise 1a package utils
Create
Createaapackage
packageutils
utils
Create
Createaaclass
classExercisesUtils
ExercisesUtils
Create
Createan
anstatic
staticmethod
methodlogonToMax
logonToMaxthat
that
returns MXSession.
returns MXSession.
Create
Createananstatic
staticmethod
methodprintCompany
printCompany
that
that prints the MboSet asin
prints the MboSet as inExercise
Exercise11
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 23
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
47
Exercise 1a package utils
public
publicclass
classExercisesUtils
ExercisesUtils
{{ Classname: ExercisesUtils
////
////method
methodtotoreceive
receive33arguments
arguments
////
//// - - host
Specs
host e.g.
e.g.localhost
localhost
//// - - username
username e.g.
e.g.wilson
wilson
//// - - password
password e.g.
e.g.wilson
wilson
////
public
publicstatic
staticMXSession
MXSessionlogonToMax(String[]
logonToMax(String[]args)
args)
{{
Method: logonToMax
}}
////
////method
methodtotoprint
printall
allthe
thecompanies
companiesininthe
theMboSet
MboSet
////
public
publicstatic
staticvoid
voidprintCompany(MboSetRemote
printCompany(MboSetRemotecoset,
coset,String
Stringtitle)
title)
{{
}} Method: printCompany
}}
48
Exercise 1a package utils
Get Arguments
Get session
Connect to session Take the statements from
Exercise 1
return session
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 24
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
49
Exercise 1a package utils
50
Exercise 1a package company.show
Hints:
Create
Create class
class TestCompShowUtils
TestCompShowUtils
Get
Get session
session using
using the
the new
new utility
utility
ExercisesUtils.logonToMax
ExercisesUtils.logonToMax
Get
Get the
the MboSet
MboSet for
for COMPANIES
COMPANIES
Print
Print the
the MboSet
MboSet using
using the
the printCompany
printCompany
method from utils
method from utils
ExercisesUtils.printCompany
ExercisesUtils.printCompany
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 25
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
51
Exercise 1a (Test) package company.show
public
publicclass
classTestCompShowUtils
TestCompShowUtils
{{
Specs
////
////main
mainprogram
programto toreceive
receive33arguments
arguments
////
//// -- host
host e.g.
e.g.localhost
localhost
//// -- username
username e.g.wilson
e.g. wilson
//// -- password
password e.g.
e.g.wilson
wilson
////
public
publicstatic
staticvoid
voidmain(String[]
main(String[]args)
args)
{{
MXSession
MXSessionsession
session=ExercisesUtils.logonToMax(args);
=ExercisesUtils.logonToMax(args);
}}
}}
52
Debugging
1-Select class to
debug
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 26
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
53
Debugging
2-Click Run
3-Click Debug
1-Select class to
debug
54
2-Click on New
1-Click on Java
Application
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 27
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
55
56
1-Enter Arguments
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 28
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
57
1- Stop in main
2-Click Debug
58
Debug Perspective
Debug Icons
Variables
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 29
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
59
Debug Icons
Resume
Step Return
Continues to next
break point Performs all the rest of the
statement in method and
Terminate returns to caller
Step Over
Step Into
Executes current statement
Steps into the method and goes to next.
that is called
60
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 30
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
61
1- Invoking method
logonToMax
62
Method logonToMax
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 31
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
63
Exercise 1 package company.show
Debugging
64
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 32
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
65
66
Exercise 2 package company.select
Create
CreateaaTestCompSelect
TestCompSelectclass
class
Get
Getthe
thecompany
companysetsetwhere
wherethe
thecompany
companyid id
(company) starts with the letter ‘A’ order by
(company) starts with the letter ‘A’ order by
Company
Companyinindescending
descendingorder.
order.
Use
Usethe
theprint
printmethod
methodcreated
createdin
inUtils
Utils
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 33
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
67
Exercise 2 package company.select
public
publicclassclassTestCompSelect
TestCompSelect
{{ Specs
////
////main
mainprogram
programto toreceive
receive33arguments
arguments
////
//// -- host
host e.g.
e.g.localhost
localhost
//// -- username
username e.g. e.g.wilson
wilson
//// -- password
password e.g.wilson
e.g. wilson
////
public
publicstatic
staticvoid
voidmain(String[]
main(String[]args)
args)
{{
Hint
}} Where
Whereclause
clausecondition
condition
}} company
companylike
like‘A%’
‘A%’
68
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 34
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
69
70
Exercise 3 package tool.valuedata
Create
Createclass
classTestToolValueData
TestToolValueData
Create
Createmethod
methodprintTool(MboSetRemote
printTool(MboSetRemotemSet)
mSet)
Display
Displayfields
fieldsToolNum
ToolNum(itemnum),
(itemnum),Description,IssueUnit
Description,IssueUnitfor
for
Tools where issueunit is not null.
Tools where issueunit is not null.
Use
Usethe
theMboValueData
MboValueDatato
toget
getdata
datafor
foreach
eachMbo.
Mbo.
Truncate
Truncatethe
thedescription
descriptionto
to30
30ififlarger
largerthan
than30.
30.
Print
PrintIn
Inthe
thefollowing
followingformat:
format:
ToolNum
ToolNum Description
Description IssueUnit
IssueUnit
-------------
------------- -------------------------------
------------------------------- ----------
----------
length(8)
length(8) length(30)
length(30) length(10)
length(10)
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 35
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
71
Exercise 3
Hints:
Hints: Hints:
Object
Objectname
nameis
isTOOLITEM
TOOLITEM
String[]
String[]attrList={“itemnum”,”description”,”issueunit”};
attrList={“itemnum”,”description”,”issueunit”};
Loop
Loopfor
forall
allMbos
Mbosin
inMboSet
MboSet
Get
GetMboValueData
MboValueDatafor
forlist
listof
ofattributes
attributesfor
foreach
eachMbo
Mbo
get
getdata
datafrom
fromMboValueData
MboValueDataand
anddisplay
displaycalling
calling
printToolLine(toolNum,toolDesc,issueUnit);
printToolLine(toolNum,toolDesc,issueUnit);
Create method
printToolLine(String toolNum,
String toolDesc,
String issueUnit)
72
Exercise 3 package tool.valuedata
public
publicclass
classTestToolValueData
TestToolValueData
{{ Class: TestToolValueData
////
////main
mainprogram
programtotoreceive
receive33arguments
arguments
////
//// - - host
host e.g.
e.g.localhost
localhost
//// - - username
username e.g.
e.g.wilson
wilson
//// - - password
password e.g.
e.g.wilson
wilson
////
public
publicstatic
staticvoid
voidmain(String[]
main(String[]args)
args)
{{
}} printTool method
public
publicstatic voidprintTool(MboSetRemote
staticvoid printTool(MboSetRemotemset,
mset,String
Stringtitle)
title)
{ { //Loop
//Loopthru
thruall
allmbos
mbosininMboSet
MboSet Loop for all Mbos in MboSet
}}
Print one line
public
publicstatic voidprintToolLine(String
staticvoid printToolLine(StringtoolNum,
toolNum,String
StringtoolDesc,
toolDesc,
String
StringissueUnit)
issueUnit)
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 36
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
73
74
Exercise 4 package tool.valuedata
In
Insame
sameclass
classas
asexercise
exercise33 TestToolValueData
TestToolValueData
Create
Createmethod
methodprintFieldInfo
printFieldInfo
Display
Displaythe
theattribute
attributeinformation
informationfor
forMbo
Mbofor
forfields
fields
ToolNum(itemnum),
ToolNum(itemnum),Description,IssueUnit
Description,IssueUnitfor thefirst
forthe first44Mbos.
Mbos.
--length
length
--isNull
isNull
--isRequired
isRequired
Will be the same for all mbos
--isReadOnly
isReadOnly
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 37
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
75
Exercise 4
Hints:
Hints:
Hints:
String[]
String[]
attrList={“itemnum”,”description”,”issueunit”};
attrList={“itemnum”,”description”,”issueunit”};
Loop
Loopfor
forall
allMbos
Mbosin
inMboSet
MboSet
Get
GetMboValueData
MboValueDatafor
forlist
list
Loop
Loopfor
forall
allattributes
attributesin
inlist
list
display
displayfield
fieldinfo
infofor
foreach
eachattribute
attribute
76
Exercise 4
Hints:
Create method
private static void printFieldInfo(
int i, // mbo position
String name, // field name
MboValueData mvd) // field MboValueData
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 38
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
77
Exercise 4 package tool.valuedata
public class TestToolValueData
{
// main program to receive 3 arguments
// - host e.g. localhost
Specs
// - username e.g. wilson
// - password e.g. wilson
public static void main(String[] args)
{
}
78
Exercise 4 package tool.valuedata
Hint
for (int i = 0; toolSet != null && (((tool = toolSet.getMbo(i)) != null) && i < 4); i++)
{ Loop for Mbos in MboSet
//
// get data from Mbo in an array of MboValueData objects
//
valData = tool.getMboValueData(attrList); Get MboValueData
// for list
for (int j = 0; j < attrList.length; j++)
{ Loop for attributes
printFieldInfo(i, attrList[j], valData[j]); in list
}
} Print the information of
one attribute
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 39
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
79
80
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 40
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
81
82
Exercise 5 package tool.valuedata
In
Insame
sameclass
classas
asexercise
exercise33TestToolValueData
TestToolValueData
Get
GetMboValueData
MboValueDatafor
forthe
theMboSet
MboSet
Create
Createmethod
method
printToolFromSet(MboSetRemote
printToolFromSet(MboSetRemotemSet)
mSet)
Display
Displayfields
fieldsToolNum,
ToolNum,Description,IssueUnit
Description,IssueUnitasasin
in
Exercise 3 but using MboValueData to get data from
Exercise 3 but using MboValueData to get data from
MboSet
MboSetin inaatwo
twodimensional
dimensionalArray
Array
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 41
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
83
Exercise 5
Hints:
Hints:
Hints:
printToolFromSet(MboSetRemote
printToolFromSet(MboSetRemotemSet,
mSet,String
Stringtitle)
title)
Get
Getthe
theMboValueData
MboValueDatafor
forthe
thewhole
wholeset
set
Loop
Loopthe
thetwo
twodimensional
dimensionalarray
arrayof
of
MboValueData
MboValueData
display
displaydata
datausing
usingprintToolLine(…)
printToolLine(…)
84
Exercise 5 package tool.valuedata
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 42
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
85
86
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 43
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
87
88
Exercise 6 package tool.attrib
Hints:
Get
Getthe
theMboset
Mboset for
forMAXATTRIBUTE
MAXATTRIBUTEforforthe
the
objectname
objectname==the
themboset
mbosetname
nameof
ofthe
theobject
objectpassed
passed
as argument
as argument
Loop
Loopfor
forall
allelements
elementsin
inMboSet
MboSet
display
displayall
allthe
thedata
datafor
foreach
eachelement.
element.
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 44
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
89
Exercise 6 package tool.attrib
public
publicclass
classTestToolAttr
TestToolAttr
{{ Specs
public
publicstatic
staticvoid
voidmain(String[]
main(String[]args)
args)
{{
…
…
String
StringobjName
objName==“TOOLITEM”
“TOOLITEM”
if(args.length
if(args.length>>3)
3)
objName
objName==args[3]
args[3]
showSetAttributes(objName);
showSetAttributes(objName);
}}
private
privatestatic
staticvoid
voidshowKeys(String
showKeys(StringobjName)
objName)
private
privatestatic
staticvoid
voidshowSetAttributes(String
showSetAttributes(StringobjName)
objName)
90
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 45
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
91
92
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 46
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
93
94
Exercise 7 package company.add
Create
CreateTestCompAdd
TestCompAddclass
class
addComp()
addComp()method
method(to
(toadd
addthree
threecompanies)
companies)
Currency
CurrencyCode
Code(currencycode)
(currencycode)==“USD”
“USD”
Company
Company==“REMCO1”,
“REMCO1”,and
and“REMCO2”,and
“REMCO2”,and“REMCO3”
“REMCO3”
Description
Description(field
(fieldname)
name)==“Inserted
“Insertedfrom
fromRemote”
Remote”
“REMC01”
“REMC01”and
and“REMCO3”
“REMCO3”with
withlong
longdescription:
description:
Concatenate
ConcatenateCompany
Companywith
withtoday’s
today’sdate
date
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 47
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
95
session.getDate()
96
Exercise 7 package company.add
Method
printCompanyWithLD(MboSet ms, String title)
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 48
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
97
Exercise 7 package company.add
Required Setup
98
Companies Setup
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 49
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
99
GoTo/Administration/Sets
Select COMPSET1
100
2-Save
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 50
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
101
Exercise 7 Hints:
MboSetRemotecoset
MboSetRemote coset==
s.getMboSet(“COMPANIES”);
s.getMboSet(“COMPANIES”); Noticeyou
Notice youset
setthe
the
valueto
value tothe
theMbo
Mbo
MboRemoteco
MboRemote co==coset.add();
coset.add();
co.setValue(“company”,”REMCO1”);
co.setValue(“company”,”REMCO1”);
Hintsfor
Hints forprintCompanyWithLD
printCompanyWithLD
Getlong
Get longdescription
descriptionfor
forfield
fieldname
name(which
(whichis
is
the company description)
the company description)
Checkififlong
Check longdescription
descriptionexist
existI.e.
I.e.ititis
isnot
not
null and it is not the empty String.
null and it is not the empty String.
102
Exercise 7 package company.add
public class TestCompAdd
{ Specs
// main program to receive 3 arguments:
// host, username, password
public static void main(String[] args)
{
}
public static void addComp()
{}
public static void printCompanyWithLD(MboSetRemote ms,
String title)
{
}
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 51
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
103
104
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 52
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
105
106
Exercise 8 package company.add
Add
Addmethod
methodto
toTestCompAdd
TestCompAddclass
class
delComp()
delComp()method
method
Delete
Deletethe
thecompanies
companiescreated
createdfirst
firstso
soyou
youcan
can
re-run
re-runwithout
withoutgetting
gettingduplicate
duplicateerror.
error.
Companies
Companiesadded
addedwhere
wherelike
like‘REM%’
‘REM%’
Display
Displaythe
thefields
fieldscompany,
company,name
nameand
and
currencycode for the deleted companies
currencycode for the deleted companies
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 53
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
107
Exercise 8 package company.add
public
publicclass
classTestCompAdd
TestCompAdd
{{
public
Specs
publicstatic
staticvoid
voidmain(String[]
main(String[]args)
args)
{{
}}
public
publicstatic
staticvoid
voidprintCompanyWithLD(MboSet
printCompanyWithLD(MboSetms,
ms,String
Stringtitle)
title)
{{
}}
public
publicstatic
staticvoid
voidaddComp()
addComp()
{{ }}
public
publicstatic
staticvoid
voiddelComp()
delComp()
{{}}
108
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 54
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
109
110
Exercise 9 package company.mod
Write
WriteTestCompMod
TestCompModclass
class
modComp()
modComp()method
method
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 55
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
111
Exercise 9 package company.mod
public
publicclass
classTestCompMod
TestCompMod
{{
////
Specs
////main
mainprogram
programto toreceive
receive33arguments
arguments
////
//// -- host
host e.g.
e.g.localhost
localhost
//// -- username
username e.g. e.g.wilson
wilson
//// -- password
password e.g.
e.g.wilson
wilson
////
public
publicstatic
staticvoid
voidmain(String[]
main(String[]args)
args)
{{
}}
public
publicstatic
staticvoid
voidmodComp()
modComp()
{{…
…}}
}}
112
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 56
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
113
114
Exercise 10 package workorder.relationship
wo
Write
Writeclass
classTestRelationships
TestRelationships asset
company
Use Relationships
Method
MethodshowUsingRelationships
showUsingRelationships
From
Fromthe
thefirst
first44Workorders
Workordersthat
thathave
haveasset
asset
11––Display
Displaythethefollowing:
following:
from
fromworkorder:
workorder:wonum,
wonum,assetnum,
assetnum,location
location
from
from asset: assetnum, vendor,manufacturer
asset: assetnum, vendor, manufacturer
from
fromcompanies:
companies: company,
company,address,
address,phone
phone
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 57
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
115
116
Exercise 10 package workorder.relationship
public
publicclass
classTestRelationships
TestRelationships
{{ Specs
public
publicstatic
staticvoid
voidmain(String[]
main(String[]args)
args)
{{
////get
getMboSet
MboSetandandcall
callmethods
methods
}}
public
publicstatic
staticvoid
voidshowUsingRelationships()
showUsingRelationships()
{{
}}
public
publicstatic
staticvoid
voidshowUsingDotNotation()
showUsingDotNotation()
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 58
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
117
118
Exercise 10a package utils
Display
Displayall
allthe
therelationships
relationshipsfor
forthe
theMboSet
MboSetpassed
passedas
as
parameter.
parameter.
Relationship
RelationshipName
Name Child
Child Sql
Sqlwhere
whereclause
clause
--------------------------
-------------------------- ----------------
---------------- -------------------------
-------------------------
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 59
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
119
Exercise 10a package utils
Hints:
Get
Getthe
theMboSet
MboSetfor
forMAXRELATIONSHIP
MAXRELATIONSHIPfor forthe
the
objectname = the mboset name of the mboset
objectname = the mboset name of the mboset
passed
passedasasargument
argument
Loop
Loopforforall
allthe
theMbos
Mbosin
inMboSet
MboSetdisplaying
displayingthe
the
fields
fields
Name,
Name,child
childand
andwhereclause
whereclause
120
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 60
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
121
122
Exercise 10a package workorder.relationship
Write Hints:
Writeclass
classTestAllRelationships
TestAllRelationships
Use
Usethis
thisclass
classto
totest
testthe
theShowAllRelationships
ShowAllRelationships
MboSetRemote
MboSetRemotewoset
woset==s.getMboSet(“workorder”)
s.getMboSet(“workorder”)
ExercisesUtils.showAllRelationships(woset);
ExercisesUtils.showAllRelationships(woset);
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 61
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
123
124
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 62
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
125
126
Company Hierarchies
COMPANY
COMPANY-child
COMPANY-child parentcompany
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 63
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
127
Exercise 11 package company.hierarchy
Create
Createthe
thefollowing
followinghierarchy
hierarchyof
ofcompanies
companies
SDKCO1
SDKCO2
SDKCO1-1
SDKCO2-1
SDKCO3 SDKCO2-2
SDKCO3-2 Child
SDKCO3-3
128
Exercise 11 package company.hierarchy
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 64
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
129
Exercise 11 package company.hierarchy
Hints:
130
Exercise 11 package company.hierarchy
Hints:
Top Level Name: SDKC0x
Create a method to do the add a
Is there a pattern? Top Level company
Parameters: Company Name
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 65
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
131
Exercise 11 package company.hierarchy
Hints:
Note:
132
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 66
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
133
134
Exercise 11a package company.hierarchy
Company
Company Children
Children
-----------------------------------------------------------
-----------------------------------------------------------
SDKCO1
SDKCO1
SDKCO1-1
SDKCO1-1
Hint:
SDKCO2
SDKCO2 Relationship?
SDKCO2-1
SDKCO2-1
SDKCO2-2
SDKCO2-2
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 67
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
135
Exercise 11a package company.hierarchy
public
publicclass
classTestCompHierarchy
TestCompHierarchy Specs
{{
public
publicstatic
staticvoid
voidmain(String[]
main(String[]args)
args)
private
privatestatic
staticvoid
voiddeleteChildrenAndTop(MboSetRemote
deleteChildrenAndTop(MboSetRemotemset)
mset)
public
publicstatic
staticvoid
voidaddTopLevel(MboSetRemote
addTopLevel(MboSetRemotemset,
mset,String
String
coName)
coName)
public
publicstatic
staticvoid
voidaddChildren(MboSetRemote
addChildren(MboSetRemotemset,
mset,
String
StringparentName,
parentName,int
intnChildrent)
nChildrent)
public
publicstatic
staticvoid
voidprintCompHierarchy(MboSetRemote
printCompHierarchy(MboSetRemotecoset,
coset,
String
Stringtitle)
title)
136
Verifying it works
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 68
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
137
138
Exercise 12 package exception
Create
Createaaclass
classTestException
TestException
Create
Createmethod
methodaddCompException
addCompExceptionwhere
whereyou
youadd
add
twice
twicethe
thesame
samecompany
companywhich
whichproduces
producesand
andException.
Exception.
Use
Use aatry
tryand
andcatch
catchblock
blockand
anddisplay
displayall
allthe
theinformation
informationabout
about
the exception
the exception
--error
errorgroup
group
--error
errorkey
key
--error
errormessage
message
--parameters
parameters
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 69
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
139
Exercise 12a package exception
Create
Createyour
yourown
ownerror
error message
message
duplicateComp=The
duplicateComp=Thecompany
company{0}
{0}is
isaaduplicate
duplicate
company
company
Run
Runaasql
sqlscript
scriptto
toupdate
updateMaximo
Maximo66messages.
messages.
In
Inyour
yourprogram
programthrow
throwthe
theexception
exception
MXApplicationException
MXApplicationException withyour
with yourmessage
message
Put
Putaatry
tryand
andcatch
catchin
inthe
themain
mainand
anddisplay
displaythe
the
exception information.
exception information.
140
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 70
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
141
142
Exercise 12 package exception
public
publicclassclassTestException
TestException
{{
////main
mainprogram
programto toreceive
receive33arguments
//// - - host
arguments
host e.g.
e.g.localhost
localhost
Specs
//// - - username
username e.g.
e.g.wilson
wilson
//// - - password
password e.g.
e.g.wilson
wilson
//// private
privatestatic
staticvoid
voidaddCompException()
addCompException()
public
publicstatic
staticvoid
voidmain(String[]
main(String[]args)
args)
{{
{{
try
try
try
try
{{////add
addaacompany
companytwice
twiceto
to
{{ addCompException();
addCompException();
force exception
force exception
}}
}}
catch(…)
catch(…)
catch(…)
catch(…)////catching
catchingMXException
MXException
{{ ////display
displayall
allthe
thedetails
detailsof
ofexception
exception
{{
}}
throw
throwexception
exceptionwith
withmessage
message
}}
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 71
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
143
Exercise 12 package exception
private static void addCompException()
{ Specs (cont)
try
}
catch(…)
}
}
144
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 72
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
145
146
Customizing
Customizing
MAXIMO Business
MAXIMO Business
Components
Components
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 73
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
147
Customizing Business Components
Validation Classess
148
Exercise 13- Steps
Notice that in the VM environment Maximo has been setup with no ear file
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 74
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
149
1- Create a domain
For Maximo setup
webLogic8-create-domain.doc
2- Configure domain
webLogic8-configure-domain.doc
Or
webLogic8-create-domain-with-JMS.doc
Notice that in the VM environment Maximo has been setup with no ear file
150
Development Environment Directories
MAXIMO root
applications
maximo
businessobjects
MXES-Customization classes
Link to
psdi
source
classes
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 75
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
151
MAXIMO root
Development Directories applications
maximo
businessobjects
MXES-Customization classes
Link to
152
2- Select Project
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 76
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
153
2- Click on Next
154
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 77
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
155
156
1-Expand Project
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 78
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
157
MXES-Classes is a link
directory pointing to the MXES
root directory.
158
Eclipse Set up
Start Eclipse
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 79
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
159
Findclass
Find classin
inMAXATTRIBUTE
MAXATTRIBUTE
Writejava
Write javafile
fileto
toextend
extendclass
class
Putfile
Put filein
incustom/app/…
custom/app/…directory
directory
Compileclass
Compile class
ModifyMAXATTRIBUTE
Modify MAXATTRIBUTEto
topoint
pointto
to
the new class
the new class
ModifyMAXATTRIBUTECFG
Modify MAXATTRIBUTECFGto
topoint
point
to the new class
to the new class
160
Add
Addthe
thefield
fieldIN19
IN19from
fromITEM
ITEMtable
tableto
tothe
theITEM
ITEMscreen.
screen.
Create
Createfield
fieldvalidation
validationfor
forIN19:
IN19:
1-1-Initialize
Initializefield
fieldto
to“IT1”
“IT1”for
fornew
newrecords
records
2-2-Allow
Allowvalues
valuesthat
thatstart
startonly
onlywith
with“I”
“I”
3-3-IfIfvalid
validmake
makeititupper
uppercase
case
4-4-IfIfinvalid
invaliddisplay
displayyour
yourown
ownerror
error
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 80
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
161
app item
class
e s custom
item
source app
.java
162
Exercise 13 package custom.app.item
Steps Hints:
Check
CheckMAXIMO
MAXIMOdata
datadictionary
dictionaryto
tosee
seeififthere
thereisisaa
validation
validationclass.
class.
select
selectobjectname,attributename,classname
objectname,attributename,classname
from
frommaxattribute
maxattribute
where
whereobjectname='ITEM'
objectname='ITEM'
and
andattributename
attributename==‘IN19’;
‘IN19’;
No
Novalidation
validationclass
classexist
exist
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 81
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
163
Exercise 13
Hints:
Class
Class name
name for
for field
field IN19
IN19 would
would be
be
FldItemIN19
FldItemIN19
For
For customized
customized classes:
classes:
CustFldItemIN19
CustFldItemIN19
Prefix: Cust
164
MboValueAdapter
MAXTableDomain Fld…
javadoc
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 82
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
165
Exercise 13
Hierarchy
MboValueAdapter
No Validation
class exist we
inherit from
top level
CustFldItemIN19
166
Exercise 13
Hints:
Tool
Tool to
to generate
generate the
the template
template for
for
field Validation Classes
field Validation Classes
Unzip
Unzip the
the Generate-MXES.zip
Generate-MXES.zip file
file from
from
the
the share directory mxgenerate into your
share directory mxgenerate into your
C:\MXESGenerate
C:\MXESGenerate
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 83
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
167
Exercise 13 Hints: Generating the template
for your new validation class
generatefldval
generatefldval p1
p1 p2
p2 p3
p3 p4
p4 p5
p5
where
where
p1
p1--MAXIMO
MAXIMOroot
rootc:\MXES
c:\MXES
P2
P2--table
tablename
name e.g.
e.g.Companies
Companies
P3
P3 - column name e.g.
- column name e.g.currencycode
currencycode
p4
p4--Customization
Customization root
rootdirectory
directory
e.g.
e.g.c:\mxes-customization
c:\mxes-customization
P5
P5 - customobject
- custom object e.g.
e.g.
custom.app.company.CustFldCompanyCurrencyCode
custom.app.company.CustFldCompanyCurrencyCode
ififthere
thereis
isaavalidation
validationclass
classfor
forthe
thefield
fieldititwill
willextend
extend
that validation class otherwise it extends MboValueAdapter
that validation class otherwise it extends MboValueAdapter
168
Exercise 13 Hints: Getting help with
parameters
Typing
Typinggeneratefldval
generatefldvalwith
withno
noparameters
parametersdisplays
displayshelp
help
Parameters:
Parameters:
p1
p1--MAXIMO
MAXIMOroot
rootc:\MXES
c:\MXES
P2
P2--table
tablename
name e.g.
e.g.Companies
Companies
P3
P3 - column name e.g.
- column name e.g.currencycode
currencycode
p4
p4--Customization
Customization root
rootdirectory
directory
e.g.
e.g.c:\mxes-customization
c:\mxes-customization
P5
P5--custom
customobject
object e.g.
e.g.
custom.app.company.CustFldCompanyCurrencyCode
custom.app.company.CustFldCompanyCurrencyCode
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 84
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
169
Exercise 13 Hints: Generating the template
for your new validation class
C:\MXESgenerate>
C:\MXESgenerate>generatefldval
generatefldvalc:\MXES
c:\MXES ITEM
ITEMIN19
IN19
C:\MXES-Customization
C:\MXES-Customization
custom.app.item.CustFldItemIN19
custom.app.item.CustFldItemIN19
C:\MXES
C:\MXES --MAXIMO
MAXIMOroot
rootdirectory
directory
ITEM
ITEM --MAXIMO
MAXIMOtable
tablename
name
IN19
IN19––Field
Fieldname
namein
intable
tableITEM
ITEM
C:\MXES-Customization
C:\MXES-Customization––Customization
Customizationdirectory
directory
custom.app.item.CustFldItemIN19
custom.app.item.CustFldItemIN19––Field
Fieldvalidation
validationclass
class
170
Exercise 13 Hints: Generating the template
for your new validation class
C:\MXESgenerate>
C:\MXESgenerate>generatefldval
generatefldvalc:\MXES
c:\MXES ITEM
ITEMIN19
IN19
C:\MXES-Customization
C:\MXES-Customization Type in
custom.app.item.CustFldItemIN19
custom.app.item.CustFldItemIN19 One line
The following files are created after executing:
The directory
C:\MXES-Customization\custom\app\item\ has:
CustFldItemIN19.java
CustFldItemIN19-register.sql
CustFldItemIN19-restore-orig.sql
CustFldItemIN19-message-register.sql
CustFldItemIN19-message-delete.sql
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 85
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
171
Exercise 13 Hints:
field
fieldvalidation
validationclass
classfor
forIN19:
IN19:
1- initValue()
1-Initialize
Initializefield
fieldto
to“IT1”
“IT1”for
fornew
newrecords
records
2-
2-Allow
Allowvalues
valuesthat
thatstart
startwith
withIIonly
only
validate()
3-
3-IfIfinvalid
invaliddisplay
displayyour
yourown
ownerror
error
4-
4-IfIfvalid
validmake
makeititupper
uppercase
case action()
172
Exercise 13
Hints: Creating your
messages
Update
UpdateMAXMESSAGES
MAXMESSAGEStable
table
Create
Createaanew
newmessage
messagefor
forError
ErrorDialog
DialogBox
Box
Group:
Group:myitem
myitem
Id:
Id:InvalidIN19
InvalidIN19
Message:
Message:The
Thevalue
valueof
ofIN19
IN19must
muststart
startwith
withan
anI.I.
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 86
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
173
Sequence for id
174
Go To/Configuration/Application Designer
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 87
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
175
ITEM Tab
176
1-Control
Palette
2-Text Box
3-Drag and Drop
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 88
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
177
178
2-Textbox Properties
3-Label: IN19
4-Attribute: IN19
1-Select Field
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 89
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
179
Save
changes
180
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 90
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
181
182
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 91
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
183
Steps
Modify CustFldItemIN19.java
184
Exercise 13- Steps
Update MAXMESSAGES
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 92
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
185
Restart Maximo
Note:
186
webLogic
Eclipse
Eclipse webSphere
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 93
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
187
Start
Start MAXIMO
MAXIMO in
in debug
debug Mode
Mode
WebLogic: startWebLogicDebug.cmd
188
1- Servers
2- Application servers
3-Select MAXIMOSERVER
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 94
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
189
Scroll down
190
Click on Debugging
Service
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 95
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
191
3-Click Apply
192
Click Save
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 96
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
193
2- Click Save
194
Click OK
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 97
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
195
Click OK
196
Click Save
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 98
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
197
Click Save
198
Click OK
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 99
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
199
Maximo is not
started yet
200
2-Click on Start
Maximo is not
1- Select
started
MAXIMOSERVER
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 100
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
201
Maximo is now
started
202
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 101
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
203
3-Select Debug…
1- Click on Project
204
2-Click on New
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 102
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
205
2-Click on Debug
206
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 103
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
207
208
Follow
Follow the
the documentation
documentation
eclipse3.2-setup\
eclipse3.2-setup\
MXMbo-Customization-setup\
MXMbo-Customization-setup\
MXCustom-debug-eclipse3.2.doc
MXCustom-debug-eclipse3.2.doc
Start
Start MAXIMO
MAXIMO in
in debug
debug Mode
Mode
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 104
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
209
210
Same
Same as
as Exercise
Exercise 13
13
Display
Display aa Yes, Yes, No,
No, Cancel
Cancel dialog
dialog box
box
and allow to enter a value not starting
and allow to enter a value not starting
with
with “I”
“I” ifif the
the response
response is
is Yes.
Yes.
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 105
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
211
Restore Original
CustFldItemIN19-restore-orig.sql
212
Exercise 13a Hints: Generating template for
package custom.app.item.yesno
generatefldvalyesno
generatefldvalyesno p1
p1p2
p2p3
p3p4
p4p5
p5
C:\MXESgenerate>generatefldvalyesno
C:\MXESgenerate> generatefldvalyesnoc:\mxes
c:\mxes
ITEM IN19 C:\MXES-Customization
ITEM IN19 C:\MXES-Customization
custom.app.item.yesno.CustFldItemIN19
custom.app.item.yesno.CustFldItemIN19
C:\mxes - MAXIMO root directory
ITEM - MAXIMO table name
IN19 – Field name in table ITEM
C:\MXES-Customization – Customization directory
custom.app.item.yesno.CustFldItemIN19 – Field validation
class Package and class name
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 106
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
213
214
Exercise 13a
Hints: Creating your
messages
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 107
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
215
Sequence for id
216
Restart Maximo
Note:
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 108
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
217
218
Exercise 14 package custom.app.company
IfIfthe
thecompany
companyis
isaachild
childset
setthe
thefield
field
CURRENCYCODE
CURRENCYCODEas asread
readonly.
only.
Two
Twocases:
cases:
New
NewCompanies
Companies
Existing
ExistingCompanies
Companies
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 109
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
219
A company is a
child if it has a
COMPANY parent
COMPANY-child parentcompany
220
Exercise 14 Hints:
IfIfthe
thecompany
companyis
isaachild
childset
setthe
thefield
field
CURRENCYCODE as read
CURRENCYCODE as read only.only.
Extend
parentcompany
validation class
Two
Twocases:
cases:
New
NewCompanies
Companies action()
Existing
ExistingCompanies
Companies init()
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 110
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
221
Triggering Event
A company is a
child if it has a
COMPANY parent
COMPANY-child parentcompany
222
Becoming a Child
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 111
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
223
1-Creating a New
Company to be used as
the Top level Company
i.e. NO parent
224
New Row to
add a child
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 112
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
225
226
When we click on
save the Parent of
“ACSN” will be set
to “COPARENT”
Selected
child In this case we made an
existing Company into a
child
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 113
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
227
Parent can be
associated at this time.
228
Exercise 14 - Steps
Selectattribute
Select attributeto
tocustomize
customize
C:\MXESgenerate>
C:\MXESgenerate>generatefldval
generatefldvalc:\MXES
c:\MXES COMPANIES
COMPANIES
PARENTCOMPANY C:\MXES-Customization
PARENTCOMPANY C:\MXES-Customization
custom.app.company.CustFldCompanyParentCompany
custom.app.company.CustFldCompanyParentCompany
Writebusiness
Write businesslogic
logic
Compileclass
Compile class
RunScripts
Run Scriptsto
toupdate
updateData
Datadictionary
dictionary
RestartMaximo
Restart Maximoand
andtest
test
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 114
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
229
Restart Maximo
Note:
230
Exercise 14 package custom.app.company
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 115
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
231
232
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 116
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
233
Optional
234
Exercise 14a package custom.app.company
Optional Exercise
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 117
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
235
Exercise 14a package custom.app.company
public
publicclass
classCustFldCompanyParentCompany
CustFldCompanyParentCompany
Optional extends
extendsFldCompanyParentCompany
FldCompanyParentCompany
{{ Do not allow a company to have more
than three children
public
publicvoid
voidvalidate()
validate()……
{{
////check
checkthat
thatthe
theparent
parentdoes
doesnot
nothave
havemore
more
////than
than33children
children
}}
}}
236
Exercise 14a package custom.app.company
Testing
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 118
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
237
238
Exercise 15 package custom.app.company
The currency
The currency code
code for
for all
all the
the children
children of
of
aa company
company must
must be
be the
the same
same as as the
the
parent’s
parent’s
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 119
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
239
Exercise 15 package custom.app.company
Cases
1-Ifthe
1-If thecurrency
currencycode
codeis ischanged
changedforforaacompany
company
thatis
that isaaparent
parentchange
changethethecurrency
currencycode
codefor
forall
all
the children to be the same as the parent.
the children to be the same as the parent.
2-Ifaanew
2-If newcompany
companyis iscreated
createdas
asaachild
childitit
should have the same currencycode
should have the same currencycode asasits
its
parent
parent
3-Ifan
3-If anold
oldcompany
companybecomes
becomesaachild
childititshould
should
havethe
have thesame
samecurrencycode
currencycodeas
asits
itsparent
parent
240
Exercise 15 package custom.app.company
Extend the
Extend the currencycode
currencycode validation
validation class
class
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 120
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
241
Exercise 15 package custom.app.company
What Relatiohship?
242
Exercise 15 package custom.app.company
Select aa Company
Select Company that
that have
have children
children and
and
modify the
modify the Currency
Currency
Verify that
Verify that all
all the
the children
children have
have the
the parent’s
parent’s
currency
currency
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 121
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
243
1-Select new
Currency
244
2-If error:
“The exchange rate was
not found”
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 122
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
245
246
3-Click on Save
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 123
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
247
Exercise 15 package custom.app.company
Extend the
Extend the parentcompany
parentcompany validation
validation class
class
248
Exercise 15 package custom.app.company
Create aa New
Create New Company
Company and
and assign
assign aa
parent
parent
Verify that
Verify that the
the currency
currency is
is the
the parent’s
parent’s
currency
currency
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 124
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
249
Exercise 15 package custom.app.company
Add aa branch
Add branch to
to aa Company
Company
The branch
The branch Company
Company should
should have
have the
the
currency of
currency of the
the parent.
parent.
250
Notice
In the current release the action() method
is NOT executed when an existing company
becomes a branch (a child) because the field is
setup with NOACTION during the save() for
Company
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 125
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
251
252
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 126
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
253
254
Exercise 15a package custom.app.company
Donot
Do notdisplay
displayaaList
Liston
onthe
theCurrencyCode
CurrencyCode
field if the field is ReadOnly.
field if the field is ReadOnly.
Inthe
In theprevious
previousexercise
exercisethe
thefield
fieldwas
wasmade
made
ReadOnly when the company was a child.
ReadOnly when the company was a child.
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 127
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
255
256
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 128
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
257
Customized Behavior
Company is a child
258
Exercise 15a package custom.app.company
Hint
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 129
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
259
GenerateJava
Generate Javaand
andScript
Scriptfiles
filesin
inthe
the
custom/app/… directory
custom/app/… directory
Writebusiness
Write businesslogic
logic
Compileclass
Compile class
RunScripts
Run Scriptsto
toupdate
updateData
Datadictionary
dictionary
RestartMaximo
Restart Maximoand
andtest
test
260
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 130
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
261
262
Exercise 16 package custom.app.pr
We
Wedeal
dealonly
onlywith
withvendor
vendorcompanies
companiesin
in
Massachusetts
Massachusetts
We
Wedo
donot
notdeal
dealwith
withmanufacturers.
manufacturers.
Therefore
Thereforethe
thevalid
validlist
listfor
forvendors
vendorsmust
mustbe
be
such
such that the address can only havethe
that the address can only have thestate
state
as
asMA
MAfor
forPRs
PRsand
andPOs
POs
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 131
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
263
Related OBJECT is
COMPANIES
List of
Vendors
264
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 132
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
265
Exercise 16 Hints:
override
hasList Extend validation
getList on Vendor field
validate
Condition
Company must not be disabled e.g. disabled is ‘N’
The state must be “MA” (field address3)
The type must be vendor “V”
Use SqlFormat for the
Use SqlFormat towhere clause
build the where clause
266
getMboSet(String where)
MAXTableDomain getMboSet(String)
getMboSet(“COMPANIES”); Warning
COMPANIES
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 133
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
267
268
Why do we need to implement validate() method?
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 134
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
269
270
Exercise 16 - Steps
Selectattribute
Select attributeto
tocustomize
customize
GenerateJava
Generate Javaand
andScript
Scriptfiles
filesin
inthe
the
custom/app/… directory
custom/app/… directory
Writebusiness
Write businesslogic
logic
Compileclass
Compile class
RunScripts
Run Scriptsto
toupdate
updateData
Datadictionary
dictionary
RestartMaximo
Restart Maximoand
andtest
test
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 135
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
271
Programming Note
Add
RemoteException
272
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 136
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
273
Type invalid
Company
274
Maximo default
behavior is to take the
value as a search
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 137
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
275
Go To Companies
276
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 138
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
277
278
Customizing Mbo
Customizing Mbo
classes
classes
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 139
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
279
280
Twocases:
Two cases:
Newrecords
New records
New Fields:
Change By, Modifiedrecords
Modified records
Change Date
Weneed
We needto
tokeep
keeptrack
trackof
ofwho
whochanges
changesananItem
Itemand
andthe
thedate
dateof
ofthe
the
change and display them on the screen.
change and display them on the screen.
Fieldsshould
Fields shouldbe
bedisplayed
displayedon
onthe
theItem
Itemscreen
screenand
andbe
beread-only.
read-only.
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 140
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
281
Exercise 17 package custom.app.item
Hints:
Addtwo
Add twofields
fieldsto
totable
tableITEM.
ITEM.CUST_CHANGEBY
CUST_CHANGEBY
––same
sameasasPERSON.PERSONID
PERSON.PERSONID
CUST_CHANGEDATE--datetime
CUST_CHANGEDATE datetime
Do this in
Database
Configure App
ExtendITEM
Extend ITEMMbo
Mbo
282
GoTo/Configuration/Database Configuration
Click on Attributes
Click on New
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 141
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
283
CUST_CHANGEBY
Same as
PERSON.PERSONID
Click on New
284
CUST_CHANGEDATE
Type DATETIME
Save Changes
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 142
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
285
Reconfigure Maximo
At DOS prompt:
Run configdb.bat
from:
<Maximo root>\tools\maximo
286
Save Changes
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 143
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
287
GoTo/Configuration/Application Designer
ITEM Application
Item tab
288
Control Palette
Select Textbox
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 144
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
289
290
Textbox Properties
Label: Changed by
Attribute:
CUST_CHANGEBY
Form object ITEM
Select Field
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 145
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
291
Textbox Properties
Attribute:
CUST_CHANGEDATE
Form object ITEM
Select Field
292
Save Changes
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 146
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
293
e.g.
e.g.Extending
ExtendingItem
ItemMbo
Mbo Hints:
Classes Interfaces
294
Exercise 17 Steps Hints:Use
generatembo
Generate custom files
CustItemSet.java
CustItemSetRemote.java
Customize
CustItem.java
init()
CustItemRemote.java
add()
CustItem-register.sql modify()
CustItem…sql Scripts
CustItem_rmic file
build project
test
run rmic (Run Ant. Select names)
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 147
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
295
Exercise 17 Hints: Generating the
template for your Mbo
classes
generatembo
generatembo p1
p1p2
p2p3
p3p4
p4
where
where
p1
p1––MXES
MXESroot
rootdirectory
directory
e.g.
e.g.c:\mxes
c:\mxes
P2
P2--Object
Objectname
name e.g.
e.g.Companies
Companies
p3
p3 - Customization rootdirectory
- Customization root directory
e.g.
e.g.c:\mxes-customization
c:\mxes-customization
P4
P4 - customobject
- custom object e.g.
e.g.
custom.app.company.CustCompany
custom.app.company.CustCompany
296
Hints: Generating the
Exercise 17
template for your new
Item class
generatembo p1 p2 p3 p4
generatembo p1 p2 p3 p4
C:\mxes-generate>
C:\mxes-generate>generatembo
generatemboc:\mxes
c:\mxesITEM
ITEM
C:\mxes-Customization
C:\mxes-Customizationcustom.app.item.CustItem
custom.app.item.CustItem
C:\mxes
C:\mxes --MAXIMO
MAXIMOroot
rootdirectory
directory
ITEM
ITEM --MAXIMO
MAXIMOObject
Objectname
name
C:\MXES-Customization
C:\MXES-Customization––Customization
Customizationdirectory
directory
custom.app.item.CustItem
custom.app.item.CustItem––Customized
Customizedclass
class
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 148
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
297
Exercise 17 Hints: Generating the template
for your new Company class
C:\mxes-generate>
C:\mxes-generate>generatembo
generatemboc:\mxes
c:\mxesITEM
ITEM
C:\mxes-Customization custom.app.item.CustItem
C:\mxes-Customization custom.app.item.CustItem
CustItem-register.sql
CustItem.java CustItem-restore-orig.sql
CustItemRemote.java CustItem-rmic.xml
CustItemSet.java CustItem-message-register.sql
CustItemSetRemote.java CustItem-message-delete.sql
298
Twocases:
Two cases:
Newrecords
New records
New Fields:
Change By, Modifiedrecords
Modified records
Change Date
Weneed
We needto
tokeep
keeptrack
trackof
ofwho
whochanges
changesananItem
Itemand
andthe
thedate
dateof
ofthe
the
change and display them on the screen.
change and display them on the screen.
Fieldsshould
Fields shouldbe
bedisplayed
displayedon
onthe
theItem
Itemscreen
screenand
andbe
beread-only.
read-only.
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 149
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
299
Hints:
init()
300
Hints:
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 150
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
301
302
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 151
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
303
304
1-Expand Current
Project MXES-Custom
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 152
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
305
306
3-Click on JRE
2-Click on Apply
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 153
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
307
2-Click on Apply
3-Click on Run
308
2-Double click on
Console tab
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 154
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
309
310
Running rmic
Follow documentation
eclipse3.2-setup\
MXMbo-Customization-setup\
MXCustom-rmic-eclipse3.2.doc
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 155
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
311
312
Exercise 17 Steps
Add fields using Database Configuration
Implement Customization
Build Project
Run rmic
Test
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 156
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
313
314
Exercise 17 a
After save,
After save, do
do not
not allow
allow to
to change
change the
the
field:
field:
LotType
LotType
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 157
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
315
Customize the
Customize the same
same Object
Object as
as in
in
Exercise 17.
Exercise 17. (ITEM)
(ITEM)
316
Hints:
What method?
After save,
After save, do
do not
not allow
allow to
to change
change the
the
field:
field:
LotType
LotType
Check if record is new
and it is going to be
saved in database.
toBeAdded()
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 158
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
317
318
Exercise 18 package custom.app.wo
For Workorder
For Workorder
Do not
Do not allow
allow aa Workorder
Workorder to to be be approved
approved
ifif the
the GLAccount
GLAccount is is null
null or
or itit is
is not
not fully
fully
specified i.e.
specified i.e. itit is
is incomplete.
incomplete.
Display message:
Display message:
Invalid GL
Invalid GL Account
Account for
for wo:
wo: xxxx.
xxxx.
Please enter
Please enter aa full
full GL
GL Account.
Account.
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 159
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
319
6500-300-???
GL is
incomplete Cannot
Approve
320
Exercise 18
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 160
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
321
2-Incomplete
segment
has ???
1-Click on
the
GLAccount
Icon
3-Click on a
value for
segment e.g. 4-Click OK
200
322
Exercise 18
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 161
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
323
Exercise 18
Method to override
canChangeStatus(…)
OR
changeStatus(…)
324
Exercise 18
To show a custom
changeStatus(…) error message you
must override
changeStatus(…)
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 162
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
325
Exercise 18 package custom.app.wo
Hints:
For Workorder
For Workorder
Extend WO Mbo
Override:
changeStatus(…) method
Donot
Do notallow
allowaaWorkorder
Workorderto tobe
beapproved
approvedififthe
the
GLAccountis
GLAccount isnull
nullor
orititis
isnot
notfully
fullyspecified
specifiedi.e.
i.e.
it is incomplete.
it is incomplete.
Get Internal status,
Check if changing to APPR
Check if glAccount is complete.
326
Programming Note
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 163
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
327
Extending WO
328
1- Click on Source
2- Override/Implement
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 164
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
329
330
Several
overloaded
changeStatus
methods
We want to override
the one with the most
parameters
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 165
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
331
2-Click OK
332
Generated code
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 166
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
333
changeStatus(String newStatus,
Date date,
String memo,
long accessModifier,
boolean comingFromReceive)
See Javadocs for arguments
334
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 167
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
335
2-Menu Refactor/rename
1-Select arg0
336
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 168
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
337
1-Type newStatus
2- Click OK
338
Changed arg0 to
newStatus
everywhere
Now the customization can be implemented
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 169
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
339
Implementation Decision
340
Implement changeStatus(..)
Build Project
Run rmic
Test
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 170
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
341
342
Exercise 19
Addfield
Add field“NUMCONTACT”
“NUMCONTACT”type
typeINTEGER
INTEGER
toCOMPANIES
to COMPANIES
Addfield
Add field“PARENTCO”
“PARENTCO”to tothe
theCompContact
CompContact
Object with sameas COMPANY
Object with sameas COMPANY in inthe
the
COMPANIESobject
COMPANIES object
Reconfigure.Run
Reconfigure. Runconfigdb
configdbfrom
fromDOS
DOS
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 171
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
343
Exercise 19
Add NUMCONTACT field to Company Contacts tab
Contacts
344
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 172
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
345
Exercise 19
package custom.app.contacts
For Company
For Company
Keep the
Keep the counter
counter ofof how
how many
many contacts
contacts
in aa company
in company inin field
field NUMCONTACT.
NUMCONTACT.
Make the
Make the field
field Read-only
Read-only init()
346
COMPANY
COMPCONTACT COMPANY
COMPANY
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 173
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
347
Exercise 19 Objects
Relationship
COMPCONTACT
COMPCONTACT
COMPCONTACT
348
Exercise 19 package custom.app.contacts
companyfield
company fieldNUMCONTACT
NUMCONTACThas
hascounter
counterof
ofContacts
Contacts
Hints:
FindMbo
Find Mbofor
forCOMPCONTACT
COMPCONTACTtable
table
Twocases:
Two cases: Triggeringevents
Triggering events
AAnew
newcompany
companycontact
contactisiscreated
created add()
delete(…)
AAcompany
companycontact
contactisisdeleted
deleted
undelete(…)
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 174
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
349
Tab Contacts
Click on
new row
Adding contacts to Companies
350
Click on delete
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 175
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
351
Click on un-delete
352
Class Hierarchy for Mbos
Each
EachMboSet
MboSethas
hasaareference
referencename
namee.g
e.gWORKORDER.
WORKORDER.
Table name
Classes Interfaces
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 176
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
353
Class Hierarchy for Customized Workorder
Classes Interfaces
WO implements WORemote
Mbo
inherits
implements
CustWO CustWORemote
354
Short Class Hierarchy for Customized Workorder
WO implements WORemote
Mbo
inherits
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 177
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
355
Exercise 19 Hints: Generating the SHORT
template for your Mbo classes
generatemboshort
generatemboshort p1
p1p2
p2p3
p3p4
p4
where
where
p1
p1––MXES
MXESroot
rootdirectory
directory
e.g.
e.g.c:\mxes
c:\mxes
P2
P2--Object
Objectname
name e.g.
e.g.Companies
Companies
p3
p3 - Customization rootdirectory
- Customization root directory
e.g.
e.g.c:\mxes-customization
c:\mxes-customization
P4
P4 - customobject
- custom object e.g.
e.g.
custom.app.company.CustCompany
custom.app.company.CustCompany
356
Exercise 19 Hints: Generating the template
for your new CompContact class
generatemboshort
generatemboshort p1
p1p2
p2p3
p3p4
p4
C:\mxes-generate>
C:\mxes-generate>generatemboshort
generatemboshortc:\mxes
c:\mxes
COMPCONTACT
COMPCONTACT
C:\mxes-Customization
C:\mxes-Customization
custom.app.contacts.CustCompContact
custom.app.contacts.CustCompContact
C:\mxes
C:\mxes --MAXIMO
MAXIMOroot
rootdirectory
directory
ITEM
ITEM --MAXIMO
MAXIMOObject
Objectname
name
C:\MXES-Customization
C:\MXES-Customization––Customization
Customizationdirectory
directory
custom.app.contacts.CustCompContact
custom.app.contacts.CustCompContact––
Customized
Customizedclass
class
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 178
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
357
Exercise 19 Hints: Generating the template for
your new CompContact class
C:\mxes-generate>
C:\mxes-generate>generatemboshort
generatemboshortc:\mxes
c:\mxes
COMPCONTACT C:\mxes-Customization
COMPCONTACT C:\mxes-Customization
custom.app.contacts.CustCompContact
custom.app.contacts.CustCompContact
CustCompContact-register.sql
CustCompContact.java CustCompContact-restore-orig.sql
CustCompContactSet.java CustCompContact-message-register.sql
CustCompContact-message-delete.sql
358
Exercise 19 Steps
Build Project
Test
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 179
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
359
360
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 180
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
361
362
Exercise 20
package custom.app.company
For Contacts
For Contacts
Set up
Set up the
the field
field PARENTCO
PARENTCO in in
CompContact in
CompContact in all
all contacts
contacts for
for aa
company equals
company equals to to the
the parentcompany
parentcompany
field in
field in the
the Company
Company
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 181
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
363
Exercise 20 package custom.app.company
For Contacts
For Contacts
Add the
Add the PARENTCO
PARENTCO fieldfield to
to the
the screen
screen
Contacts tab
Contacts tab to
to be
be able
able to
to easily
easily see
see
your customization
your customization isis working.
working.
364
COMPANIES COMPANY
COMPANY PARENTCO
COMPANY PARENTCO
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 182
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
365
Exercise 20
OR
366
A1-1 A1
A1-1 N1 A1
New
A1-1 N2 A1
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 183
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
367
A1-1 A1
A1-1 C1 null
Existing
A1-1 C2 null
New A1-1 N3 A1
Only New records are set with parentcompany value
368
A1-1 A1
A1-1 C1 A1
Existing
A1-1 C2 A1
New A1-1 N3 A1
ALL records are updated at save()
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 184
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
369
370
Transaction
Company
Save
CompContact
New Row
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 185
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
371
372
Exercise 20 package custom.app.company
Hints:
For Contacts
For Contacts
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 186
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
373
Exercise 20 Steps
Implement save()
Build Project
Test
374
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 187
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
375
376
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 188
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
377
378
Exercise 20 A
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 189
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
379
380
Exercise 20A package company.oldrecs
Create aa remote
Create remote program
program
UpdateCompOldRecs that
UpdateCompOldRecs that updates
updates
Companies and
Companies and CompContact
CompContact
Updates Companies
Updates Companies field
field
NUMCONTACT
NUMCONTACT
Updates CompContact
Updates CompContact field
field PARENTCO
PARENTCO
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 190
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
381
Exercise 20A package company.oldrecs
Hints:
382
Exercise 20A – Output when trying to run
java.rmi.UnmarshalException: error unmarshalling return;
nested exception is:
java.lang.ClassNotFoundException:
custom.app.company.solution20.CustCompanySet_Stub
(no security manager: RMI class loader disabled)
Reason
We have Customized the Company Mbo
The Eclipse project uses businessobjects.jar which has
the old Company object
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 191
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
383
Exercise 20A Rebuilding ear file
Rebuild the
Rebuild the ear
ear file
file at
at
<Maximo>\deployment>buildmaximoear
<Maximo>\deployment>buildmaximoear
Extract businessobjects.jar
Extract businessobjects.jar file
file from
from
maximo.ear in
maximo.ear in <…>\deployment\defaults
<…>\deployment\defaults
Use WinZip
Refresh the
Refresh the project
project in
in Eclipse
Eclipse
Run the
Run the TestCompOldResc
TestCompOldResc program
program again
again
384
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 192
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
385
386
Exercise 21 package custom.app.company
AA company
company must
must have
have at
at least
least two
two
contacts with
contacts with different
different telephone
telephone
numbers which
numbers which are
are not
not null.
null.
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 193
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
387
Exercise 21 package custom.app.company
AA company
company must
must have
have at
at least
least two
two
contacts with
contacts with different
different telephone
telephone
numbers
numbers which
Wewhich are not
must are notwhen
check null. the Company
null.
is being saved i.e.
appValidate()
or
save()
388
Exercise 21 package custom.app.company
Hints:
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 194
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
389
390
Testing
Contact Phone
C1 123
C2 123
Save Exception
Contact Phone
C1 123
C2 123
C3 null Save Exception
Contact Phone
C1 123
C2 123
C3 null
C4 456 Save OK
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 195
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
391
392
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 196
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
393
394
Do not
Do not allow
allow the
the deletion
deletion of
of aa contact
contact ifif
there will
there will be
be less
less that
that two
two left
left with
with
different NOT
different NOT NULL
NULL phone
phone numbers.
numbers.
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 197
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
395
Exercise 22 package custom.app.contacts
Hints:
396
Exercise 22 package custom.app.contacts
Hints:
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 198
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Customizing Business Components in IBM Maximo 6 (Exercises)
397
Summary
You should now be able to:
• Customize Maximo Business Components.
– Use customizable methods.
• Init()
• Add()
• Delete()
• Save()
• Etc.
– Work with GL Accounts
– Work with change of status.
©Copyright IBM Corp. 2007 Customizing Business Components in IBM Maximo 6 (Exercises) 199
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Student VMware Setup
Objectives
Upon completion of this unit, you will be able to:
• Use the Virtual Machine used in the training computers.
Real Machine
student
EDSERVICES2005
Real Machine
Virtual
Machine
Real Machine
Double click
on the
Maximo6
Image
Click on Cancel
10
Must be
MXES Patch 3
11
12
13
14
Shutting down
OR
15
Shutting Down
Start Menu:
Shut Down…
Click OK
16
Click on
Shut Down
17
Shutting down
18
Start everything.
19
Start Eclipse
Start Maximo 6
Command window
20
21
Summary
You should now be able to:
• Use the Virtual Machine used in the training computers.
Agenda
Eclipse 3.2
Creating class
Editing class
Copying files
Renaming files
Moving files
2-Create Project
1-Java Project
2-Click Next
1-Project Name
2-Create Project in
existing directory
3-Browse for
directory
4- Click Next
Libraries used.
In this case JDK 1.4.2
Project Created
Create Class
10
1-Class Name
3-Can create a
main to be able
to execute the
class
11
Package statement
Main method
12
13
Code Completion
14
15
16
Error description
17
18
1-Correct error
2-Re-build project
19
0 errors
20
type if(i == 5)
21
Error
i cannot be resolrved
22
23
24
25
26
2-click on option to
initialize variable to 0
27
Eclipse added
initialization of “i”
28
Formatting
29
1- Right-mouse click
anywhere
3-Select Format
2-Select Source
30
31
Select Class
32
1-Class Name
3-Can create a
main to be able
to execute the
class
33
3-Package statement
4-Main method
34
Copying a file
1-Right-click on file
2-Select Copy
35
2-Right-click
3-Select Paste
36
37
Renaming a file
1-Right-click on file
2-Select Refactor
3-Select Rename
38
Old name
39
1-New name
2-Finish
40
2-Click on Finish
41
42
Closing windows
1-Right-click on
the tab
43
44
Coding help
45
46
47
1-Options to fix
problem
48
Eclipse inserted
the import
statement
49
Re-build Project
1-Right-click on
project name
2-Select Build
Project
50
One warning