had to rename the packages to make them compliant with buckminster
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / dialogs / filteredSelection / InstitutionSelectionDialog.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection;
12
13 import java.util.UUID;
14
15 import org.eclipse.swt.widgets.Shell;
16
17 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
18 import eu.etaxonomy.cdm.api.service.IAgentService;
19 import eu.etaxonomy.cdm.model.agent.AgentBase;
20 import eu.etaxonomy.cdm.model.agent.Institution;
21 import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
22 import eu.etaxonomy.taxeditor.newWizard.NewInstitutionWizard;
23 import eu.etaxonomy.taxeditor.store.CdmStore;
24
25 /**
26 * @author n.hoffmann
27 * @created Dec 15, 2010
28 * @version 1.0
29 */
30 public class InstitutionSelectionDialog extends
31 AbstractFilteredCdmResourceSelectionDialog<Institution> {
32
33 public static Institution select(Shell shell, ConversationHolder conversation, Institution institution){
34 InstitutionSelectionDialog dialog = new InstitutionSelectionDialog(shell, conversation,
35 "Choose Institution", false, TeamSelectionDialog.class.getCanonicalName(), institution);
36 return getSelectionFromDialog(dialog);
37 }
38
39 /**
40 * @param shell
41 * @param conversation
42 * @param title
43 * @param multi
44 * @param settings
45 * @param cdmObject
46 */
47 protected InstitutionSelectionDialog(Shell shell,
48 ConversationHolder conversation, String title, boolean multi,
49 String settings, Institution cdmObject) {
50 super(shell, conversation, title, multi, settings, cdmObject);
51 }
52
53 /* (non-Javadoc)
54 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
55 */
56 @Override
57 protected Institution getPersistentObject(UUID uuid) {
58 AgentBase agentBase = CdmStore.getService(IAgentService.class).load(uuid);
59
60 if(agentBase instanceof Institution){
61 return (Institution) agentBase;
62 }
63 return null;
64 }
65
66 /* (non-Javadoc)
67 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#initModel()
68 */
69 @Override
70 protected void initModel() {
71 model = CdmStore.getService(IAgentService.class).getInstitutionUuidAndTitleCache();
72 }
73
74 /* (non-Javadoc)
75 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewWizardLinkText()
76 */
77 @Override
78 protected String getNewWizardLinkText() {
79 return "Create a new <A>Institution</A>.";
80 }
81
82 /* (non-Javadoc)
83 * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewEntityWizard(java.lang.String)
84 */
85 @Override
86 protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
87 return new NewInstitutionWizard();
88 }
89
90 }