IBM Maximo Asset Management Jython Rocks Maximo remote method invocation example - setup PyDev in Eclipse Environment - read XLS into Maximo Carsten Frentz -

Download Report

Transcript IBM Maximo Asset Management Jython Rocks Maximo remote method invocation example - setup PyDev in Eclipse Environment - read XLS into Maximo Carsten Frentz -

IBM Maximo Asset Management
Jython Rocks Maximo
remote method invocation example
- setup PyDev in Eclipse Environment
- read XLS into Maximo
Carsten Frentz - Bernt
Senior Client Technical Professional
IBM Software Group
Cloud & Smarter Infrastructure
VISIBILITY
CONTROL
AUTOMATION
© 2013 IBM Corporation
Jython Language
Jython Language
The 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.com
or check out the source at the book project on bitbucket at
http://bitbucket.org/javajuneau/jythonbook/
Jython Install Instructions
Jython 2.5.4rc 1 Has Been Released (February 10, 2013)
http://jython.org/
Jython Language
Intro based on Barry’s devworks articles
http://jython.org/
PyDev
eclipse 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 import
Syntax highlighting
Code analysis
Refactoring
Mark occurrences
Debugger
Remote debugger
Tokens browser
Interactive console
Unittest integration
and 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.3
Use 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.
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/ ]
13. Click Window, hover over Open Perspective.
14. Select PyDev (blue label on the Eclipse window will change to PyDev - Eclipse SDK).
cookbook corner
Create 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()
print 'conex.getErrorKey()
print 'conex.getDetail()
print 'conex.getDisplayMessage()
:',conex.getErrorGroup()
:',conex.getErrorKey()
:',conex.getDetail()
:',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()
print 'mboex.getErrorKey()
print 'mboex.getMessage(mboset)
session.disconnect()
:',mboex.getErrorGroup()
:',mboex.getErrorKey()
:',mboex.getMessage(woset)
cookbook corner
Import XLS to ALN Domain in MAXIMO via RMI
if __name__ == '__main__':
Import der Klassen
- Java Basis Klasse
- JXL Java API read / write XLS
- MAXIMO businessobjects
Referenz auf MAXIMO Session
und
Aufbau einer Verbindung
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()
Public interface für den Zugriff auf maxdomain = session.getMboSet("MAXDOMAIN")
MAXIMO BusinessObjects
maxdomain.setWhere("DOMAINID='CREWID'")
maxdomain.reset()
alndomainset = maxdomain.getMbo(0).getMboSet("ALNDOMAINVALUE")
Öffnen des XLS Files
workbook = Workbook.getWorkbook(File("C:\\temp\\import.xls"))
sheet = workbook.getSheet(0)
for row in range(1, sheet.getRows()):
Lese für alle XLS Zeilen die
alndomain = alndomainset.addAtEnd()
Spaltenfelder 1+2 und lege einen
neuen Datensatz in ALNDomain an alndomain.setValue("VALUE", sheet.getCell(0, row).getContents())
alndomain.setValue("DESCRIPTION", sheet.getCell(1, row).getContents())
Speichern und Abmelden
alndomainset.save()
session.disconnect()
interesting
interesting
https://www.ibm.com/developerworks/community/wikis/home?
lang=en#!/wiki/IBM%20Maximo%20Asset%20Management/page/Configuring%20and%20customizing
Configuring and Customizing
For information about configuring and customizing Maximo Asset Management, select from the following links.
Configuring the user interface
Adding 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 help
Help 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 scripts
Customizing 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 environments
Attribute 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 pages
Configuring 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.
interesting
https://www.ibm.com/developerworks/community/groups/service/html/communityview?communityUuid=a9ba1efeb731-4317-9724-a181d6155e3a#fullpageWidgetId=W5f281fe58c09_49c7_9fa4_e094f86b7e98&file=83c7752c-a621-4af9bb32-d6ba7d612ab2