diff options
author | Ralf Mollik | 2019-07-15 07:03:56 +0000 |
---|---|---|
committer | Ralf Mollik | 2019-07-15 07:03:56 +0000 |
commit | 665833d2fda52b049678fc67fecf4f6b3ed311b0 (patch) | |
tree | 4185d767a89f26ef0efad659664a2c4050a5da83 | |
parent | 52543444d65c03b7da5135f4a3cc8e7a63b4f70d (diff) | |
download | org.eclipse.osbp.authentication-665833d2fda52b049678fc67fecf4f6b3ed311b0.tar.gz org.eclipse.osbp.authentication-665833d2fda52b049678fc67fecf4f6b3ed311b0.tar.xz org.eclipse.osbp.authentication-665833d2fda52b049678fc67fecf4f6b3ed311b0.zip |
catch up with development
Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
31 files changed, 2173 insertions, 827 deletions
diff --git a/org.eclipse.osbp.authentication/META-INF/persistence.xml b/org.eclipse.osbp.authentication/META-INF/persistence.xml index 999e5a1..00af660 100644 --- a/org.eclipse.osbp.authentication/META-INF/persistence.xml +++ b/org.eclipse.osbp.authentication/META-INF/persistence.xml @@ -6,7 +6,8 @@ transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <class>org.eclipse.osbp.authentication.account.entities.UserAccount</class> - <class>org.eclipse.osbp.authentication.account.entities.UserAccountFilter</class> + <class>org.eclipse.osbp.authentication.account.entities.Filter</class> + <class>org.eclipse.osbp.authentication.account.entities.UserGroup</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> </persistence-unit> diff --git a/org.eclipse.osbp.authentication/OSGI-INF/org.eclipse.osbp.authentication.account.dtos.mapper.UserAccountFilterDtoMapper.xml b/org.eclipse.osbp.authentication/OSGI-INF/org.eclipse.osbp.authentication.account.dtos.mapper.FilterDtoMapper.xml index 008ff28..802d89d 100644 --- a/org.eclipse.osbp.authentication/OSGI-INF/org.eclipse.osbp.authentication.account.dtos.mapper.UserAccountFilterDtoMapper.xml +++ b/org.eclipse.osbp.authentication/OSGI-INF/org.eclipse.osbp.authentication.account.dtos.mapper.FilterDtoMapper.xml @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.authentication.account.dtos.mapper.useraccountfilterdtomapper"> - <implementation class="org.eclipse.osbp.authentication.account.dtos.mapper.UserAccountFilterDtoMapper"/> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.authentication.account.dtos.mapper.filterdtomapper"> + <implementation class="org.eclipse.osbp.authentication.account.dtos.mapper.FilterDtoMapper"/> <service> <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> </service> - <property name="fordto.from.entity" type="String" value="org.eclipse.osbp.authentication.account.entities.UserAccountFilter"/> - <property name="fordto.to.dto" type="String" value="org.eclipse.osbp.authentication.account.dtos.UserAccountFilterDto"/> + <property name="fordto.from.entity" type="String" value="org.eclipse.osbp.authentication.account.entities.Filter"/> + <property name="fordto.to.dto" type="String" value="org.eclipse.osbp.authentication.account.dtos.FilterDto"/> - <property name="forentity.from.dto" type="String" value="org.eclipse.osbp.authentication.account.dtos.UserAccountFilterDto"/> - <property name="forentity.to.entity" type="String" value="org.eclipse.osbp.authentication.account.entities.UserAccountFilter"/> + <property name="forentity.from.dto" type="String" value="org.eclipse.osbp.authentication.account.dtos.FilterDto"/> + <property name="forentity.to.entity" type="String" value="org.eclipse.osbp.authentication.account.entities.Filter"/> - <property name="service.pid" type="String" value="org.eclipse.osbp.authentication.account.dtos.mapper.useraccountfilterdtomapper"/> + <property name="service.pid" type="String" value="org.eclipse.osbp.authentication.account.dtos.mapper.filterdtomapper"/> <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> </scr:component> diff --git a/org.eclipse.osbp.authentication/OSGI-INF/org.eclipse.osbp.authentication.account.dtos.mapper.UserGroupDtoMapper.xml b/org.eclipse.osbp.authentication/OSGI-INF/org.eclipse.osbp.authentication.account.dtos.mapper.UserGroupDtoMapper.xml new file mode 100644 index 0000000..2c4fe9c --- /dev/null +++ b/org.eclipse.osbp.authentication/OSGI-INF/org.eclipse.osbp.authentication.account.dtos.mapper.UserGroupDtoMapper.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.authentication.account.dtos.mapper.usergroupdtomapper"> + <implementation class="org.eclipse.osbp.authentication.account.dtos.mapper.UserGroupDtoMapper"/> + <service> + <provide interface="org.eclipse.osbp.dsl.dto.lib.IMapper"/> + </service> + + <property name="fordto.from.entity" type="String" value="org.eclipse.osbp.authentication.account.entities.UserGroup"/> + <property name="fordto.to.dto" type="String" value="org.eclipse.osbp.authentication.account.dtos.UserGroupDto"/> + + <property name="forentity.from.dto" type="String" value="org.eclipse.osbp.authentication.account.dtos.UserGroupDto"/> + <property name="forentity.to.entity" type="String" value="org.eclipse.osbp.authentication.account.entities.UserGroup"/> + + <property name="service.pid" type="String" value="org.eclipse.osbp.authentication.account.dtos.mapper.usergroupdtomapper"/> + <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" + cardinality="1..1" policy="static" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +</scr:component> diff --git a/org.eclipse.osbp.authentication/OSGI-INF/org.eclipse.osbp.authentication.account.dtos.service.UserAccountFilterDtoService.xml b/org.eclipse.osbp.authentication/OSGI-INF/org.eclipse.osbp.authentication.account.dtos.service.FilterDtoService.xml index c5d7314..1125027 100644 --- a/org.eclipse.osbp.authentication/OSGI-INF/org.eclipse.osbp.authentication.account.dtos.service.UserAccountFilterDtoService.xml +++ b/org.eclipse.osbp.authentication/OSGI-INF/org.eclipse.osbp.authentication.account.dtos.service.FilterDtoService.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.authentication.account.dtos.service.useraccountfilterdtoservice"> - <implementation class="org.eclipse.osbp.authentication.account.dtos.service.UserAccountFilterDtoService"/> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.authentication.account.dtos.service.filterdtoservice"> + <implementation class="org.eclipse.osbp.authentication.account.dtos.service.FilterDtoService"/> <service> <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/> </service> - <property name="dto" type="String" value="org.eclipse.osbp.authentication.account.dtos.UserAccountFilterDto"/> - <property name="service.pid" type="String" value="org.eclipse.osbp.authentication.account.dtos.service.useraccountfilterdtoservice"/> + <property name="dto" type="String" value="org.eclipse.osbp.authentication.account.dtos.FilterDto"/> + <property name="service.pid" type="String" value="org.eclipse.osbp.authentication.account.dtos.service.filterdtoservice"/> <reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" policy="dynamic" bind="bindMapperAccess" unbind="unbindMapperAccess"/> <reference name="filterEnhancers" interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer" cardinality="0..n" diff --git a/org.eclipse.osbp.authentication/OSGI-INF/org.eclipse.osbp.authentication.account.dtos.service.UserGroupDtoService.xml b/org.eclipse.osbp.authentication/OSGI-INF/org.eclipse.osbp.authentication.account.dtos.service.UserGroupDtoService.xml new file mode 100644 index 0000000..ffdd48a --- /dev/null +++ b/org.eclipse.osbp.authentication/OSGI-INF/org.eclipse.osbp.authentication.account.dtos.service.UserGroupDtoService.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.authentication.account.dtos.service.usergroupdtoservice"> + <implementation class="org.eclipse.osbp.authentication.account.dtos.service.UserGroupDtoService"/> + <service> + <provide interface="org.eclipse.osbp.runtime.common.filter.IDTOService"/> + </service> + <property name="dto" type="String" value="org.eclipse.osbp.authentication.account.dtos.UserGroupDto"/> + <property name="service.pid" type="String" value="org.eclipse.osbp.authentication.account.dtos.service.usergroupdtoservice"/> +<reference name="mapperAccess" interface="org.eclipse.osbp.dsl.dto.lib.IMapperAccess" cardinality="1..1" + policy="dynamic" bind="bindMapperAccess" unbind="unbindMapperAccess"/> +<reference name="filterEnhancers" interface="org.eclipse.osbp.runtime.common.filter.IFilterEnhancer" cardinality="0..n" + policy="dynamic" bind="addFilterEnhancer" unbind="removeFilterEnhancer"/> +<reference name="sessionManager" interface="org.eclipse.osbp.runtime.common.session.ISessionManager" cardinality="1..1" + policy="dynamic" bind="bindSessionManager" unbind="unbindSessionManager"/> +<reference name="validators" interface="org.eclipse.osbp.runtime.common.validation.IValidationParticipant" cardinality="0..n" + policy="dynamic" bind="addValidationParticipant" unbind="removeValidationParticipant"/> +</scr:component> diff --git a/org.eclipse.osbp.authentication/i18n/I18N.properties b/org.eclipse.osbp.authentication/i18n/I18N.properties index 087f5b9..84c0fa5 100644 --- a/org.eclipse.osbp.authentication/i18n/I18N.properties +++ b/org.eclipse.osbp.authentication/i18n/I18N.properties @@ -1,4 +1,5 @@ #default +action=action activation_time=activation_time actual_owner=actual_owner administration=administration @@ -8,10 +9,10 @@ answer_yes_text=answer_yes_text cancel=cancel cancel_item=cancel_item clear_filter=clear_filter +common=common cookie_hash_code=cookie_hash_code created_by=created_by created_on=created_on -default_perpective=default_perpective default_perspective=default_perspective delete_item=delete_item description=description @@ -41,9 +42,11 @@ name=name new_item=new_item not_registered=not_registered ok=ok +organization=organization page=page password=password password_reset=password_reset +personal=personal perspective_na=perspective_na position=position print_service=print_service @@ -60,9 +63,12 @@ save_item=save_item saved_properties=saved_properties security_message=security_message set_filter=set_filter +setting=setting +settings=settings show_all=show_all start_date=start_date start_process_text=start_process_text +statistics=statistics status=status subject=subject successful_attempt=successful_attempt @@ -74,6 +80,10 @@ toolbar_for_dialogs=toolbar_for_dialogs user_account=user_account user_account_filter=user_account_filter user_administration=user_administration +user_bean=user_bean +user_filter=user_filter +user_group=user_group +user_group_filter=user_group_filter +user_group_name=user_group_name user_name=user_name users=users -x=x diff --git a/org.eclipse.osbp.authentication/i18n/I18N_de.properties b/org.eclipse.osbp.authentication/i18n/I18N_de.properties index df110b1..816cd98 100644 --- a/org.eclipse.osbp.authentication/i18n/I18N_de.properties +++ b/org.eclipse.osbp.authentication/i18n/I18N_de.properties @@ -1,79 +1,79 @@ #de -activation_time=Activation time -actual_owner=Actual owner -administration=Administration -all_accounts=All accounts -answer_no_text=Answer no text -answer_yes_text=Answer yes text -cancel=Cancel -cancel_item=Cancel item -clear_filter=Clear filter -cookie_hash_code=Hashcode -created_by=Created by -created_on=Created on -default_perpective=Default perpective +action=Aktion +administration=Verwaltung +all_accounts=Alle Konten +answer_no_text=Nein +answer_yes_text=Ja +cancel=Abbruch +cancel_item=\u00C4nderungen verwerfen +clear_filter=Filter l\u00F6schen +common=Allgemein +cookie_hash_code=Cookie hash code +created_by=Erzeugt durch +created_on=Erzeugt am default_perspective=Standard Perspektive -delete_item=Delete item -description=Description -edit_account=Edit account -email=E-Mail +delete_item=Datensatz l\u00F6schen +description=Beschreibung +edit_account=Konto bearbeiten +email=Email enabled=Aktiviert -end_date=End date -equal_to=Equal to -expiration_time=Expiration time -extra_password=zus\u00E4tzliches Passwort -failed_attempt=Anzahl fehlerhafter Anmeldungen +end_date=Endedatum +equal_to=ist gleich +expiration_time=Ablaufdatum +extra_password=Extra Passwort +failed_attempt=Fehlerhafte Anmeldungen filter=Filter -focusing_strategy=Layout -foo=Foo -force_pwd_change=Passwort Wechsel erzwingen -greater_than=Greater than -groups=Groups +force_pwd_change=Erzwinge Passwort\u00E4nderung +greater_than=Gr\u00F6\u00DFer als +groups=Gruppen id=ID -invers=invers -items_per_page=Items per page -layouting_strategy=Standard Layout -lesser_than=Lesser than -locale_tag=L\u00E4ndereinstellung -locked=gesperrt -menu=Menu +invers=Invertiert +items_per_page=Elemente pro Seite +lesser_than=Kleiner als +locale_tag=Spracheinstellung +locked=Gesperrt +menu=Men\u00FC name=Name -new_item=New item -not_registered=nicht registriert -ok=Ok -page=Page +new_item=Neu +not_registered=Nicht registriert +ok=OK +page=Seite password=Passwort -password_reset=Password reset -perspective_na=Perspective na +password_reset=Passwort zur\u00FCcksetzen +personal=Pers\u00F6nlich +perspective_na=Perspektive position=Stelle -print_service=Standard Drucker -priority=Priority -process_id=Process identifier -process_instance_id=Process instance identifier -process_session_id=Process session identifier -profile=Profile -profileimage=Profilbild -registered=Registered -reset=Reset -save=Save -save_item=Save item -saved_properties=Saved properties -security_message=Security message -set_filter=Set filter -show_all=Show all -start_date=Start date -start_process_text=Start process text +print_service=Drucker +priority=Priorit\u00E4t +process_id=Proze\u00DF ID +profile=Profil +profileimage=Foto +registered=Registriert +reset=Zur\u00FCcksetzen +save=Speichern +save_item=Speichern +saved_properties=Gespeicherte Eigenschaften +security_message=Sicherheitsnachricht +set_filter=Filter speichern +setting=Einstellung +settings=Einstellungen +show_all=Alles anzeigen +start_date=Anfangsdatum +start_process_text=Starte Proze\u00DF +statistics=Statistiken status=Status -subject=Subject -successful_attempt=Anzahl erfolgreicher Anmeldungen +subject=Thema +successful_attempt=Erfolgreiche Anmeldungen superuser=Administrator supervisor=Supervisor task_id=Task identifier -theme=Farb-Schema -toolbar_for_dialogs=Toolbar for dialogs +theme=Theme +toolbar_for_dialogs=Toolbar f\u00FCr Dialoge user_account=Benutzerkonto user_account_filter=Filter f\u00FCr Benutzerkonto -user_administration=User administration +user_administration=Benutzerverwaltung +user_group=Benutzergruppe +user_group_filter=Filter f\u00FCr Gruppe +user_group_name=Gruppenbezeichnung user_name=Benutzername -users=Users -x=X +users=Benutzer diff --git a/org.eclipse.osbp.authentication/i18n/I18N_de_AT.properties b/org.eclipse.osbp.authentication/i18n/I18N_de_AT.properties new file mode 100644 index 0000000..3f64431 --- /dev/null +++ b/org.eclipse.osbp.authentication/i18n/I18N_de_AT.properties @@ -0,0 +1 @@ +#Generated by Eclipse Messages Editor (Eclipse Babel) diff --git a/org.eclipse.osbp.authentication/i18n/I18N_en.properties b/org.eclipse.osbp.authentication/i18n/I18N_en.properties index aea52c6..3f26d43 100644 --- a/org.eclipse.osbp.authentication/i18n/I18N_en.properties +++ b/org.eclipse.osbp.authentication/i18n/I18N_en.properties @@ -1,79 +1,89 @@ #en +action=Action activation_time=Activation time actual_owner=Actual owner administration=Administration all_accounts=All accounts -answer_no_text=Answer no text -answer_yes_text=Answer yes text +answer_no_text=No +answer_yes_text=Yes cancel=Cancel cancel_item=Cancel item clear_filter=Clear filter -cookie_hash_code=cookie hash code +common=Common +cookie_hash_code=Cookie hash code created_by=Created by created_on=Created on -default_perpective=Default perpective default_perspective=Default perspective delete_item=Delete item description=Description edit_account=Edit account -email=email -enabled=enabled +email=Email +enabled=Enabled end_date=End date equal_to=Equal to expiration_time=Expiration time extra_password=Extra password -failed_attempt=failed attempt -filter=filter -focusing_strategy=focusing strategy +failed_attempt=Failed attempt +filter=Filter +focusing_strategy=Focusing strategy foo=Foo -force_pwd_change=force pwd change +force_pwd_change=Force password change greater_than=Greater than groups=Groups -id=identifier -invers=invers +id=Identifier +invers=Invers items_per_page=Items per page -layouting_strategy=layouting strategy +layouting_strategy=Layouting strategy lesser_than=Lesser than -locale_tag=locale tag -locked=locked +locale_tag=Locale tag +locked=Locked menu=Menu name=Name -new_item=New item +new_item=New not_registered=Not registered ok=Ok +organization=Organization page=Page -password=password +password=Password password_reset=Password reset -perspective_na=Perspective na -position=position +personal=Personal +perspective_na=Perspective +position=Position print_service=Print service priority=Priority process_id=Process identifier process_instance_id=Process instance identifier process_session_id=Process session identifier profile=Profile -profileimage=profileimage +profileimage=Profileimage registered=Registered reset=Reset save=Save -save_item=Save item +save_item=Save saved_properties=Saved properties security_message=Security message set_filter=Set filter +setting=Setting +settings=Settings show_all=Show all start_date=Start date -start_process_text=Start process text +start_process_text=Start process +statistics=Statistics status=Status subject=Subject -successful_attempt=successful attempt -superuser=superuser +successful_attempt=Successful attempt +superuser=Superuser supervisor=Supervisor task_id=Task identifier -theme=theme +theme=Theme toolbar_for_dialogs=Toolbar for dialogs -user_account=user account -user_account_filter=user account filter +user_account=User account +user_account_filter=User account filter user_administration=User administration -user_name=user name +user_bean=User bean +user_filter=User filter +user_group=User group +user_group_filter=Filter for user group +user_group_name=User group name +user_name=User name users=Users -x=X diff --git a/org.eclipse.osbp.authentication/i18n/I18N_en_US.properties b/org.eclipse.osbp.authentication/i18n/I18N_en_US.properties new file mode 100644 index 0000000..3f64431 --- /dev/null +++ b/org.eclipse.osbp.authentication/i18n/I18N_en_US.properties @@ -0,0 +1 @@ +#Generated by Eclipse Messages Editor (Eclipse Babel) diff --git a/org.eclipse.osbp.authentication/i18n/I18N_fr.properties b/org.eclipse.osbp.authentication/i18n/I18N_fr.properties index a84da83..73dcbaf 100644 --- a/org.eclipse.osbp.authentication/i18n/I18N_fr.properties +++ b/org.eclipse.osbp.authentication/i18n/I18N_fr.properties @@ -1 +1,17 @@ #fr +answer_no_text=Non +answer_yes_text=Oui +cancel=Abort +cancel_item=Abort +cookie_hash_code=Cookie hash code +email=E-mail +failed_attempt=Connexions refus\u00E9es +id=ID +locale_tag=Localisation +name=nom +profileimage=Photo +status=Statu +successful_attempt=Connexions r\u00E9ussies +superuser=Super-utilisateur +supervisor=Supervisor +theme=Theme diff --git a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/UserAccountFilterDto.java b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/FilterDto.java index 0162b37..ee51ff5 100644 --- a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/UserAccountFilterDto.java +++ b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/FilterDto.java @@ -3,7 +3,7 @@ package org.eclipse.osbp.authentication.account.dtos; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.io.Serializable; -import org.eclipse.osbp.authentication.account.dtos.UserAccountDto; +import org.eclipse.osbp.authentication.account.dtos.UserGroupDto; import org.eclipse.osbp.dsl.common.datatypes.IDto; import org.eclipse.osbp.runtime.common.annotations.Dirty; import org.eclipse.osbp.runtime.common.annotations.Dispose; @@ -12,7 +12,7 @@ import org.eclipse.osbp.runtime.common.annotations.FilterDepth; import org.eclipse.osbp.runtime.common.annotations.Id; @SuppressWarnings("all") -public class UserAccountFilterDto implements IDto, Serializable, PropertyChangeListener { +public class FilterDto implements IDto, Serializable, PropertyChangeListener { private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); @Dispose @@ -30,14 +30,14 @@ public class UserAccountFilterDto implements IDto, Serializable, PropertyChangeL @DomainReference @FilterDepth(depth = 0) - private UserAccountDto userAccount; + private UserGroupDto userGroup; - public UserAccountFilterDto() { + public FilterDto() { installLazyCollections(); } /** - * Installs lazy collection resolving for entity {@link UserAccountFilter} to the dto {@link UserAccountFilterDto}. + * Installs lazy collection resolving for entity {@link Filter} to the dto {@link FilterDto}. * */ protected void installLazyCollections() { @@ -186,41 +186,41 @@ public class UserAccountFilterDto implements IDto, Serializable, PropertyChangeL } /** - * Returns the userAccount property or <code>null</code> if not present. + * Returns the userGroup property or <code>null</code> if not present. */ - public UserAccountDto getUserAccount() { - return this.userAccount; + public UserGroupDto getUserGroup() { + return this.userGroup; } /** - * Sets the <code>userAccount</code> property to this instance. - * Since the reference has an opposite reference, the opposite <code>UserAccountDto# - * userAccountFilter</code> of the <code>userAccount</code> will be handled automatically and no + * Sets the <code>userGroup</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>UserGroupDto# + * userGroupFilter</code> of the <code>userGroup</code> will be handled automatically and no * further coding is required to keep them in sync.<p> - * See {@link UserAccountDto#setUserAccountFilter(UserAccountDto) + * See {@link UserGroupDto#setUserGroupFilter(UserGroupDto) * - * @param userAccount - the property + * @param userGroup - the property * @throws RuntimeException if instance is <code>disposed</code> * */ - public void setUserAccount(final UserAccountDto userAccount) { + public void setUserGroup(final UserGroupDto userGroup) { checkDisposed(); - if (this.userAccount != null) { - this.userAccount.internalRemoveFromUserAccountFilter(this); + if (this.userGroup != null) { + this.userGroup.internalRemoveFromUserGroupFilter(this); } - internalSetUserAccount(userAccount); + internalSetUserGroup(userGroup); - if (this.userAccount != null) { - this.userAccount.internalAddToUserAccountFilter(this); + if (this.userGroup != null) { + this.userGroup.internalAddToUserGroupFilter(this); } } /** * For internal use only! */ - public void internalSetUserAccount(final UserAccountDto userAccount) { - firePropertyChange("userAccount", this.userAccount, this.userAccount = userAccount); + public void internalSetUserGroup(final UserGroupDto userGroup) { + firePropertyChange("userGroup", this.userGroup, this.userGroup = userGroup); } public boolean equalVersions(final Object obj) { @@ -230,7 +230,7 @@ public class UserAccountFilterDto implements IDto, Serializable, PropertyChangeL return false; if (getClass() != obj.getClass()) return false; - UserAccountFilterDto other = (UserAccountFilterDto) obj; + FilterDto other = (FilterDto) obj; if (this.id == null) { if (other.id != null) return false; diff --git a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/UserAccountDto.java b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/UserAccountDto.java index 09bb555..be8708a 100644 --- a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/UserAccountDto.java +++ b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/UserAccountDto.java @@ -3,11 +3,10 @@ package org.eclipse.osbp.authentication.account.dtos; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.io.Serializable; -import java.util.Collections; -import java.util.List; import javax.validation.Valid; +import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; -import org.eclipse.osbp.authentication.account.dtos.UserAccountFilterDto; +import org.eclipse.osbp.authentication.account.dtos.UserGroupDto; import org.eclipse.osbp.dsl.common.datatypes.IDto; import org.eclipse.osbp.runtime.common.annotations.Dirty; import org.eclipse.osbp.runtime.common.annotations.Dispose; @@ -17,7 +16,9 @@ import org.eclipse.osbp.runtime.common.annotations.Hidden; import org.eclipse.osbp.runtime.common.annotations.Id; import org.eclipse.osbp.runtime.common.annotations.Properties; import org.eclipse.osbp.runtime.common.annotations.Property; +import org.eclipse.osbp.runtime.common.annotations.UIGroup; import org.eclipse.osbp.runtime.common.annotations.UniqueEntry; +import org.eclipse.osbp.runtime.common.validation.ErrorSeverity; import org.eclipse.osbp.runtime.common.validation.InfoSeverity; @SuppressWarnings("all") @@ -34,66 +35,82 @@ public class UserAccountDto implements IDto, Serializable, PropertyChangeListene private String id = java.util.UUID.randomUUID().toString(); @UniqueEntry + @UIGroup(name = "personal") + @NotNull(payload = ErrorSeverity.class) private String email; @UniqueEntry + @UIGroup(name = "personal") + @NotNull(payload = ErrorSeverity.class) private String userName; @Hidden private String password; + @UIGroup(name = "personal") @Pattern(regexp = "[0-9]*", payload = InfoSeverity.class) private String extraPassword; - private boolean passwordReset; + @DomainReference + @FilterDepth(depth = 0) + @UIGroup(name = "setting") + private UserGroupDto userGroup; @Properties(properties = @Property(key = "organization", value = "")) + @UIGroup(name = "setting") private String position; @Properties(properties = @Property(key = "perspective", value = "")) + @UIGroup(name = "setting") private String defaultPerspective; + @UIGroup(name = "action") + private boolean notRegistered; + + @UIGroup(name = "action") private boolean enabled; + @UIGroup(name = "action") private boolean locked; + @UIGroup(name = "action") + private boolean passwordReset; + + @UIGroup(name = "personal") private boolean superuser; + @UIGroup(name = "action") private boolean forcePwdChange; - private boolean notRegistered; - + @UIGroup(name = "statistics") private int failedAttempt; + @UIGroup(name = "statistics") private int successfulAttempt; @Hidden private int cookieHashCode; @Properties(properties = @Property(key = "i18n", value = "")) + @UIGroup(name = "setting") private String localeTag; @Properties(properties = @Property(key = "Blob", value = "2")) + @UIGroup(name = "personal") private String profileimage; - private String layoutingStrategy; - - private String focusingStrategy; - @Properties(properties = @Property(key = "theme", value = "")) + @UIGroup(name = "setting") private String theme; @Properties(properties = @Property(key = "printservice", value = "")) + @UIGroup(name = "setting") private String printService; @Hidden @Valid private byte[] savedProperties; - @DomainReference - @FilterDepth(depth = 0) - private List<UserAccountFilterDto> userAccountFilter; - public UserAccountDto() { installLazyCollections(); } @@ -103,10 +120,7 @@ public class UserAccountDto implements IDto, Serializable, PropertyChangeListene * */ protected void installLazyCollections() { - userAccountFilter = new org.eclipse.osbp.dsl.dto.lib.OppositeDtoList<>( - org.eclipse.osbp.dsl.dto.lib.MappingContext.getCurrent(), - UserAccountFilterDto.class, "userAccount.id", - (java.util.function.Supplier<Object> & Serializable) () -> this.getId(), this); + } /** @@ -215,7 +229,7 @@ public class UserAccountDto implements IDto, Serializable, PropertyChangeListene } /** - * Returns the <em>required</em> email property. + * Returns the email property or <code>null</code> if not present. */ public String getEmail() { return this.email; @@ -233,7 +247,7 @@ public class UserAccountDto implements IDto, Serializable, PropertyChangeListene } /** - * Returns the <em>required</em> userName property. + * Returns the userName property or <code>null</code> if not present. */ public String getUserName() { return this.userName; @@ -287,21 +301,41 @@ public class UserAccountDto implements IDto, Serializable, PropertyChangeListene } /** - * Returns the passwordReset property or <code>null</code> if not present. + * Returns the userGroup property or <code>null</code> if not present. */ - public boolean getPasswordReset() { - return this.passwordReset; + public UserGroupDto getUserGroup() { + return this.userGroup; } /** - * Sets the <code>passwordReset</code> property to this instance. + * Sets the <code>userGroup</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>UserGroupDto# + * userAccount</code> of the <code>userGroup</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link UserGroupDto#setUserAccount(UserGroupDto) * - * @param passwordReset - the property + * @param userGroup - the property * @throws RuntimeException if instance is <code>disposed</code> * */ - public void setPasswordReset(final boolean passwordReset) { - firePropertyChange("passwordReset", this.passwordReset, this.passwordReset = passwordReset ); + public void setUserGroup(final UserGroupDto userGroup) { + checkDisposed(); + if (this.userGroup != null) { + this.userGroup.internalRemoveFromUserAccount(this); + } + + internalSetUserGroup(userGroup); + + if (this.userGroup != null) { + this.userGroup.internalAddToUserAccount(this); + } + } + + /** + * For internal use only! + */ + public void internalSetUserGroup(final UserGroupDto userGroup) { + firePropertyChange("userGroup", this.userGroup, this.userGroup = userGroup); } /** @@ -341,6 +375,24 @@ public class UserAccountDto implements IDto, Serializable, PropertyChangeListene } /** + * Returns the notRegistered property or <code>null</code> if not present. + */ + public boolean getNotRegistered() { + return this.notRegistered; + } + + /** + * Sets the <code>notRegistered</code> property to this instance. + * + * @param notRegistered - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setNotRegistered(final boolean notRegistered) { + firePropertyChange("notRegistered", this.notRegistered, this.notRegistered = notRegistered ); + } + + /** * Returns the enabled property or <code>null</code> if not present. */ public boolean getEnabled() { @@ -377,6 +429,24 @@ public class UserAccountDto implements IDto, Serializable, PropertyChangeListene } /** + * Returns the passwordReset property or <code>null</code> if not present. + */ + public boolean getPasswordReset() { + return this.passwordReset; + } + + /** + * Sets the <code>passwordReset</code> property to this instance. + * + * @param passwordReset - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setPasswordReset(final boolean passwordReset) { + firePropertyChange("passwordReset", this.passwordReset, this.passwordReset = passwordReset ); + } + + /** * Returns the superuser property or <code>null</code> if not present. */ public boolean getSuperuser() { @@ -413,24 +483,6 @@ public class UserAccountDto implements IDto, Serializable, PropertyChangeListene } /** - * Returns the notRegistered property or <code>null</code> if not present. - */ - public boolean getNotRegistered() { - return this.notRegistered; - } - - /** - * Sets the <code>notRegistered</code> property to this instance. - * - * @param notRegistered - the property - * @throws RuntimeException if instance is <code>disposed</code> - * - */ - public void setNotRegistered(final boolean notRegistered) { - firePropertyChange("notRegistered", this.notRegistered, this.notRegistered = notRegistered ); - } - - /** * Returns the failedAttempt property or <code>null</code> if not present. */ public int getFailedAttempt() { @@ -521,42 +573,6 @@ public class UserAccountDto implements IDto, Serializable, PropertyChangeListene } /** - * Returns the layoutingStrategy property or <code>null</code> if not present. - */ - public String getLayoutingStrategy() { - return this.layoutingStrategy; - } - - /** - * Sets the <code>layoutingStrategy</code> property to this instance. - * - * @param layoutingStrategy - the property - * @throws RuntimeException if instance is <code>disposed</code> - * - */ - public void setLayoutingStrategy(final String layoutingStrategy) { - firePropertyChange("layoutingStrategy", this.layoutingStrategy, this.layoutingStrategy = layoutingStrategy ); - } - - /** - * Returns the focusingStrategy property or <code>null</code> if not present. - */ - public String getFocusingStrategy() { - return this.focusingStrategy; - } - - /** - * Sets the <code>focusingStrategy</code> property to this instance. - * - * @param focusingStrategy - the property - * @throws RuntimeException if instance is <code>disposed</code> - * - */ - public void setFocusingStrategy(final String focusingStrategy) { - firePropertyChange("focusingStrategy", this.focusingStrategy, this.focusingStrategy = focusingStrategy ); - } - - /** * Returns the theme property or <code>null</code> if not present. */ public String getTheme() { @@ -610,116 +626,6 @@ public class UserAccountDto implements IDto, Serializable, PropertyChangeListene firePropertyChange("savedProperties", this.savedProperties, this.savedProperties = savedProperties ); } - /** - * Returns an unmodifiable list of userAccountFilter. - */ - public List<UserAccountFilterDto> getUserAccountFilter() { - return Collections.unmodifiableList(internalGetUserAccountFilter()); - } - - /** - * Returns the list of <code>UserAccountFilterDto</code>s thereby lazy initializing it. For internal use only! - * - * @return list - the resulting list - * - */ - public List<UserAccountFilterDto> internalGetUserAccountFilter() { - if (this.userAccountFilter == null) { - this.userAccountFilter = new java.util.ArrayList<UserAccountFilterDto>(); - } - return this.userAccountFilter; - } - - /** - * Adds the given userAccountFilterDto to this object. <p> - * Since the reference is a composition reference, the opposite reference <code>UserAccountFilterDto#userAccount</code> of the <code>userAccountFilterDto</code> will be handled automatically and no further coding is required to keep them in sync.<p> - * See {@link UserAccountFilterDto#setUserAccount(UserAccountFilterDto)}. - * - * @param userAccountFilterDto - the property - * @throws RuntimeException if instance is <code>disposed</code> - * - */ - public void addToUserAccountFilter(final UserAccountFilterDto userAccountFilterDto) { - checkDisposed(); - - userAccountFilterDto.setUserAccount(this); - } - - /** - * Removes the given userAccountFilterDto from this object. <p> - * - * @param userAccountFilterDto - the property - * @throws RuntimeException if instance is <code>disposed</code> - * - */ - public void removeFromUserAccountFilter(final UserAccountFilterDto userAccountFilterDto) { - checkDisposed(); - - userAccountFilterDto.setUserAccount(null); - } - - /** - * For internal use only! - */ - public void internalAddToUserAccountFilter(final UserAccountFilterDto userAccountFilterDto) { - - if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { - List<UserAccountFilterDto> oldList = null; - if(internalGetUserAccountFilter() instanceof org.eclipse.osbp.dsl.dto.lib.AbstractOppositeDtoList) { - oldList = ((org.eclipse.osbp.dsl.dto.lib.AbstractOppositeDtoList) internalGetUserAccountFilter()).copy(); - } else { - oldList = new java.util.ArrayList<>(internalGetUserAccountFilter()); - } - internalGetUserAccountFilter().add(userAccountFilterDto); - firePropertyChange("userAccountFilter", oldList, internalGetUserAccountFilter()); - } - } - - /** - * For internal use only! - */ - public void internalRemoveFromUserAccountFilter(final UserAccountFilterDto userAccountFilterDto) { - if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { - List<UserAccountFilterDto> oldList = null; - if(internalGetUserAccountFilter() instanceof org.eclipse.osbp.dsl.dto.lib.AbstractOppositeDtoList) { - oldList = ((org.eclipse.osbp.dsl.dto.lib.AbstractOppositeDtoList) internalGetUserAccountFilter()).copy(); - } else { - oldList = new java.util.ArrayList<>(internalGetUserAccountFilter()); - } - internalGetUserAccountFilter().remove(userAccountFilterDto); - firePropertyChange("userAccountFilter", oldList, internalGetUserAccountFilter()); - }else{ - // in mapping mode, we do NOT resolve any collection - internalGetUserAccountFilter().remove(userAccountFilterDto); - } - } - - /** - * Sets the <code>userAccountFilter</code> property to this instance. - * Since the reference has an opposite reference, the opposite <code>UserAccountFilterDto# - * userAccount</code> of the <code>userAccountFilter</code> will be handled automatically and no - * further coding is required to keep them in sync.<p> - * See {@link UserAccountFilterDto#setUserAccount(UserAccountFilterDto) - * - * @param userAccountFilter - the property - * @throws RuntimeException if instance is <code>disposed</code> - * - */ - public void setUserAccountFilter(final List<UserAccountFilterDto> userAccountFilter) { - checkDisposed(); - for (UserAccountFilterDto dto : internalGetUserAccountFilter().toArray(new UserAccountFilterDto[this.userAccountFilter.size()])) { - removeFromUserAccountFilter(dto); - } - - if(userAccountFilter == null) { - return; - } - - for (UserAccountFilterDto dto : userAccountFilter) { - addToUserAccountFilter(dto); - } - } - public boolean equalVersions(final Object obj) { if (this == obj) return true; diff --git a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/UserGroupDto.java b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/UserGroupDto.java new file mode 100644 index 0000000..e7f44d4 --- /dev/null +++ b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/UserGroupDto.java @@ -0,0 +1,550 @@ +package org.eclipse.osbp.authentication.account.dtos; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.io.Serializable; +import java.util.Collections; +import java.util.List; +import javax.validation.constraints.NotNull; +import org.eclipse.osbp.authentication.account.dtos.FilterDto; +import org.eclipse.osbp.authentication.account.dtos.UserAccountDto; +import org.eclipse.osbp.dsl.common.datatypes.IDto; +import org.eclipse.osbp.runtime.common.annotations.AsTable; +import org.eclipse.osbp.runtime.common.annotations.Dirty; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainKey; +import org.eclipse.osbp.runtime.common.annotations.DomainReference; +import org.eclipse.osbp.runtime.common.annotations.FilterDepth; +import org.eclipse.osbp.runtime.common.annotations.Id; +import org.eclipse.osbp.runtime.common.annotations.Properties; +import org.eclipse.osbp.runtime.common.annotations.Property; +import org.eclipse.osbp.runtime.common.annotations.UIGroup; +import org.eclipse.osbp.runtime.common.annotations.UniqueEntry; +import org.eclipse.osbp.runtime.common.validation.ErrorSeverity; + +@SuppressWarnings("all") +public class UserGroupDto implements IDto, Serializable, PropertyChangeListener { + private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); + + @Dispose + private boolean disposed; + + @Dirty + private transient boolean dirty; + + @Id + private String id = java.util.UUID.randomUUID().toString(); + + @DomainKey + @UniqueEntry + @UIGroup(name = "common") + @NotNull(payload = ErrorSeverity.class) + private String userGroupName; + + @Properties(properties = @Property(key = "organization", value = "")) + @UIGroup(name = "organization") + private String position; + + @Properties(properties = @Property(key = "perspective", value = "")) + @UIGroup(name = "setting") + private String defaultPerspective; + + @Properties(properties = @Property(key = "i18n", value = "")) + @UIGroup(name = "setting") + private String localeTag; + + @Properties(properties = @Property(key = "theme", value = "")) + @UIGroup(name = "setting") + private String theme; + + @Properties(properties = @Property(key = "printservice", value = "")) + @UIGroup(name = "setting") + private String printService; + + @DomainReference + @FilterDepth(depth = 0) + @AsTable + private List<UserAccountDto> userAccount; + + @DomainReference + @FilterDepth(depth = 0) + private List<FilterDto> userGroupFilter; + + public UserGroupDto() { + installLazyCollections(); + } + + /** + * Installs lazy collection resolving for entity {@link UserGroup} to the dto {@link UserGroupDto}. + * + */ + protected void installLazyCollections() { + userAccount = new org.eclipse.osbp.dsl.dto.lib.OppositeDtoList<>( + org.eclipse.osbp.dsl.dto.lib.MappingContext.getCurrent(), + UserAccountDto.class, "userGroup.id", + (java.util.function.Supplier<Object> & Serializable) () -> this.getId(), this); + userGroupFilter = new org.eclipse.osbp.dsl.dto.lib.OppositeDtoList<>( + org.eclipse.osbp.dsl.dto.lib.MappingContext.getCurrent(), + FilterDto.class, "userGroup.id", + (java.util.function.Supplier<Object> & Serializable) () -> this.getId(), this); + } + + /** + * @return true, if the object is disposed. + * Disposed means, that it is prepared for garbage collection and may not be used anymore. + * Accessing objects that are already disposed will cause runtime exceptions. + * + */ + public boolean isDisposed() { + return this.disposed; + } + + /** + * @see PropertyChangeSupport#addPropertyChangeListener(PropertyChangeListener) + */ + public void addPropertyChangeListener(final PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(listener); + } + + /** + * @see PropertyChangeSupport#addPropertyChangeListener(String, PropertyChangeListener) + */ + public void addPropertyChangeListener(final String propertyName, final PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(propertyName, listener); + } + + /** + * @see PropertyChangeSupport#removePropertyChangeListener(PropertyChangeListener) + */ + public void removePropertyChangeListener(final PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(listener); + } + + /** + * @see PropertyChangeSupport#removePropertyChangeListener(String, PropertyChangeListener) + */ + public void removePropertyChangeListener(final String propertyName, final PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(propertyName, listener); + } + + /** + * @see PropertyChangeSupport#firePropertyChange(String, Object, Object) + */ + public void firePropertyChange(final String propertyName, final Object oldValue, final Object newValue) { + propertyChangeSupport.firePropertyChange(propertyName, oldValue, newValue); + } + + /** + * @return true, if the object is dirty. + * + */ + public boolean isDirty() { + return dirty; + } + + /** + * Sets the dirty state of this object. + * + */ + public void setDirty(final boolean dirty) { + firePropertyChange("dirty", this.dirty, this.dirty = dirty ); + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br/> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + firePropertyChange("disposed", this.disposed, this.disposed = true); + } + + /** + * Returns the id property or <code>null</code> if not present. + */ + public String getId() { + return this.id; + } + + /** + * Sets the <code>id</code> property to this instance. + * + * @param id - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setId(final String id) { + firePropertyChange("id", this.id, this.id = id ); + installLazyCollections(); + } + + /** + * Returns the userGroupName property or <code>null</code> if not present. + */ + public String getUserGroupName() { + return this.userGroupName; + } + + /** + * Sets the <code>userGroupName</code> property to this instance. + * + * @param userGroupName - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setUserGroupName(final String userGroupName) { + firePropertyChange("userGroupName", this.userGroupName, this.userGroupName = userGroupName ); + } + + /** + * Returns the position property or <code>null</code> if not present. + */ + public String getPosition() { + return this.position; + } + + /** + * Sets the <code>position</code> property to this instance. + * + * @param position - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setPosition(final String position) { + firePropertyChange("position", this.position, this.position = position ); + } + + /** + * Returns the defaultPerspective property or <code>null</code> if not present. + */ + public String getDefaultPerspective() { + return this.defaultPerspective; + } + + /** + * Sets the <code>defaultPerspective</code> property to this instance. + * + * @param defaultPerspective - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setDefaultPerspective(final String defaultPerspective) { + firePropertyChange("defaultPerspective", this.defaultPerspective, this.defaultPerspective = defaultPerspective ); + } + + /** + * Returns the localeTag property or <code>null</code> if not present. + */ + public String getLocaleTag() { + return this.localeTag; + } + + /** + * Sets the <code>localeTag</code> property to this instance. + * + * @param localeTag - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setLocaleTag(final String localeTag) { + firePropertyChange("localeTag", this.localeTag, this.localeTag = localeTag ); + } + + /** + * Returns the theme property or <code>null</code> if not present. + */ + public String getTheme() { + return this.theme; + } + + /** + * Sets the <code>theme</code> property to this instance. + * + * @param theme - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setTheme(final String theme) { + firePropertyChange("theme", this.theme, this.theme = theme ); + } + + /** + * Returns the printService property or <code>null</code> if not present. + */ + public String getPrintService() { + return this.printService; + } + + /** + * Sets the <code>printService</code> property to this instance. + * + * @param printService - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setPrintService(final String printService) { + firePropertyChange("printService", this.printService, this.printService = printService ); + } + + /** + * Returns an unmodifiable list of userAccount. + */ + public List<UserAccountDto> getUserAccount() { + return Collections.unmodifiableList(internalGetUserAccount()); + } + + /** + * Returns the list of <code>UserAccountDto</code>s thereby lazy initializing it. For internal use only! + * + * @return list - the resulting list + * + */ + public List<UserAccountDto> internalGetUserAccount() { + if (this.userAccount == null) { + this.userAccount = new java.util.ArrayList<UserAccountDto>(); + } + return this.userAccount; + } + + /** + * Adds the given userAccountDto to this object. <p> + * Since the reference is a composition reference, the opposite reference <code>UserAccountDto#userGroup</code> of the <code>userAccountDto</code> will be handled automatically and no further coding is required to keep them in sync.<p> + * See {@link UserAccountDto#setUserGroup(UserAccountDto)}. + * + * @param userAccountDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void addToUserAccount(final UserAccountDto userAccountDto) { + checkDisposed(); + + userAccountDto.setUserGroup(this); + } + + /** + * Removes the given userAccountDto from this object. <p> + * + * @param userAccountDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void removeFromUserAccount(final UserAccountDto userAccountDto) { + checkDisposed(); + + userAccountDto.setUserGroup(null); + } + + /** + * For internal use only! + */ + public void internalAddToUserAccount(final UserAccountDto userAccountDto) { + + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + List<UserAccountDto> oldList = null; + if(internalGetUserAccount() instanceof org.eclipse.osbp.dsl.dto.lib.AbstractOppositeDtoList) { + oldList = ((org.eclipse.osbp.dsl.dto.lib.AbstractOppositeDtoList) internalGetUserAccount()).copy(); + } else { + oldList = new java.util.ArrayList<>(internalGetUserAccount()); + } + internalGetUserAccount().add(userAccountDto); + firePropertyChange("userAccount", oldList, internalGetUserAccount()); + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromUserAccount(final UserAccountDto userAccountDto) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + List<UserAccountDto> oldList = null; + if(internalGetUserAccount() instanceof org.eclipse.osbp.dsl.dto.lib.AbstractOppositeDtoList) { + oldList = ((org.eclipse.osbp.dsl.dto.lib.AbstractOppositeDtoList) internalGetUserAccount()).copy(); + } else { + oldList = new java.util.ArrayList<>(internalGetUserAccount()); + } + internalGetUserAccount().remove(userAccountDto); + firePropertyChange("userAccount", oldList, internalGetUserAccount()); + }else{ + // in mapping mode, we do NOT resolve any collection + internalGetUserAccount().remove(userAccountDto); + } + } + + /** + * Sets the <code>userAccount</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>UserAccountDto# + * userGroup</code> of the <code>userAccount</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link UserAccountDto#setUserGroup(UserAccountDto) + * + * @param userAccount - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setUserAccount(final List<UserAccountDto> userAccount) { + checkDisposed(); + for (UserAccountDto dto : internalGetUserAccount().toArray(new UserAccountDto[this.userAccount.size()])) { + removeFromUserAccount(dto); + } + + if(userAccount == null) { + return; + } + + for (UserAccountDto dto : userAccount) { + addToUserAccount(dto); + } + } + + /** + * Returns an unmodifiable list of userGroupFilter. + */ + public List<FilterDto> getUserGroupFilter() { + return Collections.unmodifiableList(internalGetUserGroupFilter()); + } + + /** + * Returns the list of <code>FilterDto</code>s thereby lazy initializing it. For internal use only! + * + * @return list - the resulting list + * + */ + public List<FilterDto> internalGetUserGroupFilter() { + if (this.userGroupFilter == null) { + this.userGroupFilter = new java.util.ArrayList<FilterDto>(); + } + return this.userGroupFilter; + } + + /** + * Adds the given filterDto to this object. <p> + * Since the reference is a composition reference, the opposite reference <code>FilterDto#userGroup</code> of the <code>filterDto</code> will be handled automatically and no further coding is required to keep them in sync.<p> + * See {@link FilterDto#setUserGroup(FilterDto)}. + * + * @param filterDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void addToUserGroupFilter(final FilterDto filterDto) { + checkDisposed(); + + filterDto.setUserGroup(this); + } + + /** + * Removes the given filterDto from this object. <p> + * + * @param filterDto - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void removeFromUserGroupFilter(final FilterDto filterDto) { + checkDisposed(); + + filterDto.setUserGroup(null); + } + + /** + * For internal use only! + */ + public void internalAddToUserGroupFilter(final FilterDto filterDto) { + + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + List<FilterDto> oldList = null; + if(internalGetUserGroupFilter() instanceof org.eclipse.osbp.dsl.dto.lib.AbstractOppositeDtoList) { + oldList = ((org.eclipse.osbp.dsl.dto.lib.AbstractOppositeDtoList) internalGetUserGroupFilter()).copy(); + } else { + oldList = new java.util.ArrayList<>(internalGetUserGroupFilter()); + } + internalGetUserGroupFilter().add(filterDto); + firePropertyChange("userGroupFilter", oldList, internalGetUserGroupFilter()); + } + } + + /** + * For internal use only! + */ + public void internalRemoveFromUserGroupFilter(final FilterDto filterDto) { + if(!org.eclipse.osbp.dsl.dto.lib.MappingContext.isMappingMode()) { + List<FilterDto> oldList = null; + if(internalGetUserGroupFilter() instanceof org.eclipse.osbp.dsl.dto.lib.AbstractOppositeDtoList) { + oldList = ((org.eclipse.osbp.dsl.dto.lib.AbstractOppositeDtoList) internalGetUserGroupFilter()).copy(); + } else { + oldList = new java.util.ArrayList<>(internalGetUserGroupFilter()); + } + internalGetUserGroupFilter().remove(filterDto); + firePropertyChange("userGroupFilter", oldList, internalGetUserGroupFilter()); + }else{ + // in mapping mode, we do NOT resolve any collection + internalGetUserGroupFilter().remove(filterDto); + } + } + + /** + * Sets the <code>userGroupFilter</code> property to this instance. + * Since the reference has an opposite reference, the opposite <code>FilterDto# + * userGroup</code> of the <code>userGroupFilter</code> will be handled automatically and no + * further coding is required to keep them in sync.<p> + * See {@link FilterDto#setUserGroup(FilterDto) + * + * @param userGroupFilter - the property + * @throws RuntimeException if instance is <code>disposed</code> + * + */ + public void setUserGroupFilter(final List<FilterDto> userGroupFilter) { + checkDisposed(); + for (FilterDto dto : internalGetUserGroupFilter().toArray(new FilterDto[this.userGroupFilter.size()])) { + removeFromUserGroupFilter(dto); + } + + if(userGroupFilter == null) { + return; + } + + for (FilterDto dto : userGroupFilter) { + addToUserGroupFilter(dto); + } + } + + public boolean equalVersions(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + UserGroupDto other = (UserGroupDto) obj; + if (this.id == null) { + if (other.id != null) + return false; + } else if (!this.id.equals(other.id)) + return false; + return true; + } + + public void propertyChange(final java.beans.PropertyChangeEvent event) { + Object source = event.getSource(); + + // forward the event from embeddable beans to all listeners. So the parent of the embeddable + // bean will become notified and its dirty state can be handled properly + { + // no super class available to forward event + } + } +} diff --git a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/mapper/UserAccountFilterDtoMapper.java b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/mapper/FilterDtoMapper.java index 3d9655a..95da4b1 100644 --- a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/mapper/UserAccountFilterDtoMapper.java +++ b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/mapper/FilterDtoMapper.java @@ -1,19 +1,19 @@ package org.eclipse.osbp.authentication.account.dtos.mapper; -import org.eclipse.osbp.authentication.account.dtos.UserAccountDto; -import org.eclipse.osbp.authentication.account.dtos.UserAccountFilterDto; -import org.eclipse.osbp.authentication.account.entities.UserAccount; -import org.eclipse.osbp.authentication.account.entities.UserAccountFilter; +import org.eclipse.osbp.authentication.account.dtos.FilterDto; +import org.eclipse.osbp.authentication.account.dtos.UserGroupDto; +import org.eclipse.osbp.authentication.account.entities.Filter; +import org.eclipse.osbp.authentication.account.entities.UserGroup; import org.eclipse.osbp.dsl.dto.lib.IMapper; import org.eclipse.osbp.dsl.dto.lib.IMapperAccess; import org.eclipse.osbp.dsl.dto.lib.MappingContext; /** - * This class maps the dto {@link UserAccountFilterDto} to and from the entity {@link UserAccountFilter}. + * This class maps the dto {@link FilterDto} to and from the entity {@link Filter}. * */ @SuppressWarnings("all") -public class UserAccountFilterDtoMapper<DTO extends UserAccountFilterDto, ENTITY extends UserAccountFilter> implements IMapper<DTO, ENTITY> { +public class FilterDtoMapper<DTO extends FilterDto, ENTITY extends Filter> implements IMapper<DTO, ENTITY> { private IMapperAccess mapperAccess; /** @@ -61,26 +61,26 @@ public class UserAccountFilterDtoMapper<DTO extends UserAccountFilterDto, ENTITY /** * Creates a new instance of the entity */ - public UserAccountFilter createEntity() { - return new UserAccountFilter(); + public Filter createEntity() { + return new Filter(); } /** * Creates a new instance of the dto */ - public UserAccountFilterDto createDto() { - return new UserAccountFilterDto(); + public FilterDto createDto() { + return new FilterDto(); } /** - * Maps the entity {@link UserAccountFilter} to the dto {@link UserAccountFilterDto}. + * Maps the entity {@link Filter} to the dto {@link FilterDto}. * * @param dto - The target dto * @param entity - The source entity * @param context - The context to get information about depth,... * */ - public void mapToDTO(final UserAccountFilterDto dto, final UserAccountFilter entity, final MappingContext context) { + public void mapToDTO(final FilterDto dto, final Filter entity, final MappingContext context) { if(context == null){ throw new IllegalArgumentException("Please pass a context!"); } @@ -89,18 +89,18 @@ public class UserAccountFilterDtoMapper<DTO extends UserAccountFilterDto, ENTITY dto.setId(toDto_id(entity, context)); dto.setFilter(toDto_filter(entity, context)); dto.setInvers(toDto_invers(entity, context)); - dto.setUserAccount(toDto_userAccount(entity, context)); + dto.setUserGroup(toDto_userGroup(entity, context)); } /** - * Maps the dto {@link UserAccountFilterDto} to the entity {@link UserAccountFilter}. + * Maps the dto {@link FilterDto} to the entity {@link Filter}. * * @param dto - The source dto * @param entity - The target entity * @param context - The context to get information about depth,... * */ - public void mapToEntity(final UserAccountFilterDto dto, final UserAccountFilter entity, final MappingContext context) { + public void mapToEntity(final FilterDto dto, final Filter entity, final MappingContext context) { if(context == null){ throw new IllegalArgumentException("Please pass a context!"); } @@ -111,7 +111,7 @@ public class UserAccountFilterDtoMapper<DTO extends UserAccountFilterDto, ENTITY entity.setId(toEntity_id(dto, entity, context)); entity.setFilter(toEntity_filter(dto, entity, context)); entity.setInvers(toEntity_invers(dto, entity, context)); - entity.setUserAccount(toEntity_userAccount(dto, entity, context)); + entity.setUserGroup(toEntity_userGroup(dto, entity, context)); } /** @@ -122,7 +122,7 @@ public class UserAccountFilterDtoMapper<DTO extends UserAccountFilterDto, ENTITY * @return the mapped value * */ - protected String toDto_id(final UserAccountFilter in, final MappingContext context) { + protected String toDto_id(final Filter in, final MappingContext context) { return in.getId(); } @@ -135,7 +135,7 @@ public class UserAccountFilterDtoMapper<DTO extends UserAccountFilterDto, ENTITY * @return the mapped value * */ - protected String toEntity_id(final UserAccountFilterDto in, final UserAccountFilter parentEntity, final MappingContext context) { + protected String toEntity_id(final FilterDto in, final Filter parentEntity, final MappingContext context) { return in.getId(); } @@ -147,7 +147,7 @@ public class UserAccountFilterDtoMapper<DTO extends UserAccountFilterDto, ENTITY * @return the mapped value * */ - protected String toDto_filter(final UserAccountFilter in, final MappingContext context) { + protected String toDto_filter(final Filter in, final MappingContext context) { return in.getFilter(); } @@ -160,7 +160,7 @@ public class UserAccountFilterDtoMapper<DTO extends UserAccountFilterDto, ENTITY * @return the mapped value * */ - protected String toEntity_filter(final UserAccountFilterDto in, final UserAccountFilter parentEntity, final MappingContext context) { + protected String toEntity_filter(final FilterDto in, final Filter parentEntity, final MappingContext context) { return in.getFilter(); } @@ -172,7 +172,7 @@ public class UserAccountFilterDtoMapper<DTO extends UserAccountFilterDto, ENTITY * @return the mapped value * */ - protected boolean toDto_invers(final UserAccountFilter in, final MappingContext context) { + protected boolean toDto_invers(final Filter in, final MappingContext context) { return in.getInvers(); } @@ -185,37 +185,37 @@ public class UserAccountFilterDtoMapper<DTO extends UserAccountFilterDto, ENTITY * @return the mapped value * */ - protected boolean toEntity_invers(final UserAccountFilterDto in, final UserAccountFilter parentEntity, final MappingContext context) { + protected boolean toEntity_invers(final FilterDto in, final Filter parentEntity, final MappingContext context) { return in.getInvers(); } /** - * Maps the property userAccount from the given entity to the dto. + * Maps the property userGroup from the given entity to the dto. * * @param in - The source entity * @param context - The context to get information about depth,... * @return the mapped dto * */ - protected UserAccountDto toDto_userAccount(final UserAccountFilter in, final MappingContext context) { - if(in.getUserAccount() != null) { + protected UserGroupDto toDto_userGroup(final Filter in, final MappingContext context) { + if(in.getUserGroup() != null) { // find a mapper that knows how to map the concrete input type. - org.eclipse.osbp.dsl.dto.lib.IMapper<UserAccountDto, UserAccount> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<UserAccountDto, UserAccount>) getToDtoMapper(UserAccountDto.class, in.getUserAccount().getClass()); + org.eclipse.osbp.dsl.dto.lib.IMapper<UserGroupDto, UserGroup> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<UserGroupDto, UserGroup>) getToDtoMapper(UserGroupDto.class, in.getUserGroup().getClass()); if(mapper == null) { throw new IllegalStateException("Mapper must not be null!"); } - UserAccountDto dto = null; - dto = context.get(mapper.createDtoHash(in.getUserAccount())); + UserGroupDto dto = null; + dto = context.get(mapper.createDtoHash(in.getUserGroup())); if(dto != null) { if(context.isRefresh()){ - mapper.mapToDTO(dto, in.getUserAccount(), context); + mapper.mapToDTO(dto, in.getUserGroup(), context); } return dto; } context.increaseLevel(); dto = mapper.createDto(); - mapper.mapToDTO(dto, in.getUserAccount(), context); + mapper.mapToDTO(dto, in.getUserGroup(), context); context.decreaseLevel(); return dto; } else { @@ -224,7 +224,7 @@ public class UserAccountFilterDtoMapper<DTO extends UserAccountFilterDto, ENTITY } /** - * Maps the property userAccount from the given dto to the entity. + * Maps the property userGroup from the given dto to the entity. * * @param in - The source dto * @param parentEntity - The parent entity @@ -232,29 +232,29 @@ public class UserAccountFilterDtoMapper<DTO extends UserAccountFilterDto, ENTITY * @return the mapped entity * */ - protected UserAccount toEntity_userAccount(final UserAccountFilterDto in, final UserAccountFilter parentEntity, final MappingContext context) { - if(in.getUserAccount() != null) { + protected UserGroup toEntity_userGroup(final FilterDto in, final Filter parentEntity, final MappingContext context) { + if(in.getUserGroup() != null) { // find a mapper that knows how to map the concrete input type. - org.eclipse.osbp.dsl.dto.lib.IMapper<UserAccountDto, UserAccount> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<UserAccountDto, UserAccount>) getToEntityMapper(in.getUserAccount().getClass(), UserAccount.class); + org.eclipse.osbp.dsl.dto.lib.IMapper<UserGroupDto, UserGroup> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<UserGroupDto, UserGroup>) getToEntityMapper(in.getUserGroup().getClass(), UserGroup.class); if(mapper == null) { throw new IllegalStateException("Mapper must not be null!"); } - UserAccount entity = null; - entity = context.get(mapper.createEntityHash(in.getUserAccount())); + UserGroup entity = null; + entity = context.get(mapper.createEntityHash(in.getUserGroup())); if(entity != null) { return entity; } else { - entity = (UserAccount) context - .findEntityByEntityManager(UserAccount.class, in.getUserAccount().getId()); + entity = (UserGroup) context + .findEntityByEntityManager(UserGroup.class, in.getUserGroup().getId()); if (entity != null) { - context.register(mapper.createEntityHash(in.getUserAccount()), entity); + context.register(mapper.createEntityHash(in.getUserGroup()), entity); return entity; } } entity = mapper.createEntity(); - mapper.mapToEntity(in.getUserAccount(), entity, context); + mapper.mapToEntity(in.getUserGroup(), entity, context); return entity; } else { return null; @@ -262,10 +262,10 @@ public class UserAccountFilterDtoMapper<DTO extends UserAccountFilterDto, ENTITY } public String createDtoHash(final Object in) { - return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(UserAccountFilterDto.class, in); + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(FilterDto.class, in); } public String createEntityHash(final Object in) { - return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(UserAccountFilter.class, in); + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(Filter.class, in); } } diff --git a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/mapper/UserAccountDtoMapper.java b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/mapper/UserAccountDtoMapper.java index c6373f4..6ed03dd 100644 --- a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/mapper/UserAccountDtoMapper.java +++ b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/mapper/UserAccountDtoMapper.java @@ -1,10 +1,9 @@ package org.eclipse.osbp.authentication.account.dtos.mapper; -import java.util.List; import org.eclipse.osbp.authentication.account.dtos.UserAccountDto; -import org.eclipse.osbp.authentication.account.dtos.UserAccountFilterDto; +import org.eclipse.osbp.authentication.account.dtos.UserGroupDto; import org.eclipse.osbp.authentication.account.entities.UserAccount; -import org.eclipse.osbp.authentication.account.entities.UserAccountFilter; +import org.eclipse.osbp.authentication.account.entities.UserGroup; import org.eclipse.osbp.dsl.dto.lib.IMapper; import org.eclipse.osbp.dsl.dto.lib.IMapperAccess; import org.eclipse.osbp.dsl.dto.lib.MappingContext; @@ -92,21 +91,20 @@ public class UserAccountDtoMapper<DTO extends UserAccountDto, ENTITY extends Use dto.setUserName(toDto_userName(entity, context)); dto.setPassword(toDto_password(entity, context)); dto.setExtraPassword(toDto_extraPassword(entity, context)); - dto.setPasswordReset(toDto_passwordReset(entity, context)); + dto.setUserGroup(toDto_userGroup(entity, context)); dto.setPosition(toDto_position(entity, context)); dto.setDefaultPerspective(toDto_defaultPerspective(entity, context)); + dto.setNotRegistered(toDto_notRegistered(entity, context)); dto.setEnabled(toDto_enabled(entity, context)); dto.setLocked(toDto_locked(entity, context)); + dto.setPasswordReset(toDto_passwordReset(entity, context)); dto.setSuperuser(toDto_superuser(entity, context)); dto.setForcePwdChange(toDto_forcePwdChange(entity, context)); - dto.setNotRegistered(toDto_notRegistered(entity, context)); dto.setFailedAttempt(toDto_failedAttempt(entity, context)); dto.setSuccessfulAttempt(toDto_successfulAttempt(entity, context)); dto.setCookieHashCode(toDto_cookieHashCode(entity, context)); dto.setLocaleTag(toDto_localeTag(entity, context)); dto.setProfileimage(toDto_profileimage(entity, context)); - dto.setLayoutingStrategy(toDto_layoutingStrategy(entity, context)); - dto.setFocusingStrategy(toDto_focusingStrategy(entity, context)); dto.setTheme(toDto_theme(entity, context)); dto.setPrintService(toDto_printService(entity, context)); dto.setSavedProperties(toDto_savedProperties(entity, context)); @@ -133,25 +131,23 @@ public class UserAccountDtoMapper<DTO extends UserAccountDto, ENTITY extends Use entity.setUserName(toEntity_userName(dto, entity, context)); entity.setPassword(toEntity_password(dto, entity, context)); entity.setExtraPassword(toEntity_extraPassword(dto, entity, context)); - entity.setPasswordReset(toEntity_passwordReset(dto, entity, context)); + entity.setUserGroup(toEntity_userGroup(dto, entity, context)); entity.setPosition(toEntity_position(dto, entity, context)); entity.setDefaultPerspective(toEntity_defaultPerspective(dto, entity, context)); + entity.setNotRegistered(toEntity_notRegistered(dto, entity, context)); entity.setEnabled(toEntity_enabled(dto, entity, context)); entity.setLocked(toEntity_locked(dto, entity, context)); + entity.setPasswordReset(toEntity_passwordReset(dto, entity, context)); entity.setSuperuser(toEntity_superuser(dto, entity, context)); entity.setForcePwdChange(toEntity_forcePwdChange(dto, entity, context)); - entity.setNotRegistered(toEntity_notRegistered(dto, entity, context)); entity.setFailedAttempt(toEntity_failedAttempt(dto, entity, context)); entity.setSuccessfulAttempt(toEntity_successfulAttempt(dto, entity, context)); entity.setCookieHashCode(toEntity_cookieHashCode(dto, entity, context)); entity.setLocaleTag(toEntity_localeTag(dto, entity, context)); entity.setProfileimage(toEntity_profileimage(dto, entity, context)); - entity.setLayoutingStrategy(toEntity_layoutingStrategy(dto, entity, context)); - entity.setFocusingStrategy(toEntity_focusingStrategy(dto, entity, context)); entity.setTheme(toEntity_theme(dto, entity, context)); entity.setPrintService(toEntity_printService(dto, entity, context)); entity.setSavedProperties(toEntity_savedProperties(dto, entity, context)); - toEntity_userAccountFilter(dto, entity, context); } /** @@ -280,28 +276,75 @@ public class UserAccountDtoMapper<DTO extends UserAccountDto, ENTITY extends Use } /** - * Maps the property passwordReset from the given entity to dto property. + * Maps the property userGroup from the given entity to the dto. * * @param in - The source entity * @param context - The context to get information about depth,... - * @return the mapped value + * @return the mapped dto * */ - protected boolean toDto_passwordReset(final UserAccount in, final MappingContext context) { - return in.getPasswordReset(); + protected UserGroupDto toDto_userGroup(final UserAccount in, final MappingContext context) { + if(in.getUserGroup() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<UserGroupDto, UserGroup> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<UserGroupDto, UserGroup>) getToDtoMapper(UserGroupDto.class, in.getUserGroup().getClass()); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + UserGroupDto dto = null; + dto = context.get(mapper.createDtoHash(in.getUserGroup())); + if(dto != null) { + if(context.isRefresh()){ + mapper.mapToDTO(dto, in.getUserGroup(), context); + } + return dto; + } + + context.increaseLevel(); + dto = mapper.createDto(); + mapper.mapToDTO(dto, in.getUserGroup(), context); + context.decreaseLevel(); + return dto; + } else { + return null; + } } /** - * Maps the property passwordReset from the given entity to dto property. + * Maps the property userGroup from the given dto to the entity. * - * @param in - The source entity - * @param parentEntity - The parentEntity + * @param in - The source dto + * @param parentEntity - The parent entity * @param context - The context to get information about depth,... - * @return the mapped value + * @return the mapped entity * */ - protected boolean toEntity_passwordReset(final UserAccountDto in, final UserAccount parentEntity, final MappingContext context) { - return in.getPasswordReset(); + protected UserGroup toEntity_userGroup(final UserAccountDto in, final UserAccount parentEntity, final MappingContext context) { + if(in.getUserGroup() != null) { + // find a mapper that knows how to map the concrete input type. + org.eclipse.osbp.dsl.dto.lib.IMapper<UserGroupDto, UserGroup> mapper = (org.eclipse.osbp.dsl.dto.lib.IMapper<UserGroupDto, UserGroup>) getToEntityMapper(in.getUserGroup().getClass(), UserGroup.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + UserGroup entity = null; + entity = context.get(mapper.createEntityHash(in.getUserGroup())); + if(entity != null) { + return entity; + } else { + entity = (UserGroup) context + .findEntityByEntityManager(UserGroup.class, in.getUserGroup().getId()); + if (entity != null) { + context.register(mapper.createEntityHash(in.getUserGroup()), entity); + return entity; + } + } + + entity = mapper.createEntity(); + mapper.mapToEntity(in.getUserGroup(), entity, context); + return entity; + } else { + return null; + } } /** @@ -355,6 +398,31 @@ public class UserAccountDtoMapper<DTO extends UserAccountDto, ENTITY extends Use } /** + * Maps the property notRegistered from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected boolean toDto_notRegistered(final UserAccount in, final MappingContext context) { + return in.getNotRegistered(); + } + + /** + * Maps the property notRegistered from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected boolean toEntity_notRegistered(final UserAccountDto in, final UserAccount parentEntity, final MappingContext context) { + return in.getNotRegistered(); + } + + /** * Maps the property enabled from the given entity to dto property. * * @param in - The source entity @@ -405,19 +473,19 @@ public class UserAccountDtoMapper<DTO extends UserAccountDto, ENTITY extends Use } /** - * Maps the property superuser from the given entity to dto property. + * Maps the property passwordReset from the given entity to dto property. * * @param in - The source entity * @param context - The context to get information about depth,... * @return the mapped value * */ - protected boolean toDto_superuser(final UserAccount in, final MappingContext context) { - return in.getSuperuser(); + protected boolean toDto_passwordReset(final UserAccount in, final MappingContext context) { + return in.getPasswordReset(); } /** - * Maps the property superuser from the given entity to dto property. + * Maps the property passwordReset from the given entity to dto property. * * @param in - The source entity * @param parentEntity - The parentEntity @@ -425,24 +493,24 @@ public class UserAccountDtoMapper<DTO extends UserAccountDto, ENTITY extends Use * @return the mapped value * */ - protected boolean toEntity_superuser(final UserAccountDto in, final UserAccount parentEntity, final MappingContext context) { - return in.getSuperuser(); + protected boolean toEntity_passwordReset(final UserAccountDto in, final UserAccount parentEntity, final MappingContext context) { + return in.getPasswordReset(); } /** - * Maps the property forcePwdChange from the given entity to dto property. + * Maps the property superuser from the given entity to dto property. * * @param in - The source entity * @param context - The context to get information about depth,... * @return the mapped value * */ - protected boolean toDto_forcePwdChange(final UserAccount in, final MappingContext context) { - return in.getForcePwdChange(); + protected boolean toDto_superuser(final UserAccount in, final MappingContext context) { + return in.getSuperuser(); } /** - * Maps the property forcePwdChange from the given entity to dto property. + * Maps the property superuser from the given entity to dto property. * * @param in - The source entity * @param parentEntity - The parentEntity @@ -450,24 +518,24 @@ public class UserAccountDtoMapper<DTO extends UserAccountDto, ENTITY extends Use * @return the mapped value * */ - protected boolean toEntity_forcePwdChange(final UserAccountDto in, final UserAccount parentEntity, final MappingContext context) { - return in.getForcePwdChange(); + protected boolean toEntity_superuser(final UserAccountDto in, final UserAccount parentEntity, final MappingContext context) { + return in.getSuperuser(); } /** - * Maps the property notRegistered from the given entity to dto property. + * Maps the property forcePwdChange from the given entity to dto property. * * @param in - The source entity * @param context - The context to get information about depth,... * @return the mapped value * */ - protected boolean toDto_notRegistered(final UserAccount in, final MappingContext context) { - return in.getNotRegistered(); + protected boolean toDto_forcePwdChange(final UserAccount in, final MappingContext context) { + return in.getForcePwdChange(); } /** - * Maps the property notRegistered from the given entity to dto property. + * Maps the property forcePwdChange from the given entity to dto property. * * @param in - The source entity * @param parentEntity - The parentEntity @@ -475,8 +543,8 @@ public class UserAccountDtoMapper<DTO extends UserAccountDto, ENTITY extends Use * @return the mapped value * */ - protected boolean toEntity_notRegistered(final UserAccountDto in, final UserAccount parentEntity, final MappingContext context) { - return in.getNotRegistered(); + protected boolean toEntity_forcePwdChange(final UserAccountDto in, final UserAccount parentEntity, final MappingContext context) { + return in.getForcePwdChange(); } /** @@ -605,56 +673,6 @@ public class UserAccountDtoMapper<DTO extends UserAccountDto, ENTITY extends Use } /** - * Maps the property layoutingStrategy from the given entity to dto property. - * - * @param in - The source entity - * @param context - The context to get information about depth,... - * @return the mapped value - * - */ - protected String toDto_layoutingStrategy(final UserAccount in, final MappingContext context) { - return in.getLayoutingStrategy(); - } - - /** - * Maps the property layoutingStrategy from the given entity to dto property. - * - * @param in - The source entity - * @param parentEntity - The parentEntity - * @param context - The context to get information about depth,... - * @return the mapped value - * - */ - protected String toEntity_layoutingStrategy(final UserAccountDto in, final UserAccount parentEntity, final MappingContext context) { - return in.getLayoutingStrategy(); - } - - /** - * Maps the property focusingStrategy from the given entity to dto property. - * - * @param in - The source entity - * @param context - The context to get information about depth,... - * @return the mapped value - * - */ - protected String toDto_focusingStrategy(final UserAccount in, final MappingContext context) { - return in.getFocusingStrategy(); - } - - /** - * Maps the property focusingStrategy from the given entity to dto property. - * - * @param in - The source entity - * @param parentEntity - The parentEntity - * @param context - The context to get information about depth,... - * @return the mapped value - * - */ - protected String toEntity_focusingStrategy(final UserAccountDto in, final UserAccount parentEntity, final MappingContext context) { - return in.getFocusingStrategy(); - } - - /** * Maps the property theme from the given entity to dto property. * * @param in - The source entity @@ -729,49 +747,6 @@ public class UserAccountDtoMapper<DTO extends UserAccountDto, ENTITY extends Use return in.getSavedProperties(); } - /** - * Maps the property userAccountFilter from the given entity to the dto. - * - * @param in - The source entity - * @param context - The context to get information about depth,... - * @return A list of mapped dtos - * - */ - protected List<UserAccountFilterDto> toDto_userAccountFilter(final UserAccount in, final MappingContext context) { - // nothing to do here. Mapping is done by OppositeLists - return null; - } - - /** - * Maps the property userAccountFilter from the given dto to the entity. - * - * @param in - The source dto - * @param parentEntity - The parent entity - * @param context - The context to get information about depth,... - * @return A list of mapped entities - * - */ - protected List<UserAccountFilter> toEntity_userAccountFilter(final UserAccountDto in, final UserAccount parentEntity, final MappingContext context) { - org.eclipse.osbp.dsl.dto.lib.IMapper<UserAccountFilterDto, UserAccountFilter> mapper = getToEntityMapper(UserAccountFilterDto.class, UserAccountFilter.class); - if(mapper == null) { - throw new IllegalStateException("Mapper must not be null!"); - } - - org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<UserAccountFilterDto> childsList = - (org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<UserAccountFilterDto>) in.internalGetUserAccountFilter(); - - // if entities are being added, then they are passed to - // #addToContainerChilds of the parent entity. So the container ref is setup - // properly! - // if entities are being removed, then they are passed to the - // #internalRemoveFromChilds method of the parent entity. So they are - // removed directly from the list of entities. - if ( childsList != null ) childsList.mapToEntity(mapper, - parentEntity::addToUserAccountFilter, - parentEntity::internalRemoveFromUserAccountFilter); - return null; - } - public String createDtoHash(final Object in) { return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(UserAccountDto.class, in); } diff --git a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/mapper/UserGroupDtoMapper.java b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/mapper/UserGroupDtoMapper.java new file mode 100644 index 0000000..5b3201e --- /dev/null +++ b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/mapper/UserGroupDtoMapper.java @@ -0,0 +1,396 @@ +package org.eclipse.osbp.authentication.account.dtos.mapper; + +import java.util.List; +import org.eclipse.osbp.authentication.account.dtos.FilterDto; +import org.eclipse.osbp.authentication.account.dtos.UserAccountDto; +import org.eclipse.osbp.authentication.account.dtos.UserGroupDto; +import org.eclipse.osbp.authentication.account.entities.Filter; +import org.eclipse.osbp.authentication.account.entities.UserAccount; +import org.eclipse.osbp.authentication.account.entities.UserGroup; +import org.eclipse.osbp.dsl.dto.lib.IMapper; +import org.eclipse.osbp.dsl.dto.lib.IMapperAccess; +import org.eclipse.osbp.dsl.dto.lib.MappingContext; + +/** + * This class maps the dto {@link UserGroupDto} to and from the entity {@link UserGroup}. + * + */ +@SuppressWarnings("all") +public class UserGroupDtoMapper<DTO extends UserGroupDto, ENTITY extends UserGroup> implements IMapper<DTO, ENTITY> { + private IMapperAccess mapperAccess; + + /** + * Returns the mapper instance that may map between the given dto and entity. Or <code>null</code> if no mapper is available. + * + * @param dtoClass - the class of the dto that should be mapped + * @param entityClass - the class of the entity that should be mapped + * @return the mapper instance or <code>null</code> + */ + protected <D, E> IMapper<D, E> getToDtoMapper(final Class<D> dtoClass, final Class<E> entityClass) { + return mapperAccess.getToDtoMapper(dtoClass, entityClass); + } + + /** + * Returns the mapper instance that may map between the given dto and entity. Or <code>null</code> if no mapper is available. + * + * @param dtoClass - the class of the dto that should be mapped + * @param entityClass - the class of the entity that should be mapped + * @return the mapper instance or <code>null</code> + */ + protected <D, E> IMapper<D, E> getToEntityMapper(final Class<D> dtoClass, final Class<E> entityClass) { + return mapperAccess.getToEntityMapper(dtoClass, entityClass); + } + + /** + * Called by OSGi-DS. Binds the mapper access service. + * + * @param service - The mapper access service + * + */ + protected void bindMapperAccess(final IMapperAccess mapperAccess) { + this.mapperAccess = mapperAccess; + } + + /** + * Called by OSGi-DS. Binds the mapper access service. + * + * @param service - The mapper access service + * + */ + protected void unbindMapperAccess(final IMapperAccess mapperAccess) { + this.mapperAccess = null; + } + + /** + * Creates a new instance of the entity + */ + public UserGroup createEntity() { + return new UserGroup(); + } + + /** + * Creates a new instance of the dto + */ + public UserGroupDto createDto() { + return new UserGroupDto(); + } + + /** + * Maps the entity {@link UserGroup} to the dto {@link UserGroupDto}. + * + * @param dto - The target dto + * @param entity - The source entity + * @param context - The context to get information about depth,... + * + */ + public void mapToDTO(final UserGroupDto dto, final UserGroup entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + context.register(createDtoHash(entity), dto); + + dto.setId(toDto_id(entity, context)); + dto.setUserGroupName(toDto_userGroupName(entity, context)); + dto.setPosition(toDto_position(entity, context)); + dto.setDefaultPerspective(toDto_defaultPerspective(entity, context)); + dto.setLocaleTag(toDto_localeTag(entity, context)); + dto.setTheme(toDto_theme(entity, context)); + dto.setPrintService(toDto_printService(entity, context)); + } + + /** + * Maps the dto {@link UserGroupDto} to the entity {@link UserGroup}. + * + * @param dto - The source dto + * @param entity - The target entity + * @param context - The context to get information about depth,... + * + */ + public void mapToEntity(final UserGroupDto dto, final UserGroup entity, final MappingContext context) { + if(context == null){ + throw new IllegalArgumentException("Please pass a context!"); + } + + context.register(createEntityHash(dto), entity); + context.registerMappingRoot(createEntityHash(dto), dto); + + entity.setId(toEntity_id(dto, entity, context)); + entity.setUserGroupName(toEntity_userGroupName(dto, entity, context)); + entity.setPosition(toEntity_position(dto, entity, context)); + entity.setDefaultPerspective(toEntity_defaultPerspective(dto, entity, context)); + entity.setLocaleTag(toEntity_localeTag(dto, entity, context)); + entity.setTheme(toEntity_theme(dto, entity, context)); + entity.setPrintService(toEntity_printService(dto, entity, context)); + toEntity_userAccount(dto, entity, context); + toEntity_userGroupFilter(dto, entity, context); + } + + /** + * Maps the property id from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_id(final UserGroup in, final MappingContext context) { + return in.getId(); + } + + /** + * Maps the property id from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_id(final UserGroupDto in, final UserGroup parentEntity, final MappingContext context) { + return in.getId(); + } + + /** + * Maps the property userGroupName from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_userGroupName(final UserGroup in, final MappingContext context) { + return in.getUserGroupName(); + } + + /** + * Maps the property userGroupName from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_userGroupName(final UserGroupDto in, final UserGroup parentEntity, final MappingContext context) { + return in.getUserGroupName(); + } + + /** + * Maps the property position from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_position(final UserGroup in, final MappingContext context) { + return in.getPosition(); + } + + /** + * Maps the property position from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_position(final UserGroupDto in, final UserGroup parentEntity, final MappingContext context) { + return in.getPosition(); + } + + /** + * Maps the property defaultPerspective from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_defaultPerspective(final UserGroup in, final MappingContext context) { + return in.getDefaultPerspective(); + } + + /** + * Maps the property defaultPerspective from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_defaultPerspective(final UserGroupDto in, final UserGroup parentEntity, final MappingContext context) { + return in.getDefaultPerspective(); + } + + /** + * Maps the property localeTag from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_localeTag(final UserGroup in, final MappingContext context) { + return in.getLocaleTag(); + } + + /** + * Maps the property localeTag from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_localeTag(final UserGroupDto in, final UserGroup parentEntity, final MappingContext context) { + return in.getLocaleTag(); + } + + /** + * Maps the property theme from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_theme(final UserGroup in, final MappingContext context) { + return in.getTheme(); + } + + /** + * Maps the property theme from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_theme(final UserGroupDto in, final UserGroup parentEntity, final MappingContext context) { + return in.getTheme(); + } + + /** + * Maps the property printService from the given entity to dto property. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toDto_printService(final UserGroup in, final MappingContext context) { + return in.getPrintService(); + } + + /** + * Maps the property printService from the given entity to dto property. + * + * @param in - The source entity + * @param parentEntity - The parentEntity + * @param context - The context to get information about depth,... + * @return the mapped value + * + */ + protected String toEntity_printService(final UserGroupDto in, final UserGroup parentEntity, final MappingContext context) { + return in.getPrintService(); + } + + /** + * Maps the property userAccount from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return A list of mapped dtos + * + */ + protected List<UserAccountDto> toDto_userAccount(final UserGroup in, final MappingContext context) { + // nothing to do here. Mapping is done by OppositeLists + return null; + } + + /** + * Maps the property userAccount from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return A list of mapped entities + * + */ + protected List<UserAccount> toEntity_userAccount(final UserGroupDto in, final UserGroup parentEntity, final MappingContext context) { + org.eclipse.osbp.dsl.dto.lib.IMapper<UserAccountDto, UserAccount> mapper = getToEntityMapper(UserAccountDto.class, UserAccount.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<UserAccountDto> childsList = + (org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<UserAccountDto>) in.internalGetUserAccount(); + + // if entities are being added, then they are passed to + // #addToContainerChilds of the parent entity. So the container ref is setup + // properly! + // if entities are being removed, then they are passed to the + // #internalRemoveFromChilds method of the parent entity. So they are + // removed directly from the list of entities. + if ( childsList != null ) childsList.mapToEntity(mapper, + parentEntity::addToUserAccount, + parentEntity::internalRemoveFromUserAccount); + return null; + } + + /** + * Maps the property userGroupFilter from the given entity to the dto. + * + * @param in - The source entity + * @param context - The context to get information about depth,... + * @return A list of mapped dtos + * + */ + protected List<FilterDto> toDto_userGroupFilter(final UserGroup in, final MappingContext context) { + // nothing to do here. Mapping is done by OppositeLists + return null; + } + + /** + * Maps the property userGroupFilter from the given dto to the entity. + * + * @param in - The source dto + * @param parentEntity - The parent entity + * @param context - The context to get information about depth,... + * @return A list of mapped entities + * + */ + protected List<Filter> toEntity_userGroupFilter(final UserGroupDto in, final UserGroup parentEntity, final MappingContext context) { + org.eclipse.osbp.dsl.dto.lib.IMapper<FilterDto, Filter> mapper = getToEntityMapper(FilterDto.class, Filter.class); + if(mapper == null) { + throw new IllegalStateException("Mapper must not be null!"); + } + + org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<FilterDto> childsList = + (org.eclipse.osbp.dsl.dto.lib.IEntityMappingList<FilterDto>) in.internalGetUserGroupFilter(); + + // if entities are being added, then they are passed to + // #addToContainerChilds of the parent entity. So the container ref is setup + // properly! + // if entities are being removed, then they are passed to the + // #internalRemoveFromChilds method of the parent entity. So they are + // removed directly from the list of entities. + if ( childsList != null ) childsList.mapToEntity(mapper, + parentEntity::addToUserGroupFilter, + parentEntity::internalRemoveFromUserGroupFilter); + return null; + } + + public String createDtoHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(UserGroupDto.class, in); + } + + public String createEntityHash(final Object in) { + return org.eclipse.osbp.runtime.common.hash.HashUtil.createObjectWithIdHash(UserGroup.class, in); + } +} diff --git a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/service/FilterDtoService.java b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/service/FilterDtoService.java new file mode 100644 index 0000000..7a426c5 --- /dev/null +++ b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/service/FilterDtoService.java @@ -0,0 +1,25 @@ +package org.eclipse.osbp.authentication.account.dtos.service; + +import org.eclipse.osbp.authentication.account.dtos.FilterDto; +import org.eclipse.osbp.authentication.account.entities.Filter; +import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; + +@SuppressWarnings("all") +public class FilterDtoService extends AbstractDTOService<FilterDto, Filter> { + public FilterDtoService() { + // set the default persistence ID + setPersistenceId("authentication"); + } + + public Class<FilterDto> getDtoClass() { + return FilterDto.class; + } + + public Class<Filter> getEntityClass() { + return Filter.class; + } + + public Object getId(final FilterDto dto) { + return dto.getId(); + } +} diff --git a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/service/UserAccountFilterDtoService.java b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/service/UserAccountFilterDtoService.java deleted file mode 100644 index 038e4c0..0000000 --- a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/service/UserAccountFilterDtoService.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.eclipse.osbp.authentication.account.dtos.service; - -import org.eclipse.osbp.authentication.account.dtos.UserAccountFilterDto; -import org.eclipse.osbp.authentication.account.entities.UserAccountFilter; -import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; - -@SuppressWarnings("all") -public class UserAccountFilterDtoService extends AbstractDTOService<UserAccountFilterDto, UserAccountFilter> { - public UserAccountFilterDtoService() { - // set the default persistence ID - setPersistenceId("authentication"); - } - - public Class<UserAccountFilterDto> getDtoClass() { - return UserAccountFilterDto.class; - } - - public Class<UserAccountFilter> getEntityClass() { - return UserAccountFilter.class; - } - - public Object getId(final UserAccountFilterDto dto) { - return dto.getId(); - } -} diff --git a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/service/UserGroupDtoService.java b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/service/UserGroupDtoService.java new file mode 100644 index 0000000..f11abb0 --- /dev/null +++ b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/service/UserGroupDtoService.java @@ -0,0 +1,25 @@ +package org.eclipse.osbp.authentication.account.dtos.service; + +import org.eclipse.osbp.authentication.account.dtos.UserGroupDto; +import org.eclipse.osbp.authentication.account.entities.UserGroup; +import org.eclipse.osbp.dsl.dto.lib.services.impl.AbstractDTOService; + +@SuppressWarnings("all") +public class UserGroupDtoService extends AbstractDTOService<UserGroupDto, UserGroup> { + public UserGroupDtoService() { + // set the default persistence ID + setPersistenceId("authentication"); + } + + public Class<UserGroupDto> getDtoClass() { + return UserGroupDto.class; + } + + public Class<UserGroup> getEntityClass() { + return UserGroup.class; + } + + public Object getId(final UserGroupDto dto) { + return dto.getId(); + } +} diff --git a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/entities/UserAccountFilter.java b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/entities/Filter.java index 0aceeda..ea84ea2 100644 --- a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/entities/UserAccountFilter.java +++ b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/entities/Filter.java @@ -10,15 +10,15 @@ import javax.persistence.ManyToOne; import javax.persistence.PreRemove; import javax.persistence.Table; import javax.persistence.Transient; -import org.eclipse.osbp.authentication.account.entities.UserAccount; +import org.eclipse.osbp.authentication.account.entities.UserGroup; import org.eclipse.osbp.dsl.common.datatypes.IEntity; import org.eclipse.osbp.runtime.common.annotations.Dispose; @Entity -@Table(name = "USER_ACCOUNT_FILTER") -@DiscriminatorValue(value = "USER_ACCOUNT_FILTER") +@Table(name = "FILTER") +@DiscriminatorValue(value = "FILTER") @SuppressWarnings("all") -public class UserAccountFilter implements IEntity { +public class Filter implements IEntity { @Transient @Dispose private boolean disposed; @@ -34,8 +34,8 @@ public class UserAccountFilter implements IEntity { private boolean invers; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "USER_ACCOUNT_ID") - private UserAccount userAccount; + @JoinColumn(name = "USER_GROUP_ID") + private UserGroup userGroup; /** * @return true, if the object is disposed. @@ -122,27 +122,27 @@ public class UserAccountFilter implements IEntity { } /** - * @return Returns the userAccount property or <code>null</code> if not present. + * @return Returns the userGroup property or <code>null</code> if not present. */ - public UserAccount getUserAccount() { + public UserGroup getUserGroup() { checkDisposed(); - return this.userAccount; + return this.userGroup; } /** - * Sets the userAccount property to this instance. - * Since the reference is a container reference, the opposite reference (UserAccount.userAccountFilter) - * of the userAccount will be handled automatically and no further coding is required to keep them in sync. - * See {@link UserAccount#setUserAccountFilter(UserAccount)}. + * Sets the userGroup property to this instance. + * Since the reference is a container reference, the opposite reference (UserGroup.userGroupFilter) + * of the userGroup will be handled automatically and no further coding is required to keep them in sync. + * See {@link UserGroup#setUserGroupFilter(UserGroup)}. */ - public void setUserAccount(final UserAccount userAccount) { + public void setUserGroup(final UserGroup userGroup) { checkDisposed(); - if (this.userAccount != null) { - this.userAccount.internalRemoveFromUserAccountFilter(this); + if (this.userGroup != null) { + this.userGroup.internalRemoveFromUserGroupFilter(this); } - internalSetUserAccount(userAccount); - if (this.userAccount != null) { - this.userAccount.internalAddToUserAccountFilter(this); + internalSetUserGroup(userGroup); + if (this.userGroup != null) { + this.userGroup.internalAddToUserGroupFilter(this); } } @@ -150,8 +150,8 @@ public class UserAccountFilter implements IEntity { /** * For internal use only! */ - public void internalSetUserAccount(final UserAccount userAccount) { - this.userAccount = userAccount; + public void internalSetUserGroup(final UserGroup userGroup) { + this.userGroup = userGroup; } public boolean equalVersions(final Object obj) { @@ -161,7 +161,7 @@ public class UserAccountFilter implements IEntity { return false; if (getClass() != obj.getClass()) return false; - UserAccountFilter other = (UserAccountFilter) obj; + Filter other = (Filter) obj; if (this.id == null) { if (other.id != null) return false; diff --git a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/entities/UserAccount.java b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/entities/UserAccount.java index c009970..c19823c 100644 --- a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/entities/UserAccount.java +++ b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/entities/UserAccount.java @@ -1,8 +1,5 @@ package org.eclipse.osbp.authentication.account.entities; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; import javax.persistence.Basic; import javax.persistence.Cacheable; import javax.persistence.Column; @@ -13,20 +10,23 @@ import javax.persistence.Id; import javax.persistence.Index; import javax.persistence.JoinColumn; import javax.persistence.Lob; -import javax.persistence.OneToMany; +import javax.persistence.ManyToOne; import javax.persistence.PreRemove; import javax.persistence.PreUpdate; import javax.persistence.Table; import javax.persistence.Transient; import javax.validation.Valid; +import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; -import org.eclipse.osbp.authentication.account.entities.UserAccountFilter; +import org.eclipse.osbp.authentication.account.entities.UserGroup; import org.eclipse.osbp.dsl.common.datatypes.IEntity; import org.eclipse.osbp.runtime.common.annotations.Dispose; import org.eclipse.osbp.runtime.common.annotations.Hidden; import org.eclipse.osbp.runtime.common.annotations.Properties; import org.eclipse.osbp.runtime.common.annotations.Property; +import org.eclipse.osbp.runtime.common.annotations.UIGroup; import org.eclipse.osbp.runtime.common.annotations.UniqueEntry; +import org.eclipse.osbp.runtime.common.validation.ErrorSeverity; import org.eclipse.osbp.runtime.common.validation.InfoSeverity; @Cacheable(false) @@ -43,12 +43,16 @@ public class UserAccount implements IEntity { @Column(name = "ID") private String id = java.util.UUID.randomUUID().toString(); - @Column(name = "EMAIL", nullable = false) + @Column(name = "EMAIL") @UniqueEntry + @UIGroup(name = "personal") + @NotNull(payload = ErrorSeverity.class) private String email; - @Column(name = "USER_NAME", nullable = false) + @Column(name = "USER_NAME") @UniqueEntry + @UIGroup(name = "personal") + @NotNull(payload = ErrorSeverity.class) private String userName; @Hidden @@ -56,39 +60,54 @@ public class UserAccount implements IEntity { private String password; @Column(name = "EXTRA_PASSWORD") + @UIGroup(name = "personal") @Pattern(regexp = "[0-9]*", payload = InfoSeverity.class) private String extraPassword; - @Column(name = "PASSWORD_RESET") - private boolean passwordReset; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "USER_GROUP_ID") + private UserGroup userGroup; @Column(name = "POSITION") + @UIGroup(name = "setting") @Properties(properties = @Property(key = "organization", value = "")) private String position; @Column(name = "DEFAULT_PERSPECTIVE") + @UIGroup(name = "setting") @Properties(properties = @Property(key = "perspective", value = "")) private String defaultPerspective; + @Column(name = "NOT_REGISTERED") + @UIGroup(name = "action") + private boolean notRegistered; + @Column(name = "ENABLED") + @UIGroup(name = "action") private boolean enabled; @Column(name = "LOCKED") + @UIGroup(name = "action") private boolean locked; + @Column(name = "PASSWORD_RESET") + @UIGroup(name = "action") + private boolean passwordReset; + @Column(name = "SUPERUSER") + @UIGroup(name = "personal") private boolean superuser; @Column(name = "FORCE_PWD_CHANGE") + @UIGroup(name = "action") private boolean forcePwdChange; - @Column(name = "NOT_REGISTERED") - private boolean notRegistered; - @Column(name = "FAILED_ATTEMPT") + @UIGroup(name = "statistics") private int failedAttempt; @Column(name = "SUCCESSFUL_ATTEMPT") + @UIGroup(name = "statistics") private int successfulAttempt; @Hidden @@ -96,24 +115,22 @@ public class UserAccount implements IEntity { private int cookieHashCode; @Column(name = "LOCALE_TAG") + @UIGroup(name = "setting") @Properties(properties = @Property(key = "i18n", value = "")) private String localeTag; @Column(name = "PROFILEIMAGE") + @UIGroup(name = "personal") @Properties(properties = @Property(key = "Blob", value = "2")) private String profileimage; - @Column(name = "LAYOUTING_STRATEGY") - private String layoutingStrategy; - - @Column(name = "FOCUSING_STRATEGY") - private String focusingStrategy; - @Column(name = "THEME") + @UIGroup(name = "setting") @Properties(properties = @Property(key = "theme", value = "")) private String theme; @Column(name = "PRINT_SERVICE") + @UIGroup(name = "setting") @Properties(properties = @Property(key = "printservice", value = "")) private String printService; @@ -124,10 +141,6 @@ public class UserAccount implements IEntity { @Valid private byte[] savedProperties; - @JoinColumn(name = "USER_ACCOUNT_FILTER_ID") - @OneToMany(mappedBy = "userAccount") - private List<UserAccountFilter> userAccountFilter; - /** * @return true, if the object is disposed. * Disposed means, that it is prepared for garbage collection and may not be used anymore. @@ -181,7 +194,7 @@ public class UserAccount implements IEntity { } /** - * @return Returns the <em>required</em> email property. + * @return Returns the email property or <code>null</code> if not present. */ public String getEmail() { checkDisposed(); @@ -197,7 +210,7 @@ public class UserAccount implements IEntity { } /** - * @return Returns the <em>required</em> userName property. + * @return Returns the userName property or <code>null</code> if not present. */ public String getUserName() { checkDisposed(); @@ -245,19 +258,36 @@ public class UserAccount implements IEntity { } /** - * @return Returns the passwordReset property or <code>null</code> if not present. + * @return Returns the userGroup property or <code>null</code> if not present. */ - public boolean getPasswordReset() { + public UserGroup getUserGroup() { checkDisposed(); - return this.passwordReset; + return this.userGroup; } /** - * Sets the passwordReset property to this instance. + * Sets the userGroup property to this instance. + * Since the reference is a container reference, the opposite reference (UserGroup.userAccount) + * of the userGroup will be handled automatically and no further coding is required to keep them in sync. + * See {@link UserGroup#setUserAccount(UserGroup)}. */ - public void setPasswordReset(final boolean passwordReset) { + public void setUserGroup(final UserGroup userGroup) { checkDisposed(); - this.passwordReset = passwordReset; + if (this.userGroup != null) { + this.userGroup.internalRemoveFromUserAccount(this); + } + internalSetUserGroup(userGroup); + if (this.userGroup != null) { + this.userGroup.internalAddToUserAccount(this); + } + + } + + /** + * For internal use only! + */ + public void internalSetUserGroup(final UserGroup userGroup) { + this.userGroup = userGroup; } /** @@ -293,6 +323,22 @@ public class UserAccount implements IEntity { } /** + * @return Returns the notRegistered property or <code>null</code> if not present. + */ + public boolean getNotRegistered() { + checkDisposed(); + return this.notRegistered; + } + + /** + * Sets the notRegistered property to this instance. + */ + public void setNotRegistered(final boolean notRegistered) { + checkDisposed(); + this.notRegistered = notRegistered; + } + + /** * @return Returns the enabled property or <code>null</code> if not present. */ public boolean getEnabled() { @@ -325,6 +371,22 @@ public class UserAccount implements IEntity { } /** + * @return Returns the passwordReset property or <code>null</code> if not present. + */ + public boolean getPasswordReset() { + checkDisposed(); + return this.passwordReset; + } + + /** + * Sets the passwordReset property to this instance. + */ + public void setPasswordReset(final boolean passwordReset) { + checkDisposed(); + this.passwordReset = passwordReset; + } + + /** * @return Returns the superuser property or <code>null</code> if not present. */ public boolean getSuperuser() { @@ -357,22 +419,6 @@ public class UserAccount implements IEntity { } /** - * @return Returns the notRegistered property or <code>null</code> if not present. - */ - public boolean getNotRegistered() { - checkDisposed(); - return this.notRegistered; - } - - /** - * Sets the notRegistered property to this instance. - */ - public void setNotRegistered(final boolean notRegistered) { - checkDisposed(); - this.notRegistered = notRegistered; - } - - /** * @return Returns the failedAttempt property or <code>null</code> if not present. */ public int getFailedAttempt() { @@ -453,38 +499,6 @@ public class UserAccount implements IEntity { } /** - * @return Returns the layoutingStrategy property or <code>null</code> if not present. - */ - public String getLayoutingStrategy() { - checkDisposed(); - return this.layoutingStrategy; - } - - /** - * Sets the layoutingStrategy property to this instance. - */ - public void setLayoutingStrategy(final String layoutingStrategy) { - checkDisposed(); - this.layoutingStrategy = layoutingStrategy; - } - - /** - * @return Returns the focusingStrategy property or <code>null</code> if not present. - */ - public String getFocusingStrategy() { - checkDisposed(); - return this.focusingStrategy; - } - - /** - * Sets the focusingStrategy property to this instance. - */ - public void setFocusingStrategy(final String focusingStrategy) { - checkDisposed(); - this.focusingStrategy = focusingStrategy; - } - - /** * @return Returns the theme property or <code>null</code> if not present. */ public String getTheme() { @@ -532,80 +546,6 @@ public class UserAccount implements IEntity { this.savedProperties = savedProperties; } - /** - * @return Returns an unmodifiable list of userAccountFilter. - */ - public List<UserAccountFilter> getUserAccountFilter() { - checkDisposed(); - return Collections.unmodifiableList(internalGetUserAccountFilter()); - } - - /** - * Sets the given userAccountFilter to the object. Currently contained userAccountFilter instances will be removed. - * - * @param userAccountFilter the list of new instances - */ - public void setUserAccountFilter(final List<UserAccountFilter> userAccountFilter) { - // remove the old userAccountFilter - for(UserAccountFilter oldElement : new ArrayList<UserAccountFilter>(this.internalGetUserAccountFilter())){ - removeFromUserAccountFilter(oldElement); - } - - // add the new userAccountFilter - for(UserAccountFilter newElement : userAccountFilter){ - addToUserAccountFilter(newElement); - } - } - - /** - * For internal use only! Returns the list of <code>UserAccountFilter</code>s thereby lazy initializing it. - */ - public List<UserAccountFilter> internalGetUserAccountFilter() { - if (this.userAccountFilter == null) { - this.userAccountFilter = new ArrayList<UserAccountFilter>(); - } - return this.userAccountFilter; - } - - /** - * Adds the given userAccountFilter to this object. <p> - * Since the reference is a composition reference, the opposite reference (UserAccountFilter.userAccount) - * of the userAccountFilter will be handled automatically and no further coding is required to keep them in sync. - * See {@link UserAccountFilter#setUserAccount(UserAccountFilter)}. - * - */ - public void addToUserAccountFilter(final UserAccountFilter userAccountFilter) { - checkDisposed(); - userAccountFilter.setUserAccount(this); - } - - /** - * Removes the given userAccountFilter from this object. <p> - * - */ - public void removeFromUserAccountFilter(final UserAccountFilter userAccountFilter) { - checkDisposed(); - userAccountFilter.setUserAccount(null); - } - - /** - * For internal use only! - */ - public void internalAddToUserAccountFilter(final UserAccountFilter userAccountFilter) { - if(userAccountFilter == null) { - return; - } - - internalGetUserAccountFilter().add(userAccountFilter); - } - - /** - * For internal use only! - */ - public void internalRemoveFromUserAccountFilter(final UserAccountFilter userAccountFilter) { - internalGetUserAccountFilter().remove(userAccountFilter); - } - @PreUpdate public void preUpdate() { if ((this.locked && (!this.enabled))) { @@ -648,9 +588,6 @@ public class UserAccount implements IEntity { */ @PreRemove protected void preRemove() { - // remove the userAccountFilter - for(UserAccountFilter oldElement : new ArrayList<UserAccountFilter>(this.internalGetUserAccountFilter())){ - removeFromUserAccountFilter(oldElement); - } + } } diff --git a/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/entities/UserGroup.java b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/entities/UserGroup.java new file mode 100644 index 0000000..573b7b8 --- /dev/null +++ b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/entities/UserGroup.java @@ -0,0 +1,424 @@ +package org.eclipse.osbp.authentication.account.entities; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import javax.persistence.Cacheable; +import javax.persistence.Column; +import javax.persistence.DiscriminatorValue; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Index; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.PreRemove; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.validation.constraints.NotNull; +import org.eclipse.osbp.authentication.account.entities.Filter; +import org.eclipse.osbp.authentication.account.entities.UserAccount; +import org.eclipse.osbp.dsl.common.datatypes.IEntity; +import org.eclipse.osbp.runtime.common.annotations.AsTable; +import org.eclipse.osbp.runtime.common.annotations.Dispose; +import org.eclipse.osbp.runtime.common.annotations.DomainKey; +import org.eclipse.osbp.runtime.common.annotations.Properties; +import org.eclipse.osbp.runtime.common.annotations.Property; +import org.eclipse.osbp.runtime.common.annotations.UIGroup; +import org.eclipse.osbp.runtime.common.annotations.UniqueEntry; +import org.eclipse.osbp.runtime.common.validation.ErrorSeverity; + +@Cacheable(false) +@Entity +@Table(name = "USER_GROUP", indexes = @Index(name = "USER_GROUP_GROUP_NAME", unique = true, columnList = "USER_GROUP_NAME")) +@DiscriminatorValue(value = "USER_GROUP") +@SuppressWarnings("all") +public class UserGroup implements IEntity { + @Transient + @Dispose + private boolean disposed; + + @Id + @Column(name = "ID") + private String id = java.util.UUID.randomUUID().toString(); + + @DomainKey + @Column(name = "USER_GROUP_NAME") + @UniqueEntry + @UIGroup(name = "common") + @NotNull(payload = ErrorSeverity.class) + private String userGroupName; + + @Column(name = "POSITION") + @UIGroup(name = "organization") + @Properties(properties = @Property(key = "organization", value = "")) + private String position; + + @Column(name = "DEFAULT_PERSPECTIVE") + @UIGroup(name = "setting") + @Properties(properties = @Property(key = "perspective", value = "")) + private String defaultPerspective; + + @Column(name = "LOCALE_TAG") + @UIGroup(name = "setting") + @Properties(properties = @Property(key = "i18n", value = "")) + private String localeTag; + + @Column(name = "THEME") + @UIGroup(name = "setting") + @Properties(properties = @Property(key = "theme", value = "")) + private String theme; + + @Column(name = "PRINT_SERVICE") + @UIGroup(name = "setting") + @Properties(properties = @Property(key = "printservice", value = "")) + private String printService; + + @JoinColumn(name = "USER_ACCOUNT_ID") + @OneToMany(mappedBy = "userGroup") + @AsTable + private List<UserAccount> userAccount; + + @JoinColumn(name = "USER_GROUP_FILTER_ID") + @OneToMany(mappedBy = "userGroup") + private List<Filter> userGroupFilter; + + /** + * @return true, if the object is disposed. + * Disposed means, that it is prepared for garbage collection and may not be used anymore. + * Accessing objects that are already disposed will cause runtime exceptions. + * + */ + @Dispose + public boolean isDisposed() { + return this.disposed; + } + + /** + * Checks whether the object is disposed. + * @throws RuntimeException if the object is disposed. + */ + private void checkDisposed() { + if (isDisposed()) { + throw new RuntimeException("Object already disposed: " + this); + } + } + + /** + * Calling dispose will destroy that instance. The internal state will be + * set to 'disposed' and methods of that object must not be used anymore. + * Each call will result in runtime exceptions.<br> + * If this object keeps composition containments, these will be disposed too. + * So the whole composition containment tree will be disposed on calling this method. + */ + @Dispose + public void dispose() { + if (isDisposed()) { + return; + } + disposed = true; + } + + /** + * @return Returns the id property or <code>null</code> if not present. + */ + public String getId() { + checkDisposed(); + return this.id; + } + + /** + * Sets the id property to this instance. + */ + public void setId(final String id) { + checkDisposed(); + this.id = id; + } + + /** + * @return Returns the userGroupName property or <code>null</code> if not present. + */ + public String getUserGroupName() { + checkDisposed(); + return this.userGroupName; + } + + /** + * Sets the userGroupName property to this instance. + */ + public void setUserGroupName(final String userGroupName) { + checkDisposed(); + this.userGroupName = userGroupName; + } + + /** + * @return Returns the position property or <code>null</code> if not present. + */ + public String getPosition() { + checkDisposed(); + return this.position; + } + + /** + * Sets the position property to this instance. + */ + public void setPosition(final String position) { + checkDisposed(); + this.position = position; + } + + /** + * @return Returns the defaultPerspective property or <code>null</code> if not present. + */ + public String getDefaultPerspective() { + checkDisposed(); + return this.defaultPerspective; + } + + /** + * Sets the defaultPerspective property to this instance. + */ + public void setDefaultPerspective(final String defaultPerspective) { + checkDisposed(); + this.defaultPerspective = defaultPerspective; + } + + /** + * @return Returns the localeTag property or <code>null</code> if not present. + */ + public String getLocaleTag() { + checkDisposed(); + return this.localeTag; + } + + /** + * Sets the localeTag property to this instance. + */ + public void setLocaleTag(final String localeTag) { + checkDisposed(); + this.localeTag = localeTag; + } + + /** + * @return Returns the theme property or <code>null</code> if not present. + */ + public String getTheme() { + checkDisposed(); + return this.theme; + } + + /** + * Sets the theme property to this instance. + */ + public void setTheme(final String theme) { + checkDisposed(); + this.theme = theme; + } + + /** + * @return Returns the printService property or <code>null</code> if not present. + */ + public String getPrintService() { + checkDisposed(); + return this.printService; + } + + /** + * Sets the printService property to this instance. + */ + public void setPrintService(final String printService) { + checkDisposed(); + this.printService = printService; + } + + /** + * @return Returns an unmodifiable list of userAccount. + */ + public List<UserAccount> getUserAccount() { + checkDisposed(); + return Collections.unmodifiableList(internalGetUserAccount()); + } + + /** + * Sets the given userAccount to the object. Currently contained userAccount instances will be removed. + * + * @param userAccount the list of new instances + */ + public void setUserAccount(final List<UserAccount> userAccount) { + // remove the old userAccount + for(UserAccount oldElement : new ArrayList<UserAccount>(this.internalGetUserAccount())){ + removeFromUserAccount(oldElement); + } + + // add the new userAccount + for(UserAccount newElement : userAccount){ + addToUserAccount(newElement); + } + } + + /** + * For internal use only! Returns the list of <code>UserAccount</code>s thereby lazy initializing it. + */ + public List<UserAccount> internalGetUserAccount() { + if (this.userAccount == null) { + this.userAccount = new ArrayList<UserAccount>(); + } + return this.userAccount; + } + + /** + * Adds the given userAccount to this object. <p> + * Since the reference is a composition reference, the opposite reference (UserAccount.userGroup) + * of the userAccount will be handled automatically and no further coding is required to keep them in sync. + * See {@link UserAccount#setUserGroup(UserAccount)}. + * + */ + public void addToUserAccount(final UserAccount userAccount) { + checkDisposed(); + userAccount.setUserGroup(this); + } + + /** + * Removes the given userAccount from this object. <p> + * + */ + public void removeFromUserAccount(final UserAccount userAccount) { + checkDisposed(); + userAccount.setUserGroup(null); + } + + /** + * For internal use only! + */ + public void internalAddToUserAccount(final UserAccount userAccount) { + if(userAccount == null) { + return; + } + + internalGetUserAccount().add(userAccount); + } + + /** + * For internal use only! + */ + public void internalRemoveFromUserAccount(final UserAccount userAccount) { + internalGetUserAccount().remove(userAccount); + } + + /** + * @return Returns an unmodifiable list of userGroupFilter. + */ + public List<Filter> getUserGroupFilter() { + checkDisposed(); + return Collections.unmodifiableList(internalGetUserGroupFilter()); + } + + /** + * Sets the given userGroupFilter to the object. Currently contained userGroupFilter instances will be removed. + * + * @param userGroupFilter the list of new instances + */ + public void setUserGroupFilter(final List<Filter> userGroupFilter) { + // remove the old filter + for(Filter oldElement : new ArrayList<Filter>(this.internalGetUserGroupFilter())){ + removeFromUserGroupFilter(oldElement); + } + + // add the new filter + for(Filter newElement : userGroupFilter){ + addToUserGroupFilter(newElement); + } + } + + /** + * For internal use only! Returns the list of <code>Filter</code>s thereby lazy initializing it. + */ + public List<Filter> internalGetUserGroupFilter() { + if (this.userGroupFilter == null) { + this.userGroupFilter = new ArrayList<Filter>(); + } + return this.userGroupFilter; + } + + /** + * Adds the given filter to this object. <p> + * Since the reference is a composition reference, the opposite reference (Filter.userGroup) + * of the filter will be handled automatically and no further coding is required to keep them in sync. + * See {@link Filter#setUserGroup(Filter)}. + * + */ + public void addToUserGroupFilter(final Filter filter) { + checkDisposed(); + filter.setUserGroup(this); + } + + /** + * Removes the given filter from this object. <p> + * + */ + public void removeFromUserGroupFilter(final Filter filter) { + checkDisposed(); + filter.setUserGroup(null); + } + + /** + * For internal use only! + */ + public void internalAddToUserGroupFilter(final Filter filter) { + if(filter == null) { + return; + } + + internalGetUserGroupFilter().add(filter); + } + + /** + * For internal use only! + */ + public void internalRemoveFromUserGroupFilter(final Filter filter) { + internalGetUserGroupFilter().remove(filter); + } + + public boolean equalVersions(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + UserGroup other = (UserGroup) obj; + if (this.id == null) { + if (other.id != null) + return false; + } else if (!this.id.equals(other.id)) + return false; + return true; + } + + @Override + public boolean equals(final Object obj) { + return equalVersions(obj); + } + + @Override + public int hashCode() { + int prime = 31; + int result = 1; + result = prime * result + ((this.id== null) ? 0 : this.id.hashCode()); + return result; + } + + /** + * Iterates all cross references and removes them from the parent to avoid ConstraintViolationException + */ + @PreRemove + protected void preRemove() { + // remove the userAccount + for(UserAccount oldElement : new ArrayList<UserAccount>(this.internalGetUserAccount())){ + removeFromUserAccount(oldElement); + } + // remove the userGroupFilter + for(Filter oldElement : new ArrayList<Filter>(this.internalGetUserGroupFilter())){ + removeFromUserGroupFilter(oldElement); + } + } +} diff --git a/org.eclipse.osbp.authentication/src/account.datatype b/org.eclipse.osbp.authentication/src/account.datatype index 890ff37..c6296b9 100644 --- a/org.eclipse.osbp.authentication/src/account.datatype +++ b/org.eclipse.osbp.authentication/src/account.datatype @@ -36,6 +36,7 @@ package org.eclipse.osbp.authentication.account.datatypes { datatype BigDecimal jvmType java.math.BigDecimal datatype String jvmType java.lang.String + datatype StringMandatory jvmType java.lang.String isNotNull[severity=error] datatype BlobImage jvmType java.lang.String properties (key="Blob" value="2") datatype Date dateType date datatype datetype dateType date diff --git a/org.eclipse.osbp.authentication/src/account.dto b/org.eclipse.osbp.authentication/src/account.dto index 4c6543b..2652a45 100644 --- a/org.eclipse.osbp.authentication/src/account.dto +++ b/org.eclipse.osbp.authentication/src/account.dto @@ -1,6 +1,7 @@ import ns org.eclipse.osbp.authentication.account.entities.UserAccount -import ns org.eclipse.osbp.authentication.account.entities.UserAccountFilter +import ns org.eclipse.osbp.authentication.account.entities.Filter +import ns org.eclipse.osbp.authentication.account.entities.UserGroup package org.eclipse.osbp.authentication.account.dtos { autoDto UserAccountDto wraps UserAccount { @@ -10,33 +11,44 @@ package org.eclipse.osbp.authentication.account.dtos { inheritVar userName inheritVar password inheritVar extraPassword - inheritVar passwordReset + inheritRef userGroup mapto UserGroupDto inheritVar position inheritVar defaultPerspective + inheritVar notRegistered inheritVar enabled inheritVar locked + inheritVar passwordReset inheritVar superuser inheritVar forcePwdChange - inheritVar notRegistered inheritVar failedAttempt - inheritVar successfulAttempt inheritVar - cookieHashCode + successfulAttempt + inheritVar cookieHashCode inheritVar localeTag inheritVar profileimage - inheritVar layoutingStrategy - inheritVar focusingStrategy inheritVar theme inheritVar printService inheritVar savedProperties - inheritRef userAccountFilter mapto UserAccountFilterDto } - autoDto UserAccountFilterDto wraps UserAccountFilter { + autoDto FilterDto wraps Filter { inheritVar id inheritVar ^filter inheritVar invers + inheritRef userGroup mapto UserGroupDto + } + + autoDto UserGroupDto wraps UserGroup { + + inheritVar id + inheritVar userGroupName + inheritVar position + inheritVar defaultPerspective + inheritVar localeTag + inheritVar theme + inheritVar printService inheritRef userAccount mapto UserAccountDto + inheritRef userGroupFilter mapto FilterDto } }
\ No newline at end of file diff --git a/org.eclipse.osbp.authentication/src/account.entity b/org.eclipse.osbp.authentication/src/account.entity index 56e7c5d..efa915d 100644 --- a/org.eclipse.osbp.authentication/src/account.entity +++ b/org.eclipse.osbp.authentication/src/account.entity @@ -20,35 +20,34 @@ import ns org.eclipse.osbp.authentication.account.datatypes.String import ns org.eclipse.osbp.authentication.account.datatypes.blobtype import ns org.eclipse.osbp.authentication.account.datatypes.boolean import ns org.eclipse.osbp.authentication.account.datatypes.int +import ns org.eclipse.osbp.authentication.account.datatypes.StringMandatory package org.eclipse.osbp.authentication.account.entities { @Cacheable(false) // disable caching for userdata to allow manipulation of user data via SQL tools entity UserAccount { persistenceUnit "authentication" uuid String id - var unique String[1] email - var unique String[1] userName + var unique StringMandatory email group personal + var unique StringMandatory userName group personal var hidden String password - var String [ regex("[0-9]*") ] extraPassword - var boolean passwordReset - var String position properties(key = "organization" value = "") - var String defaultPerspective properties(key = "perspective" value = "") - var boolean enabled - var boolean locked - var boolean superuser - var boolean forcePwdChange - var boolean notRegistered - var int failedAttempt - var int successfulAttempt + var String [ regex("[0-9]*") ] extraPassword group personal + ref UserGroup userGroup opposite userAccount group setting + var String position group setting properties(key = "organization" value = "") + var String defaultPerspective group setting properties(key = "perspective" value = "") + var boolean notRegistered group action + var boolean enabled group action + var boolean locked group action + var boolean passwordReset group action + var boolean superuser group personal + var boolean forcePwdChange group action + var int failedAttempt group statistics + var int successfulAttempt group statistics var hidden int cookieHashCode - var String localeTag properties(key = "i18n" value = "") - var BlobImage profileimage - var String layoutingStrategy - var String focusingStrategy - var String theme properties(key = "theme" value = "") - var String printService properties(key = "printservice" value = "") + var String localeTag group setting properties(key = "i18n" value = "") + var BlobImage profileimage group personal + var String theme group setting properties(key = "theme" value = "") + var String printService group setting properties(key = "printservice" value = "") var hidden blobtype savedProperties - ref UserAccountFilter [*] userAccountFilter opposite userAccount @PreUpdate def void preUpdate() { if ( locked && ! enabled ) @@ -62,11 +61,35 @@ package org.eclipse.osbp.authentication.account.entities { } } - entity UserAccountFilter { + entity Filter { persistenceUnit "authentication" uuid String id var String ^filter var boolean invers - ref UserAccount userAccount opposite userAccountFilter + ref UserGroup userGroup opposite userGroupFilter } + + @Cacheable(false) // disable caching for userdata to allow manipulation of user data via SQL tools + entity UserGroup { + persistenceUnit "authentication" + uuid String id +// var UserBean userBean + domainKey unique StringMandatory userGroupName group common + var String position group organization properties(key = "organization" value = "") + var String defaultPerspective group setting properties(key = "perspective" value = "") + var String localeTag group setting properties(key = "i18n" value = "") + var String theme group setting properties(key = "theme" value = "") + var String printService group setting properties(key = "printservice" value = "") + ref UserAccount [*] userAccount opposite userGroup asTable + ref Filter [*] userGroupFilter opposite userGroup + unique index GroupName { + userGroupName + } + } + +// bean UserBean { +// var String localeTag properties(key = "i18n" value = "") +// var String theme properties(key = "theme" value = "") +// var String printService properties(key = "printservice" value = "") +// } }
\ No newline at end of file diff --git a/org.eclipse.osbp.authentication/src/account.service b/org.eclipse.osbp.authentication/src/account.service index 54bcaf8..cd54d96 100644 --- a/org.eclipse.osbp.authentication/src/account.service +++ b/org.eclipse.osbp.authentication/src/account.service @@ -1,13 +1,17 @@ import ns org.eclipse.osbp.authentication.account.dtos.UserAccountDto -import ns org.eclipse.osbp.authentication.account.dtos.UserAccountFilterDto -package org.eclipse.osbp.authentication.account.dtos.service { +import ns org.eclipse.osbp.authentication.account.dtos.FilterDto +import ns org.eclipse.osbp.authentication.account.dtos.UserGroupDto package org.eclipse.osbp.authentication.account.dtos.service { dtoservice UserAccountDtoService provides UserAccountDto { mutable persistenceUnit authentication } - dtoservice UserAccountFilterDtoService provides UserAccountFilterDto { + dtoservice FilterDtoService provides FilterDto { + mutable persistenceUnit authentication + } + + dtoservice UserGroupDtoService provides UserGroupDto { mutable persistenceUnit authentication } }
\ No newline at end of file diff --git a/org.eclipse.osbp.authentication/src/org/eclipse/osbp/authentication/providerimpl/UserAccessService.java b/org.eclipse.osbp.authentication/src/org/eclipse/osbp/authentication/providerimpl/UserAccessService.java index c01b086..f6a4b60 100644 --- a/org.eclipse.osbp.authentication/src/org/eclipse/osbp/authentication/providerimpl/UserAccessService.java +++ b/org.eclipse.osbp.authentication/src/org/eclipse/osbp/authentication/providerimpl/UserAccessService.java @@ -42,8 +42,9 @@ import org.apache.shiro.util.ThreadContext; import org.apache.shiro.web.config.WebIniSecurityManagerFactory; import org.apache.shiro.web.mgt.DefaultWebSecurityManager; import org.eclipse.osbp.authentication.Activator; +import org.eclipse.osbp.authentication.account.dtos.FilterDto; import org.eclipse.osbp.authentication.account.dtos.UserAccountDto; -import org.eclipse.osbp.authentication.account.dtos.UserAccountFilterDto; +import org.eclipse.osbp.authentication.account.dtos.UserGroupDto; import org.eclipse.osbp.authentication.shiro.extensions.StaticRealm; import org.eclipse.osbp.authentication.shiro.extensionsimpl.PortalUsernamePasswordToken; import org.eclipse.osbp.authentication.shiro.extensionsimpl.UserAccessAuthorizationRealm; @@ -54,8 +55,8 @@ import org.eclipse.osbp.core.api.persistence.IPersistenceService; import org.eclipse.osbp.dsl.dto.lib.impl.DtoServiceAccess; import org.eclipse.osbp.jpa.services.Query; import org.eclipse.osbp.preferences.ProductConfiguration; -import org.eclipse.osbp.runtime.common.filter.IDTOService; import org.eclipse.osbp.ui.api.complexdatacontainer.IComplexDataContainerChangedListener; +import org.eclipse.osbp.ui.api.user.filter.FilterMap; import org.eclipse.osbp.ui.api.useraccess.AbstractAuthorization; import org.eclipse.osbp.ui.api.useraccess.AbstractAuthorization.Action; import org.eclipse.osbp.ui.api.useraccess.AbstractAuthorization.Group; @@ -65,7 +66,6 @@ import org.eclipse.osbp.ui.api.useraccess.IOrganizationService; import org.eclipse.osbp.ui.api.useraccess.IPosition; import org.eclipse.osbp.ui.api.useraccess.ISubOrganization; import org.eclipse.osbp.ui.api.useraccess.IUserAccessService; -import org.eclipse.osbp.ui.api.userfilter.UserFilterMap; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; @@ -90,9 +90,15 @@ public class UserAccessService extends UserProtocol implements IUserAccessServic /** The Constant USER_KEY. */ private static final String USER_KEY = "user"; + /** The Constant USER_GROUP_KEY. */ + private static final String USER_GROUP_KEY = "userGroup"; + /** The Constant USER_FILTER_MAP_KEY. */ private static final String USER_FILTER_MAP_KEY = "userFilterMap"; + /** The Constant USER__GROUP_FILTER_MAP_KEY. */ + private static final String USER_GROUP_FILTER_MAP_KEY = "userGroupFilterMap"; + /** The Constant POSITION_KEY. */ private static final String POSITION_KEY = "position"; @@ -146,7 +152,7 @@ public class UserAccessService extends UserProtocol implements IUserAccessServic SecurityUtils.setSecurityManager(sSecurityManager); LOGGER.debug("{}", "security manager is set"); if (UserProtocol.dtoUserAccountDtoService == null) { - UserProtocol.dtoUserAccountDtoService = (IDTOService<UserAccountDto>) DtoServiceAccess + UserProtocol.dtoUserAccountDtoService = DtoServiceAccess .getService(UserAccountDto.class); } // for password encryption @@ -221,14 +227,18 @@ public class UserAccessService extends UserProtocol implements IUserAccessServic subject.login(token); realm = token.getAuthenticatedByRealm(); UserAccountDto user = null; - UserFilterMap userFilterMap = null; + UserGroupDto userGroup = null; + FilterMap userGroupFilterMap = null; AbstractPosition position = null; String defaultPerspective = null; List<String> roles = null; AbstractAuthorization authorization = null; if (realm instanceof UserAccessAuthorizationRealm) { user = ((UserAccessAuthorizationRealm) realm).findUserAccount(username); - userFilterMap = createFilterMap(user); + userGroup = user.getUserGroup(); + if (userGroup != null) { + userGroupFilterMap = createFilterMap(userGroup.getUserGroupFilter()); + } position = ((UserAccessAuthorizationRealm) realm).findPositionForUser(username); defaultPerspective = user.getDefaultPerspective(); authorization = ((UserAccessAuthorizationRealm) realm).findPermissionsForUser(username); @@ -240,7 +250,8 @@ public class UserAccessService extends UserProtocol implements IUserAccessServic } setSessionAttribute(AUTHENTICATED_BY_REALM, token.getAuthenticatedByRealm()); setSessionAttribute(USER_KEY, user); - setSessionAttribute(USER_FILTER_MAP_KEY, userFilterMap); + setSessionAttribute(USER_GROUP_KEY, userGroup); + setSessionAttribute(USER_GROUP_FILTER_MAP_KEY, userGroupFilterMap); setSessionAttribute(POSITION_KEY, position); setSessionAttribute(ROLES_KEY, roles); setSessionAttribute(AUTHORIZATION_KEY, authorization); @@ -386,7 +397,7 @@ public class UserAccessService extends UserProtocol implements IUserAccessServic if (user != null) { return user.getUserName(); } - return ""; + return null; } /* @@ -401,7 +412,7 @@ public class UserAccessService extends UserProtocol implements IUserAccessServic if (user != null) { return user.getProfileimage(); } - return ""; + return null; } /* @@ -414,9 +425,15 @@ public class UserAccessService extends UserProtocol implements IUserAccessServic public String getPositionName() { UserAccountDto user = getUser(); if (user != null) { - return user.getPosition(); + + if( user.getPosition() != null && !user.getPosition().isEmpty() ) + return user.getPosition(); + + UserGroupDto userGroup = user.getUserGroup(); + if (userGroup != null) + return userGroup.getPosition(); } - return ""; + return null; } /* @@ -430,7 +447,7 @@ public class UserAccessService extends UserProtocol implements IUserAccessServic if (user != null) { return user.getId(); } - return ""; + return null; } /* @@ -444,7 +461,7 @@ public class UserAccessService extends UserProtocol implements IUserAccessServic if (user != null) { return user.getEmail(); } - return ""; + return null; } /* @@ -456,41 +473,16 @@ public class UserAccessService extends UserProtocol implements IUserAccessServic public String getLocaleTag() { UserAccountDto user = getUser(); if (user != null) { - return user.getLocaleTag(); + if ( user.getLocaleTag() != null && !user.getLocaleTag().isEmpty() ) + return user.getLocaleTag(); + + UserGroupDto userGroup = user.getUserGroup(); + if (userGroup != null) + return userGroup.getLocaleTag(); } - return ""; + return null; } - /* - * (non-Javadoc) - * - * @see org.eclipse.osbp.ui.api.useraccess.IUserAccessService# - * getLayoutingStrategy () - */ - @Override - public String getLayoutingStrategy() { - UserAccountDto user = getUser(); - if (user != null) { - return user.getLayoutingStrategy(); - } - return ""; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.osbp.ui.api.useraccess.IUserAccessService#getFocusingStrategy - * () - */ - @Override - public String getFocusingStrategy() { - UserAccountDto user = getUser(); - if (user != null) { - return user.getFocusingStrategy(); - } - return ""; - } /* * (non-Javadoc) @@ -501,9 +493,14 @@ public class UserAccessService extends UserProtocol implements IUserAccessServic public String getTheme() { UserAccountDto user = getUser(); if (user != null) { - return user.getTheme(); + if( user.getTheme() != null && !user.getTheme().isEmpty() ) + return user.getTheme(); + + UserGroupDto userGroup = user.getUserGroup(); + if (userGroup != null) + return userGroup.getTheme(); } - return ""; + return null; } /* @@ -516,9 +513,14 @@ public class UserAccessService extends UserProtocol implements IUserAccessServic public String getPrintService() { UserAccountDto user = getUser(); if (user != null) { - return user.getPrintService(); + if( user.getPrintService() != null && !user.getPrintService().isEmpty() ) + return user.getPrintService(); + + UserGroupDto userGroup = user.getUserGroup(); + if (userGroup != null) + return userGroup.getPrintService(); } - return ""; + return null; } /* @@ -555,9 +557,15 @@ public class UserAccessService extends UserProtocol implements IUserAccessServic public String getPerspective() { UserAccountDto user = getUser(); if (user != null) { - return user.getDefaultPerspective(); + if (user.getDefaultPerspective() != null && !user.getDefaultPerspective().isEmpty()) + return user.getDefaultPerspective(); + + UserGroupDto userGroup = user.getUserGroup(); + if (userGroup != null) { + return userGroup.getDefaultPerspective(); + } } - return ""; + return null; } /* @@ -572,7 +580,7 @@ public class UserAccessService extends UserProtocol implements IUserAccessServic if (user != null) { return user.getExtraPassword(); } - return ""; + return null; } /* @@ -792,12 +800,12 @@ public class UserAccessService extends UserProtocol implements IUserAccessServic * org.eclipse.osbp.ui.api.useraccess.IUserAccessService#getUserFilterMap() */ @Override - public UserFilterMap getUserFilterMap() { - UserFilterMap userFilterMap = (UserFilterMap) getSessionAttribute(USER_FILTER_MAP_KEY); - if (userFilterMap == null) { - LOGGER.error("{}", "Authentication getUserFilterMap returned null"); + public FilterMap getFilterMap() { + FilterMap filterMap = (FilterMap) getSessionAttribute(USER_GROUP_FILTER_MAP_KEY); + if (filterMap == null) { + LOGGER.debug("SessionAttribute {} returned null", USER_GROUP_FILTER_MAP_KEY); } - return userFilterMap; + return filterMap; } /* @@ -896,9 +904,9 @@ public class UserAccessService extends UserProtocol implements IUserAccessServic * the user * @return the filter map */ - private UserFilterMap createFilterMap(UserAccountDto user) { - UserFilterMap filterMap = new UserFilterMap(); - for (UserAccountFilterDto filter : user.getUserAccountFilter()) { + private FilterMap createFilterMap(List<FilterDto> filterList) { + FilterMap filterMap = new FilterMap(); + for (FilterDto filter : filterList) { String[] splitFilter = filter.getFilter().split(":"); if (filter.getInvers()) { List<String> notFilterValueList = filterMap.getNotFilterMap().get(splitFilter[0]); @@ -963,10 +971,12 @@ public class UserAccessService extends UserProtocol implements IUserAccessServic triggerComplexDataContainerChangedListeners(); } + @Override public void addComplexDataContainerChangedListener(IComplexDataContainerChangedListener listener) { Activator.userAccountChangedListeners.add(listener); } + @Override public void removeComplexDataContainerChangedListener(IComplexDataContainerChangedListener listener) { Activator.userAccountChangedListeners.remove(listener); } diff --git a/org.eclipse.osbp.authentication/src/org/eclipse/osbp/authentication/shiro/extensionsimpl/UserAccessAuthorizationRealm.java b/org.eclipse.osbp.authentication/src/org/eclipse/osbp/authentication/shiro/extensionsimpl/UserAccessAuthorizationRealm.java index 3024966..7403ccf 100644 --- a/org.eclipse.osbp.authentication/src/org/eclipse/osbp/authentication/shiro/extensionsimpl/UserAccessAuthorizationRealm.java +++ b/org.eclipse.osbp.authentication/src/org/eclipse/osbp/authentication/shiro/extensionsimpl/UserAccessAuthorizationRealm.java @@ -14,7 +14,6 @@ */ package org.eclipse.osbp.authentication.shiro.extensionsimpl; -import java.util.Collection; import java.util.Collections; import java.util.List; @@ -25,6 +24,7 @@ import org.apache.shiro.authz.AuthorizationInfo; import org.apache.shiro.realm.AuthorizingRealm; import org.apache.shiro.subject.PrincipalCollection; import org.eclipse.osbp.authentication.account.dtos.UserAccountDto; +import org.eclipse.osbp.authentication.account.dtos.UserGroupDto; import org.eclipse.osbp.authentication.providerimpl.UserAccessService; import org.eclipse.osbp.authentication.shiro.extensions.IUserAccess; import org.eclipse.osbp.preferences.ProductConfiguration; @@ -70,7 +70,13 @@ public abstract class UserAccessAuthorizationRealm extends AuthorizingRealm impl public AbstractPosition findPositionForUser(String username) { UserAccountDto user = findUserAccount(username); if (user != null) { - return findPositionForPositionName(user.getPosition()); + if( user.getPosition() != null && !user.getPosition().isEmpty() ) + return findPositionForPositionName(user.getPosition()); + + UserGroupDto userGroup = user.getUserGroup(); + if (userGroup != null) + return findPositionForPositionName(userGroup.getPosition()); + } return null; } diff --git a/org.eclipse.osbp.user/META-INF/MANIFEST.MF b/org.eclipse.osbp.user/META-INF/MANIFEST.MF index 2706aef..583ab2f 100644 --- a/org.eclipse.osbp.user/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.user/META-INF/MANIFEST.MF @@ -15,10 +15,11 @@ Require-Bundle: org.eclipse.core.runtime, javax.servlet;bundle-version="3.1.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy -Import-Package: org.eclipse.osbp.ui.api.customfields;version="0.9.0", +Import-Package: javax.annotation, + org.eclipse.osbp.ui.api.customfields;version="0.9.0", org.eclipse.osbp.ui.api.user;version="0.9.0", + org.eclipse.osbp.ui.api.user.filter;version="0.9.0", org.eclipse.osbp.ui.api.useraccess;version="0.9.0", - org.slf4j, - javax.annotation + org.slf4j Export-Package: org.eclipse.osbp.user;version="0.9.0" Service-Component: OSGI-INF/*.xml diff --git a/org.eclipse.osbp.user/src/org/eclipse/osbp/user/User.java b/org.eclipse.osbp.user/src/org/eclipse/osbp/user/User.java index cfca2ca..14a4a6a 100644 --- a/org.eclipse.osbp.user/src/org/eclipse/osbp/user/User.java +++ b/org.eclipse.osbp.user/src/org/eclipse/osbp/user/User.java @@ -25,6 +25,7 @@ import org.eclipse.e4.core.di.extensions.EventUtils; import org.eclipse.e4.core.services.translation.TranslationService; import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.osbp.ui.api.user.IUser; +import org.eclipse.osbp.ui.api.user.filter.FilterMap; import org.eclipse.osbp.ui.api.useraccess.IUserAccessService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -70,12 +71,6 @@ public class User extends Hashtable<String, Object> implements IUser { /** The locale. */ private Locale locale; - /** The layouting strategy. */ - private String layoutingStrategy; - - /** The focusing strategy. */ - private String focusingStrategy; - /** The theme. */ private String theme; @@ -92,13 +87,15 @@ public class User extends Hashtable<String, Object> implements IUser { private String profileImageId; /** The persisted properties of the user **/ - private Map<String, Object> properties; + private transient Map<String, Object> properties; /** The flag to determine if the properties map is changed but not already persisted. **/ private boolean dirtyPropertiesMap; /** Internal class instance as wrapper for the properties. **/ - private IColumnUtil columnUtil; + private transient IColumnUtil columnUtil; + + private transient FilterMap userFilter; /** * Instantiates a new user. @@ -121,11 +118,10 @@ public class User extends Hashtable<String, Object> implements IUser { email = UserBinder.getUserAccessService().getEmail(); roles = UserBinder.getUserAccessService().getRoles(); id = UserBinder.getUserAccessService().getId(); - layoutingStrategy = UserBinder.getUserAccessService().getLayoutingStrategy(); - focusingStrategy = UserBinder.getUserAccessService().getFocusingStrategy(); theme = UserBinder.getUserAccessService().getTheme(); printService = UserBinder.getUserAccessService().getPrintService(); properties = UserBinder.getUserAccessService().getProperties(); + userFilter = UserBinder.getUserAccessService().getFilterMap(); dirtyPropertiesMap = false; columnUtil = this.new ColumnUtil(); if (UserBinder.getUserAccessService().getLocaleTag() != null) { @@ -144,28 +140,11 @@ public class User extends Hashtable<String, Object> implements IUser { } /** - * Gets the layouting strategy. - * - * @return the layouting strategy - */ - public String getLayoutingStrategy() { - return layoutingStrategy; - } - - /** - * Gets the focusing strategy. - * - * @return the focusing strategy - */ - public String getFocusingStrategy() { - return focusingStrategy; - } - - /** * Gets the theme. * * @return the theme */ + @Override public String getTheme() { return theme; } @@ -175,6 +154,7 @@ public class User extends Hashtable<String, Object> implements IUser { * * @return the print service */ + @Override public String getPrintService() { return printService; } @@ -185,6 +165,7 @@ public class User extends Hashtable<String, Object> implements IUser { * @param printService * the new print service */ + @Override public void setPrintService(String printService) { this.printService = printService; } @@ -195,6 +176,7 @@ public class User extends Hashtable<String, Object> implements IUser { * @see * org.eclipse.osbp.vaaclipse.publicapi.authentication.IUser#getUserName() */ + @Override public String getUserName() { return userName; } @@ -205,10 +187,12 @@ public class User extends Hashtable<String, Object> implements IUser { * @param userName * the new user name */ + @Override public void setUserName(String userName) { this.userName = userName; } + @Override public String getProfileImageId() { return profileImageId; } @@ -218,6 +202,7 @@ public class User extends Hashtable<String, Object> implements IUser { * * @return the id */ + @Override public String getId() { return id; } @@ -227,6 +212,7 @@ public class User extends Hashtable<String, Object> implements IUser { * * @return the position */ + @Override public String getPosition() { return position; } @@ -236,6 +222,7 @@ public class User extends Hashtable<String, Object> implements IUser { * * @return the extra password */ + @Override public String getExtraPassword() { return extraPassword; } @@ -245,6 +232,7 @@ public class User extends Hashtable<String, Object> implements IUser { * * @return the supervisor */ + @Override public boolean isSupervisor() { return supervisor; } @@ -254,6 +242,7 @@ public class User extends Hashtable<String, Object> implements IUser { * * @return the perspective id */ + @Override public String getPerspective() { return perspective; } @@ -263,6 +252,7 @@ public class User extends Hashtable<String, Object> implements IUser { * * @return the email */ + @Override public String getEmail() { return email; } @@ -272,6 +262,7 @@ public class User extends Hashtable<String, Object> implements IUser { * * @return the roles */ + @Override public Collection<String> getRoles() { return roles; } @@ -281,6 +272,7 @@ public class User extends Hashtable<String, Object> implements IUser { * * @return the locale */ + @Override public Locale getLocale() { return locale; } @@ -291,6 +283,7 @@ public class User extends Hashtable<String, Object> implements IUser { * @param locale * the new locale */ + @Override public void setLocale(Locale locale) { this.locale = locale; // force e4 application to switch locale and update localization @@ -351,24 +344,28 @@ public class User extends Hashtable<String, Object> implements IUser { setLocale(locale); } + @Override public Object getProperty (String key) { return properties.get(key); } + @Override public void addToProperties (String key, Object value) { properties.put(key, value); dirtyPropertiesMap = true; persistProperties(); } + @Override public void removeFromProperties (String key) { properties.remove(key); dirtyPropertiesMap = true; persistProperties(); } + @Override public void persistProperties() { - getUserAccessService().persistProperties(properties); + if( dirtyPropertiesMap ) getUserAccessService().persistProperties(properties); dirtyPropertiesMap = false; } @@ -384,6 +381,7 @@ public class User extends Hashtable<String, Object> implements IUser { * Inner class as wrapper to the properties */ class ColumnUtil implements IColumnUtil{ + @Override public String getColumnWidth(String key) { Object property = getProperty(key); if (property instanceof String){ @@ -393,7 +391,7 @@ public class User extends Hashtable<String, Object> implements IUser { } @Override - public String getColumnCollapsed(String key) { + public String getColumnCollapsed(String key) { // NOSONAR Object property = getProperty(key); if (property instanceof String){ return (String)property; @@ -418,4 +416,9 @@ public class User extends Hashtable<String, Object> implements IUser { public IColumnUtil getColumnUtil() { return columnUtil; } + + @Override + public FilterMap getUserFilter() { + return userFilter; + } } |