Upload
berenice-allison
View
237
Download
0
Embed Size (px)
Citation preview
AUTOMATIONVISIBILITY CONTROL
IBM Maximo Asset ManagementJython Rocks Maximo
remote method invocation example
- setup PyDev in Eclipse Environment
- read XLS into Maximo
© 2013 IBM Corporation
Carsten Frentz - BerntSenior Client Technical ProfessionalIBM Software GroupCloud & Smarter Infrastructure
Jython Language
Jython LanguageThe Definitive Guide to Jython
http://www.apress.com/9781430225270
The Definitive Guide to Jython, written by the official Jython team leads, covers Jython 2.5 (or 2.5.x),from the basics to more advanced features.
The Definitive Guide to Jython is organized for beginners as well as advanced users. The book provides a general overview of the Jython language itself, but it also includes intermediate and advanced topics.
This book is also presented in open source and licensed through Creative Commons 3.0
You can read the book at http://jythonbook.comor check out the source at the book project on bitbucket at http://bitbucket.org/javajuneau/jythonbook/
Jython Install Instructionshttp://jython.org/Jython 2.5.4rc 1 Has Been Released (February 10, 2013)
Jython LanguageIntro based on Barry’s devworks articles http://jython.org/
PyDeveclipse based IDE
setup environment PyDev (eclipse based IDE)
PyDev is a third-party plug-in for Eclipse. It is an Integrated Development Environment (IDE) used for programming in Python, Jython and IronPython development.
It comes with many goodies such as:
Code completion with auto importSyntax highlightingCode analysisRefactoringMark occurrencesDebuggerRemote debuggerTokens browserInteractive consoleUnittest integrationand many others
PyDev home :http://pydev.org/http://pydev.org/download.html
Requirements Java 6 or higher (java 7 recommended)
At least one of: Python (2.1 or newer) Jython (2.1 or newer) IronPython (2.6 or newer)
and Eclipse (3.2 to 3.8/4.2)
install jython, eclipse and pydev – part 1
recommended instruction
http://www.ics.uci.edu/~pattis/common/handouts/pythoneclipsejava/eclipsepython.html
1. Install Jython and Java before installing Eclipse
2. Install Eclipse Standard SDK / Kepler Release v4.3Use 32 Bit Operating System for your machine (even if your Operating System is 64 Bits)This file is about 180 Mb so it might take a while to download fully.
3. Move this file to a more permanent location, so that you can install Eclipse.
4. Jython and Java should be installed before installing Eclipse.
5. Unzip <eclipse-SDK-4.3-win32.zip>, the file that you just downloaded and moved.
6. Open Eclipse and accept Workspace Launcher pop-up window.
7. Terminate (click X on) the Welcome tab.
8. Click Help and then click Install New Software.
9. Enter the text <http://pydev.org/updates> into the Work with text box.Select only the PyDev checkbox; do NOT select PyDev Mylyn Integration (optional) box.
10. Install pop-up window will appear, click NEXT and accept terms of the license agreement.
11. Finish and restart Ecplise.
install jython, eclipse and pydev – part 2
recommended instruction
http://www.ics.uci.edu/~pattis/common/handouts/pythoneclipsejava/eclipsepython.html
12. After Restart, click Window and then click Preferences.
13. Click Window, hover over Open Perspective.
14. Select PyDev (blue label on the Eclipse window will change to PyDev - Eclipse SDK).
add libraries …
businessobjects.jar[ MAXIMO business logic ][ extract from maximo.ear ]
icu4j.jar[ provides globalization technology into Java ][ extract from maximo.ear ]
jxl.jar[ xls read / write … download from http://sourceforge.net/projects/jexcelapi/ ]
cookbook cornerCreate Workorder in MAXIMO via RMI
if __name__ == '__main__':
import psdi.util.MXSession as MXSession import psdi.util.MXException as MXException try: session = MXSession.getSession() session.setHost('192.168.80.128:13400/MXServer') session.setUserName('maxadmin') session.setPassword('maxadmin') session.connect() except MXException, conex: print 'conex.getErrorGroup() :',conex.getErrorGroup() print 'conex.getErrorKey() :',conex.getErrorKey() print 'conex.getDetail() :',conex.getDetail() print 'conex.getDisplayMessage() :',conex.getDisplayMessage()
try: woset = session.getMboSet('WORKORDER') wo = woset.addAtEnd() # wo.setValue(“WONUM","&AUTOKEY&") wo.setValue(“DESCRIPTION","test description") woset.save() except MXException, mboex: print 'mboex.getErrorGroup() :',mboex.getErrorGroup() print 'mboex.getErrorKey() :',mboex.getErrorKey() print 'mboex.getMessage(mboset) :',mboex.getMessage(woset) session.disconnect()
cookbook cornerImport XLS to ALN Domain in MAXIMO via RMI
if __name__ == '__main__':
from java.io import File
from jxl import *
import psdi.util.MXSession as MXSession
import psdi.mbo.MboSetRemote as MboSetRemote
session = MXSession.getSession()
session.setHost("192.168.126.140:13400/MXServer")
session.setUserName("maxadmin")
session.setPassword("maxadmin")
session.connect()
maxdomain = session.getMboSet("MAXDOMAIN")
maxdomain.setWhere("DOMAINID='CREWID'")
maxdomain.reset()
alndomainset = maxdomain.getMbo(0).getMboSet("ALNDOMAINVALUE")
workbook = Workbook.getWorkbook(File("C:\\temp\\import.xls"))
sheet = workbook.getSheet(0)
for row in range(1, sheet.getRows()):
alndomain = alndomainset.addAtEnd()
alndomain.setValue("VALUE", sheet.getCell(0, row).getContents())
alndomain.setValue("DESCRIPTION", sheet.getCell(1, row).getContents())
alndomainset.save()
session.disconnect()
Import der Klassen
- Java Basis Klasse- JXL Java API read / write XLS- MAXIMO businessobjects
Referenz auf MAXIMO SessionundAufbau einer Verbindung
Public interface für den Zugriff auf MAXIMO BusinessObjects
Öffnen des XLS Files
Lese für alle XLS Zeilen die Spaltenfelder 1+2 und lege einen neuen Datensatz in ALNDomain an
Speichern und Abmelden
interesting
interestinghttps://www.ibm.com/developerworks/community/wikis/home?
lang=en#!/wiki/IBM%20Maximo%20Asset%20Management/page/Configuring%20and%20customizing
Configuring and CustomizingFor information about configuring and customizing Maximo Asset Management, select from the following links.
Configuring the user interfaceAdding a new field using Application Designer: View a beginner tutorial on how to add a new field to an application dialog using Application Designer. Customizing Headers with corporate colors and logo: Learn how to customize the Maximo Asset Management header with your corporate colors and logo. Hiding sections of the user interface: Learn how to improve usability by hiding sections of the user interface that are not needed by your users. For example, you might want the approvers of your work orders to see only the main Work Order tab of the Work Order Tracking application and not be distracted by any of the other tabs. Making long description a text field: Maximo Asset Management 7.5 added the ability to use a Rich Text Editor for the long descriptions. Learn how to configure the product to use the text area for long descriptions again. Stylize a label or text control to draw attention to a field or value: Learn how to draw attention to a particular field by stylizing its label or internal text. Application configuration best practices: Learn how to use the Application Designer to customize your user interface.Adding information to the user interface: Learn how to add additional information, such as fields or sections into an application to improve the efficiency of your users. UI Best Practices for Products Built on Tivoli's process automation engine: This document describes the screen layout features, UI style and details, and accessibility features that result in an optimally usable product UI. Follow the best practices that are provided in this document to ensure that the UI remains consistent, accessible, and easy to navigate and use. UI framework event handling: Learn how the user interface framework handles events when users press buttons or interact with widgets. Rich Text Formatting in Maximo and SmartCloud Control Desk 7.5: Learn how to add rich text to long descriptions and other parts of the user interface. Customizing helpHelp Customization Toolkit: Use the Help Customization Toolkit to install and develop a custom plug-in for Maximo Asset Management 7.5 and add this plug-in to your product information center. Separating Maximo Help files from WebSphere Application Server admin files: Learn how to deploy the MxEclipse application to create a standalone Eclipse information center that allows you to separate the Maximo files from the WebSphere admin files. Cloning application help in Maximo 7.1: Learn how to clone help for cloned applications in Maximo Asset Management Version 7.1. Customizing with automation scriptsCustomizing Maximo with Scripts: For Maximo Asset Management version 7.5, learn how to use scripting to customize many components without writing java code or rebuilding the EAR file. Maximo Scripting: Script compilation and caching: Learn how Maximo executes automation scripts saved in the database. Maximo Scripting: Date Dizziness--Part 1: Learn how to use scripts to calculate elapsed time based on date and time measurements in Maximo business objects and how to present that information in the user interface. Maximo Scripting: Date Dizziness--Part 2: Learn a Java-based approach to calculating dates through a scenario in which an escalation executes a scripted action. Maximo Scripting: Date Dizziness--Part 3: Learn how to implement a JavaScript-based script to calculate dates. Multiple language environmentsAttribute and domain functions: This article provides an overview of attribute and domain functions for multiple language environments, including the Maxattribute.Localizable, Maxattribute.Mlinuse and Maxattribute.Mlsupported attributes and ALN-/SYNONYMDOMAIN. Configuring a Start Center for multiple language environments: This article describes how to configure start centers for multiple language environments and provides an example that describes how to configure for Dutch and English. Hints and tips for multiple language environments: This article provides useful hints and tips for users who have multiple language environments. Customization Detection Tool: Learn how to use a tool that can locate customizations for objects, attributes, and service classes that have been extended and/or added to.Configuring Colors in Assignment Manager: Learn how to assign colors based on priorities in the Work List of the Assignment Manager application.Deploying clustered configurations: Learn how to deploy a clustered configuration for Maximo Asset Management.Introducing Email Interaction Setup: Learn how to update an object or workflow assignment by sending an email with a number prompt. This enhancement provided with Maximo Asset Management 7.5.0.3 is device independent and updates can be made by laptop, smartphone, tablet and other devices on a wide range of existing networks and carriers.Maximo business object development: View best practices for developing Maximo business objects (MBOs).Skip fields during duplication: Learn how to skip user-defined fields during duplication of a record. Related pagesConfiguring the Maximo Enterprise Adapter for SAP Applications without SAP NetWeaver Process Integration: Learn how to configure an alternative middleware component to support integration between Maximo Asset Management and SAP ERP, version 6.0.
interestinghttps://www.ibm.com/developerworks/community/groups/service/html/communityview?communityUuid=a9ba1efe-
b731-4317-9724-a181d6155e3a#fullpageWidgetId=W5f281fe58c09_49c7_9fa4_e094f86b7e98&file=83c7752c-a621-4af9-bb32-d6ba7d612ab2