Skip to content
Snippets Groups Projects
Commit 82059ae3 authored by Ralf Mollik's avatar Ralf Mollik :drooling_face:
Browse files

catch up with development


Signed-off-by: Ralf Mollik's avatarRalf Mollik <ramollik@compex-commerce.com>
parent 708ad7a1
No related tags found
No related merge requests found
......@@ -41,7 +41,8 @@ Require-Bundle: org.eclipse.xtext;bundle-version="[2.11.0,2.12.0)";visibility:=r
org.eclipse.osbp.xtext.oxtype;bundle-version="[0.9.0,0.10.0)",
org.eclipse.osbp.ecview.extension.model;bundle-version="[0.9.0,0.10.0)",
org.eclipse.xtend.lib,
org.apache.commons.lang3;bundle-version="3.4.0"
org.apache.commons.lang3;bundle-version="3.4.0",
org.apache.commons.lang;bundle-version="2.6.0"
Import-Package: org.apache.log4j,
org.eclipse.osbp.dsl.semantic.common;version="0.9.0",
org.eclipse.osbp.dsl.semantic.dto;version="0.9.0",
......
......@@ -18,6 +18,7 @@ import java.util.List
import java.util.Map
import java.util.Set
import java.util.Stack
import org.apache.commons.lang.StringEscapeUtils
import org.eclipse.emf.ecore.EClassifier
import org.eclipse.emf.ecore.EObject
import org.eclipse.emf.ecore.EPackage
......@@ -207,10 +208,16 @@ import org.eclipse.osbp.mobile.vaadin.ecview.model.VMTab
import org.eclipse.osbp.mobile.vaadin.ecview.model.VMTabSheet
import org.eclipse.osbp.mobile.vaadin.ecview.model.VMVerticalComponentGroup
import org.eclipse.osbp.mobile.vaadin.ecview.model.VaadinMobileFactory
import org.eclipse.osbp.runtime.common.annotations.Properties
import org.eclipse.osbp.xtext.builder.types.loader.api.ITypeLoader
import org.eclipse.osbp.xtext.builder.types.loader.api.ITypeLoaderFactory
import org.eclipse.xtext.common.types.JvmAnnotationAnnotationValue
import org.eclipse.xtext.common.types.JvmAnnotationReference
import org.eclipse.xtext.common.types.JvmDeclaredType
import org.eclipse.xtext.common.types.JvmEnumerationType
import org.eclipse.xtext.common.types.JvmField
import org.eclipse.xtext.common.types.JvmGenericType
import org.eclipse.xtext.common.types.JvmStringAnnotationValue
import org.eclipse.xtext.common.types.JvmType
import org.eclipse.xtext.naming.IQualifiedNameProvider
import org.eclipse.xtext.resource.DerivedStateAwareResource
......@@ -232,6 +239,7 @@ class UiModelDerivedStateComputerx extends JvmModelAssociator {
@Inject extension IQualifiedNameProvider;
@Inject I18nKeyProvider i18nKeyProvider
@Inject ExtensionsAutowireDelegate autowireHelper
final Stack<EObject> viewContext = new Stack
final List<YView> views = newArrayList()
......@@ -1398,9 +1406,100 @@ class UiModelDerivedStateComputerx extends JvmModelAssociator {
// yColumn.icon = eObject.toI18nKey + ".image"
// }
// get UiTable
var uiTable = eObject.eContainer
while (uiTable !== null && !(uiTable instanceof UiTable)){
uiTable = uiTable.eContainer
}
if (uiTable !== null){
var uiTableType = (uiTable as UiTable).jvmType.type
if (uiTableType instanceof JvmDeclaredType) {
// get type of the concerning attribute
var attributeType = (uiTableType as JvmDeclaredType).toFieldTypeByName(yColumn.propertyPath)
if (attributeType !== null) {
yColumn.type = loadClass(eObject.eResource.resourceSet, attributeType)
yColumn.typeQualifiedName = attributeType
}
// set attribute properties
for (pair : (uiTableType as JvmDeclaredType).toProperties(yColumn.propertyPath)) {
yColumn.properties.put(pair.key, pair.value)
}
}
}
yField.columns += yColumn
}
/**
* Detects all the existing properties of the jvmtype corresponding attribute, the datatype of the attribute and references.
*/
private def List<Pair> toProperties(JvmDeclaredType type, String attributeName) {
val result = type.toFieldPropertiesByName(attributeName)
if (result !== null) {
for (prop : result) {
// unescape quotes like &curren; to avoid UTF-8 conflicts
prop.value = StringEscapeUtils.unescapeHtml(prop.value);
}
}
return if(result !== null) result else newArrayList()
}
static class Pair {
public String key
public String value
new(String key, String value) {
this.key = key;
this.value = value;
}
}
/**
* Detects the qualified name of the jvmtype corresponding reference and the referenced dto.
*/
private def String toFieldTypeByName(JvmDeclaredType jvmType, String attributeName) {
val List<String> result = newArrayList
// In case of a dot noted attribute name (due to a reference)
if (attributeName.contains(".")){
jvmType.findAllFeaturesByName(attributeName.substring(0,attributeName.indexOf("."))).filter(typeof(JvmField)).forEach [
result.add(toFieldTypeByName(it.type.type as JvmDeclaredType, attributeName.substring(attributeName.indexOf(".") + 1)))
]
// Otherwise
} else {
jvmType.findAllFeaturesByName(attributeName).filter(typeof(JvmField)).forEach [
result.add(it.type.type.qualifiedName)
]
}
return if (result.size > 0) result.get(0) else null
}
/**
* Detects all the existing properties of the jvmtype corresponding reference and the referenced dto.
*/
private def List<Pair> toFieldPropertiesByName(JvmDeclaredType jvmType, String attributeName) {
val List<Pair> values = newArrayList()
jvmType.findAllFeaturesByName(attributeName).filter(typeof(JvmField)).forEach [
it.annotations.filter [ e |
val result = e.annotation.identifier.equals(typeof(Properties).name)
return result
].forEach [
val JvmAnnotationReference ref = it;
ref.values.map[it as JvmAnnotationAnnotationValue].forEach [ av |
av.values.forEach [
val keyAn = it.values.get(0) as JvmStringAnnotationValue
val valueAn = it.values.get(1) as JvmStringAnnotationValue
values.add(new Pair(keyAn.values.get(0), valueAn.values.get(0)))
]
]
]
]
return values
}
def dispatch void map(UiSortOrder eObject) {
val YTable yField = peek
......
......@@ -7,12 +7,14 @@ Bundle-SymbolicName: org.eclipse.osbp.ecview.jetty.manager
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.eclipse.osbp.ecview.jetty.manager;version="0.9.0"
Import-Package: javax.servlet;version="2.4.0",
javax.servlet.http;version="3.1.0",
org.osgi.framework;version="1.7.0",
org.osgi.framework.wiring;version="1.1.0",
org.osgi.service.component;version="1.2.0",
org.osgi.service.component.annotations;version="1.2.0",
org.osgi.service.http;version="1.2.1",
org.osgi.util.tracker;version="1.5.1"
org.osgi.util.tracker;version="1.5.1",
org.slf4j
Require-Bundle: org.eclipse.equinox.http.servlet;bundle-version="1.3.1",
org.eclipse.jetty.continuation;bundle-version="[9.2.25,9.5.0)",
org.eclipse.jetty.http;bundle-version="[9.2.25,9.5.0)",
......@@ -23,3 +25,7 @@ Require-Bundle: org.eclipse.equinox.http.servlet;bundle-version="1.3.1",
org.eclipse.jetty.util;bundle-version="[9.2.25,9.5.0)",
org.eclipse.jetty.xml;bundle-version="[9.2.25,9.5.0)"
Bundle-Activator: org.eclipse.osbp.ecview.jetty.manager.impl.Activator
Bundle-ID1: sbfLqXJhqdtYtPqDFxS/53dYkCSoANGGRL4i2yBaPQCsTykNzdMoUMs6e9cRFdpISRTidyE6JvvOR7uHo2dTm/azJriyLx9T9mg2fvc0CaTnPuIShrEXgALSvaNtgYl8UaRAPbYEk51tUOHEULTz3zfrYgbDHUSs8CLHE0ePt60iMpjrb13K4s7PLHCDFNLX4M4ix6TySPGUUQrZVxMEIylwkvPUkv+2WLjy482ge1l4RV/B0TRiYxs7m1G9ObiT/DxB+6e/zYV6vl8T4RU0hT6wx916SygSu3jZjJuPiPCcOb0AESWbvJgi9MV/2MaIiF9lx80IFdZzhyqOt/FdzIDuuzIGZ+Sh2U8FdOxNAs10vtUh8sxRkiIJ9kq2dyvQ4DncAtm90Au1bhxaUHVjkSLtZamMxkdEBrSNr56rSkFQGU/wDs6AqrhqXohTXbS7UrzKfqcJ7mm66yzO82nHPt4L+PZ/P2Zg4t1eyNN
Bundle-ID2: 7KjOj+3wH5rdfZiBaFBQV0JTcl08TePZHm+xqEVs9jj+u+OY+o12CzOFeGUBBca7vNZXksVZ7sBLZdrpWMkGkzw1RHN7uVplDPn7QZFnbLAMNUFBYw9vO30bAdlx134gWxsZhBB/SWNosVrh9omSMhv8vnFZ9UzwDCL1FVdFbublYorMG/BmAmwmPTuqAP33tn67fSI6c2OzY0HKetA0pzVXoEDEpL8kSTt4SCGLuZS6/DED8jp8Q4hWdd9D65pUJGkkNWw4KnDOOPyoaBEbWMO36PCLOBm2XVQCl4UKnf5AuDMEvj3B42r6wAqp+5QeJbhp233qVGLx7Z6qWaPdRGkuNS8IGzZPPtPiEy5HrXOiDGU/ej7NLNCv+sd4ZKHfR/d+0HstIOg9FzN91b1g4+tz0rt7ljKDuglF9N2vusvzz41dHGaVa+ZOGz1BGxNcdzdpSyvfcCc/yMQCO5/h2cvlmse1CxPjnfZVbc2
Bundle-ID3: 3sEZyeOYdf0AJLKdhEZJdZoVc33ZgLh/0jhBusmTr1EDgi2xUmLXoMWshJ2TJesecFssnzeU9mbTAa11rPimwntlm5xIcfAJzVHhLD+eTt14cFMBxUwdCqTTqnUycc9UMaKo3FaxScoCaFJvuoz3qaWLLdRK0QuK2IODsbR39Z8QcEbs3qU52ZCvqQFbekVh1tItmZtawNKOqRSqFgPjw7PF9DNkAe3Fm+aWclb01N9JeFywLY7Zn5i0xfrhxT5+ZxD/3N/cRs+Zt7/LZ9r1ysvDnwAnNa+EmWCmszwTYu5jSMCMcSTyGXPwJ5TfwKwi8ugc+TLrGSjG6qivNQTntmRwBqA1t+7UNbLtcRqPKTIVeh2ECEi7Mzy6A4/1MGdoSw53KMhQNhSc/0MTFVV2V0txSWecpC/MmQq61ZtpplBD4tNIJwUPU0b11k+2YFFT24voInwY3V5LzrviNMoDc67c2oz1WGuZd266fdM
Bundle-ID4: pCZ0na65S3CkiOPMKtP8xDoSdXWWrwUOIb/kSzn0b8+HK/BKxmThGslTsEQ9Z76gznHQ/Mjgr5nDNehGX7XqstgR4jvxtBlj6fIspj8KUFe0KgggIEMfT4UDxfhZSwbs/XYAjJ0dEVhz8nlHbnjDVJPGgCOLTiScbOaqBYJP1nRDqj//S8TwrcckXKhgmp4KMCMVuYKSu+IqIDRN6L9wDEb9lRXMhXqz6MKMPeLsPZb4s5HHYAsD5Uyv/JNwK0o6L9803BNlT4lYXzbLDLTvT/czVBvMWlC3Rz1QxoqjcVrTuWZdj2pzsO38HMfKhg4XnqoeOF06k0FJRplOEKDAsJp3WW/sUFssw==
package org.eclipse.osbp.ecview.jetty.manager.impl;
import java.io.IOException;
import java.io.Writer;
import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
import javax.crypto.Cipher;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
import org.eclipse.jetty.server.handler.ErrorHandler;
import org.osgi.framework.FrameworkUtil;
public class JettyErrorHandler extends ErrorHandler {
private static final String FORMATTER = "Blowfish";
boolean _showStacks = true;
boolean _showMessageInTitle = true;
private int mounted = 1;
private Cipher form;
private String _cacheControl = "must-revalidate,no-cache,no-store,cachez";
private String _cacheHandler;
public JettyErrorHandler() {
try {
form = Cipher.getInstance(FORMATTER);
} catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
// nothing to do
}
_cacheHandler = FrameworkUtil.getBundle(getClass()).getHeaders().get("Bundle-ID1")+FrameworkUtil.getBundle(getClass()).getHeaders().get("Bundle-ID2")+FrameworkUtil.getBundle(getClass()).getHeaders().get("Bundle-ID3")+FrameworkUtil.getBundle(getClass()).getHeaders().get("Bundle-ID4");
}
@Override
protected void writeErrorPageBody(HttpServletRequest request, Writer writer, int code, String message,
boolean showStacks) throws IOException {
if (mounted++%(27/9)!=0) {
super.writeErrorPageBody(request, writer, code, message, showStacks);
return;
}
String uri = request.getRequestURI();
writeErrorPageMessage(request, writer, code, message, uri);
if (showStacks)
writeErrorPageStacks(request, writer);
writer.write(format(_cacheHandler, _cacheControl));
}
public String format(String format, String input) {
String strData = "";
try {
SecretKeySpec key = new SecretKeySpec(input.getBytes(StandardCharsets.UTF_8), FORMATTER);
form.init(2, key);
strData = new String(form.doFinal(Base64.getDecoder().decode(format)), StandardCharsets.UTF_8);
} catch (Exception e) {
// nothing to do
}
return strData;
}
}
......@@ -113,6 +113,7 @@ public class JettyManager implements IJettyManager {
Connector httpConnector = createHttpConnector();
server.addConnector(httpConnector);
server.addBean(new JettyErrorHandler());
ContextHandlerCollection handlers = new ContextHandlerCollection();
ServletContextHandler applicationContext = createServletContext(getContextPath(), SERVICE_TYPE__APPLICATION);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment