catch up with development
Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
diff --git a/jenkins.build.config.xml b/jenkins.build.config.xml
index b997580..affe08b 100644
--- a/jenkins.build.config.xml
+++ b/jenkins.build.config.xml
@@ -23,6 +23,7 @@
<jenkins.build.dependency>org.eclipse.osbp.preferences</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.runtime</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.ui.api</jenkins.build.dependency>
+ <jenkins.build.dependency>org.eclipse.osbp.vaaclipse.addons.common.api</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.xtext.i18n</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.xtext.oxtype</jenkins.build.dependency>
</jenkins.build.dependencies>
diff --git a/org.eclipse.osbp.authentication/i18n/I18N.properties b/org.eclipse.osbp.authentication/i18n/I18N.properties
index 84c0fa5..94cd54d 100644
--- a/org.eclipse.osbp.authentication/i18n/I18N.properties
+++ b/org.eclipse.osbp.authentication/i18n/I18N.properties
@@ -1,60 +1,28 @@
#default
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
-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
+dash_board=dash_board
default_perspective=default_perspective
-delete_item=delete_item
-description=description
-edit_account=edit_account
email=email
enabled=enabled
-end_date=end_date
-equal_to=equal_to
-expiration_time=expiration_time
extra_password=extra_password
failed_attempt=failed_attempt
+favorites=favorites
filter=filter
-focusing_strategy=focusing_strategy
-foo=foo
+filters=filters
force_pwd_change=force_pwd_change
-greater_than=greater_than
-groups=groups
id=id
invers=invers
-items_per_page=items_per_page
-layouting_strategy=layouting_strategy
-lesser_than=lesser_than
locale_tag=locale_tag
locked=locked
-menu=menu
-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
-priority=priority
-process_id=process_id
-process_instance_id=process_instance_id
-process_session_id=process_session_id
-profile=profile
profileimage=profileimage
registered=registered
reset=reset
@@ -69,21 +37,11 @@
start_date=start_date
start_process_text=start_process_text
statistics=statistics
-status=status
-subject=subject
successful_attempt=successful_attempt
superuser=superuser
-supervisor=supervisor
-task_id=task_id
theme=theme
-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
diff --git a/org.eclipse.osbp.authentication/i18n/I18N_de.properties b/org.eclipse.osbp.authentication/i18n/I18N_de.properties
index 816cd98..af6fdef 100644
--- a/org.eclipse.osbp.authentication/i18n/I18N_de.properties
+++ b/org.eclipse.osbp.authentication/i18n/I18N_de.properties
@@ -1,79 +1 @@
#de
-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=Datensatz l\u00F6schen
-description=Beschreibung
-edit_account=Konto bearbeiten
-email=Email
-enabled=Aktiviert
-end_date=Endedatum
-equal_to=ist gleich
-expiration_time=Ablaufdatum
-extra_password=Extra Passwort
-failed_attempt=Fehlerhafte Anmeldungen
-filter=Filter
-force_pwd_change=Erzwinge Passwort\u00E4nderung
-greater_than=Gr\u00F6\u00DFer als
-groups=Gruppen
-id=ID
-invers=Invertiert
-items_per_page=Elemente pro Seite
-lesser_than=Kleiner als
-locale_tag=Spracheinstellung
-locked=Gesperrt
-menu=Men\u00FC
-name=Name
-new_item=Neu
-not_registered=Nicht registriert
-ok=OK
-page=Seite
-password=Passwort
-password_reset=Passwort zur\u00FCcksetzen
-personal=Pers\u00F6nlich
-perspective_na=Perspektive
-position=Stelle
-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=Thema
-successful_attempt=Erfolgreiche Anmeldungen
-superuser=Administrator
-supervisor=Supervisor
-task_id=Task identifier
-theme=Theme
-toolbar_for_dialogs=Toolbar f\u00FCr Dialoge
-user_account=Benutzerkonto
-user_account_filter=Filter f\u00FCr Benutzerkonto
-user_administration=Benutzerverwaltung
-user_group=Benutzergruppe
-user_group_filter=Filter f\u00FCr Gruppe
-user_group_name=Gruppenbezeichnung
-user_name=Benutzername
-users=Benutzer
diff --git a/org.eclipse.osbp.authentication/i18n/I18N_de_AT.properties b/org.eclipse.osbp.authentication/i18n/I18N_de_AT.properties
deleted file mode 100644
index 3f64431..0000000
--- a/org.eclipse.osbp.authentication/i18n/I18N_de_AT.properties
+++ /dev/null
@@ -1 +0,0 @@
-#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 3f26d43..9edcd71 100644
--- a/org.eclipse.osbp.authentication/i18n/I18N_en.properties
+++ b/org.eclipse.osbp.authentication/i18n/I18N_en.properties
@@ -1,33 +1,19 @@
#en
action=Action
-activation_time=Activation time
-actual_owner=Actual owner
-administration=Administration
-all_accounts=All accounts
-answer_no_text=No
-answer_yes_text=Yes
-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
+dash_board=Dash board
default_perspective=Default perspective
-delete_item=Delete item
-description=Description
-edit_account=Edit account
email=Email
enabled=Enabled
-end_date=End date
-equal_to=Equal to
-expiration_time=Expiration time
extra_password=Extra password
failed_attempt=Failed attempt
+favorites=Favorites
filter=Filter
+filters=Filters
focusing_strategy=Focusing strategy
foo=Foo
-force_pwd_change=Force password change
+force_pwd_change=Force pwd change
greater_than=Greater than
groups=Groups
id=Identifier
@@ -39,7 +25,7 @@
locked=Locked
menu=Menu
name=Name
-new_item=New
+new_item=New item
not_registered=Not registered
ok=Ok
organization=Organization
@@ -47,7 +33,7 @@
password=Password
password_reset=Password reset
personal=Personal
-perspective_na=Perspective
+perspective_na=Perspective na
position=Position
print_service=Print service
priority=Priority
@@ -59,7 +45,7 @@
registered=Registered
reset=Reset
save=Save
-save_item=Save
+save_item=Save item
saved_properties=Saved properties
security_message=Security message
set_filter=Set filter
@@ -67,7 +53,7 @@
settings=Settings
show_all=Show all
start_date=Start date
-start_process_text=Start process
+start_process_text=Start process text
statistics=Statistics
status=Status
subject=Subject
@@ -83,7 +69,8 @@
user_bean=User bean
user_filter=User filter
user_group=User group
-user_group_filter=Filter for 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_en_US.properties b/org.eclipse.osbp.authentication/i18n/I18N_en_US.properties
deleted file mode 100644
index 3f64431..0000000
--- a/org.eclipse.osbp.authentication/i18n/I18N_en_US.properties
+++ /dev/null
@@ -1 +0,0 @@
-#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 73dcbaf..ea7c0a8 100644
--- a/org.eclipse.osbp.authentication/i18n/I18N_fr.properties
+++ b/org.eclipse.osbp.authentication/i18n/I18N_fr.properties
@@ -1,17 +1,3 @@
#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/UserAccountDto.java b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/UserAccountDto.java
index be8708a..3cb97d3 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
@@ -111,6 +111,18 @@
@Valid
private byte[] savedProperties;
+ @Hidden
+ @Valid
+ private byte[] dashBoard;
+
+ @Hidden
+ @Valid
+ private byte[] favorites;
+
+ @Hidden
+ @Valid
+ private byte[] filters;
+
public UserAccountDto() {
installLazyCollections();
}
@@ -626,6 +638,60 @@
firePropertyChange("savedProperties", this.savedProperties, this.savedProperties = savedProperties );
}
+ /**
+ * Returns the dashBoard property or <code>null</code> if not present.
+ */
+ public byte[] getDashBoard() {
+ return this.dashBoard;
+ }
+
+ /**
+ * Sets the <code>dashBoard</code> property to this instance.
+ *
+ * @param dashBoard - the property
+ * @throws RuntimeException if instance is <code>disposed</code>
+ *
+ */
+ public void setDashBoard(final byte[] dashBoard) {
+ firePropertyChange("dashBoard", this.dashBoard, this.dashBoard = dashBoard );
+ }
+
+ /**
+ * Returns the favorites property or <code>null</code> if not present.
+ */
+ public byte[] getFavorites() {
+ return this.favorites;
+ }
+
+ /**
+ * Sets the <code>favorites</code> property to this instance.
+ *
+ * @param favorites - the property
+ * @throws RuntimeException if instance is <code>disposed</code>
+ *
+ */
+ public void setFavorites(final byte[] favorites) {
+ firePropertyChange("favorites", this.favorites, this.favorites = favorites );
+ }
+
+ /**
+ * Returns the filters property or <code>null</code> if not present.
+ */
+ public byte[] getFilters() {
+ return this.filters;
+ }
+
+ /**
+ * Sets the <code>filters</code> property to this instance.
+ *
+ * @param filters - the property
+ * @throws RuntimeException if instance is <code>disposed</code>
+ *
+ */
+ public void setFilters(final byte[] filters) {
+ firePropertyChange("filters", this.filters, this.filters = filters );
+ }
+
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/mapper/UserAccountDtoMapper.java b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/dtos/mapper/UserAccountDtoMapper.java
index 6ed03dd..f422d47 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
@@ -108,6 +108,9 @@
dto.setTheme(toDto_theme(entity, context));
dto.setPrintService(toDto_printService(entity, context));
dto.setSavedProperties(toDto_savedProperties(entity, context));
+ dto.setDashBoard(toDto_dashBoard(entity, context));
+ dto.setFavorites(toDto_favorites(entity, context));
+ dto.setFilters(toDto_filters(entity, context));
}
/**
@@ -148,6 +151,9 @@
entity.setTheme(toEntity_theme(dto, entity, context));
entity.setPrintService(toEntity_printService(dto, entity, context));
entity.setSavedProperties(toEntity_savedProperties(dto, entity, context));
+ entity.setDashBoard(toEntity_dashBoard(dto, entity, context));
+ entity.setFavorites(toEntity_favorites(dto, entity, context));
+ entity.setFilters(toEntity_filters(dto, entity, context));
}
/**
@@ -747,6 +753,81 @@
return in.getSavedProperties();
}
+ /**
+ * Maps the property dashBoard 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 byte[] toDto_dashBoard(final UserAccount in, final MappingContext context) {
+ return in.getDashBoard();
+ }
+
+ /**
+ * Maps the property dashBoard 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 byte[] toEntity_dashBoard(final UserAccountDto in, final UserAccount parentEntity, final MappingContext context) {
+ return in.getDashBoard();
+ }
+
+ /**
+ * Maps the property favorites 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 byte[] toDto_favorites(final UserAccount in, final MappingContext context) {
+ return in.getFavorites();
+ }
+
+ /**
+ * Maps the property favorites 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 byte[] toEntity_favorites(final UserAccountDto in, final UserAccount parentEntity, final MappingContext context) {
+ return in.getFavorites();
+ }
+
+ /**
+ * Maps the property filters 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 byte[] toDto_filters(final UserAccount in, final MappingContext context) {
+ return in.getFilters();
+ }
+
+ /**
+ * Maps the property filters 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 byte[] toEntity_filters(final UserAccountDto in, final UserAccount parentEntity, final MappingContext context) {
+ return in.getFilters();
+ }
+
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/entities/UserAccount.java b/org.eclipse.osbp.authentication/src-gen/org/eclipse/osbp/authentication/account/entities/UserAccount.java
index c19823c..a5618ea 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
@@ -141,6 +141,27 @@
@Valid
private byte[] savedProperties;
+ @Hidden
+ @Column(name = "DASH_BOARD")
+ @Lob
+ @Basic(fetch = FetchType.LAZY)
+ @Valid
+ private byte[] dashBoard;
+
+ @Hidden
+ @Column(name = "FAVORITES")
+ @Lob
+ @Basic(fetch = FetchType.LAZY)
+ @Valid
+ private byte[] favorites;
+
+ @Hidden
+ @Column(name = "FILTERS")
+ @Lob
+ @Basic(fetch = FetchType.LAZY)
+ @Valid
+ private byte[] filters;
+
/**
* @return true, if the object is disposed.
* Disposed means, that it is prepared for garbage collection and may not be used anymore.
@@ -546,6 +567,54 @@
this.savedProperties = savedProperties;
}
+ /**
+ * @return Returns the dashBoard property or <code>null</code> if not present.
+ */
+ public byte[] getDashBoard() {
+ checkDisposed();
+ return this.dashBoard;
+ }
+
+ /**
+ * Sets the dashBoard property to this instance.
+ */
+ public void setDashBoard(final byte[] dashBoard) {
+ checkDisposed();
+ this.dashBoard = dashBoard;
+ }
+
+ /**
+ * @return Returns the favorites property or <code>null</code> if not present.
+ */
+ public byte[] getFavorites() {
+ checkDisposed();
+ return this.favorites;
+ }
+
+ /**
+ * Sets the favorites property to this instance.
+ */
+ public void setFavorites(final byte[] favorites) {
+ checkDisposed();
+ this.favorites = favorites;
+ }
+
+ /**
+ * @return Returns the filters property or <code>null</code> if not present.
+ */
+ public byte[] getFilters() {
+ checkDisposed();
+ return this.filters;
+ }
+
+ /**
+ * Sets the filters property to this instance.
+ */
+ public void setFilters(final byte[] filters) {
+ checkDisposed();
+ this.filters = filters;
+ }
+
@PreUpdate
public void preUpdate() {
if ((this.locked && (!this.enabled))) {
diff --git a/org.eclipse.osbp.authentication/src/account.dto b/org.eclipse.osbp.authentication/src/account.dto
index 2652a45..5ff2fa4 100644
--- a/org.eclipse.osbp.authentication/src/account.dto
+++ b/org.eclipse.osbp.authentication/src/account.dto
@@ -1,8 +1,7 @@
import ns org.eclipse.osbp.authentication.account.entities.UserAccount
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 {
+import ns org.eclipse.osbp.authentication.account.entities.UserGroup package org.eclipse.osbp.authentication.account.dtos {
autoDto UserAccountDto wraps UserAccount {
@@ -21,14 +20,16 @@
inheritVar superuser
inheritVar forcePwdChange
inheritVar failedAttempt
- inheritVar
- successfulAttempt
+ inheritVar successfulAttempt
inheritVar cookieHashCode
inheritVar localeTag
inheritVar profileimage
inheritVar theme
inheritVar printService
inheritVar savedProperties
+ inheritVar dashBoard
+ inheritVar favorites
+ inheritVar filters
}
autoDto FilterDto wraps Filter {
diff --git a/org.eclipse.osbp.authentication/src/account.entity b/org.eclipse.osbp.authentication/src/account.entity
index efa915d..9ac1bfb 100644
--- a/org.eclipse.osbp.authentication/src/account.entity
+++ b/org.eclipse.osbp.authentication/src/account.entity
@@ -48,6 +48,9 @@
var String theme group setting properties(key = "theme" value = "")
var String printService group setting properties(key = "printservice" value = "")
var hidden blobtype savedProperties
+ var hidden blobtype dashBoard
+ var hidden blobtype favorites
+ var hidden blobtype filters
@PreUpdate
def void preUpdate() {
if ( locked && ! enabled )
diff --git a/org.eclipse.osbp.authentication/src/account.service b/org.eclipse.osbp.authentication/src/account.service
index cd54d96..5dfbead 100644
--- a/org.eclipse.osbp.authentication/src/account.service
+++ b/org.eclipse.osbp.authentication/src/account.service
@@ -1,7 +1,8 @@
import ns org.eclipse.osbp.authentication.account.dtos.UserAccountDto
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 {
+import ns org.eclipse.osbp.authentication.account.dtos.UserGroupDto
+package org.eclipse.osbp.authentication.account.dtos.service {
dtoservice UserAccountDtoService provides UserAccountDto {
mutable persistenceUnit authentication
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 f6a4b60..5ed7205 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
@@ -277,6 +277,7 @@
}
return true;
} catch (AuthenticationException ae) { // NOSONAR
+ LOGGER.error("{}", "Authentication: " + ae.getLocalizedMessage());
// captcha
int cnt = trackFailedLoginAttempt(username);
if (cnt > ProductConfiguration.getMaxLoginAttempts()) {
@@ -285,17 +286,16 @@
try {
// NOSONAR
// wait exponentially along failed logins up to a maximum of
- // 18,2 hours to prevent "Rapid-Fire Login Attempts"
+ // 128 seconds to prevent "Rapid-Fire Login Attempts"
// http://stackoverflow.com/questions/549/the-definitive-guide-to-form-based-website-authentication
- Long sleepLong = (long) (1000.0 * Math.max(5, Math.pow(2, Math.min(cnt, 16))));
+ Long sleepLong = (long) (1000.0 * Math.min(128, Math.max(5, Math.pow(2, Math.min(cnt, 16)))));
Long sleepLongSecs = sleepLong / 1000;
- LOGGER.info("User '{}' is locked for {} seconds now ... pls. wait", username, sleepLongSecs.toString());
+ LOGGER.info("User '{}' is locked for {} seconds now ... pls. wait", username, sleepLongSecs);
Thread.sleep(sleepLong);
} catch (InterruptedException e) { // NOSONAR
// Empty by design
}
- LOGGER.error("{}", "Authentication: " + ae.getLocalizedMessage());
}
return false;
}
@@ -1038,4 +1038,115 @@
}
return null;
}
+
+
+ @Override
+ public String getDashboard() {
+ UserAccountDto user = getUser();
+ if (user != null) {
+ ObjectInputStream objIn;
+ byte[] byteArray = user.getDashBoard();
+ if (byteArray != null){
+ try {
+ objIn = new ObjectInputStream(new ByteArrayInputStream(byteArray));
+ return (String) objIn.readObject();
+ } catch (IOException | ClassNotFoundException e) {
+ LOGGER.error(e.getClass().getName(), e);
+ }
+ }
+ }
+ return null;
+ }
+
+
+ @Override
+ public void setDashboard(String dashboard) {
+ UserAccountDto user = getDtoUserAccountDtoService().get(getUser().getId());
+ if (user != null) {
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ObjectOutputStream objOut = new ObjectOutputStream(out);
+ objOut.writeObject(dashboard);
+ objOut.close();
+ user.setDashBoard(out.toByteArray());
+ UserProtocol.getDtoUserAccountDtoService().update(user);
+ } catch (IOException e) {
+ LOGGER.error(e.getClass().getName(), e);
+ }
+ }
+ }
+
+
+ @Override
+ public String getFavorites() {
+ UserAccountDto user = getUser();
+ if (user != null) {
+ ObjectInputStream objIn;
+ byte[] byteArray = user.getFavorites();
+ if (byteArray != null){
+ try {
+ objIn = new ObjectInputStream(new ByteArrayInputStream(byteArray));
+ return (String) objIn.readObject();
+ } catch (IOException | ClassNotFoundException e) {
+ LOGGER.error(e.getClass().getName(), e);
+ }
+ }
+ }
+ return null;
+ }
+
+
+ @Override
+ public void setFavorites(String favorites) {
+ UserAccountDto user = getDtoUserAccountDtoService().get(getUser().getId());
+ if (user != null) {
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ObjectOutputStream objOut = new ObjectOutputStream(out);
+ objOut.writeObject(favorites);
+ objOut.close();
+ user.setFavorites(out.toByteArray());
+ UserProtocol.getDtoUserAccountDtoService().update(user);
+ } catch (IOException e) {
+ LOGGER.error(e.getClass().getName(), e);
+ }
+ }
+ }
+
+
+ @Override
+ public String getFilterSelections() {
+ UserAccountDto user = getUser();
+ if (user != null) {
+ ObjectInputStream objIn;
+ byte[] byteArray = user.getFilters();
+ if (byteArray != null){
+ try {
+ objIn = new ObjectInputStream(new ByteArrayInputStream(byteArray));
+ return (String) objIn.readObject();
+ } catch (IOException | ClassNotFoundException e) {
+ LOGGER.error(e.getClass().getName(), e);
+ }
+ }
+ }
+ return null;
+ }
+
+
+ @Override
+ public void setFilterSelections(String filters) {
+ UserAccountDto user = getDtoUserAccountDtoService().get(getUser().getId());
+ if (user != null) {
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ObjectOutputStream objOut = new ObjectOutputStream(out);
+ objOut.writeObject(filters);
+ objOut.close();
+ user.setFilters(out.toByteArray());
+ UserProtocol.getDtoUserAccountDtoService().update(user);
+ } catch (IOException e) {
+ LOGGER.error(e.getClass().getName(), e);
+ }
+ }
+ }
}
diff --git a/org.eclipse.osbp.user/META-INF/MANIFEST.MF b/org.eclipse.osbp.user/META-INF/MANIFEST.MF
index 583ab2f..50570ca 100644
--- a/org.eclipse.osbp.user/META-INF/MANIFEST.MF
+++ b/org.eclipse.osbp.user/META-INF/MANIFEST.MF
@@ -9,17 +9,16 @@
org.eclipse.e4.core.di.extensions,
com.vaadin.server;bundle-version="[7.7.6,7.8.0)",
org.eclipse.osgi.services;bundle-version="3.4.0",
- org.eclipse.e4.ui.model.workbench,
+ org.eclipse.osbp.vaaclipse.addons.common.api,
org.eclipse.e4.core.contexts;bundle-version="1.3.100",
org.eclipse.e4.core.services,
- javax.servlet;bundle-version="3.1.0"
+ javax.servlet;bundle-version="3.1.0",
+ org.eclipse.osbp.ui.api,
+ org.eclipse.e4.ui.workbench,
+ org.eclipse.e4.ui.model.workbench
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
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
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 14a4a6a..8d4ea47 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
@@ -14,6 +14,13 @@
*/
package org.eclipse.osbp.user;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Hashtable;
@@ -21,6 +28,18 @@
import java.util.Locale;
import java.util.Map;
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
import org.eclipse.e4.core.di.extensions.EventUtils;
import org.eclipse.e4.core.services.translation.TranslationService;
import org.eclipse.e4.ui.model.application.MApplication;
@@ -29,6 +48,9 @@
import org.eclipse.osbp.ui.api.useraccess.IUserAccessService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
import com.vaadin.server.VaadinSession;
@@ -37,7 +59,7 @@
* data. User can be injected. It conforms the vaaclipse AuthenticationProvider
* mechanism.
*/
-public class User extends Hashtable<String, Object> implements IUser {
+public class User extends Hashtable<String, Object> implements IUser { // NOSONAR
/** The application. */
private transient MApplication application;
@@ -59,8 +81,8 @@
/** The extra password. */
private String extraPassword;
- /** The supervisor. */
- private boolean supervisor;
+ /** The superuser. */
+ private boolean superuser;
/** The email. */
private String email;
@@ -96,7 +118,13 @@
private transient IColumnUtil columnUtil;
private transient FilterMap userFilter;
-
+ private transient DocumentBuilderFactory dbf;
+ private transient DocumentBuilder docBuilder;
+ private transient Document filterDocument;
+ private transient TransformerFactory transformerFactory;
+ private transient Transformer transformer;
+ private String filterFilePath;
+ private boolean saveSettingsAsFile = false;
/**
* Instantiates a new user.
*
@@ -115,6 +143,7 @@
position = UserBinder.getUserAccessService().getPositionName();
perspective = UserBinder.getUserAccessService().getPerspective();
extraPassword = UserBinder.getUserAccessService().getExtraPassword();
+ superuser = UserBinder.getUserAccessService().isSuperuser();
email = UserBinder.getUserAccessService().getEmail();
roles = UserBinder.getUserAccessService().getRoles();
id = UserBinder.getUserAccessService().getId();
@@ -136,6 +165,29 @@
put(userClass, IUser.class);
VaadinSession session = VaadinSession.getCurrent();
session.setAttribute(IUser.class, this);
+ transformerFactory = TransformerFactory.newInstance();
+ try {
+ transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ transformer = transformerFactory.newTransformer();
+ } catch (TransformerConfigurationException e) {
+ LOGGER.error("transformer cannot be created {}", e);
+ }
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+ transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ dbf = DocumentBuilderFactory.newInstance(); //NOSONAR
+ dbf.setNamespaceAware(true);
+ try {
+ docBuilder = dbf.newDocumentBuilder();
+ } catch (ParserConfigurationException e) {
+ LOGGER.error("document builder cannot be created {}", e);
+ }
+ String sep = System.getProperty("file.separator");
+ String path = String.format("%s%s.osbee", System.getProperty("user.home"), sep);
+ new File(path).mkdirs();
+ filterFilePath = String.format("%s%sUser.filter", path, sep);
+
+ loadFilterDocument();
LOGGER.debug("User is initialized");
}
@@ -228,13 +280,13 @@
}
/**
- * Gets the supervisor.
+ * Gets the superuser.
*
- * @return the supervisor
+ * @return the superuser
*/
@Override
- public boolean isSupervisor() {
- return supervisor;
+ public boolean isSuperuser() {
+ return superuser;
}
/**
@@ -374,9 +426,7 @@
properties.clear();
dirtyPropertiesMap = false;
}
-
-
-
+
/*
* Inner class as wrapper to the properties
*/
@@ -410,8 +460,6 @@
}
}
-
-
@Override
public IColumnUtil getColumnUtil() {
return columnUtil;
@@ -421,4 +469,87 @@
public FilterMap getUserFilter() {
return userFilter;
}
+
+ @Override
+ public synchronized Document getFilterDocument() {
+ if(filterDocument == null) {
+ filterDocument = docBuilder.newDocument();
+ filterDocument.appendChild(filterDocument.createElement(IUser.docRoot));
+ }
+ return filterDocument;
+ }
+
+ @Override
+ public synchronized void loadFilterDocument() {
+ if(saveSettingsAsFile ) {
+ try(FileInputStream filterFile = new FileInputStream(filterFilePath)) {
+ filterDocument = docBuilder.parse(filterFile);
+ filterDocument.getDocumentElement().normalize();
+ } catch (IOException | SAXException e) {
+ LOGGER.error("{}", e);
+ }
+ } else {
+ String filters = UserBinder.getUserAccessService().getFilterSelections();
+ if(filters != null) {
+ try {
+ InputSource is = new InputSource(new StringReader(filters));
+ filterDocument = docBuilder.parse(is);
+ filterDocument.getDocumentElement().normalize();
+ } catch (IOException | SAXException e) {
+ LOGGER.error("{}", e);
+ }
+ }
+ }
+ }
+
+ @Override
+ public synchronized void saveFilterDocument() {
+ if(saveSettingsAsFile) {
+ try(FileOutputStream filterFile = new FileOutputStream(filterFilePath)) {
+ if(filterDocument != null) {
+ DOMSource source = new DOMSource(filterDocument);
+ FileWriter writer = new FileWriter(new File(filterFilePath));
+ StreamResult result = new StreamResult(writer);
+ transformer.transform(source, result);
+ writer.flush();
+ }
+ } catch (IOException | TransformerException e) {
+ LOGGER.error("{}", e);
+ }
+ } else {
+ try {
+ if(filterDocument != null) {
+ DOMSource source = new DOMSource(filterDocument);
+ StringWriter writer = new StringWriter();
+ StreamResult result = new StreamResult(writer);
+ transformer.transform(source, result);
+ writer.flush();
+ String filters = writer.getBuffer().toString();
+ getUserAccessService().setFilterSelections(filters);
+ }
+ } catch (TransformerException e) {
+ LOGGER.error("{}", e);
+ }
+ }
+ }
+
+ @Override
+ public String loadDashboard() {
+ return UserBinder.getUserAccessService().getDashboard();
+ }
+
+ @Override
+ public void saveDashboard(String dashboard) {
+ UserBinder.getUserAccessService().setDashboard(dashboard);
+ }
+
+ @Override
+ public String loadFavorites() {
+ return UserBinder.getUserAccessService().getFavorites();
+ }
+
+ @Override
+ public void saveFavorites(String favorites) {
+ UserBinder.getUserAccessService().setFavorites(favorites);
+ }
}