jtopenlite.com.ibm.jtopenlite.components.JobInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jt400 Show documentation
Show all versions of jt400 Show documentation
The Open Source version of the IBM Toolbox for Java
///////////////////////////////////////////////////////////////////////////////
//
// JTOpenLite
//
// Filename: JobInfo.java
//
// The source code contained herein is licensed under the IBM Public License
// Version 1.0, which has been approved by the Open Source Initiative.
// Copyright (C) 2011-2012 International Business Machines Corporation and
// others. All rights reserved.
//
///////////////////////////////////////////////////////////////////////////////
package com.ibm.jtopenlite.components;
import java.util.*;
/**
* Represents job information returned by the ListActiveJobs class.
* The toString(), toString2(), and toString3() methods will print
* the various fields in a format similar to what WRKACTJOB does.
**/
public class JobInfo
{
private String jobName_;
private String userName_;
private String jobNumber_;
private String jobType_;
private String status_;
private String subsystem_;
private String functionPrefix_;
private String functionName_;
private String currentUser_;
private int cpu_; // Percentage in tenths.
private int threadCount_;
private int runPriority_;
private long totalCPU_; // In milliseconds.
private String memoryPool_;
JobInfo(String jobName, String userName, String jobNumber, String jobType, String status)
{
jobName_ = jobName;
userName_ = userName;
jobNumber_ = jobNumber;
jobType_ = jobType;
status_ = status;
}
public static void arrangeBySubsystem(JobInfo[] jobs)
{
Arrays.sort(jobs, comparator_);
/* for (int i=1; i 0)
{
JobInfo saved = jobs[0];
for (int i=1; i= '0');
}
private static final int compareStrings(String s1, String s2)
{
for (int i=0; i comparator_ = new Comparator()
{
public int compare(JobInfo j1, JobInfo j2)
{
String n1 = j1.getJobName().trim();
String n2 = j2.getJobName().trim();
String t1 = j1.getJobType().trim();
String t2 = j2.getJobType().trim();
String s1 = j1.getSubsystem();
String s2 = j2.getSubsystem();
s1 = (s1 == null ? "" : s1.trim());
s2 = (s2 == null ? "" : s2.trim());
if (t1.equals("SBS"))
{
if (t2.equals("SBS")) return compareStrings(n1,n2); //n1.compareTo(n2);
if (t2.equals("SYS")) return -1;
if (n1.equals(s2)) return -1;
return compareStrings(n1,s2); //n1.compareTo(s2);
}
if (t2.equals("SBS"))
{
if (t1.equals("SYS")) return 1;
if (n2.equals(s1)) return 1;
return compareStrings(s1,n2); //s1.compareTo(n2);
}
if (t1.equals("SYS") && t2.equals("SYS"))
{
return compareStrings(n1,n2); //n1.compareTo(n2);
}
if (t1.equals("SYS"))
{
return 1;
}
if (t2.equals("SYS"))
{
return -1;
}
if (s1.equals(s2))
{
return compareStrings(n1,n2); //n1.compareTo(n2);
}
return compareStrings(s1,s2); //s1.compareTo(s2);
}
};
public static void arrangeBySubsystem(List jobs)
{
Collections.sort(jobs, comparator_);
/* for (int i=1; i 0)
{
JobInfo saved = jobs.get(0);
for (int i=1; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy