*/
package eu.etaxonomy.taxeditor.editor.view.derivate;
+import java.util.Set;
import java.util.UUID;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeCacheStrategy;
-import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.taxeditor.store.CdmStore;
/**
+ * Editor input for the {@link DerivateView} which holds the currently selected derivate for which
+ * the derivate hierarchy should be shown in the DerivateView.<br>
+ * It also holds a {@link SpecimenOrObservationBase} which is the root of the hierarchy. (both may be the same object)
* @author pplitzner
* @date 25.11.2013
*
*/
public class DerivateViewEditorInput implements IEditorInput {
- private final UUID uuid;
+ /**
+ * The {@link UUID}s of the derivative entities
+ */
+ private Set<UUID> derivativeUUIDs;
/**
- * @param uuid
+ * Creates an editor input for the {@link DerivateView} with the currently selected derivates and the
+ * corresponding {@link FieldUnit}s (both may be the same object).
+ * @param derivateUuids the {@link UUID}s of the derivates for which the derivate hierarchy should be shown
+ * @param derivativeUUIDs the root of the hierarchy
*/
- public DerivateViewEditorInput(UUID uuid) {
- super();
- this.uuid = uuid;
+ public DerivateViewEditorInput(Set<UUID> derivateUuids) {
+ this.derivativeUUIDs = derivateUuids;
}
/* (non-Javadoc)
*/
@Override
public String getName() {
- return uuid.toString();
+ return getEditorName();
}
/* (non-Javadoc)
*/
@Override
public String getToolTipText() {
- return uuid.toString();
+ return getEditorName();
}
- public SpecimenOrObservationBase<DerivedUnitFacadeCacheStrategy> getDerivate(){
- IOccurrenceService service = CdmStore.getService(IOccurrenceService.class);
- return service.find(uuid);
+ private String getEditorName() {
+ return "Derivative Editor";
}
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
+ /**
+ * @return the derivativeUUIDs
*/
+ public Set<UUID> getDerivativeUUIDs() {
+ return derivativeUUIDs;
+ }
+
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
+ result = prime * result + ((derivativeUUIDs == null) ? 0 : derivativeUUIDs.hashCode());
return result;
}
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
@Override
public boolean equals(Object obj) {
if (this == obj) {
return false;
}
DerivateViewEditorInput other = (DerivateViewEditorInput) obj;
- if (uuid == null) {
- if (other.uuid != null) {
+ if (derivativeUUIDs == null) {
+ if (other.derivativeUUIDs != null) {
return false;
}
- } else if (!uuid.equals(other.uuid)) {
+ } else if (!derivativeUUIDs.equals(other.derivativeUUIDs)) {
return false;
}
return true;