1 /*******************************************************************************
2 * Copyright (c) 2019 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Semantum Oy - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.document.server.bean;
14 import org.simantics.document.server.io.CommandContext;
15 import org.simantics.document.server.io.ICommand;
17 public class Command implements ICommand {
19 public String targetId;
20 public String trigger;
21 public String command;
22 public CommandContext constants;
26 public Command(String command) {
27 this.command = command;
30 public Command(String targetId, String trigger, String command, CommandContext constants) {
31 this.targetId = targetId;
32 this.trigger = trigger;
33 this.command = command;
34 this.constants = constants;
37 public String getTrigger() {
41 public String getTargetId() {
45 public String getCommand() {
50 public CommandContext getConstants() {
55 public String toString() {
56 StringBuilder sb = new StringBuilder();
70 public int hashCode() {
73 result = prime * result + ((command == null) ? 0 : command.hashCode());
74 result = prime * result
75 + ((constants == null) ? 0 : constants.hashCode());
76 result = prime * result
77 + ((targetId == null) ? 0 : targetId.hashCode());
78 result = prime * result + ((trigger == null) ? 0 : trigger.hashCode());
83 public boolean equals(Object obj) {
88 if (getClass() != obj.getClass())
90 Command other = (Command) obj;
91 if (command == null) {
92 if (other.command != null)
94 } else if (!command.equals(other.command))
96 if (constants == null) {
97 if (other.constants != null)
99 } else if (!constants.equals(other.constants))
101 if (targetId == null) {
102 if (other.targetId != null)
104 } else if (!targetId.equals(other.targetId))
106 if (trigger == null) {
107 if (other.trigger != null)
109 } else if (!trigger.equals(other.trigger))