2 * Copyright (C) 2014 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.molecular
.editor
;
11 import java
.util
.Arrays
;
12 import java
.util
.List
;
13 import java
.util
.UUID
;
15 import eu
.etaxonomy
.cdm
.api
.service
.molecular
.ISequenceService
;
16 import eu
.etaxonomy
.cdm
.model
.molecular
.Sequence
;
17 import eu
.etaxonomy
.taxeditor
.editor
.CdmEntitySessionInput
;
18 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
25 public class AlignmentEditorInput
extends CdmEntitySessionInput
<Sequence
> {
27 private final UUID sequenceNodeUuid
;
28 private Sequence sequenceNode
;
30 public AlignmentEditorInput(UUID sequenceNodeUuid
) {
32 this.sequenceNodeUuid
= sequenceNodeUuid
;
37 * Returns the {@link UUID} of the sequence CDM node that should be edited by the {@link AlignmentEditor} this object
40 * @return the uuid of the CDM node to work on
42 public UUID
getSequenceNodeUuid() {
43 return sequenceNodeUuid
;
47 public int hashCode() {
50 result
= prime
* result
51 + ((sequenceNodeUuid
== null) ?
0 : sequenceNodeUuid
.hashCode());
56 public boolean equals(Object obj
) {
63 if (getClass() != obj
.getClass()) {
66 AlignmentEditorInput other
= (AlignmentEditorInput
) obj
;
67 if (sequenceNodeUuid
== null) {
68 if (other
.sequenceNodeUuid
!= null) {
71 } else if (!sequenceNodeUuid
.equals(other
.sequenceNodeUuid
)) {
77 public void setSequenceNode(Sequence sequenceNode
) {
78 this.sequenceNode
= sequenceNode
;
82 public List
<Sequence
> getRootEntities() {
83 return Arrays
.asList(sequenceNode
);
88 CdmStore
.getService(ISequenceService
.class).merge(sequenceNode
, true);