diff options
author | Ralf Mollik | 2018-03-27 14:39:20 +0000 |
---|---|---|
committer | Ralf Mollik | 2018-03-27 14:39:20 +0000 |
commit | 8151152afdb8339e4724def59a06a27f0d2da534 (patch) | |
tree | 0a81e24deca0d9ea105520c08bae419c02bbb154 | |
parent | 55148c79f1ba7d81943c1b304b54c4c44aa8d636 (diff) | |
download | org.eclipse.osbp.ui.api-8151152afdb8339e4724def59a06a27f0d2da534.tar.gz org.eclipse.osbp.ui.api-8151152afdb8339e4724def59a06a27f0d2da534.tar.xz org.eclipse.osbp.ui.api-8151152afdb8339e4724def59a06a27f0d2da534.zip |
catch up with development
20 files changed, 77 insertions, 485 deletions
diff --git a/org.eclipse.osbp.ui.api/.project b/org.eclipse.osbp.ui.api/.project index 9e8b8f6..a677c31 100644 --- a/org.eclipse.osbp.ui.api/.project +++ b/org.eclipse.osbp.ui.api/.project @@ -31,12 +31,12 @@ </arguments> </buildCommand> <buildCommand> - <name>org.eclipse.m2e.core.maven2Builder</name> + <name>org.sonarlint.eclipse.core.sonarlintBuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> - <name>org.sonarlint.eclipse.core.sonarlintBuilder</name> + <name>org.eclipse.m2e.core.maven2Builder</name> <arguments> </arguments> </buildCommand> diff --git a/org.eclipse.osbp.ui.api/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.ui.api/.settings/org.eclipse.xtend.core.Xtend.prefs index 0933f8c..19e3115 100644 --- a/org.eclipse.osbp.ui.api/.settings/org.eclipse.xtend.core.Xtend.prefs +++ b/org.eclipse.osbp.ui.api/.settings/org.eclipse.xtend.core.Xtend.prefs @@ -1,4 +1,5 @@ //outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true eclipse.preferences.version=1 is_project_specific=true outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true diff --git a/org.eclipse.osbp.ui.api/META-INF/MANIFEST.MF b/org.eclipse.osbp.ui.api/META-INF/MANIFEST.MF index c47c746..b614a09 100644 --- a/org.eclipse.osbp.ui.api/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.ui.api/META-INF/MANIFEST.MF @@ -32,6 +32,7 @@ Export-Package: org.eclipse.osbp.ui.api.complexdatacontainer;version="0.9.0", org.eclipse.osbp.ui.api.metadata, org.eclipse.osbp.ecview.core.common.context, org.eclipse.osbp.ui.api.user", + org.eclipse.osbp.ui.api.table;version="0.9.0", org.eclipse.osbp.ui.api.themes;version="0.9.0";uses:="com.vaadin.server", org.eclipse.osbp.ui.api.user;version="0.9.0";uses:="org.eclipse.osbp.ui.api.customfields,org.eclipse.e4.ui.model.application", org.eclipse.osbp.ui.api.useraccess;version="0.9.0";uses:="org.eclipse.osbp.dsl.common.datatypes,org.eclipse.osbp.ui.api.complexdatacontainer,org.eclipse.osbp.ui.api.userfilter", diff --git a/org.eclipse.osbp.ui.api/pom.xml b/org.eclipse.osbp.ui.api/pom.xml index 8184207..71d7aa2 100644 --- a/org.eclipse.osbp.ui.api/pom.xml +++ b/org.eclipse.osbp.ui.api/pom.xml @@ -29,7 +29,7 @@ <dependency> <groupId>org.eclipse.osbp.dependencies</groupId> <artifactId>org.eclipse.osbp.dependencies.feature.vaadin</artifactId> - <version>${vaadin.version}</version> + <version>${vaadin.version}-SNAPSHOT</version> <type>eclipse-feature</type> </dependency> </dependencies> diff --git a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/contextfunction/IDashboardProvider.java b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/contextfunction/IDashboardProvider.java new file mode 100644 index 0000000..00a8da2 --- /dev/null +++ b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/contextfunction/IDashboardProvider.java @@ -0,0 +1,7 @@ +package org.eclipse.osbp.ui.api.contextfunction; + +import org.eclipse.e4.core.contexts.IEclipseContext; + +public interface IDashboardProvider { + void createDashboard(IEclipseContext context); +} diff --git a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/contextfunction/IVaadinDialogProvider.java b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/contextfunction/IVaadinDialogProvider.java index 40db253..470641d 100644 --- a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/contextfunction/IVaadinDialogProvider.java +++ b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/contextfunction/IVaadinDialogProvider.java @@ -15,7 +15,6 @@ package org.eclipse.osbp.ui.api.contextfunction; import com.vaadin.ui.Component; import com.vaadin.ui.VerticalLayout; -// TODO: Auto-generated Javadoc /** * The Interface IVaadinDialogProvider. Used to inject a vaadin based dialog. */ diff --git a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/customfields/IBlobUploadComponent.java b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/customfields/IBlobUploadComponent.java deleted file mode 100644 index dc5ba57..0000000 --- a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/customfields/IBlobUploadComponent.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * - * Copyright (c) 2011 - 2016 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Initial contribution: - * Loetz GmbH & Co. KG - * - */ -package org.eclipse.osbp.ui.api.customfields; - -import java.util.List; - -import org.eclipse.e4.core.services.events.IEventBroker; - -import com.vaadin.server.Resource; -import com.vaadin.ui.Label; - -public interface IBlobUploadComponent { - public enum BUTTON_ALIGNMENT { - TOP, BUTTOM, LEFT, RIGHT, DEFAULT - } - - /** - * Enables the upload button. - * - * @param uploadButton - * the upload button - */ - void enableUploadButton(boolean uploadButton); - - /** - * Sets the resolution for the blob to be displayed via resolution id - * - * @param displayResolutionId - */ - void setDisplayResolutionId(int displayResolutionId); - - /** - * Sets the resolution for the blob to be displayed via resolution string - * - * @param displayResolution the new display resolution - */ - void setDisplayResolution(String displayResolution); - /** - * Sets the uuid for the blob to be displayed - * - * @param uniqueName - */ - void setUploadedUniqueName(String uniqueName); - - /** - * Sets the firmly linked. - * - * @param firmlyLinked - * the new firmly linked - */ - void setFirmlyLinked(boolean firmlyLinked); - - /** - * Checks if component is firmly linked. - * - * @return true, if is firmly linked - */ - boolean isFirmlyLinked(); - - /** - * Sets the event broker. - * - * @param eventBroker the new event broker - */ - void setEventBroker(IEventBroker eventBroker); - - /** - * Sets the display image label. - * - * @param displayImageLabel the new display image label - */ - void setDisplayImageLabel(Label displayImageLabel); - - /** - * Sets the button alignment. - * - * @param buttonAlignment the new button alignment - */ - void setUploadButtonAlignment(BUTTON_ALIGNMENT buttonAlignment); - - /** - * Checks if is unique name enabled. - * - * @return true, if is unique name enabled - */ - boolean isUniqueNameEnabled(); - - /** - * Sets the unique name enabled. - * - * @param uniqueNameEnabled the new unique name enabled - */ - void setUniqueNameEnabled(boolean uniqueNameEnabled); - - /** - * Sets the upload component label. - * - * @param label the new blob upload comp label - */ - void setBlobUploadCompLabel(Label label); - - /** - * Sets the upload button caption. - * - * @param buttonCaption the new upload button caption - */ - void setUploadButtonCaption(String buttonCaption); - - /** - * Sets the upload icon. - * - * @param uploadIcon the new upload icon - */ - void setUploadIcon(Resource uploadIcon); - - /** - * Sets the download icon. - * - * @param downloadIcon the new download icon - */ - void setDownloadIcon(Resource downloadIcon); - - /** - * Sets the upload accepted mime types. - * - * @param mimeTypes the new upload accepted mime types - */ - void setUploadAcceptedMimeTypes(List<String> mimeTypes); - -}
\ No newline at end of file diff --git a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/datamart/DatamartFilter.java b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/datamart/DatamartFilter.java index ca9fe4a..e86e2a6 100644 --- a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/datamart/DatamartFilter.java +++ b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/datamart/DatamartFilter.java @@ -251,13 +251,15 @@ public class DatamartFilter { this.name = name; DateTimeFormat format = null; DateResolution resolution = null; - for (Entry<String, String> entry : dateFormatMap.entrySet()){ - if (DateTimeFormat.get(entry.getKey()) != null ){ - format = DateTimeFormat.get(entry.getKey()); - } - if (DateResolution.get(entry.getValue()) != null ){ - resolution = DateResolution.get(entry.getValue()); - } + if (dateFormatMap != null) { + for (Entry<String, String> entry : dateFormatMap.entrySet()){ + if (DateTimeFormat.get(entry.getKey()) != null ){ + format = DateTimeFormat.get(entry.getKey()); + } + if (DateResolution.get(entry.getValue()) != null ){ + resolution = DateResolution.get(entry.getValue()); + } + } } this.format = format; this.resolution = resolution; diff --git a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/datamart/DerivedOlapException.java b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/datamart/DerivedOlapException.java deleted file mode 100644 index 6c6946a..0000000 --- a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/datamart/DerivedOlapException.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation - * - */ - package org.eclipse.osbp.ui.api.datamart; - -public class DerivedOlapException extends Exception { - - public DerivedOlapException(String message) { - super(message); - } - - /** - * - */ - private static final long serialVersionUID = 1L; - - -} diff --git a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/datamart/IDataMart.java b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/datamart/IDataMart.java index 2da94b2..9d828a0 100644 --- a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/datamart/IDataMart.java +++ b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/datamart/IDataMart.java @@ -19,7 +19,7 @@ import org.eclipse.osbp.ui.api.user.IUser; public interface IDataMart { enum EType { - BOOLEAN, DATE, FLOAT, DOUBLE, BYTE, SHORT, INTEGER, LONG, STRING, TIME, BLOPMAPPING, LENUM, NONE + BOOLEAN, DATE, FLOAT, DOUBLE, BYTE, SHORT, INTEGER, LONG, STRING, RICHTEXTAREA, TIME, BLOPMAPPING, LENUM, NONE } static final String DATAMART_CLASS_POSTFIX = "Datamart"; @@ -34,6 +34,7 @@ import org.eclipse.osbp.ui.api.user.IUser; void renderFilters(); HashMap<String, EType> getIdMap(); HashMap<String, EType> getTypesMap(); + HashMap<String, String> getTypesProp(); ArrayList<DatamartPrimary<?>> getPrimaryList(); void computeConditions(); void clearCache(); diff --git a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/datamart/IDualData.java b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/datamart/IDualData.java deleted file mode 100644 index 678f8de..0000000 --- a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/datamart/IDualData.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * - * Copyright (c) 2011 - 2017 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Initial contribution: - * Loetz GmbH & Co. KG - * - */ -package org.eclipse.osbp.ui.api.datamart; - -/** - * The Interface IDualData. - */ -public interface IDualData { - - /** - * Gets the selection value. - * - * @return the selection value - */ - String getSelectionValue(); - - /** - * Sets the selection value. - * - * @param value the new selection value - */ - void setSelectionValue(String value); - - /** - * Gets the formatted value. - * - * @return the formatted value - */ - String getFormattedValue(); - - /** - * Gets the significant value. - * - * @return the significant value - */ - String getSignificantValue(); - - /** - * Sets the formatted value. - * - * @param formattedValue the new formatted value - */ - void setFormattedValue(String formattedValue); - - /** - * Sets the unformatted value. - * - * @param unformattedValue the new unformatted value - */ - void setUnformattedValue(String unformattedValue); - - /** - * Gets the hierarchy. - * - * @return the hierarchy - */ - String getHierarchy(); -} diff --git a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/message/MessageEvent.java b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/message/MessageEvent.java index 8154ffd..63bc572 100644 --- a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/message/MessageEvent.java +++ b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/message/MessageEvent.java @@ -2,7 +2,7 @@ package org.eclipse.osbp.ui.api.message; public class MessageEvent { public enum EventType { - KEYBOARD, TRIGGER, ID, MESSAGEOPEN, MESSAGECLOSE, ERROR, STATUSOPEN, STATUSCLOSE; + KEYBOARD, TRIGGER, ID, MESSAGEOPEN, MESSAGECLOSE, ERROR, STATUSOPEN, STATUSCLOSE, FUNCTIONALKEYBOARD; }; private EventType type; diff --git a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/metadata/IDSLMetadataService.java b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/metadata/IDSLMetadataService.java index 0544d95..538fd54 100644 --- a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/metadata/IDSLMetadataService.java +++ b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/metadata/IDSLMetadataService.java @@ -26,7 +26,6 @@ import org.eclipse.xtext.util.Pair; /** * The Interface IDSLMetadataService. */ -@SuppressWarnings("restriction") public interface IDSLMetadataService { /** @@ -244,4 +243,11 @@ public interface IDSLMetadataService { */ Class<?> getDatamartRootClass(String canonicalName); String getDatamartRootClassIdentifierName(String canonicalName); + + /** + * Checks if is osbee. + * + * @return true, if we loaded osbee related bundles + */ + boolean isOsbee(); } diff --git a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/statemachine/IBeeper.java b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/statemachine/IBeeper.java new file mode 100644 index 0000000..71758ef --- /dev/null +++ b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/statemachine/IBeeper.java @@ -0,0 +1,5 @@ +package org.eclipse.osbp.ui.api.statemachine; + +public interface IBeeper { + void beep(Integer duration, Integer frequency); +} diff --git a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/statemachine/IPeripheral.java b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/statemachine/IPeripheral.java index 6681ffc..ee103b6 100644 --- a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/statemachine/IPeripheral.java +++ b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/statemachine/IPeripheral.java @@ -13,8 +13,11 @@ */ package org.eclipse.osbp.ui.api.statemachine; +import com.vaadin.ui.Audio; +import com.vaadin.ui.Video; + public interface IPeripheral{ - boolean initDevices(); + boolean initDevices(IBeeper beeper, Audio audio, Video video); void releaseDevices(); /** diff --git a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/statemachine/IStateMachine.java b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/statemachine/IStateMachine.java index d4e0f64..a420ef5 100644 --- a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/statemachine/IStateMachine.java +++ b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/statemachine/IStateMachine.java @@ -7,6 +7,7 @@ import java.util.Map; import java.util.Set; import org.eclipse.e4.core.contexts.IEclipseContext; +import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.osbp.dsl.common.datatypes.IDto; import org.eclipse.osbp.runtime.common.filter.IQuery; import org.eclipse.osbp.ui.api.customfields.IBlobService; @@ -18,6 +19,8 @@ import org.eclipse.osbp.ui.api.themes.IThemeResourceService; import org.eclipse.osbp.ui.api.user.IUser; import org.joda.time.DateTime; +import com.vaadin.ui.VerticalLayout; + public interface IStateMachine { String getIPAddress(); @@ -97,7 +100,7 @@ public interface IStateMachine { Boolean isHttps(); - void schedule(IStateMachine statemachine, long milliseconds, + void schedule(IStateMachine statemachine, int milliseconds, MessageEvent event); Double parseDouble(String doubleStr); @@ -169,4 +172,8 @@ public interface IStateMachine { void setBlobService(IBlobService blobService); IBlobService getBlobService(); + + void installKeyEventConsumer(VerticalLayout layout); + + void uninstallKeyEventConsumer(); } diff --git a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/table/ITableRowCheckListener.java b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/table/ITableRowCheckListener.java new file mode 100644 index 0000000..3ea09d0 --- /dev/null +++ b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/table/ITableRowCheckListener.java @@ -0,0 +1,11 @@ +package org.eclipse.osbp.ui.api.table; + +public interface ITableRowCheckListener { + void addTableRowCheckListener(ITableRowCheckListener.CheckRecipient recipient); + void removeTableRowCheckListener(ITableRowCheckListener.CheckRecipient recipient); + + public interface CheckRecipient extends java.util.EventListener { + void rowChecked(Object selection, boolean select); + } + +} diff --git a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/themes/IThemeResourceService.java b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/themes/IThemeResourceService.java index 3284922..19f78c8 100644 --- a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/themes/IThemeResourceService.java +++ b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/themes/IThemeResourceService.java @@ -13,6 +13,7 @@ package org.eclipse.osbp.ui.api.themes; import java.io.InputStream; +import java.util.Locale; import org.eclipse.equinox.app.IApplicationContext; @@ -32,16 +33,21 @@ public interface IThemeResourceService { /** flag icon, mostly 16x16 px */ FLAG, /** html resource */ - HTML + HTML, + /** sound resource. */ + SOUND, + /** video resource */ + VIDEO } /** - * Inits the themeResourceService + * Inits the themeResourceService. * * @param appContext the app context * @param themeEngine the theme engine + * @param themeManager the theme manager */ - void init(IApplicationContext appContext, Object themeEngine); + void init(IApplicationContext appContext, Object themeEngine, Object themeManager); /** * Resets the base paths of the theme resource */ @@ -79,4 +85,13 @@ public interface IThemeResourceService { * @return the theme resource input stream */ InputStream getThemeResourceInputStream(String resourceURL); + + /** + * Gets the theme resource HTML. The resource must have TRANSLATABLE in its name to be translated. + * + * @param subject the subject + * @param locale the locale + * @return the theme resource HTML + */ + String getThemeResourceHTML(String subject, Locale locale); } diff --git a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/useraccess/AbstractRoleAuthorizationGroup.java b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/useraccess/AbstractRoleAuthorizationGroup.java deleted file mode 100644 index bdb5e2b..0000000 --- a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/useraccess/AbstractRoleAuthorizationGroup.java +++ /dev/null @@ -1,185 +0,0 @@ -/** - * - * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation - */ -package org.eclipse.osbp.ui.api.useraccess; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.eclipse.osbp.ui.api.useraccess.AbstractAuthorization.Action; -import org.eclipse.osbp.ui.api.useraccess.AbstractAuthorization.Group; -import org.eclipse.osbp.ui.api.useraccess.AbstractAuthorization.Permission; -import org.eclipse.osbp.ui.api.useraccess.AbstractAuthorization.Type; - -// TODO: Auto-generated Javadoc -/** - * The Class ARoleAuthorizationGroup. - */ -public abstract class AbstractRoleAuthorizationGroup { - - /** The permissions. */ - private Map<String,Boolean> fPermissions = new HashMap<>(); - - /** - * Instantiates a new a role authorization group. - * - * @param permissionSets the permission sets - */ - @SafeVarargs - protected AbstractRoleAuthorizationGroup(Set<Permission>... permissionSets) { - for (Set<Permission> permissionSet : permissionSets) { - for (Permission permission : permissionSet) { - fPermissions.put(permission.toString(), permission.isPermitted()); - } - } - } - - /** - * Adds the permission. - * - * @param permission the permission - */ - public final void addPermission(Permission permission) { - fPermissions.put(permission.toString(), permission.isPermitted()); - } - - /** - * Gets the name. - * - * @return the name - */ - public final String getName() { - return getRoleName(); - } - - /** - * Gets the role name. - * - * @return the role name - */ - public final String getRoleName() { - return this.getClass().getSimpleName(); - } - -// final public Map<String,Boolean> getPermissions() { // NOSONAR -// return fPermissions; // NOSONAR -// } // NOSONAR - - /** - * Gets the permission keys. - * - * @return the permission keys - */ -public final Set<String> getPermissionKeys() { - return fPermissions.keySet(); - } - - /** - * Exists permission keys. - * - * @param key the key - * @return true, if successful - */ - public final boolean existsPermissionKeys(String key) { - return fPermissions.containsKey(key); - } - - /** - * Gets the permission. - * - * @param key the key - * @return the permission - */ - public final boolean getPermission(String key) { - return fPermissions.get(key); - } - - /** - * Granted. - * - * @param group the group - * @param clas the clas - * @param actions the actions - * @return the sets the - */ - public static final Set<Permission> granted(Group group, String clas, Action... actions) { - Set<Permission> granted = new HashSet<>(); - // --- any default authorizations --- - if (group.hasDefaultAction()) { - granted.add(new Permission(group, clas, group.getDefaultAction())); - } - // --- if the ANY-authorization is given --- - if ((actions.length == 1) && actions[0].equals(Action.any)) { - for (Action anyAction : group.getAnyActions()) { - granted.add(new Permission(group, clas, anyAction)); - } - } - else { - // --- every authorization explizit --- - for (Action action : actions) { - granted.add(new Permission(group, clas, action)); - } - } - return granted; - } - - /** - * Granted. - * - * @param group the group - * @param clas the clas - * @param attribute the attribute - * @param actions the actions - * @return the sets the - */ - public static final Set<Permission> granted(Group group, String clas, String attribute, Action... actions) { - Set<Permission> granted = new HashSet<>(); - for (Action action : actions) { - // --- if the action has auto granted actions --- - if (action.hasAutoGrantedActions()) { - for (Action autoGrantedAction : action.getAutoGrantedActions()) { - granted.add(new Permission(Type.GRANT, group, clas, attribute, autoGrantedAction)); - } - } - // --- grant the action itself --- - granted.add(new Permission(Type.GRANT, group, clas, attribute, action)); - } - return granted; - } - - /** - * Denied. - * - * @param group the group - * @param clas the clas - * @param attribute the attribute - * @param actions the actions - * @return the sets the - */ - public static final Set<Permission> denied(Group group, String clas, String attribute, Action... actions) { - Set<Permission> denied = new HashSet<>(); - for (Action action : actions) { - // --- if the action has auto denied actions --- - if (action.hasAutoDeniedActions()) { - for (Action autoDeniedAction : action.getAutoDeniedActions()) { - denied.add(new Permission(Type.DENY, group, clas, attribute, autoDeniedAction)); - } - } - // --- deny the action itself --- - denied.add(new Permission(Type.DENY, group, clas, attribute, action)); - } - return denied; - } - -} diff --git a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/useraccess/IPermissionList.java b/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/useraccess/IPermissionList.java deleted file mode 100644 index 65130e9..0000000 --- a/org.eclipse.osbp.ui.api/src/org/eclipse/osbp/ui/api/useraccess/IPermissionList.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation - */ -package org.eclipse.osbp.ui.api.useraccess; - -import java.util.Collection; -import java.util.Set; - -// TODO: Auto-generated Javadoc -/** - * The Interface IPermissionList. - */ -public interface IPermissionList { - - /** The Constant NEGATIVE_POSTFIX. */ - public static final String NEGATIVE_POSTFIX = "_FALSE"; - - /** - * Sets the. - * - * @param roles the roles - * @param authorizationServices the authorization services - * @return the i permission list - */ - IPermissionList set(Collection<String> roles, AbstractAuthorization authorizationService); - - /** - * Gets the permissions. - * - * @return the permissions - */ - Set<String> getPermissions(); - -} |