catch up with development

Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
diff --git a/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/AbstractLayoutingStrategy.java b/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/AbstractLayoutingStrategy.java
index 72bbb4f..ec789f0 100644
--- a/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/AbstractLayoutingStrategy.java
+++ b/org.eclipse.osbp.ecview.extension.strategy/src/org/eclipse/osbp/ecview/extension/strategy/AbstractLayoutingStrategy.java
@@ -197,6 +197,8 @@
 
 	private static Map<String, Boolean> isSuspectEditable = new HashMap<>();
 
+	private static Map<String, Boolean> isSuspectVisible = new HashMap<>();
+
 	/** The Constant LOGGER. */
 	private static final Logger LOGGER = LoggerFactory.getLogger(AbstractLayoutingStrategy.class);
 
@@ -374,14 +376,14 @@
 		for (YSuspect suspect : suspectList) {
 			if (suspect.getGroupName() == null) {
 				String groupName = UNGROUPED;
-				if (suspect instanceof YTypedCompoundSuspect && !suspect.getTags().contains(TAG__BEANONTAB)) {
+				if (suspect instanceof YTypedCompoundSuspect && !suspect.getTags().contains(TAG__BEANONTAB) && isVisible(suspect)) {
 					groupName = suspect.getLabelI18nKey();
 				}
 				suspectMap.put(groupName, new ArrayList<YSuspect>());
 				if (!suspectGroupList.contains(groupName)) {
 					suspectGroupList.add(groupName);
 				}
-			} else {
+			} else if(isVisible(suspect)) {
 				suspectMap.put(suspect.getGroupName(), new ArrayList<YSuspect>());
 				if (!suspectGroupList.contains(suspect.getGroupName())) {
 					suspectGroupList.add(suspect.getGroupName());
@@ -391,11 +393,11 @@
 		for (YSuspect suspect : suspectList) {
 			if (suspect.getGroupName() == null) {
 				String groupName = UNGROUPED;
-				if (suspect instanceof YTypedCompoundSuspect && !suspect.getTags().contains(TAG__BEANONTAB)) {
+				if (suspect instanceof YTypedCompoundSuspect && !suspect.getTags().contains(TAG__BEANONTAB) && isVisible(suspect)) {
 					groupName = suspect.getLabelI18nKey();
 				}
 				suspectMap.get(groupName).add(suspect);
-			} else {
+			} else if(isVisible(suspect)){
 				suspectMap.get(suspect.getGroupName()).add(suspect);
 			}
 		}
@@ -1281,6 +1283,7 @@
 	 *            the y suspect
 	 * @return the y embeddable
 	 */
+	@SuppressWarnings("unchecked")
 	private YEmbeddable createEnumCombo(YSuspect ySuspect) {
 		LOGGER.trace("{}", "createEnumCombo");
 		YEmbeddable yEmbeddable;
@@ -1289,6 +1292,13 @@
 		YTypedSuspect yTypedSuspect = (YTypedSuspect) ySuspect;
 		yEnumCombo.setType(yTypedSuspect.getType());
 		yEnumCombo.setTypeQualifiedName(yTypedSuspect.getTypeQualifiedName());
+		
+		if(ySuspect.getProperties().containsKey("defaultLiteralName")){
+			String defaultLiteralName = ySuspect.getProperties().get("defaultLiteralName");
+			Enum<?> enumLitObj = Enum.valueOf((Class) yTypedSuspect.getType(), defaultLiteralName);
+			yEnumCombo.setDefaultLiteral(enumLitObj);
+		}
+		
 		return yEmbeddable;
 	}
 
@@ -1562,6 +1572,29 @@
 	}
 
 	/**
+	 * Helper class to determine if the component is visible due to the
+	 * existing user permissions
+	 */
+	private boolean isVisible(YSuspect ySuspect) {
+		LOGGER.trace("{}", "isVisible");
+		String dtoName = ySuspect.getAuthorizationGroup();
+		String dtoProperty = ySuspect.getAuthorizationId();
+		
+		Boolean result = false;
+		String grantKey = dtoName + "." + dtoProperty + "###VISIBLE";
+		if (isSuspectVisible.containsKey(grantKey)) {
+			result = isSuspectVisible.get(grantKey);
+		} else {
+			if (userAccessService.isGranted(Group.DTO, Action.READABLE, dtoName)) {
+				boolean invisible = userAccessService.isVetoed(Group.DTO, Action.INVISIBLE, dtoName, dtoProperty);
+				result = !invisible;
+			}
+			isSuspectVisible.put(grantKey, result);
+		}
+		return result;
+	}
+	
+	/**
 	 * Helper Comparator to allow to sort a list of suspects due to their table
 	 * or grid property value. Sort criteria is that the highest value became
 	 * the first of the list followed by the suspects with decreasing value. In