1 package fi.vtt.simantics.procore.internal;
3 import java.util.ArrayList;
4 import java.util.Collection;
5 import java.util.Collections;
8 import org.simantics.db.Operation;
9 import org.simantics.db.service.ExternalOperation;
11 public class OperationImpl implements Operation {
12 private final long id;
13 private final long csid;
14 private Operation combined;
15 private final List<ExternalOperation> externals;
16 OperationImpl(long id, long csid) {
19 OperationImpl(long id, long csid, List<ExternalOperation> externals) {
23 this.externals = externals.isEmpty() ? null : externals;
26 public String toString() {
27 return "Operation id=" + id + " cs=" + csid + ".";
35 public long getCSId() {
40 public void combine(Operation operation) {
45 public List<Operation> getOperations() {
47 if(combined == null) return Collections.<Operation>singletonList(this);
49 ArrayList<Operation> result = new ArrayList<Operation>();
50 OperationImpl current = this;
51 while(current != null) {
53 current = (OperationImpl)(current.combined);
56 Collections.reverse(result);
63 public Collection<ExternalOperation> getExternalOperations() {
65 return Collections.emptyList();