summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/gui/tabs/execution/ActivityItem.java
blob: bacdd52c0cbb2cfe51407c63b02bc7d42b33a360 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.c2kernel.gui.tabs.execution;
import java.util.ArrayList;

import com.c2kernel.entity.agent.Job;

public class ActivityItem {
    public String stepPath;
    public int state;
    public String stateName;
    public String name;
    ArrayList<Job> jobs = new ArrayList<Job>();

    public ActivityItem() {
    	stepPath = "";
    	state = -1;
    	name = "--";
    }

    public ActivityItem(Job thisJob) {
        stepPath = thisJob.getStepPath();
        state = thisJob.getTransition().getOriginStateId();
        stateName = thisJob.getOriginStateName();
        name = thisJob.getStepName();
        jobs.add(thisJob);
    }

    public void addJob(Job newJob) {
        jobs.add(newJob);
    }

    public ArrayList<Job> getJobs() {
        return jobs;
    }

    public String getStepPath() {
        return stepPath;
    }

    @Override
	public String toString() {
        return name+(state>-1?" ("+stateName+")":"");
    }

    @Override
	public boolean equals(Object other) {
        if (other instanceof ActivityItem)
            return hashCode() == ((ActivityItem)other).hashCode();
        return false;
    }

	@Override
	public int hashCode() {
		return stepPath.hashCode();
	}

}