Basically fixes #2282. I will create new tickets for still open issues.
authorn.hoffmann <n.hoffmann@localhost>
Thu, 10 Mar 2011 18:08:11 +0000 (18:08 +0000)
committern.hoffmann <n.hoffmann@localhost>
Thu, 10 Mar 2011 18:08:11 +0000 (18:08 +0000)
50 files changed:
.gitattributes
taxeditor-application/src/main/java/eu/etaxonomy/taxeditor/perspective/Default.java
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditorLineDisplay.java
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/BulkEditorInputTypeValues.java
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/GroupEditorInput.java [new file with mode: 0644]
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/NameEditorInput.java
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/UserEditorInput.java [new file with mode: 0644]
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/GroupCreator.java [new file with mode: 0644]
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/UserCreator.java [new file with mode: 0644]
taxeditor-store/plugin.xml
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/handler/CreateUserHandler.java [deleted file]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/handler/EditUserHandler.java [deleted file]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/handler/ToggleUserEnablementHandler.java [deleted file]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/CreateUserOperation.java [deleted file]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/DeleteUserOperation.java [deleted file]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/EditUserOperation.java [deleted file]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/ToggleUserEnablementOperation.java [deleted file]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/wizard/UserWizard.java [deleted file]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/wizard/UserWizardPage.java [deleted file]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewGroupWizard.java [new file with mode: 0644]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/store/LoginManager.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/store/SearchManager.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/GroupSelectionDialog.java [new file with mode: 0644]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/UserSelectionDialog.java [new file with mode: 0644]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/AbstractCdmEntityWizardPage.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/CdmFormFactory.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/password/EditPasswordElement.java [new file with mode: 0644]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/password/PasswordWizard.java [new file with mode: 0644]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/password/PasswordWizardPage.java [new file with mode: 0644]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionSection.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GrantedAuthorityDetailElement.java [new file with mode: 0644]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GrantedAuthorityDetailSection.java [new file with mode: 0644]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailElement.java [new file with mode: 0644]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailSection.java [new file with mode: 0644]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailWizardPage.java [new file with mode: 0644]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/MemberDetailElement.java [new file with mode: 0644]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/MemberDetailSection.java [new file with mode: 0644]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/user/GroupsByUserDetailElement.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/user/GroupsByUserDetailSection.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/user/UserDetailElement.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/GroupSelectionElement.java [new file with mode: 0644]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/NamedAreaSelectionElement.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/UserSelectionElement.java [new file with mode: 0644]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/group/GroupLabelProvider.java [deleted file]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/group/GroupViewPart.java [deleted file]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/user/UserContentProvider.java [deleted file]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/user/UserLabelProvider.java [deleted file]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/user/UserView.java [deleted file]

index ea2450b6e7ac27ae811976d2f5d7fb65d241b461..7078b5e67f16d30ea774de01895428d122e2d9b7 100644 (file)
@@ -102,14 +102,18 @@ taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/Set
 taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/ShowReferencingObjectsHandler.java -text
 taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java -text
 taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AgentEditorInput.java -text
+taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/GroupEditorInput.java -text
 taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/NameEditorInput.java -text
 taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/NameRelationshipEditorInput.java -text
 taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/OccurrenceEditorInput.java -text
 taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/ReferenceEditorInput.java -text
+taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/UserEditorInput.java -text
 taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/AgentCreator.java -text
+taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/GroupCreator.java -text
 taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/NameCreator.java -text
 taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/OccurrenceCreator.java -text
 taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/ReferenceCreator.java -text
+taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/UserCreator.java -text
 taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/AbstractDateComparator.java -text
 taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/AbstractSortProvider.java -text
 taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/CdmBaseSortProvider.java -text
@@ -725,15 +729,6 @@ taxeditor-store/icons/web.gif -text
 taxeditor-store/p2.inf -text
 taxeditor-store/plugin.xml -text
 taxeditor-store/pom.xml -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/handler/CreateUserHandler.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/handler/EditUserHandler.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/handler/ToggleUserEnablementHandler.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/CreateUserOperation.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/DeleteUserOperation.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/EditUserOperation.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/ToggleUserEnablementOperation.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/wizard/UserWizard.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/wizard/UserWizardPage.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/datasource/CdmDataSourceRepository.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/datasource/wizard/CdmDataSourceCredentialsWizardPage.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/datasource/wizard/CdmDataSourceH2WizardPage.java -text
@@ -816,6 +811,7 @@ taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewClassification
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewCollectionWizard.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewDerivedUnitBaseWizard.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewFieldObservationWizard.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewGroupWizard.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewInstitutionWizard.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewNonViralNameWizard.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewPersonWizard.java -text
@@ -890,6 +886,7 @@ taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelectio
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/FeatureSelectionDialog.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/FeatureTreeSelectionDialog.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/FieldObservationSelectionDialog.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/GroupSelectionDialog.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/InstitutionSelectionDialog.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/NameSelectionDialog.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/NamedAreaSelectionDialog.java -text
@@ -900,6 +897,7 @@ taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelectio
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/TaxonBaseSelectionDialog.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/TaxonNodeSelectionDialog.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/TeamSelectionDialog.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/UserSelectionDialog.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/AbstractCdmEntityWizardPage.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/AbstractCdmFormElement.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/AbstractCdmFormElementWithErrors.java -text
@@ -935,6 +933,9 @@ taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/TextWithLabelEleme
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/TimePeriodElement.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/ToggleableTextElement.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/UriWithLabelElement.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/password/EditPasswordElement.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/password/PasswordWizard.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/password/PasswordWizardPage.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/openurl/IOpenUrlEnabled.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/openurl/OpenUrlContentProvider.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/openurl/OpenUrlLabelProvider.java -text
@@ -1001,6 +1002,13 @@ taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/deta
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/operation/ChangeDescriptionElementType.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureDistributionDetailElement.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureDistributionDetailSection.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GrantedAuthorityDetailElement.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GrantedAuthorityDetailSection.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailElement.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailSection.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailWizardPage.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/MemberDetailElement.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/MemberDetailSection.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/GeographicalScopeDetailSection.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyDetailElement.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyDetailSection.java -text
@@ -1101,6 +1109,7 @@ taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/EditFromSelect
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/FeatureSelectionElement.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/FeatureTreeSelectionElement.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/FieldObservationSelectionElement.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/GroupSelectionElement.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/InstitutionSelectionElement.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/NameSelectionElement.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/NamedAreaSelectionElement.java -text
@@ -1114,6 +1123,7 @@ taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/TaxonBaseSelec
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/TaxonNodeSelectionElement.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/TaxonSelectionElement.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/TeamSelectionElement.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/UserSelectionElement.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/term/AbstractEnumComboElement.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/term/AbstractTermComboElement.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/term/AnnotationTypeComboElement.java -text
@@ -1168,14 +1178,9 @@ taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/Upd
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/detail/CdmSectionPart.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/group/GroupLabelProvider.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/group/GroupViewPart.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/reporting/ReportingViewPart.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java -text
 taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewer.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/user/UserContentProvider.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/user/UserLabelProvider.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/user/UserView.java -text
 taxeditor-store/src/main/resources/eu/etaxonomy/cdm/editorApplicationContext.xml -text
 taxeditor-store/src/main/resources/log4j.properties -text
 taxeditor-store/src/test/java/eu/etaxonomy/taxeditor/store/CdmStoreTest.java -text
index ca709e7f834002f9e7d5ee48dfb656ac2cf5e266..8e008436ebabc7a13ef0ffe48e97dfd32e9d7864 100644 (file)
@@ -9,7 +9,6 @@ import org.eclipse.ui.IPlaceholderFolderLayout;
 import org.eclipse.ui.progress.IProgressConstants;
 
 import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
-import eu.etaxonomy.taxeditor.view.user.UserView;
 
 /**
  * @author n.hoffmann
@@ -31,7 +30,6 @@ public abstract class Default implements IPerspectiveFactory {
                
                folderAdditional.addPlaceholder(CdmDataSourceViewPart.ID);
                folderAdditional.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
-               folderAdditional.addPlaceholder(UserView.ID);
        }
 
 }
index 8a8085aeead4311377787132473caf91272f5403..3cfe8bd2c14cf882bc92110b534b226888ac1bf0 100644 (file)
@@ -25,6 +25,7 @@ import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.agent.AgentBase;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.IAnnotatableEntity;
+import eu.etaxonomy.cdm.model.common.ICdmBase;
 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
 import eu.etaxonomy.cdm.model.common.Marker;
 import eu.etaxonomy.cdm.model.common.MarkerType;
@@ -76,19 +77,7 @@ public class BulkEditorLineDisplay implements ILineDisplayStrategy {
         */
        /** {@inheritDoc} */
        public String getText(Object entity) {          
-               String text = null;
-               
-               if(entity instanceof IdentifiableEntity){
-                       IdentifiableEntity identifiableEntity = (IdentifiableEntity) HibernateProxyHelper.deproxy(entity);
-                       if(identifiableEntity instanceof TaxonNameBase){
-                               // TODO it is not very nice to do this here. Please refactor
-                               text = ((TaxonNameBase) identifiableEntity).getFullTitleCache();
-                       }else{
-                               text = identifiableEntity.getTitleCache();
-                       }
-               }
-               
-               return text == null ? "" : text;
+               return editor.getEditorInput().getText((ICdmBase) entity);
        }
 
 
index cb69b1cfa11c40aca59b77027809fab16c0e5749..5a7fa09083e9f1d6d0c74f9cdc729891fa9c3184 100644 (file)
@@ -17,16 +17,20 @@ import org.eclipse.core.commands.IParameterValues;
 import org.eclipse.ui.IEditorInput;
 
 import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.cdm.model.common.User;
 import eu.etaxonomy.cdm.model.name.NameRelationship;
 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
 import eu.etaxonomy.taxeditor.bulkeditor.input.AgentEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.input.GroupEditorInput;
 import eu.etaxonomy.taxeditor.bulkeditor.input.NameEditorInput;
 import eu.etaxonomy.taxeditor.bulkeditor.input.NameRelationshipEditorInput;
 import eu.etaxonomy.taxeditor.bulkeditor.input.OccurrenceEditorInput;
 import eu.etaxonomy.taxeditor.bulkeditor.input.ReferenceEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.input.UserEditorInput;
 
 /**
  * <p>BulkEditorInputTypeValues class.</p>
@@ -41,8 +45,11 @@ public class BulkEditorInputTypeValues implements IParameterValues {
                REFERENCE("Reference", ReferenceEditorInput.ID),
                NAME("Name", NameEditorInput.ID),
                AGENT("Authors and Author Teams", AgentEditorInput.ID),
-               OCCURRENCE("Specimen or Observations", OccurrenceEditorInput.ID), 
-               NAME_RELATIONSHIP("Name Relationship", NameRelationshipEditorInput.ID);
+               OCCURRENCE("Specimens or Observations", OccurrenceEditorInput.ID), 
+               NAME_RELATIONSHIP("Name Relationship", NameRelationshipEditorInput.ID),
+               USER("User", UserEditorInput.ID), 
+               GROUP("Group", GroupEditorInput.ID);
+               
                
                public String id;
                public String label;
@@ -79,6 +86,12 @@ public class BulkEditorInputTypeValues implements IParameterValues {
                        else if (NameRelationship.class.isAssignableFrom(clazz)){
                                return NAME_RELATIONSHIP;
                        }
+                       else if (Group.class.isAssignableFrom(clazz)){
+                               return GROUP;
+                       }
+                       else if (User.class.isAssignableFrom(clazz)){
+                               return USER;
+                       }
                        return null;
                }
                
@@ -98,6 +111,12 @@ public class BulkEditorInputTypeValues implements IParameterValues {
                        else if (input instanceof NameRelationshipEditorInput) {
                                return NAME_RELATIONSHIP;
                        }
+                       else if(input instanceof UserEditorInput){
+                               return USER;
+                       }
+                       else if(input instanceof GroupEditorInput){
+                               return GROUP;
+                       }
                        return null;
                }
                
@@ -113,8 +132,12 @@ public class BulkEditorInputTypeValues implements IParameterValues {
                                return new OccurrenceEditorInput();
                        case NAME_RELATIONSHIP:
                                return new NameRelationshipEditorInput();
+                       case USER:
+                               return new UserEditorInput();
+                       case GROUP:
+                               return new GroupEditorInput();
                        default:
-                               return null;
+                               throw new IllegalStateException("No input class for the given input type defined.");
                        }
                }
        }
index d47572ee95308d6369bfbfdd747cace6862a2ce9..9c340c15a6b01f11e4eabd704abde00a4cda9c8d 100644 (file)
@@ -21,6 +21,7 @@ import org.eclipse.ui.IPersistableElement;
 
 import eu.etaxonomy.cdm.api.service.ICommonService;
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.common.ICdmBase;
 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
 import eu.etaxonomy.cdm.model.common.MarkerType;
@@ -268,10 +269,26 @@ public abstract class AbstractBulkEditorInput<T extends ICdmBase> implements IEd
                return entity.getClass().getSimpleName();
        }
 
+       /**
+        * @param entity
+        * @return
+        */
+       public String getText(T entity) {
+               if(entity instanceof IdentifiableEntity){
+                       IdentifiableEntity identifiableEntity = (IdentifiableEntity) HibernateProxyHelper.deproxy(entity);
+                       
+                       return identifiableEntity.getTitleCache();
+               }
+               
+               return "No text. Implement in subclass";
+       }
+       
        /**
         * @return
         */
        public List<?> getModel() {
                return model;
        }
+
+
 }
diff --git a/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/GroupEditorInput.java b/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/GroupEditorInput.java
new file mode 100644 (file)
index 0000000..69058a0
--- /dev/null
@@ -0,0 +1,112 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.bulkeditor.input;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+import eu.etaxonomy.cdm.api.service.IGroupService;
+import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
+import eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorInputTypeValues.BulkEditorInputType;
+import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.GroupCreator;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class GroupEditorInput extends AbstractBulkEditorInput<Group> {
+
+       public static final String ID = "bulkeditor.input.group";
+       
+       private static GroupEditorInput instance;
+       
+       /**
+        * @return the instance
+        */
+       public static GroupEditorInput getInstance() {
+               if(instance == null){
+                       instance = new GroupEditorInput();
+               }
+               return instance;
+       }
+       
+       /* (non-Javadoc)
+        * @see org.eclipse.ui.IEditorInput#getName()
+        */
+       @Override
+       public String getName() {
+               return BulkEditorInputType.GROUP.label;
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.ui.IEditorInput#getToolTipText()
+        */
+       @Override
+       public String getToolTipText() {
+               return getName();
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#save(java.lang.Object)
+        */
+       @Override
+       public boolean save(Group entity) {
+               return CdmStore.getService(IGroupService.class).saveOrUpdate(entity) != null;
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#delete(java.lang.Object)
+        */
+       @Override
+       public boolean delete(Group entity) {
+               return CdmStore.getService(IGroupService.class).delete(entity) != null;
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#listEntities(eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator)
+        */
+       @Override
+       protected List<Group> listEntities(
+                       IIdentifiableEntityServiceConfigurator configurator) {
+               return CdmStore.getSearchManager().findGroups(configurator);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#loadEntity(java.util.UUID)
+        */
+       @Override
+       protected Group loadEntity(UUID entityUuid) {
+               List<String> propertyPaths = Arrays.asList(new String[]{}); 
+               return CdmStore.getService(IGroupService.class).load(entityUuid, propertyPaths);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#createEntityCreator()
+        */
+       @Override
+       protected IEntityCreator<Group> createEntityCreator() {
+               return new GroupCreator();
+       }
+       
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getText(eu.etaxonomy.cdm.model.common.ICdmBase)
+        */
+       @Override
+       public String getText(Group entity) {
+               return entity.getName();
+       }
+
+}
index 28ade89101531ff80410be6296356950054c266e..586391206d8057f767fe2e300b55dc9d90865885 100644 (file)
@@ -149,5 +149,13 @@ public class NameEditorInput extends AbstractBulkEditorInput<TaxonNameBase> {
                }
                return super.getTypeText(entity);
        }
+       
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getText(eu.etaxonomy.cdm.model.common.ICdmBase)
+        */
+       @Override
+       public String getText(TaxonNameBase entity) {
+               return ((TaxonNameBase) entity).getFullTitleCache();
+       }
 
 }
diff --git a/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/UserEditorInput.java b/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/UserEditorInput.java
new file mode 100644 (file)
index 0000000..404b6be
--- /dev/null
@@ -0,0 +1,112 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.bulkeditor.input;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
+import eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorInputTypeValues.BulkEditorInputType;
+import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.UserCreator;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class UserEditorInput extends AbstractBulkEditorInput<User> {
+
+       public static final String ID = "bulkeditor.input.user";
+       
+       private static UserEditorInput instance;
+       
+       /**
+        * @return the instance
+        */
+       public static UserEditorInput getInstance() {
+               if(instance == null){
+                       instance = new UserEditorInput();
+               }
+               return instance;
+       }
+       
+       /* (non-Javadoc)
+        * @see org.eclipse.ui.IEditorInput#getName()
+        */
+       @Override
+       public String getName() {
+               return BulkEditorInputType.USER.label;
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.ui.IEditorInput#getToolTipText()
+        */
+       @Override
+       public String getToolTipText() {
+               return getName();
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#save(java.lang.Object)
+        */
+       @Override
+       public boolean save(User entity) {
+               return CdmStore.getService(IUserService.class).saveOrUpdate(entity) != null;
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#delete(java.lang.Object)
+        */
+       @Override
+       public boolean delete(User entity) {
+               return CdmStore.getService(IUserService.class).delete(entity) != null;
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#listEntities(eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator)
+        */
+       @Override
+       protected List<User> listEntities(
+                       IIdentifiableEntityServiceConfigurator configurator) {
+               return CdmStore.getSearchManager().findUsers(configurator);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#loadEntity(java.util.UUID)
+        */
+       @Override
+       protected User loadEntity(UUID entityUuid) {
+               List<String> propertyPaths = Arrays.asList(new String[]{}); 
+               return CdmStore.getService(IUserService.class).load(entityUuid, propertyPaths);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#createEntityCreator()
+        */
+       @Override
+       protected IEntityCreator<User> createEntityCreator() {
+               return new UserCreator();
+       }
+       
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getText(eu.etaxonomy.cdm.model.common.ICdmBase)
+        */
+       @Override
+       public String getText(User entity) {
+               return String.format("%s, %s", entity.getUsername(), entity.getPerson());
+       }
+
+}
diff --git a/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/GroupCreator.java b/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/GroupCreator.java
new file mode 100644 (file)
index 0000000..e5f2deb
--- /dev/null
@@ -0,0 +1,52 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class GroupCreator implements IEntityCreator<Group> {
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.String)
+        */
+       @Override
+       public Group createEntity(String text) {
+               return createEntity(null, text);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.Object, java.lang.String)
+        */
+       @Override
+       public Group createEntity(Object key, String text) {
+               return Group.NewInstance(text);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#getKeyLabelPairs()
+        */
+       @Override
+       public Map<Object, String> getKeyLabelPairs() {
+               Map<Object, String> result = new HashMap<Object, String>();
+               result.put(Group.class, "Group");
+               return result;
+       }
+
+}
diff --git a/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/UserCreator.java b/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/UserCreator.java
new file mode 100644 (file)
index 0000000..1713fe1
--- /dev/null
@@ -0,0 +1,56 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class UserCreator  implements IEntityCreator<User>{
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.String)
+        */
+       @Override
+       public User createEntity(String text) {
+               return createEntity(null, text);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.Object, java.lang.String)
+        */
+       @Override
+       public User createEntity(Object key, String text) {
+               User user = User.NewInstance(text, text);
+               CdmStore.getService(IUserService.class).createUser(user);
+               return user;
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#getKeyLabelPairs()
+        */
+       @Override
+       public Map<Object, String> getKeyLabelPairs() {
+               Map<Object, String> result = new HashMap<Object, String>();
+               result.put(User.class, "User");
+               return result;
+       }
+
+}
index d12709fa257ab4a6c4a9c59f0eb00e516c10706e..35589febe8b3a7be2d0e0c3117999c59c5ec4c70 100644 (file)
             name="Datasource"
             restorable="true">
       </view>
-      <view
-            class="eu.etaxonomy.taxeditor.view.user.UserView"
-            icon="icons/system-users.png"
-            id="eu.etaxonomy.taxeditor.store.userManagerView"
-            name="User"
-            restorable="true">
-      </view>
-      <view
-            class="eu.etaxonomy.taxeditor.view.group.GroupViewPart"
-            id="eu.etaxonomy.taxeditor.store.groupView"
-            name="Group"
-            restorable="true">
-      </view>
       <view  
                        name="Progress View"  
                        category="org.eclipse.ui"  
                      value="eu.etaxonomy.taxeditor.view.datasource">
                </parameter>
             </command>
-            <command
-                  commandId="org.eclipse.ui.views.showView"
-                  label="Users"
-                  style="push">
-               <parameter
-                     name="org.eclipse.ui.views.showView.viewId"
-                     value="eu.etaxonomy.taxeditor.store.userManagerView">
-               </parameter>
-            </command>
             <command
                   commandId="org.eclipse.ui.views.showView"
                   label="Messages"
                   </reference>
                </visibleWhen>
             </command>
-            <command
-                  commandId="org.eclipse.ui.views.showView"
-                  label="Groups"
-                  style="push">
-               <parameter
-                     name="org.eclipse.ui.views.showView.viewId"
-                     value="eu.etaxonomy.taxeditor.store.groupView">
-               </parameter>
-            </command>
          </menu>
       </menuContribution>
       <menuContribution
             </visibleWhen>
          </command>
       </menuContribution>
-      <menuContribution
-            locationURI="popup:eu.etaxonomy.taxeditor.store.userManagerView">
-         <command
-               commandId="eu.etaxonomy.taxeditor.store.createUser"
-               label="New"
-               style="push">
-         </command>
-         <command
-               commandId="eu.etaxonomy.taxeditor.store.editUser"
-               label="Edit"
-               style="push">
-         </command>
-         <separator
-               name="eu.etaxonomy.taxeditor.store.userManager.separator"
-               visible="true">
-         </separator>
-         <command
-               commandId="eu.etaxonomy.taxeditor.store.disableUser"
-               label="Toggle Enablement"
-               style="push">
-         </command>
-      </menuContribution>
       <menuContribution
             locationURI="toolbar:org.eclipse.ui.trim.status">
          <toolbar
             name="Update Datasource">
       </command>
    </extension>
-   <extension
-         point="org.eclipse.ui.commands">
-      <command
-            defaultHandler="eu.etaxonomy.taxeditor.account.user.handler.CreateUserHandler"
-            id="eu.etaxonomy.taxeditor.store.createUser"
-            name="Create User">
-      </command>
-      <command
-            defaultHandler="eu.etaxonomy.taxeditor.account.user.handler.EditUserHandler"
-            id="eu.etaxonomy.taxeditor.store.editUser"
-            name="Edit User">
-      </command>
-      <command
-            defaultHandler="eu.etaxonomy.taxeditor.account.user.handler.ToggleUserEnablementHandler"
-            id="eu.etaxonomy.taxeditor.store.disableUser"
-            name="Toggle User Enablement">
-      </command>
-   </extension>
    <extension
          point="org.eclipse.ui.importWizards">
       <category
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/handler/CreateUserHandler.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/handler/CreateUserHandler.java
deleted file mode 100644 (file)
index 235ca56..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.account.user.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.taxeditor.newWizard.NewUserWizard;
-import eu.etaxonomy.taxeditor.view.user.UserView;
-
-/**
- * <p>CreateUserHandler class.</p>
- *
- * @author n.hoffmann
- * @created 02.07.2009
- * @version 1.0
- */
-public class CreateUserHandler extends AbstractHandler {
-
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-        */
-       /** {@inheritDoc} */
-       public Object execute(ExecutionEvent event) throws ExecutionException {
-               UserView part = (UserView) HandlerUtil.getActivePart(event);
-               
-               NewUserWizard wizard = new NewUserWizard();
-               wizard.init(null, null);
-               
-               WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
-           if(dialog.open() == IStatus.OK){
-               part.getViewer().refresh();
-           }
-               return null;
-       }
-}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/handler/EditUserHandler.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/handler/EditUserHandler.java
deleted file mode 100644 (file)
index 85a7807..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.account.user.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.account.user.wizard.UserWizard;
-import eu.etaxonomy.taxeditor.view.user.UserView;
-
-/**
- * <p>EditUserHandler class.</p>
- *
- * @author n.hoffmann
- * @created 02.07.2009
- * @version 1.0
- */
-public class EditUserHandler extends AbstractHandler {
-
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-        */
-       /** {@inheritDoc} */
-       public Object execute(ExecutionEvent event) throws ExecutionException {
-               ISelection menuSelection = HandlerUtil.getActiveMenuSelection(event);
-               User user = (User) ((StructuredSelection) menuSelection).getFirstElement();
-
-               UserView part = (UserView) HandlerUtil.getActivePart(event);
-               
-               UserWizard wizard = new UserWizard(part, user);
-               WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
-           dialog.open();
-           
-               return null;
-       }
-}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/handler/ToggleUserEnablementHandler.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/handler/ToggleUserEnablementHandler.java
deleted file mode 100644 (file)
index 4f51d8b..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.account.user.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.account.user.operation.ToggleUserEnablementOperation;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.view.user.UserView;
-
-/**
- * <p>ToggleUserEnablementHandler class.</p>
- *
- * @author n.hoffmann
- * @created 02.07.2009
- * @version 1.0
- */
-public class ToggleUserEnablementHandler extends AbstractHandler {
-
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-        */
-       /** {@inheritDoc} */
-       public Object execute(ExecutionEvent event) throws ExecutionException {
-               
-               StructuredSelection menuSelection = (StructuredSelection) HandlerUtil.getActiveMenuSelection(event);
-               
-               for (Object object : menuSelection.toArray()){
-               
-                       User user = (User) object;
-
-                       // TODO refresh the list -> set postOperationEnabled to the real deal
-                       UserView userManagerView = (UserView) HandlerUtil.getActivePart(event);
-                       
-                       AbstractPostOperation operation = null;
-                       try {
-                               operation = new ToggleUserEnablementOperation(event.getCommand().getName(), 
-                                                       StoreUtil.getUndoContext(), user, userManagerView, userManagerView);
-                               
-                               StoreUtil.executeOperation(operation);
-                       } catch (NotDefinedException e) {
-                               StoreUtil.warn(this.getClass(), "Command name not set");
-                       }
-               }
-
-               return null;
-       }
-}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/CreateUserOperation.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/CreateUserOperation.java
deleted file mode 100644 (file)
index 428502a..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.account.user.operation;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.api.service.IUserService;
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * <p>CreateUserOperation class.</p>
- *
- * @author n.hoffmann
- * @created Jan 19, 2010
- * @version 1.0
- */
-public class CreateUserOperation extends AbstractPersistentPostOperation {
-       
-       private User user;
-
-       /**
-        * <p>Constructor for CreateUserOperation.</p>
-        *
-        * @param label a {@link java.lang.String} object.
-        * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
-        * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
-        * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
-        * @param user a {@link eu.etaxonomy.cdm.model.common.User} object.
-        */
-       public CreateUserOperation(String label, IUndoContext undoContext, User user,
-                       IPostOperationEnabled postOperationEnabled,
-                       IConversationEnabled conversationEnabled) {
-               super(label, undoContext, postOperationEnabled, conversationEnabled);
-               this.user = user;
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
-        */
-       /** {@inheritDoc} */
-       @Override
-       public IStatus execute(IProgressMonitor monitor, IAdaptable info)
-                       throws ExecutionException {
-               bind();
-               monitor.worked(20);
-               CdmStore.getService(IUserService.class).createUser(user);
-               monitor.worked(40);
-
-               return postExecute(null);
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
-        */
-       /** {@inheritDoc} */
-       @Override
-       public IStatus redo(IProgressMonitor monitor, IAdaptable info)
-                       throws ExecutionException {
-               return null;
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
-        */
-       /** {@inheritDoc} */
-       @Override
-       public IStatus undo(IProgressMonitor monitor, IAdaptable info)
-                       throws ExecutionException {
-               return null;
-       }
-}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/DeleteUserOperation.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/DeleteUserOperation.java
deleted file mode 100644 (file)
index fd85c5d..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.account.user.operation;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.api.service.IUserService;
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * @author n.hoffmann
- * @created Dec 2, 2010
- * @version 1.0
- */
-public class DeleteUserOperation extends AbstractPersistentPostOperation {
-
-       private User user;
-       
-       /**
-        * @param label
-        * @param undoContext
-        * @param postOperationEnabled
-        * @param conversationEnabled
-        */
-       protected DeleteUserOperation(String label, IUndoContext undoContext,
-                       IPostOperationEnabled postOperationEnabled, User user,
-                       IConversationEnabled conversationEnabled) {
-               super(label, undoContext, postOperationEnabled, conversationEnabled);
-               this.user = user;
-       }
-
-       
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
-        */
-       @Override
-       public IStatus execute(IProgressMonitor monitor, IAdaptable info)
-                       throws ExecutionException {
-               bind();
-               monitor.worked(20);
-               CdmStore.getService(IUserService.class).delete(user);
-               monitor.worked(40);
-
-               return postExecute(null);
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
-        */
-       @Override
-       public IStatus redo(IProgressMonitor monitor, IAdaptable info)
-                       throws ExecutionException {
-               return null;
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
-        */
-       @Override
-       public IStatus undo(IProgressMonitor monitor, IAdaptable info)
-                       throws ExecutionException {
-               return null;
-       }
-
-}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/EditUserOperation.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/EditUserOperation.java
deleted file mode 100644 (file)
index 81e58bf..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.account.user.operation;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.api.service.IUserService;
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * <p>EditUserOperation class.</p>
- *
- * @author n.hoffmann
- * @created Jan 25, 2010
- * @version 1.0
- */
-public class EditUserOperation extends AbstractPersistentPostOperation {
-
-       private User user;
-
-       /**
-        * <p>Constructor for EditUserOperation.</p>
-        *
-        * @param label a {@link java.lang.String} object.
-        * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
-        * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
-        * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
-        * @param user a {@link eu.etaxonomy.cdm.model.common.User} object.
-        */
-       public EditUserOperation(String label, IUndoContext undoContext, User user,
-                       IPostOperationEnabled postOperationEnabled,
-                       IConversationEnabled conversationEnabled) {
-               super(label, undoContext, postOperationEnabled, conversationEnabled);
-               this.user = user;
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
-        */
-       /** {@inheritDoc} */
-       @Override
-       public IStatus execute(IProgressMonitor monitor, IAdaptable info)
-                       throws ExecutionException {
-               bind();
-               monitor.worked(20);
-
-               CdmStore.getService(IUserService.class).updateUser(user);
-               monitor.worked(40);
-
-               return postExecute(null);
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
-        */
-       /** {@inheritDoc} */
-       @Override
-       public IStatus redo(IProgressMonitor monitor, IAdaptable info)
-                       throws ExecutionException {
-               return null;
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
-        */
-       /** {@inheritDoc} */
-       @Override
-       public IStatus undo(IProgressMonitor monitor, IAdaptable info)
-                       throws ExecutionException {
-               return null;
-       }
-}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/ToggleUserEnablementOperation.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/ToggleUserEnablementOperation.java
deleted file mode 100644 (file)
index a3edcf2..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.account.user.operation;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.api.service.IUserService;
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * <p>ToggleUserEnablementOperation class.</p>
- *
- * @author n.hoffmann
- * @created 02.07.2009
- * @version 1.0
- */
-public class ToggleUserEnablementOperation extends AbstractPersistentPostOperation {
-
-       private User user;
-
-       /**
-        * <p>Constructor for ToggleUserEnablementOperation.</p>
-        *
-        * @param label a {@link java.lang.String} object.
-        * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
-        * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
-        * @param user a {@link eu.etaxonomy.cdm.model.common.User} object.
-        * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
-        */
-       public ToggleUserEnablementOperation(String label, IUndoContext undoContext,
-                       User user, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {
-               super(label, undoContext, postOperationEnabled, conversationEnabled);
-               this.user = user;
-       }
-       
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
-        */
-       /** {@inheritDoc} */
-       @Override
-       public IStatus execute(IProgressMonitor monitor, IAdaptable info)
-                       throws ExecutionException {
-
-               bind();
-               monitor.worked(20);
-               
-               user.setEnabled(! user.isEnabled());
-               
-               CdmStore.getService(IUserService.class).saveOrUpdate(user);
-               monitor.worked(40);
-
-        return postExecute(null);
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
-        */
-       /** {@inheritDoc} */
-       @Override
-       public IStatus redo(IProgressMonitor monitor, IAdaptable info)
-                       throws ExecutionException {
-               return execute(monitor, info);
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
-        */
-       /** {@inheritDoc} */
-       @Override
-       public IStatus undo(IProgressMonitor monitor, IAdaptable info)
-                       throws ExecutionException {
-               bind();
-               CdmStore.getService(IUserService.class).createUser(user);
-               return postExecute(null);
-       }
-}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/wizard/UserWizard.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/wizard/UserWizard.java
deleted file mode 100644 (file)
index b0c355e..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.account.user.wizard;
-
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.wizard.Wizard;
-
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.account.user.operation.CreateUserOperation;
-import eu.etaxonomy.taxeditor.account.user.operation.EditUserOperation;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.view.user.UserView;
-
-/**
- * <p>UserWizard class.</p>
- *
- * @author n.hoffmann
- * @created 02.07.2009
- * @version 1.0
- */
-public class UserWizard extends Wizard {
-       private User user;
-       private UserWizardPage page;
-       private UserView view;
-       private boolean createMode;
-
-       /**
-        * <p>Constructor for UserWizard.</p>
-        *
-        * @param view a {@link eu.etaxonomy.taxeditor.view.user.UserView} object.
-        */
-       public UserWizard(UserView view){
-               this.view = view;
-               setWindowTitle("User Wizard");
-               createMode = true;
-       }
-       
-       /**
-        * <p>Constructor for UserWizard.</p>
-        *
-        * @param view a {@link eu.etaxonomy.taxeditor.view.user.UserView} object.
-        * @param user a {@link eu.etaxonomy.cdm.model.common.User} object.
-        */
-       public UserWizard(UserView view, User user){
-               this(view);
-               if(user != null){
-                       this.user = user;
-                       createMode = false;
-               }
-       }
-       
-       /* (non-Javadoc)
-        * @see org.eclipse.jface.wizard.Wizard#addPages()
-        */
-       /** {@inheritDoc} */
-       @Override
-       public void addPages() {
-               super.addPages();
-               
-               page = new UserWizardPage(user);
-               
-               addPage(page);
-               
-       }
-       
-       /* (non-Javadoc)
-        * @see org.eclipse.jface.wizard.Wizard#performFinish()
-        */
-       /** {@inheritDoc} */
-       @Override
-       public boolean performFinish() {
-               
-               AbstractPostOperation operation;
-               if(createMode){
-                       operation = new CreateUserOperation("Create User", 
-                                       StoreUtil.getUndoContext(), page.getUser(), view, view);
-               }else{
-                       operation = new EditUserOperation("Edit User",
-                                       StoreUtil.getUndoContext(), page.getUser(), view, view);
-               }
-               
-               return StoreUtil.executeOperation(operation) == Status.OK_STATUS ? true : false;
-       }
-
-}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/wizard/UserWizardPage.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/wizard/UserWizardPage.java
deleted file mode 100644 (file)
index aacee67..0000000
+++ /dev/null
@@ -1,299 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.account.user.wizard;
-
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Text;
-
-import eu.etaxonomy.cdm.api.service.IUserService;
-import eu.etaxonomy.cdm.model.agent.Person;
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.model.CommonHelper;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * <p>UserWizardPage class.</p>
- *
- * @author n.hoffmann
- * @created 02.07.2009
- * @version 1.0
- */
-public class UserWizardPage extends WizardPage implements ModifyListener{
-
-//     private static final Logger logger = Logger.getLogger(UserWizardPage.class);
-       
-       /** Constant <code>NAME="USER_WIZARD_PAGE"</code> */
-       public static final String NAME = "USER_WIZARD_PAGE";
-       
-
-       private Composite composite;
-       private Text text_username;
-       private Text text_oldPassword;
-       private Text text_password;
-       private Text text_passwordRepeat;
-       private User user;
-       private boolean newMode = false;
-       private Group group_person;
-       private Text text_personFirstName;
-       private Text text_personLastName;
-       private Text text_userEmail;
-
-       private IInputValidator uniqueUserNameValidator;
-       private PasswordValidator passwordValidator;
-       
-       /**
-        * <p>Constructor for UserWizardPage.</p>
-        *
-        * @param user a {@link eu.etaxonomy.cdm.model.common.User} object.
-        */
-       protected UserWizardPage(User user) {
-               super(NAME);
-               
-               this.user = user;
-               
-               if(user == null){
-                       setTitle("Create new user");
-                       setDescription("Enter information for new user.");
-                       newMode = true;
-                       this.user = User.NewInstance(null, null);
-               }else{
-                       setTitle("Edit existing user");
-                       setDescription("Edit information for the selected user.");
-               }
-
-               uniqueUserNameValidator = new UniqueUserNameValidator();
-               passwordValidator = new PasswordValidator();
-       }
-
-
-       /* (non-Javadoc)
-        * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
-        */
-       /** {@inheritDoc} */
-       public void createControl(Composite parent) {
-               // right - edit Form
-               composite = new Composite(parent, SWT.NULL);
-               GridLayout compositeLayout = new GridLayout();
-               compositeLayout.numColumns = 2;
-               composite.setLayout(compositeLayout);
-               composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-               
-               CLabel label_username = new CLabel(composite, SWT.NULL);
-               label_username.setText("Username");
-               text_username = new Text(composite, SWT.BORDER);
-               text_username.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-               text_username.addModifyListener(this);
-               
-               if(! newMode){
-                       text_username.setEnabled(false);
-               }
-               
-               if(newMode){
-                       createPasswordFieldsNew(composite);
-                       setPageComplete(false);
-               }else if(userIsAuthenticated()){
-                       createPasswordFieldsEdit(composite);
-                       setPageComplete(false);
-               }
-
-               group_person = createPersonGroup(composite);
-               group_person.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
-               
-               setControl(composite);
-               
-               
-               
-               init();
-       }
-
-       /**
-        * @return
-        */
-       private boolean userIsAuthenticated() {
-               return user.equals(CdmStore.getLoginManager().getAuthenticatedUser());
-       }
-
-       private void createPasswordFieldsEdit(Composite parent){
-               CLabel label_oldPassword = new CLabel(parent, SWT.NULL);
-               label_oldPassword.setText("Old Password");
-               text_oldPassword = new Text(parent, SWT.PASSWORD | SWT.BORDER);
-               text_oldPassword.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-               text_oldPassword.addModifyListener(this);
-               
-               createPasswordFieldsNew(parent);
-       }
-       
-       private void createPasswordFieldsNew(Composite parent){
-               CLabel label_password = new CLabel(parent, SWT.NULL);
-               label_password.setText("Password");
-               
-               text_password = new Text(parent, SWT.PASSWORD | SWT.BORDER);
-               text_password.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-               text_password.addModifyListener(this);
-               
-               new CLabel(parent, SWT.NULL);
-               text_passwordRepeat = new Text(parent, SWT.PASSWORD | SWT.BORDER);
-               text_passwordRepeat.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-               text_passwordRepeat.addModifyListener(this);
-       }
-       
-       private Group createPersonGroup(Composite parent){
-
-               Group group = new Group(parent, SWT.NONE);
-               GridLayout layout = new GridLayout();
-               layout.numColumns = 2;
-               group.setLayout(layout);
-               
-               CLabel label_personFirstName = new CLabel(group, SWT.NULL);
-               label_personFirstName.setText("First Name");
-               text_personFirstName = new Text(group, SWT.BORDER);
-               text_personFirstName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-               text_personFirstName.addModifyListener(this);
-               
-               CLabel label_personLastName = new CLabel(group, SWT.NULL);
-               label_personLastName.setText("Last Name");
-               text_personLastName = new Text(group, SWT.BORDER);
-               text_personLastName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-               text_personLastName.addModifyListener(this);
-               
-               
-               CLabel label_userEmail = new CLabel(group, SWT.NULL);
-               label_userEmail.setText("Email");
-               text_userEmail = new Text(group, SWT.BORDER);
-               text_userEmail.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-               text_userEmail.addModifyListener(this);
-               
-               return group;
-       }
-       
-       /**
-        * 
-        */
-       private void init() {
-               CommonHelper.editTextWithoutTriggeringListeners(text_username, this, user.getUsername());
-               if(user.getPerson() == null){
-                       user.setPerson(Person.NewInstance());
-               }else{  
-                       CommonHelper.editTextWithoutTriggeringListeners(text_personFirstName, this, user.getPerson().getFirstname());
-                       CommonHelper.editTextWithoutTriggeringListeners(text_personLastName, this, user.getPerson().getLastname());
-                       CommonHelper.editTextWithoutTriggeringListeners(text_userEmail, this, user.getEmailAddress());
-               }
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
-        */
-       /** {@inheritDoc} */
-       public void modifyText(ModifyEvent e) {
-               if(newMode){
-                       user.setUsername(text_username.getText().trim());                       
-                       user.setPassword(text_password.getText());
-                       validate();
-               }else if(userIsAuthenticated()){
-                       user.setPassword(text_password.getText());
-                       validate();
-               }
-               user.getPerson().setFirstname(text_personFirstName.getText());
-               user.getPerson().setLastname(text_personLastName.getText());
-               user.setEmailAddress(text_userEmail.getText());
-       }
-
-       /**
-        * <p>Getter for the field <code>user</code>.</p>
-        *
-        * @return a {@link eu.etaxonomy.cdm.model.common.User} object.
-        */
-       public User getUser() {
-               return user;
-       }
-       
-       private void validate(){
-               String message;
-               
-               if(!userIsAuthenticated()){
-                       if((message = uniqueUserNameValidator.isValid(text_username.getText())) != null){
-                               // pass
-                       }
-               }else if((message = passwordValidator.isValid(text_password.getText())) != null){
-                       // pass
-               }else if((message = passwordValidator.passwordsMatch(text_password.getText(), text_passwordRepeat.getText())) != null){
-                       // pass
-               }
-               
-               setErrorMessage(message);               
-       }
-       
-       private class UniqueUserNameValidator implements IInputValidator{
-
-               private static final String USER_EXISTS = "Username already exists";
-               private static final String NAME_TO_SHORT = "Username is empty";
-               
-               /* (non-Javadoc)
-                * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
-                */
-               public String isValid(String newText) {
-                       // query for username
-                       if(newText.length() < 1){
-                               setPageComplete(false);
-                               return NAME_TO_SHORT;
-                       }
-                       if(CdmStore.getService(IUserService.class).userExists(newText)){
-                               setPageComplete(false);
-                               return USER_EXISTS;
-                       }
-                       
-                       setPageComplete(true);
-                       return null;
-               }
-       }
-       
-       private class PasswordValidator implements IInputValidator{
-
-               private static final int PW_MIN_LENGTH = 5;
-               
-               private static final String TO_SHORT = "Password has to have at least " + PW_MIN_LENGTH + " characters";
-               private static final String NO_MATCH = "The passwords do not match";
-               
-               /* (non-Javadoc)
-                * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
-                */
-               public String isValid(String newText) {
-                       if(newText.length() < PW_MIN_LENGTH){
-                               setPageComplete(false);
-                               return TO_SHORT;
-                       }
-                       
-                       setPageComplete(true);
-                       return null;
-               }
-               
-               public String passwordsMatch(String password1, String password2){
-
-                       if(! password1.equals(password2)){
-                               setPageComplete(false);
-                               return NO_MATCH;
-                       }
-                       
-                       setPageComplete(true);
-                       return null;
-               }
-               
-       }
-}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewGroupWizard.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewGroupWizard.java
new file mode 100644 (file)
index 0000000..5cf3207
--- /dev/null
@@ -0,0 +1,52 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.newWizard;
+
+import eu.etaxonomy.cdm.api.service.IGroupService;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailWizardPage;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 10, 2011
+ * @version 1.0
+ */
+public class NewGroupWizard extends AbstractNewEntityWizard<Group> {
+
+       private GroupDetailWizardPage groupPage;
+       
+       /* (non-Javadoc)
+        * @see org.eclipse.jface.wizard.Wizard#addPages()
+        */
+       @Override
+       public void addPages() {
+               groupPage = new GroupDetailWizardPage(formFactory, getConversationHolder(), getEntity());
+               super.addPage(groupPage);
+       }
+       
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard#saveEntity()
+        */
+       @Override
+       protected void saveEntity() {
+               CdmStore.getService(IGroupService.class).saveOrUpdate(getEntity());
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard#createNewEntity()
+        */
+       @Override
+       protected Group createNewEntity() {
+               return Group.NewInstance();
+       }
+
+}
index 019460ce490dd3e8a3c7a5e6a7bc78b3722a0795..43d703e49f925c2c898745238254876baf4612e3 100644 (file)
@@ -18,7 +18,10 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
 
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 
 /**
  * <p>LoginManager class.</p>
@@ -27,7 +30,9 @@ import eu.etaxonomy.cdm.model.common.User;
  * @created 03.07.2009
  * @version 1.0
  */
-public class LoginManager extends Observable{
+public class LoginManager extends Observable implements IConversationEnabled{
+       
+       private ConversationHolder conversation;
        
        /**
         * <p>authenticate</p>
@@ -36,6 +41,7 @@ public class LoginManager extends Observable{
         */
        public void authenticate(String username, String password){             
                try{
+                       getConversationHolder().bind();
                        UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password); 
                        
                        SecurityContextHolder.clearContext();
@@ -77,4 +83,21 @@ public class LoginManager extends Observable{
                SecurityContextHolder.clearContext();
                notifyObservers();              
        }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
+        */
+       @Override
+       public void update(CdmDataChangeMap arg) {}
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
+        */
+       @Override
+       public ConversationHolder getConversationHolder() {
+               if(conversation == null){
+                       conversation = CdmStore.createConversation();
+               }
+               return conversation;
+       }
 }
index 3119397a830dc54cfd43ccc13e3cf2c4e63e3dec..f3f055a7b807a58224673a5a987236bc9ac51f70 100644 (file)
@@ -14,14 +14,17 @@ import java.util.ArrayList;
 import java.util.List;
 
 import eu.etaxonomy.cdm.api.service.IAgentService;
+import eu.etaxonomy.cdm.api.service.IGroupService;
 import eu.etaxonomy.cdm.api.service.INameService;
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
 import eu.etaxonomy.cdm.api.service.IReferenceService;
 import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.api.service.IUserService;
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
 import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator;
 import eu.etaxonomy.cdm.model.agent.AgentBase;
-import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.cdm.model.common.User;
 import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
@@ -40,7 +43,7 @@ public class SearchManager {
         * @param configurator a {@link eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator} object.
         * @return a {@link java.util.List} object.
         */
-       public static List<TaxonNameBase> findNames(IIdentifiableEntityServiceConfigurator configurator){
+       public List<TaxonNameBase> findNames(IIdentifiableEntityServiceConfigurator configurator){
                // TODO we want to use IIdentifiableEntityServiceConfigurator for all find methods
                // unfortunately this is not consistently implemented in the library.
                // FIXME use proper method once it is implemented in the library
@@ -55,7 +58,7 @@ public class SearchManager {
         * @param configurator a {@link eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator} object.
         * @return a {@link java.util.List} object.
         */
-       public static List<UuidAndTitleCache<TaxonBase>> findTaxaAndNames(ITaxonServiceConfigurator configurator){
+       public List<UuidAndTitleCache<TaxonBase>> findTaxaAndNames(ITaxonServiceConfigurator configurator){
                
                return CdmStore.getService(ITaxonService.class).findTaxaAndNamesForEditor(configurator);
        }
@@ -66,7 +69,7 @@ public class SearchManager {
         * @param configurator a {@link eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator} object.
         * @return a {@link java.util.List} object.
         */
-       public static List<Reference> findReferences(IIdentifiableEntityServiceConfigurator configurator){
+       public List<Reference> findReferences(IIdentifiableEntityServiceConfigurator configurator){
                // TODO we want to use IIdentifiableEntityServiceConfigurator for all find methods
                // unfortunately this is not consistently implemented in the library.
                // FIXME use proper method once it is implemented in the library
@@ -81,7 +84,7 @@ public class SearchManager {
         * @param configurator a {@link eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator} object.
         * @return a {@link java.util.List} object.
         */
-       public static List<AgentBase> findAgents(IIdentifiableEntityServiceConfigurator configurator){
+       public List<AgentBase> findAgents(IIdentifiableEntityServiceConfigurator configurator){
                // TODO we want to use IIdentifiableEntityServiceConfigurator for all find methods
                // unfortunately this is not consistently implemented in the library.
                // FIXME use proper method once it is implemented in the library
@@ -96,7 +99,7 @@ public class SearchManager {
         * @param configurator a {@link eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator} object.
         * @return a {@link java.util.List} object.
         */
-       public static List<AgentBase> findTeamOrPersons(IIdentifiableEntityServiceConfigurator configurator){
+       public List<AgentBase> findTeamOrPersons(IIdentifiableEntityServiceConfigurator configurator){
                // TODO move this to cdmlib
                List<AgentBase> result = new ArrayList<AgentBase>();
                for (AgentBase agent : findAgents(configurator)) {
@@ -111,7 +114,7 @@ public class SearchManager {
         * @param configurator a {@link eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator} object.
         * @return a {@link java.util.List} object.
         */
-       public static List<SpecimenOrObservationBase> findOccurrences(IIdentifiableEntityServiceConfigurator configurator){
+       public List<SpecimenOrObservationBase> findOccurrences(IIdentifiableEntityServiceConfigurator configurator){
                // TODO we want to use IIdentifiableEntityServiceConfigurator for all find methods
                // unfortunately this is not consistently implemented in the library.
                // FIXME use proper method once it is implemented in the library
@@ -119,4 +122,18 @@ public class SearchManager {
                
                return CdmStore.getService(IOccurrenceService.class).findByTitle(SpecimenOrObservationBase.class, titleSearchString, null, null, null, null, null, null).getRecords();
        }
+       
+       public List<User> findUsers(IIdentifiableEntityServiceConfigurator configurator){
+               String userNameSearchString = configurator.getTitleSearchString().replace("*", "%");
+               
+               // FIXME there is no search at the moment, we will return all users for starters
+               return CdmStore.getService(IUserService.class).list(User.class, null, null, null, null);
+       }
+       
+       public List<Group> findGroups(IIdentifiableEntityServiceConfigurator configurator){
+               String groupNameSearchString = configurator.getTitleSearchString().replace("*", "%");
+               
+               // FIXME there is no search at the moment, we will return all users for starters
+               return CdmStore.getService(IGroupService.class).list(Group.class, null, null, null, null);
+       }
 }
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/GroupSelectionDialog.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/GroupSelectionDialog.java
new file mode 100644 (file)
index 0000000..9931c5b
--- /dev/null
@@ -0,0 +1,93 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.IGroupService;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
+import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
+import eu.etaxonomy.taxeditor.newWizard.NewGroupWizard;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 10, 2011
+ * @version 1.0
+ */
+public class GroupSelectionDialog extends
+               AbstractFilteredCdmResourceSelectionDialog<Group> {
+
+       public static Group select(Shell shell, ConversationHolder conversation, Group group){
+               GroupSelectionDialog dialog = new GroupSelectionDialog(shell, conversation,
+                               "Choose Group", false, GroupSelectionDialog.class.getCanonicalName(), group);
+               return getSelectionFromDialog(dialog);
+       }
+       
+       /**
+        * @param shell
+        * @param conversation
+        * @param title
+        * @param multi
+        * @param settings
+        * @param cdmObject
+        */
+       protected GroupSelectionDialog(Shell shell,
+                       ConversationHolder conversation, String title, boolean multi,
+                       String settings, Group cdmObject) {
+               super(shell, conversation, title, multi, settings, cdmObject);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#initModel()
+        */
+       @Override
+       protected void initModel() {
+               List<Group> groups = CdmStore.getService(IGroupService.class).list(Group.class, null, null, null, null);
+               
+               model = new ArrayList<UuidAndTitleCache<Group>>();
+               
+               for(Group group : groups){
+                       model.add(new UuidAndTitleCache<Group>(Group.class, group.getUuid(),String.format("%s", group.getName())));
+               }       
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewWizardLinkText()
+        */
+       @Override
+       protected String getNewWizardLinkText() {
+               return "Create a new <A>Group</A>.";
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewEntityWizard(java.lang.String)
+        */
+       @Override
+       protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
+               return new NewGroupWizard();
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
+        */
+       @Override
+       protected Group getPersistentObject(UUID uuid) {
+               return CdmStore.getService(IGroupService.class).load(uuid);
+       }
+
+}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/UserSelectionDialog.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/UserSelectionDialog.java
new file mode 100644 (file)
index 0000000..331d6b3
--- /dev/null
@@ -0,0 +1,99 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
+import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
+import eu.etaxonomy.taxeditor.newWizard.NewUserWizard;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 10, 2011
+ * @version 1.0
+ */
+public class UserSelectionDialog extends
+               AbstractFilteredCdmResourceSelectionDialog<User> {
+
+       /**
+        * 
+        * @param shell
+        * @param conversation
+        * @param user
+        * @return
+        */
+       public static User select(Shell shell, ConversationHolder conversation, User user){
+               UserSelectionDialog dialog = new UserSelectionDialog(shell, conversation,
+                               "Choose User", false, UserSelectionDialog.class.getCanonicalName(), user);
+               return getSelectionFromDialog(dialog);
+       }
+       
+       /**
+        * @param shell
+        * @param conversation
+        * @param title
+        * @param multi
+        * @param settings
+        * @param cdmObject
+        */
+       protected UserSelectionDialog(Shell shell, ConversationHolder conversation,
+                       String title, boolean multi, String settings, User cdmObject) {
+               super(shell, conversation, title, multi, settings, cdmObject);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#initModel()
+        */
+       @Override
+       protected void initModel() {
+               List<User> users = CdmStore.getService(IUserService.class).list(User.class, null, null, null, null);
+               
+               model = new ArrayList<UuidAndTitleCache<User>>();
+               
+               for(User user : users){
+                       model.add(new UuidAndTitleCache<User>(User.class, user.getUuid(),String.format("%s, %s", user.getUsername(), user.getPerson())));
+               }                
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewWizardLinkText()
+        */
+       @Override
+       protected String getNewWizardLinkText() {
+               return "Create a new <A>User</A>.";
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewEntityWizard(java.lang.String)
+        */
+       @Override
+       protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
+               return new NewUserWizard();
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
+        */
+       @Override
+       protected User getPersistentObject(UUID uuid) {
+               return CdmStore.getService(IUserService.class).load(uuid);
+       }
+
+}
index 7d8bdb82e7b4a408f785de185d1a78c25dd7e535..46d5ceb18016e574f405eb9f79e864345ac17682 100644 (file)
@@ -105,7 +105,7 @@ public abstract class AbstractCdmEntityWizardPage<T> extends WizardPage implemen
         */
        public abstract AbstractCdmDetailElement<T> createElement(ICdmFormElement rootElement);
        
-       private class WizardPageRootElement extends RootElement implements IConversationEnabled{
+       protected class WizardPageRootElement extends RootElement implements IConversationEnabled{
 
                private ConversationHolder conversation;
                
@@ -143,7 +143,9 @@ public abstract class AbstractCdmEntityWizardPage<T> extends WizardPage implemen
        @Override
        public void dispose() {
                super.dispose();
-               detailElement.removeElements();
+               if(detailElement != null){
+                       detailElement.removeElements();
+               }
        }
        
        /**
index 7cd0c9b60f411d1edeabe9cb8f62824d143eafa8..763683062c8abba8411349b88f788fc912dd39ac 100644 (file)
@@ -39,8 +39,10 @@ import org.eclipse.ui.forms.widgets.TableWrapData;
 import org.eclipse.ui.forms.widgets.TableWrapLayout;
 import org.eclipse.ui.internal.forms.widgets.FormFonts;
 import org.joda.time.Partial;
+import org.springframework.security.core.GrantedAuthority;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.agent.Institution;
 import eu.etaxonomy.cdm.model.agent.Person;
@@ -53,15 +55,16 @@ import eu.etaxonomy.cdm.model.common.DefinedTermBase;
 import eu.etaxonomy.cdm.model.common.DescriptionElementSource;
 import eu.etaxonomy.cdm.model.common.Extension;
 import eu.etaxonomy.cdm.model.common.ExtensionType;
+import eu.etaxonomy.cdm.model.common.Group;
 import eu.etaxonomy.cdm.model.common.IAnnotatableEntity;
 import eu.etaxonomy.cdm.model.common.ICdmBase;
-import eu.etaxonomy.cdm.model.common.IVersionableEntity;
 import eu.etaxonomy.cdm.model.common.IdentifiableSource;
 import eu.etaxonomy.cdm.model.common.Language;
 import eu.etaxonomy.cdm.model.common.LanguageString;
 import eu.etaxonomy.cdm.model.common.Marker;
 import eu.etaxonomy.cdm.model.common.MarkerType;
 import eu.etaxonomy.cdm.model.common.TimePeriod;
+import eu.etaxonomy.cdm.model.common.User;
 import eu.etaxonomy.cdm.model.common.VersionableEntity;
 import eu.etaxonomy.cdm.model.description.CategoricalData;
 import eu.etaxonomy.cdm.model.description.CommonTaxonName;
@@ -121,6 +124,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.forms.password.EditPasswordElement;
 import eu.etaxonomy.taxeditor.ui.openurl.IOpenUrlEnabled;
 import eu.etaxonomy.taxeditor.ui.openurl.OpenUrlSelectorElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
@@ -170,6 +174,12 @@ import eu.etaxonomy.taxeditor.ui.section.description.detail.TaxonInteractionDeta
 import eu.etaxonomy.taxeditor.ui.section.description.detail.TextDataDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.group.GrantedAuthorityDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.group.GrantedAuthorityDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.key.GeographicalScopeDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
@@ -252,6 +262,7 @@ import eu.etaxonomy.taxeditor.ui.selection.DerivedUnitBaseSelectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.FeatureSelectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.FeatureTreeSelectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.FieldObservationSelectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.GroupSelectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.InstitutionSelectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.NameSelectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.NamedAreaSelectionElement;
@@ -265,6 +276,7 @@ import eu.etaxonomy.taxeditor.ui.selection.TaxonBaseSelectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.TaxonNodeSelectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.TaxonSelectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.TeamSelectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.UserSelectionElement;
 import eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement;
 import eu.etaxonomy.taxeditor.ui.term.AbstractTermComboElement;
 import eu.etaxonomy.taxeditor.ui.term.AnnotationTypeComboElement;
@@ -654,6 +666,23 @@ public class CdmFormFactory extends FormToolkit{
                return element;
        }
        
+       /**
+        * 
+        * @param parentElement
+        * @param labelString
+        * @param conversationEnabled
+        * @param user
+        * @param style
+        * @return
+        */
+       public EditPasswordElement createEditPasswordElement(ICdmFormElement parentElement, String labelString,
+                       ConversationHolder conversation, User user, int style){
+               EditPasswordElement element = new EditPasswordElement(this, parentElement, labelString, user, conversation);
+               adapt(element);
+               parentElement.addElement(element);
+               return element;
+       }
+       
        /**
         * <p>createIntegerTextWithLabelElement</p>
         *
@@ -971,7 +1000,9 @@ public class CdmFormFactory extends FormToolkit{
                COLLECTION, 
                FEATURE, 
                POLYTOMOUS_KEY, 
-               POLYTOMOUS_KEY_NODE
+               POLYTOMOUS_KEY_NODE, 
+               USER, 
+               GROUP
        }       
                
        /**
@@ -1305,8 +1336,8 @@ public class CdmFormFactory extends FormToolkit{
                INSTITUTION, 
                DERIVED_UNIT_GENERAL, 
                HYBRID, 
-               USER, 
-               GROUPS_BY_USER
+               USER,
+               GROUP
        }
        
        /**
@@ -1404,8 +1435,8 @@ public class CdmFormFactory extends FormToolkit{
                case USER:
                        section = new UserDetailSection(this, conversation, parentElement, selectionProvider, style);
                        break;
-               case GROUPS_BY_USER:
-                       section = new GroupsByUserDetailSection(this, conversation, parentElement, selectionProvider, style);
+               case GROUP:
+                       section = new GroupDetailSection(this, conversation, parentElement, selectionProvider, style);
                        break;
                }
                
@@ -1505,8 +1536,8 @@ public class CdmFormFactory extends FormToolkit{
                case USER:
                        element = new UserDetailElement(this, parentElement);
                        break;
-               case GROUPS_BY_USER:
-                       element = new GroupsByUserDetailElement(this, parentElement);
+               case GROUP:
+                       element = new GroupDetailElement(this, parentElement);
                        break;
                }
                
@@ -1554,7 +1585,10 @@ public class CdmFormFactory extends FormToolkit{
                SPECIMEN_COLLECTION, 
                IDENTIFIABLE_SOURCE_COLLECTION, 
                GEOGRAPHICAL_SCOPE, 
-               SCOPE_RESTRICTION
+               SCOPE_RESTRICTION,
+               MEMBER, 
+               GRANTED_AUTHORITY, 
+               GROUPS_BY_USER
        }
        
        /**
@@ -1657,6 +1691,15 @@ public class CdmFormFactory extends FormToolkit{
                case SCOPE_RESTRICTION:
                        section = new ScopeRestrictionSection(this, conversation, parentElement, style);
                        break;
+               case MEMBER:
+                       section = new MemberDetailSection(this, conversation, parentElement, style);
+                       break;
+               case GRANTED_AUTHORITY:
+                       section = new GrantedAuthorityDetailSection(this, conversation, parentElement, style);
+                       break;
+               case GROUPS_BY_USER:
+                       section = new GroupsByUserDetailSection(this, conversation, parentElement, style);
+                       break;
                }
                parentElement.addElement(section);
                adapt(section);
@@ -1673,10 +1716,10 @@ public class CdmFormFactory extends FormToolkit{
         * @param backgroundColor a {@link org.eclipse.swt.graphics.Color} object.
         * @return a {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement} object.
         */
-       public AbstractEntityCollectionElement createEntityCollectionElement(AbstractFormSection parentElement, IVersionableEntity versionableEntity, SelectionListener removeListener, Color backgroundColor, int style){
+       public AbstractEntityCollectionElement createEntityCollectionElement(AbstractFormSection parentElement, Object versionableEntity, SelectionListener removeListener, Color backgroundColor, int style){
                AbstractEntityCollectionElement element = null;
                
-               VersionableEntity entity = (VersionableEntity) HibernateProxyHelper.deproxy(versionableEntity);
+               Object entity = HibernateProxyHelper.deproxy(versionableEntity);
                
                if(entity instanceof Annotation){
                        element = new AnnotationElement(this, parentElement, (Annotation) entity, removeListener, style);
@@ -1750,7 +1793,15 @@ public class CdmFormFactory extends FormToolkit{
                else if(entity instanceof Specimen){
                        element = new SpecimenCollectionDetailElement(this, parentElement, (Specimen) entity, removeListener, style);
                }
-               
+               else if(entity instanceof User){
+                       element = new MemberDetailElement(this, parentElement, (User) entity, removeListener, style);
+               }
+               else if(entity instanceof GrantedAuthority){
+                       element = new GrantedAuthorityDetailElement(this, parentElement, (GrantedAuthority) entity, removeListener, style);
+               }
+               else if(entity instanceof Group){
+                       element = new GroupsByUserDetailElement(this, parentElement, (Group) entity, removeListener, style);
+               }
                else if(entity instanceof DescriptionElementBase){
                        // this is the special case for protologs, maybe we can do this differently when API improves
                        DescriptionElementBase descriptionElement = (DescriptionElementBase) entity;
@@ -1848,6 +1899,12 @@ public class CdmFormFactory extends FormToolkit{
                case POLYTOMOUS_KEY_NODE:
                        element = new PolytomousKeyNodeSelectionElement(this, conversation, parentElement, labelString, (PolytomousKeyNode) entity, style);
                        break;
+               case USER:
+                       element = new UserSelectionElement(this, conversation, parentElement, labelString, (User) entity, style);
+                       break;
+               case GROUP:
+                       element = new GroupSelectionElement(this, conversation, parentElement, labelString, (Group) entity, style);
+                       break;
                default:
                        new RuntimeException("There is no selection composite for the desired selection type.");
                        break;
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/password/EditPasswordElement.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/password/EditPasswordElement.java
new file mode 100644 (file)
index 0000000..85a766d
--- /dev/null
@@ -0,0 +1,102 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.forms.password;
+
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Label;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.ui.forms.AbstractCdmFormElement;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 10, 2011
+ * @version 1.0
+ */
+public class EditPasswordElement extends AbstractCdmFormElement implements SelectionListener, IConversationEnabled{
+
+       private User user;
+       private Button button;
+
+       private ConversationHolder conversation;
+       
+       /**
+        * @param formFactory
+        * @param formElement
+        */
+       public EditPasswordElement(CdmFormFactory formFactory,
+                       ICdmFormElement formElement, String labelString, User user, ConversationHolder conversation) {
+               super(formFactory, formElement);
+               
+               this.conversation = conversation;
+               
+               Label label = formFactory.createLabel(getLayoutComposite(), null);
+               addControl(label);
+               
+               String buttonLabelString = (labelString != null) ? labelString : "Change Password";
+               
+               button = formFactory.createButton(getLayoutComposite(), buttonLabelString, SWT.PUSH);
+               button.setLayoutData(CdmFormFactory.RIGHT());
+               addControl(button);
+               
+               button.addSelectionListener(this);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.forms.ISelectable#setSelected(boolean)
+        */
+       @Override
+       public void setSelected(boolean selected) {
+               
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+        */
+       @Override
+       public void widgetSelected(SelectionEvent e) {
+               PasswordWizard wizard = new PasswordWizard(conversation, user);
+               WizardDialog dialog = new WizardDialog(getLayoutComposite().getShell(), wizard);
+               
+               dialog.open();
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+        */
+       @Override
+       public void widgetDefaultSelected(SelectionEvent e) {}
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
+        */
+       @Override
+       public void update(CdmDataChangeMap arg0) {}
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
+        */
+       @Override
+       public ConversationHolder getConversationHolder() {
+               return conversation;
+       }
+
+
+}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/password/PasswordWizard.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/password/PasswordWizard.java
new file mode 100644 (file)
index 0000000..6f45bd1
--- /dev/null
@@ -0,0 +1,80 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.forms.password;
+
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Display;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 10, 2011
+ * @version 1.0
+ */
+public class PasswordWizard extends Wizard implements IConversationEnabled{
+
+       private PasswordWizardPage passwordPage;
+       private User user;
+       private ConversationHolder conversation;
+       
+       public PasswordWizard(ConversationHolder conversation, User user){
+               this.conversation = conversation;
+               this.user = user;
+       }
+       
+       /* (non-Javadoc)
+        * @see org.eclipse.jface.wizard.Wizard#addPages()
+        */
+       @Override
+       public void addPages() {
+               CdmFormFactory formFactory = new CdmFormFactory(Display.getDefault());
+               passwordPage = new PasswordWizardPage(formFactory, getConversationHolder(), user);
+               super.addPage(passwordPage);
+       }
+       
+       /* (non-Javadoc)
+        * @see org.eclipse.jface.wizard.Wizard#performFinish()
+        */
+       @Override
+       public boolean performFinish() {
+               ConversationHolder internalConversation = CdmStore.getLoginManager().getConversationHolder();
+               internalConversation.bind();
+               CdmStore.getService(IUserService.class).changePassword(passwordPage.getOldPassword(), passwordPage.getNewPassword());
+               internalConversation.commit();
+               conversation.bind();
+               return true;
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
+        */
+       @Override
+       public void update(CdmDataChangeMap arg0) {
+               // TODO Auto-generated method stub
+               
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
+        */
+       @Override
+       public ConversationHolder getConversationHolder() {
+               return conversation;
+       }
+
+}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/password/PasswordWizardPage.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/password/PasswordWizardPage.java
new file mode 100644 (file)
index 0000000..a58d199
--- /dev/null
@@ -0,0 +1,184 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.forms.password;
+
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+
+/**
+ * <p>UserWizardPage class.</p>
+ *
+ * @author n.hoffmann
+ * @created 02.07.2009
+ * @version 1.0
+ */
+public class PasswordWizardPage extends AbstractCdmEntityWizardPage<User> implements ModifyListener{
+
+       /** Constant <code>NAME="USER_WIZARD_PAGE"</code> */
+       public static final String NAME = "USER_WIZARD_PAGE";
+       
+       private TextWithLabelElement text_oldPassword;
+       private TextWithLabelElement text_password;
+       private TextWithLabelElement text_passwordRepeat;
+       private PasswordValidator passwordValidator;
+
+       /**
+        * @param formFactory
+        * @param conversation
+        * @param entity
+        */
+       protected PasswordWizardPage(CdmFormFactory formFactory,
+                       ConversationHolder conversation, User entity) {
+               super(formFactory, conversation, entity);
+               
+               passwordValidator = new PasswordValidator();
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#createControl(org.eclipse.swt.widgets.Composite)
+        */
+       @Override
+       public void createControl(Composite parent) {
+               Composite control = formFactory.createComposite(parent);
+               control.setLayoutData(CdmFormFactory.FILL());
+               
+               setPageComplete(false);
+               
+               control.setLayout(CdmFormFactory.LAYOUT(2, false));
+               WizardPageRootElement rootElement = new WizardPageRootElement(formFactory, control, getConversationHolder());
+               
+               text_oldPassword = formFactory.createTextWithLabelElement(rootElement, "Old Password", null, SWT.PASSWORD);
+               
+               text_password =  formFactory.createTextWithLabelElement(rootElement, "New Password", null, SWT.PASSWORD);
+               text_passwordRepeat =  formFactory.createTextWithLabelElement(rootElement, "Repeat Password", null, SWT.PASSWORD);
+               
+               ((Text)text_passwordRepeat.getMainControl()).addModifyListener(this);
+               
+               setControl(control);
+       }
+       
+       
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement)
+        */
+       @Override
+       public AbstractCdmDetailElement<User> createElement(
+                       ICdmFormElement rootElement) {
+               // not used
+               return null;
+       }
+       
+       /* (non-Javadoc)
+        * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+        */
+       /** {@inheritDoc} */
+       public void modifyText(ModifyEvent e) {
+               validate();
+       }
+       
+       private void validate(){
+               String message;
+               
+               if((message = passwordValidator.passwordsMatch(text_password.getText(), text_passwordRepeat.getText())) != null){
+                       // pass
+               }
+               else if((message = passwordValidator.isValid(text_password.getText())) != null){
+                       // pass
+               }
+               
+               setErrorMessage(message);               
+       }
+       
+       private class UniqueUserNameValidator implements IInputValidator{
+
+               private static final String USER_EXISTS = "Username already exists";
+               private static final String NAME_TO_SHORT = "Username is empty";
+               
+               /* (non-Javadoc)
+                * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
+                */
+               public String isValid(String newText) {
+                       // query for username
+                       if(newText.length() < 1){
+                               setPageComplete(false);
+                               return NAME_TO_SHORT;
+                       }
+                       if(CdmStore.getService(IUserService.class).userExists(newText)){
+                               setPageComplete(false);
+                               return USER_EXISTS;
+                       }
+                       
+                       setPageComplete(true);
+                       return null;
+               }
+       }
+       
+       private class PasswordValidator implements IInputValidator{
+
+               private static final int PW_MIN_LENGTH = 5;
+               
+               private static final String TO_SHORT = "Password has to have at least " + PW_MIN_LENGTH + " characters";
+               private static final String NO_MATCH = "The passwords do not match";
+               
+               /* (non-Javadoc)
+                * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
+                */
+               public String isValid(String newText) {
+                       if(newText.length() < PW_MIN_LENGTH){
+                               setPageComplete(false);
+                               return TO_SHORT;
+                       }
+                       
+                       setPageComplete(true);
+                       return null;
+               }
+               
+               public String passwordsMatch(String password1, String password2){
+
+                       if(! password1.equals(password2)){
+                               setPageComplete(false);
+                               return NO_MATCH;
+                       }
+                       
+                       setPageComplete(true);
+                       return null;
+               }
+               
+       }
+
+       /**
+        * @return
+        */
+       public String getOldPassword() {
+               return text_oldPassword.getText();
+       }
+
+       /**
+        * @return
+        */
+       public String getNewPassword() {
+               return text_password.getText();
+       }
+}
index a198c8433eb8fd4433ac945061d3548146635e9d..e2e18117f5c850b9261491b36381e799ee05fd66 100644 (file)
@@ -41,7 +41,7 @@ import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
  * @author n.hoffmann
  * @version $Id: $
  */
-public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT extends IVersionableEntity> extends AbstractFormSection<ENTITY> implements IExpansionListener{
+public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends AbstractFormSection<ENTITY> implements IExpansionListener{
                
        protected Composite container;
        
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GrantedAuthorityDetailElement.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GrantedAuthorityDetailElement.java
new file mode 100644 (file)
index 0000000..402c61b
--- /dev/null
@@ -0,0 +1,71 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.group;
+
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.springframework.security.core.GrantedAuthority;
+
+import eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class GrantedAuthorityDetailElement extends AbstractEntityCollectionElement<GrantedAuthority> {
+
+       /**
+        * @param formFactory
+        * @param section
+        * @param entity
+        * @param removeListener
+        * @param backgroundColor
+        * @param style
+        */
+       public GrantedAuthorityDetailElement(CdmFormFactory formFactory,
+                       AbstractFormSection section, GrantedAuthority entity,
+                       SelectionListener removeListener, int style) {
+               super(formFactory, section, entity, removeListener, null, style);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#setEntity(java.lang.Object)
+        */
+       @Override
+       public void setEntity(GrantedAuthority entity) {
+               // TODO Auto-generated method stub
+               
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#createControls(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement, int)
+        */
+       @Override
+       public void createControls(ICdmFormElement element, int style) {
+               // TODO Auto-generated method stub
+               
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
+        */
+       @Override
+       public void handleEvent(Object eventSource) {
+               // TODO Auto-generated method stub
+               
+       }
+
+       
+}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GrantedAuthorityDetailSection.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GrantedAuthorityDetailSection.java
new file mode 100644 (file)
index 0000000..f89d985
--- /dev/null
@@ -0,0 +1,96 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.group;
+
+import java.util.Collection;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.springframework.security.core.GrantedAuthority;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class GrantedAuthorityDetailSection extends AbstractEntityCollectionSection<Group, GrantedAuthority> {
+
+       /**
+        * @param formFactory
+        * @param conversation
+        * @param parentElement
+        * @param title
+        * @param style
+        */
+       public GrantedAuthorityDetailSection(CdmFormFactory formFactory,
+                       ConversationHolder conversation, ICdmFormElement parentElement,
+                       int style) {
+               super(formFactory, conversation, parentElement, "Granted Authorities", style);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
+        */
+       @Override
+       public Collection<GrantedAuthority> getCollection(Group entity) {
+               return entity.getGrantedAuthorities();
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
+        */
+       @Override
+       public GrantedAuthority createNewElement() {
+               GrantedAuthority selection = null; // TODO GrantedAuthoritySelectionDialog.select(...);
+               return selection;
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement(java.lang.Object)
+        */
+       @Override
+       public void addElement(GrantedAuthority element) {
+               getEntity().addGrantedAuthority(element);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#removeElement(java.lang.Object)
+        */
+       @Override
+       public void removeElement(GrantedAuthority element) {
+               getEntity().removeGrantedAuthority(element);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getEmptyString()
+        */
+       @Override
+       public String getEmptyString() {
+               return "No Granted Athorities yet.";
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getTooltipString()
+        */
+       @Override
+       protected String getTooltipString() {
+               return "Add a Granted Authority";
+       }
+
+       
+}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailElement.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailElement.java
new file mode 100644 (file)
index 0000000..e551a43
--- /dev/null
@@ -0,0 +1,56 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.group;
+
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class GroupDetailElement extends AbstractCdmDetailElement<Group> {
+
+       private TextWithLabelElement text_name;
+       
+       /**
+        * @param formFactory
+        * @param formElement
+        */
+       public GroupDetailElement(CdmFormFactory formFactory,
+                       ICdmFormElement formElement) {
+               super(formFactory, formElement);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement, java.lang.Object, int)
+        */
+       @Override
+       protected void createControls(ICdmFormElement formElement, Group entity,
+                       int style) {
+               text_name = formFactory.createTextWithLabelElement(formElement, "Name", entity.getName(), style);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
+        */
+       @Override
+       public void handleEvent(Object eventSource) {
+               if(eventSource == text_name){
+                       getEntity().setName(text_name.getText());
+               }
+       }
+
+}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailSection.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailSection.java
new file mode 100644 (file)
index 0000000..c7bc8a4
--- /dev/null
@@ -0,0 +1,58 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.group;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class GroupDetailSection extends AbstractCdmDetailSection<Group> {
+
+       /**
+        * @param formFactory
+        * @param conversation
+        * @param parentElement
+        * @param selectionProvider
+        * @param style
+        */
+       public GroupDetailSection(CdmFormFactory formFactory,
+                       ConversationHolder conversation, ICdmFormElement parentElement,
+                       ISelectionProvider selectionProvider, int style) {
+               super(formFactory, conversation, parentElement, selectionProvider, style);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getDetailType()
+        */
+       @Override
+       protected DetailType getDetailType() {
+               return DetailType.GROUP;
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading()
+        */
+       @Override
+       public String getHeading() {
+               return "Group " + (getEntity() != null ? getEntity().getName() : "");
+       }
+
+}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailWizardPage.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailWizardPage.java
new file mode 100644 (file)
index 0000000..42ef280
--- /dev/null
@@ -0,0 +1,51 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.group;
+
+import org.eclipse.swt.SWT;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 10, 2011
+ * @version 1.0
+ */
+public class GroupDetailWizardPage  extends AbstractCdmEntityWizardPage<Group>{
+
+       /**
+        * @param formFactory
+        * @param conversation
+        * @param entity
+        */
+       public GroupDetailWizardPage(CdmFormFactory formFactory,
+                       ConversationHolder conversation, Group entity) {
+               super(formFactory, conversation, entity);
+               setTitle("Group");
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement)
+        */
+       @Override
+       public AbstractCdmDetailElement<Group> createElement(
+                       ICdmFormElement rootElement) {
+               GroupDetailElement groupElement = (GroupDetailElement) formFactory.createCdmDetailElement(DetailType.GROUP, rootElement, SWT.NULL);
+               return groupElement;
+       }
+
+}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/MemberDetailElement.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/MemberDetailElement.java
new file mode 100644 (file)
index 0000000..8a6be81
--- /dev/null
@@ -0,0 +1,73 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.group;
+
+import org.eclipse.swt.events.SelectionListener;
+
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.UserSelectionElement;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class MemberDetailElement extends AbstractEntityCollectionElement<User> {
+
+       private UserSelectionElement selection_user; 
+       
+       /**
+        * @param formFactory
+        * @param section
+        * @param entity
+        * @param removeListener
+        * @param backgroundColor
+        * @param style
+        */
+       public MemberDetailElement(CdmFormFactory formFactory,
+                       AbstractFormSection section, User entity,
+                       SelectionListener removeListener, int style) {
+               super(formFactory, section, entity, removeListener, null, style);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#setEntity(java.lang.Object)
+        */
+       @Override
+       public void setEntity(User entity) {
+               selection_user.setEntity(entity);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#createControls(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement, int)
+        */
+       @Override
+       public void createControls(ICdmFormElement element, int style) {
+               selection_user = (UserSelectionElement) formFactory.createSelectionElement(SelectionType.USER, getConversationHolder(), element, "Member", entity, style);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
+        */
+       @Override
+       public void handleEvent(Object eventSource) {
+               if(eventSource == selection_user){
+                       setEntity(selection_user.getEntity());
+               }
+       }
+
+       
+}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/MemberDetailSection.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/MemberDetailSection.java
new file mode 100644 (file)
index 0000000..cbf4311
--- /dev/null
@@ -0,0 +1,94 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.group;
+
+import java.util.Collection;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.UserSelectionDialog;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class MemberDetailSection extends AbstractEntityCollectionSection<Group, User> {
+
+       /**
+        * @param formFactory
+        * @param conversation
+        * @param parentElement
+        * @param title
+        * @param style
+        */
+       public MemberDetailSection(CdmFormFactory formFactory,
+                       ConversationHolder conversation, ICdmFormElement parentElement,
+                       int style) {
+               super(formFactory, conversation, parentElement, "Members", style);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
+        */
+       @Override
+       public Collection<User> getCollection(Group entity) {
+               return entity.getMembers();
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
+        */
+       @Override
+       public User createNewElement() {
+               User selection = UserSelectionDialog.select(getLayoutComposite().getShell(), getConversationHolder(), null);
+               return selection;
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
+        */
+       @Override
+       public void addElement(User element) {
+               getEntity().addMember(element);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
+        */
+       @Override
+       public void removeElement(User element) {
+               getEntity().removeMember(element);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getEmptyString()
+        */
+       @Override
+       public String getEmptyString() {
+               return "No members yet.";
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getTooltipString()
+        */
+       @Override
+       protected String getTooltipString() {
+               return "Add a memeber to this group";
+       }
+
+       
+
+}
index 3bb09ce60b45a24cc87b7a0b06ff8c59ede65d7c..8c4bb4c1139324f4fa008b1bec658ebea63bc5f0 100644 (file)
@@ -1,27 +1,62 @@
 package eu.etaxonomy.taxeditor.ui.section.user;
 
-import eu.etaxonomy.cdm.model.common.User;
+import org.eclipse.swt.events.SelectionListener;
+
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType;
 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.GroupSelectionElement;
 
-public class GroupsByUserDetailElement extends AbstractCdmDetailElement<User> {
+/**
+ * 
+ * @author n.hoffmann
+ * @created Mar 10, 2011
+ * @version 1.0
+ */
+public class GroupsByUserDetailElement extends AbstractEntityCollectionElement<Group> {
 
+       private GroupSelectionElement selection_group;
+       
+       /**
+        * @param formFactory
+        * @param section
+        * @param entity
+        * @param removeListener
+        * @param backgroundColor
+        * @param style
+        */
        public GroupsByUserDetailElement(CdmFormFactory formFactory,
-                       ICdmFormElement formElement) {
-               super(formFactory, formElement);
+                       AbstractFormSection section, Group entity,
+                       SelectionListener removeListener, int style) {
+               super(formFactory, section, entity, removeListener, null, style);
        }
 
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#setEntity(java.lang.Object)
+        */
        @Override
-       protected void createControls(ICdmFormElement formElement, User entity,
-                       int style) {
-               
-               
+       public void setEntity(Group entity) {
+               selection_group.setEntity(entity);
        }
 
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#createControls(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement, int)
+        */
        @Override
-       public void handleEvent(Object eventSource) {
-               
+       public void createControls(ICdmFormElement element, int style) {
+               selection_group = (GroupSelectionElement) formFactory.createSelectionElement(SelectionType.GROUP, getConversationHolder(), element, "Group", getEntity(), style);
        }
 
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
+        */
+       @Override
+       public void handleEvent(Object eventSource) {
+               if(eventSource == selection_group){
+                       
+               }
+       }
 }
index e98b365dfbca5b0d63f40397aa6044368a8c7269..c891c639dec2ddf01b39b6738b29315858cbabf4 100644 (file)
@@ -3,36 +3,82 @@
  */
 package eu.etaxonomy.taxeditor.ui.section.user;
 
-import org.eclipse.jface.viewers.ISelectionProvider;
+import java.util.Collection;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.Group;
 import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.GroupSelectionDialog;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
 
 /**
  * @author n.hoffmann
  *
  */
-public class GroupsByUserDetailSection extends AbstractCdmDetailSection<User> {
+public class GroupsByUserDetailSection extends AbstractEntityCollectionSection<User, Group> {
 
+       /**
+        * @param formFactory
+        * @param conversation
+        * @param parentElement
+        * @param title
+        * @param style
+        */
        public GroupsByUserDetailSection(CdmFormFactory formFactory,
                        ConversationHolder conversation, ICdmFormElement parentElement,
-                       ISelectionProvider selectionProvider, int style) {
-               super(formFactory, conversation, parentElement, selectionProvider, style);
+                       int style) {
+               super(formFactory, conversation, parentElement, "Groups", style);
        }
 
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
+        */
        @Override
-       protected DetailType getDetailType() {
-               return DetailType.GROUPS_BY_USER;
+       public Collection<Group> getCollection(User entity) {
+               return entity.getGroups();
        }
 
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
+        */
        @Override
-       public String getHeading() {
-               return "Groups";
+       public Group createNewElement() {
+               Group selectedGroup = GroupSelectionDialog.select(getShell(), getConversationHolder(), null);
+               return selectedGroup;
        }
 
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement(java.lang.Object)
+        */
+       @Override
+       public void addElement(Group element) {
+               element.addMember(getEntity());
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#removeElement(java.lang.Object)
+        */
+       @Override
+       public void removeElement(Group element) {
+               element.removeMember(getEntity());
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getEmptyString()
+        */
+       @Override
+       public String getEmptyString() {
+               return "No groups yet.";
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getTooltipString()
+        */
+       @Override
+       protected String getTooltipString() {
+               return "Add this user to a group";
+       }
        
 }
index 61b631c6deb232f95640cf36f3ba0fe0d8e62b8d..036ee80cfcbdf60d766ef9b29e1fdf7651383cdb 100644 (file)
@@ -3,12 +3,20 @@
  */
 package eu.etaxonomy.taxeditor.ui.section.user;
 
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+
+import eu.etaxonomy.cdm.api.service.IUserService;
 import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType;
 import eu.etaxonomy.taxeditor.ui.forms.CheckboxElement;
 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.forms.TextActionElement;
 import eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.forms.password.EditPasswordElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
 import eu.etaxonomy.taxeditor.ui.selection.PersonSelectionElement;
 
@@ -19,8 +27,7 @@ import eu.etaxonomy.taxeditor.ui.selection.PersonSelectionElement;
 public class UserDetailElement extends AbstractCdmDetailElement<User> {
 
        private TextWithLabelElement text_username;
-       private TextWithLabelElement text_password;
-       private TextWithLabelElement text_passwordRepeat;
+       private EditPasswordElement element_editPassword;
        private TextWithLabelElement text_emailAdress;
        private PersonSelectionElement selection_person;
        private CheckboxElement checkbox_credentialsNonExpired;
@@ -41,6 +48,10 @@ public class UserDetailElement extends AbstractCdmDetailElement<User> {
                        int style) {
                text_username = formFactory.createTextWithLabelElement(formElement, "Username", entity.getUsername(), style);
                
+               if(userIsAuthenticated()){                      
+                       element_editPassword = formFactory.createEditPasswordElement(formElement, "Change Password", getConversationHolder(), entity, style);
+               }
+               
                text_emailAdress = formFactory.createTextWithLabelElement(formElement, "Email Adress", entity.getEmailAddress(), style);
                
                selection_person = (PersonSelectionElement) formFactory.createSelectionElement(SelectionType.PERSON, getConversationHolder(), formElement, "Person", entity.getPerson(), style);
@@ -51,6 +62,14 @@ public class UserDetailElement extends AbstractCdmDetailElement<User> {
                checkbox_credentialsNonExpired = formFactory.createCheckbox(formElement, "Credentials Non Expired", entity.isCredentialsNonExpired(), style);
        }
 
+       /**
+        * 
+        * @return
+        */
+       private boolean userIsAuthenticated() {
+               return getEntity().equals(CdmStore.getLoginManager().getAuthenticatedUser());
+       }
+       
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
         */
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/GroupSelectionElement.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/GroupSelectionElement.java
new file mode 100644 (file)
index 0000000..ca5574a
--- /dev/null
@@ -0,0 +1,63 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.selection;
+
+import org.eclipse.swt.events.SelectionEvent;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.GroupSelectionDialog;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 10, 2011
+ * @version 1.0
+ */
+public class GroupSelectionElement extends AbstractSelectionElement<Group> {
+
+       /**
+        * @param formFactory
+        * @param conversation
+        * @param parentElement
+        * @param labelString
+        * @param entity
+        * @param isEditable
+        * @param isSelectable
+        * @param isDeletable
+        * @param style
+        */
+       public GroupSelectionElement(CdmFormFactory formFactory,
+                       ConversationHolder conversation, ICdmFormElement parentElement,
+                       String labelString, Group entity, int style) {
+               super(formFactory, conversation, parentElement, labelString, entity,
+                               false, false, false, style);
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+        */
+       @Override
+       public void widgetSelected(SelectionEvent e) {
+               Group newSelection = GroupSelectionDialog.select(getShell(), getConversationHolder(), getEntity());
+               setSelectionInternal(newSelection);
+       }
+       
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement#getTitle()
+        */
+       @Override
+       protected String getTitle() {
+               return (getEntity() != null) ? getEntity().getName() : "UNTITLED GROUP";
+       }
+
+}
index f9c2972fd1c48076c00863f34c768c2bbcfa5f33..d322fecb31c781712b1245f9db7e91d753339824 100644 (file)
@@ -28,11 +28,6 @@ import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
  * @version 1.0
  */
 public class NamedAreaSelectionElement extends AbstractSelectionElement<NamedArea> {
-
-
-
-       private static final Logger logger = Logger
-                       .getLogger(NamedAreaSelectionElement.class);
        
        /**
         * <p>Constructor for NamedAreaSelectionElement.</p>
@@ -48,7 +43,7 @@ public class NamedAreaSelectionElement extends AbstractSelectionElement<NamedAre
                        ICdmFormElement parentElement, String labelString,
                        NamedArea entity, int style) {
                super(formFactory, conversation, parentElement, labelString, entity,
-                               false, false, true, style);
+                               false, false, false, style);
        }
 
        /** {@inheritDoc} */
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/UserSelectionElement.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/UserSelectionElement.java
new file mode 100644 (file)
index 0000000..4ffe93c
--- /dev/null
@@ -0,0 +1,62 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.selection;
+
+import org.eclipse.swt.events.SelectionEvent;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.UserSelectionDialog;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 10, 2011
+ * @version 1.0
+ */
+public class UserSelectionElement extends AbstractSelectionElement<User> {
+
+       /**
+        * @param formFactory
+        * @param conversation
+        * @param parentElement
+        * @param labelString
+        * @param entity
+        * @param isEditable
+        * @param isSelectable
+        * @param isDeletable
+        * @param style
+        */
+       public UserSelectionElement(CdmFormFactory formFactory,
+                       ConversationHolder conversation, ICdmFormElement parentElement,
+                       String labelString, User entity, int style) {
+               super(formFactory, conversation, parentElement, labelString, entity,
+                               false, false, false, style);
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+        */
+       @Override
+       public void widgetSelected(SelectionEvent e) {
+               User newSelection = UserSelectionDialog.select(getShell(), getConversationHolder(), entity);
+               setSelectionInternal(newSelection);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement#getTitle()
+        */
+       @Override
+       protected String getTitle() {
+               return (entity != null) ? entity.getUsername() : "NO USER";
+       }
+}
index 0328c04bf82670c471005d2f7602bb154d2a823b..73835c64650b00b5e097cfedafe9f9436151a98d 100644 (file)
@@ -21,6 +21,7 @@ import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
 import eu.etaxonomy.cdm.model.agent.Person;
 import eu.etaxonomy.cdm.model.agent.Team;
 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
+import eu.etaxonomy.cdm.model.common.Group;
 import eu.etaxonomy.cdm.model.common.User;
 import eu.etaxonomy.cdm.model.description.DescriptionBase;
 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
@@ -34,9 +35,9 @@ import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.ui.forms.RootElement;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EntityDetailType;
+import eu.etaxonomy.taxeditor.ui.forms.RootElement;
 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
@@ -50,6 +51,9 @@ import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
 import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.group.GrantedAuthorityDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.key.GeographicalScopeDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
@@ -98,7 +102,8 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                FEATURE_DISTRIBUTION,
                POLYTOMOUS_KEY,
                POLYTOMOUS_KEY_NODE,
-               USER
+               USER,
+               GROUP
        }
        
        private VIEW_PART currentViewPart;
@@ -235,12 +240,20 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                                createPolytomousKeyNodeSection(rootElement);
                                currentViewPart = VIEW_PART.POLYTOMOUS_KEY_NODE;
                        }
-               }else if(getInput() instanceof User){
+               }
+               else if(getInput() instanceof User){
                        if(currentViewPart != VIEW_PART.USER){
                                createUserSection(rootElement);
                                currentViewPart = VIEW_PART.USER;
                        }
-               }else{
+               }
+               else if(getInput() instanceof Group){
+                       if(currentViewPart != VIEW_PART.GROUP){
+                               createGroupSection(rootElement);
+                               currentViewPart = VIEW_PART.GROUP;
+                       }
+               }
+               else{
                        destroySections();
                        currentViewPart = VIEW_PART.EMPTY;
                }
@@ -248,6 +261,24 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                layout();
        }
 
+       /**
+        * @param rootElement
+        */
+       private void createGroupSection(RootElement parent) {
+               destroySections();
+               
+               GroupDetailSection groupDetailSection = (GroupDetailSection) 
+                       formFactory.createCdmDetailSection(DetailType.GROUP, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED);
+               MemberDetailSection memberDetailSection = (MemberDetailSection) 
+                       formFactory.createEntityDetailSection(EntityDetailType.MEMBER, getConversationHolder(), parent, Section.TWISTIE | Section.EXPANDED);
+               GrantedAuthorityDetailSection grantedAuthorityDetailSection = (GrantedAuthorityDetailSection)
+                       formFactory.createEntityDetailSection(EntityDetailType.GRANTED_AUTHORITY, getConversationHolder(), parent, Section.TWISTIE | Section.EXPANDED);
+               
+               addPart(groupDetailSection);
+               addPart(memberDetailSection);
+               addPart(grantedAuthorityDetailSection);
+       }
+
        /* (non-Javadoc)
         * @see org.eclipse.jface.viewers.Viewer#getSelection()
         */
@@ -562,7 +593,8 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                UserDetailSection userDetailSection = (UserDetailSection) 
                        formFactory.createCdmDetailSection(DetailType.USER, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED);
                
-               GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection) formFactory.createCdmDetailSection(DetailType.GROUPS_BY_USER, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED);
+               GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection) 
+                       formFactory.createEntityDetailSection(EntityDetailType.GROUPS_BY_USER, getConversationHolder(), parent, Section.TWISTIE | Section.EXPANDED);
                
                addPart(userDetailSection);
                addPart(groupByUserDetailSection);
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/group/GroupLabelProvider.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/group/GroupLabelProvider.java
deleted file mode 100644 (file)
index 1a32363..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.group;
-
-import org.eclipse.jface.viewers.LabelProvider;
-
-import eu.etaxonomy.cdm.model.common.Group;
-
-/**
- * @author n.hoffmann
- * @created Feb 16, 2011
- * @version 1.0
- */
-public class GroupLabelProvider extends LabelProvider {
-
-       /* (non-Javadoc)
-        * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
-        */
-       @Override
-       public String getText(Object element) {
-               if(element instanceof Group){
-                       
-                       return ((Group) element).getName();
-                       
-               }
-               return super.getText(element);
-       }
-       
-}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/group/GroupViewPart.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/group/GroupViewPart.java
deleted file mode 100644 (file)
index ffe3627..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.group;
-
-import java.util.Collection;
-
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbenchPart;
-
-import eu.etaxonomy.cdm.api.service.IUserService;
-import eu.etaxonomy.cdm.model.common.Group;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.view.AbstractAccountViewPart;
-
-/**
- * @author n.hoffmann
- * @created Feb 16, 2011
- * @version 1.0
- */
-public class GroupViewPart extends AbstractAccountViewPart<Group>{
-
-       public static String ID = "eu.etaxonomy.taxeditor.store.groupView";
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.account.AbstractAccountView#getInput()
-        */
-       @Override
-       public Collection<String> getInput() {
-               return CdmStore.getService(IUserService.class).findAllGroups();
-       }
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.account.AbstractAccountView#getLabelProvider()
-        */
-       @Override
-       protected IBaseLabelProvider getLabelProvider() {
-               return new GroupLabelProvider();
-       }
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.account.AbstractAccountView#createColumns(org.eclipse.jface.viewers.TableViewer)
-        */
-       @Override
-       protected void createColumns(TableViewer viewer) {
-       }       
-}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/user/UserContentProvider.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/user/UserContentProvider.java
deleted file mode 100644 (file)
index ed87450..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.user;
-
-import java.util.List;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-import eu.etaxonomy.cdm.model.common.User;
-
-/**
- * <p>UserManagerContentProvider class.</p>
- *
- * @author n.hoffmann
- * @created 01.07.2009
- * @version 1.0
- */
-public class UserContentProvider implements IStructuredContentProvider {
-
-       /* (non-Javadoc)
-        * @see org.eclipse.jface.viewers.IContentProvider#dispose()
-        */
-       /**
-        * <p>dispose</p>
-        */
-       public void dispose() {
-
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
-        */
-       /** {@inheritDoc} */
-       public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
-       }
-
-       /* (non-Javadoc)
-        * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
-        */
-       /** {@inheritDoc} */
-       public Object[] getElements(Object inputElement) {
-               List<User> users = (List<User>) inputElement;
-               return users.toArray();
-       }
-}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/user/UserLabelProvider.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/user/UserLabelProvider.java
deleted file mode 100644 (file)
index 99fd151..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.user;
-
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-import eu.etaxonomy.cdm.model.agent.Person;
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * <p>UserManagerLabelProvider class.</p>
- *
- * @author n.hoffmann
- * @created 01.07.2009
- * @version 1.0
- */
-public class UserLabelProvider extends LabelProvider implements ITableLabelProvider {
-
-       /** {@inheritDoc} */
-       public Image getColumnImage(Object element, int columnIndex) {
-               return null;
-       }
-
-       /** {@inheritDoc} */
-       public String getColumnText(Object element, int columnIndex) {
-               User user = (User) element;
-               
-               User authenticatedUser = CdmStore.getLoginManager().getAuthenticatedUser();
-               
-               switch(columnIndex){
-               case 0:
-                       return user.equals(authenticatedUser) ? "*" : "";
-               case 1: 
-                       return user.getUsername();
-               case 2:
-                       return user.isEnabled() ? "Yes" : "No";
-               case 3: 
-                       return user.isAccountNonLocked() ? "No" : "Yes";
-               case 4:
-                       Person person = user.getPerson();
-                       if (person != null){
-                               return person.getTitleCache();
-                       }
-               case 5:
-                       return user.getEmailAddress();
-               
-               }
-               
-               return "-";
-       }
-
-}
diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/user/UserView.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/user/UserView.java
deleted file mode 100644 (file)
index cf34cab..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.user;
-
-import java.util.List;
-
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Table;
-
-import eu.etaxonomy.cdm.api.service.IUserService;
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.view.AbstractAccountViewPart;
-
-/**
- * <p>UserManagerView class.</p>
- *
- * @author n.hoffmann
- * @created 01.07.2009
- * @version 1.0
- */
-public class UserView extends AbstractAccountViewPart<User>{
-       
-       
-       /** Constant <code>ID="eu.etaxonomy.taxeditor.store.userManage"{trunked}</code> */
-       public static String ID = "eu.etaxonomy.taxeditor.store.userManagerView";
-       
-       // This will create the columns for the table
-       protected void createColumns(TableViewer viewer) {
-               Table table = viewer.getTable();
-               String[] titles = {"Active", "Name", "Enabled", "Locked", "Person", "Email"};
-               int[] bounds = { 20, 200, 50, 50, 200, 100};
-
-               for (int i = 0; i < titles.length; i++) {
-                       TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
-                       column.getColumn().setText(titles[i]);
-                       column.getColumn().setWidth(bounds[i]);
-                       column.getColumn().setResizable(true);
-                       column.getColumn().setMoveable(true);
-               }
-               table.setHeaderVisible(true);
-               table.setLinesVisible(true);
-       }
-       
-       
-       /**
-        * 
-        * @return
-        */
-       public List<User> getInput(){
-               return CdmStore.getService(IUserService.class).list(null, null, null, null, null);
-       }
-
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.account.AbstractAccountView#getLabelProvider()
-        */
-       @Override
-       protected IBaseLabelProvider getLabelProvider() {
-               return new UserLabelProvider();
-       }
-       
-}