Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/EntityUtils.xtend6
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/IEntityIdModificationListenerView.java73
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/constants/GeneratorConstants.xtend30
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/constants/PathConstants.xtend23
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entityhelper/DataType.xtend24
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/ABaseMockEntity.java175
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/ABaseMockObject.java211
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/ABaseMockResource.java65
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/AEntityMockDataGenerator.java107
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/IEntityImportInitializationListener.java37
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/IEntityMockDataDbFiller.java42
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/IEntityMockDataGenerator.java59
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/Iterators.java147
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/MockedEntityDto.java40
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/FillerTextProvider.java686
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/FillerTextType.java162
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/provider/BaseProvider.java58
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/provider/DateProvider.java55
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/provider/TextConfigurator.java163
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/provider/TextProvider.java55
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/theme/EnumCssClass.java55
-rw-r--r--org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/xtext/GenericFormatter.xtend204
-rw-r--r--org.eclipse.osbp.utils/test/org/eclipse/osbp/utils/fillertext/test/FillerTextExample.java132
-rw-r--r--org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/common/EntityUtils.java24
-rw-r--r--org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/constants/GeneratorConstants.java41
-rw-r--r--org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/constants/PathConstants.java38
-rw-r--r--org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/entityhelper/DataType.java34
-rw-r--r--org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/xtext/GenericFormatter.java286
28 files changed, 70 insertions, 2962 deletions
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/EntityUtils.xtend b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/EntityUtils.xtend
index 1ec22ff..583580e 100644
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/EntityUtils.xtend
+++ b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/EntityUtils.xtend
@@ -163,10 +163,10 @@ class EntityUtils {
def static LEntity getEntityFromDto(JvmType type) {
var LEntity entity = null
try {
- var qualifiedDtoName = type.qualifiedName
- var resourceSet = type.eResource.resourceSet
+ var qualifiedDtoName = type?.qualifiedName
+ var resourceSet = type?.eResource?.resourceSet
val objectDescs = ServiceListener.getEObjectDescriptions(OSBPDtoPackage.Literals.LDTO, qualifiedDtoName)
- if (objectDescs.iterator.hasNext) {
+ if (objectDescs?.iterator.hasNext) {
val eobjectDesc = objectDescs.iterator.next
if (resourceSet !== null) {
var dto = resourceSet.getEObject(eobjectDesc.EObjectURI, true) as LDto
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/IEntityIdModificationListenerView.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/IEntityIdModificationListenerView.java
deleted file mode 100644
index 5e40d45..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/common/IEntityIdModificationListenerView.java
+++ /dev/null
@@ -1,73 +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.utils.common;
-
-import org.eclipse.osbp.eventbroker.EventBrokerMsg;
-
-
-public interface IEntityIdModificationListenerView {
-
- /**
- * Each time, the view is refreshed, the list of previous listened entity ids should be reseted!
- */
- public void resetListeningForEntityIdsModifications();
-
- /**
- * Each implementation should react on the refresh, due to modification of the entity and id,
- * in the correct way depending on the view context!
- * <br>
- * <b>Important:</b> If the view should be refreshed, call {@link #resetListeningForEntityIdsModifications()}!
- * @param entity name of the modified entity, all dots will be replaced by slash
- * @param id primary key of the modified entity
- */
- public void refreshViewDueToModifiedEntityId(String entity, Object id);
-
- /**
- * Add relevant entity name and primary key that are rendered inside this report,
- * so that any change of their entities can be listened!
- *
- * <b>If an entity wasn't rendered at this time, it can't be listened,
- * even if it will be contained after it's change the next time!</b>
- * @param entityName, all dots will be replaced by slash
- * @param primaryKey
- */
- public void addEntityIdToModifyListener(String entityName, Object primaryKey);
-
- /**
- * Remove relevant entity name and primary key that are rendered inside this report,
- * so that any change of their entities can be listened!
- *
- * <b>If an entity wasn't rendered at this time, it can't be listened,
- * even if it will be contained after it's change the next time!</b>
- * @param entityName, all dots will be replaced by slash
- * @param primaryKey
- */
- public void removeEntityIdFromModifyListener(String entityName, Object primaryKey);
-
- /**
- * checks for the event broker message if the sent entity id should do a refresh view
- * @param message
- * @param doRefresh if true, the refresh will be forced inside
- * @return true if it should do a refresh
- */
- public boolean checkOnModifiedEntityId(EventBrokerMsg message, boolean doRefresh);
-
- /**
- * checks for the event broker message if the sent entity id should do a refresh view
- * @param entityName, all dots will be replaced by slash
- * @param id
- * @param doRefresh if true, the refresh will be forced inside
- * @return true if it should do a refresh
- */
- public boolean checkOnModifiedEntityId(String entityName, Object id, boolean doRefresh);
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/constants/GeneratorConstants.xtend b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/constants/GeneratorConstants.xtend
deleted file mode 100644
index 28a14f8..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/constants/GeneratorConstants.xtend
+++ /dev/null
@@ -1,30 +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
- *
- *
- * This copyright notice shows up in the generated Java code
- *
- */
-
-package org.eclipse.osbp.utils.constants
-
-class GeneratorConstants {
- public final static val GENERATED_CLASSES_DOCUMENTATION ='''<b>This class was auto generated! Leave it unmodified to avoid unpredictable results!</b>'''
-
- public final static String I18N_RESOURCE_PATH_NAME = "i18n";
- private final static String I18N_RESOURCE_FILE_NAME = "I18N";
- private final static String I18N_RESOURCE_FILE_EXTENSION = ".properties";
- public final static String I18N_RESOURCE_FULL_FILE_NAME = I18N_RESOURCE_FILE_NAME+I18N_RESOURCE_FILE_EXTENSION;
- public final static String I18N_RESOURCE_FULL_PATH_NAME = I18N_RESOURCE_PATH_NAME+"/"+I18N_RESOURCE_FILE_NAME+I18N_RESOURCE_FILE_EXTENSION;
- public final static String I18N_RESOURCE_FULL_BUNDLE_NAME = I18N_RESOURCE_PATH_NAME+"."+I18N_RESOURCE_FILE_NAME;
-
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/constants/PathConstants.xtend b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/constants/PathConstants.xtend
deleted file mode 100644
index c663d12..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/constants/PathConstants.xtend
+++ /dev/null
@@ -1,23 +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
- *
- *
- * This copyright notice shows up in the generated Java code
- *
- */
-
-package org.eclipse.osbp.utils.constants
-
-class PathConstants {
- public final static val JS_PLUGIN_PREFIX ='''theme://plugin/'''
- public final static val COMPEX_UTILS_JS_PLUGIN_PATH ='''«JS_PLUGIN_PREFIX»org.eclipse.osbp.utils.js/org/eclipse/osbp/utils/js/'''
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entityhelper/DataType.xtend b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entityhelper/DataType.xtend
index 7c8491c..f0286f9 100644
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entityhelper/DataType.xtend
+++ b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entityhelper/DataType.xtend
@@ -30,6 +30,8 @@ import org.eclipse.osbp.ui.api.datamart.IDataMart.EType
import org.eclipse.xtext.common.types.JvmEnumerationType
import org.eclipse.xtext.common.types.JvmType
import org.eclipse.xtext.common.types.access.IJvmTypeProvider
+import org.eclipse.osbp.dsl.semantic.common.types.LAttribute
+import org.eclipse.xtext.common.types.JvmTypeReference
public class DataType {
@@ -42,7 +44,7 @@ public class DataType {
@Inject
IJvmTypeProvider.Factory typeProviderFactory
- def public LDataType getLDataType(LEntityAttribute attributeRef) {
+ def public LDataType getLDataType(LAttribute attributeRef) {
var type = attributeRef.type
var lDataType = null as LDataType
if (type instanceof LDataType) {
@@ -51,7 +53,7 @@ public class DataType {
return lDataType
}
- def public JvmType getJvmType(LEntityAttribute attributeRef) {
+ def public JvmType getJvmType(LAttribute attributeRef) {
var type = attributeRef.type
var lDataType = null as LDataType
var ltype = null as JvmType
@@ -75,7 +77,13 @@ public class DataType {
val typeProvider = getTypeProvider(attributeRef.eResource.resourceSet)
return typeProvider.findTypeByName(pkg.name + "." + type.name)
}
- var typeJvm = entityExtensions.toTypeReference(attributeRef)
+ var JvmTypeReference typeJvm = null
+ if (attributeRef instanceof LEntityAttribute) {
+ typeJvm = entityExtensions.toTypeReference(attributeRef)
+ } else {
+ typeJvm = entityExtensions.toTypeReference(attributeRef)
+ }
+
var typeJvmType = typeJvm.type
return typeJvmType
}
@@ -136,7 +144,7 @@ public class DataType {
return getBasicType(type.identifier)
}
- def public EType getBasicType(LEntityAttribute attribute) {
+ def public EType getBasicType(LAttribute attribute) {
var lDataType = getLDataType(attribute)
if (lDataType !== null) {
if (lDataType.date) {
@@ -147,12 +155,18 @@ public class DataType {
if (lDataType.properties.exists[it.key.toLowerCase.equals("blob")]){
return EType.BLOPMAPPING
}
+ if (lDataType.properties.exists[it.value.toLowerCase.equals("richtextarea")]){
+ return EType.RICHTEXTAREA
+ }
}
// Otherwise entity attribute is defined as Blob
if (!attribute.properties.isNullOrEmpty) {
- if (lDataType.properties.exists[it.key.toLowerCase.equals("blob")]){
+ if (attribute.properties.exists[it.key.toLowerCase.equals("blob")]){
return EType.BLOPMAPPING
}
+ if (attribute.properties.exists[it.value.toLowerCase.equals("richtextarea")]){
+ return EType.RICHTEXTAREA
+ }
}
if ("blobMapping".equalsIgnoreCase(lDataType.name)) {
return EType.BLOPMAPPING
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/ABaseMockEntity.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/ABaseMockEntity.java
deleted file mode 100644
index eb8e0a5..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/ABaseMockEntity.java
+++ /dev/null
@@ -1,175 +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.utils.entitymock;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-
-import org.eclipse.osbp.dsl.common.datatypes.IDto;
-import org.eclipse.osbp.dsl.dto.lib.impl.DtoServiceAccess;
-import org.eclipse.osbp.dsl.dto.lib.services.IDTOService;
-import org.eclipse.osbp.dsl.dto.lib.services.Query;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class ABaseMockEntity<E> extends ABaseMockObject {
-
- private final static Logger log = LoggerFactory.getLogger(ABaseMockEntity.class);
-
- protected static boolean asBoolean(Object value) {
- return (value instanceof Boolean) ? (Boolean)value : (value == null) ? false : Boolean.parseBoolean(value.toString());
- }
-
- protected static Date asDate(Object value) {
- return (value instanceof Date) ? (Date)value : null;
- }
-
- protected static double asDouble(Object value) {
- if (value instanceof Double) {
- return (Double)value;
- }
- else if (value instanceof Float) {
- return (Float)value;
- }
- else if (value == null) {
- return 0.0;
- }
- return Double.parseDouble(value.toString());
- }
-
- protected static float asFloat(Object value) {
- if (value instanceof Float) {
- return (Float)value;
- }
- else if (value == null) {
- return (float)0.0;
- }
- return Float.parseFloat(value.toString());
- }
-
- protected static long asLong(Object value) {
- if (value instanceof Long) {
- return (Long)value;
- }
- else if (value instanceof Integer) {
- return (Integer)value;
- }
- else if (value instanceof Short) {
- return (Short)value;
- }
- else if (value == null) {
- return 0;
- }
- return Long.parseLong(value.toString());
- }
-
- protected static int asInt(Object value) {
- if (value instanceof Integer) {
- return (Integer)value;
- }
- else if (value instanceof Short) {
- return (Short)value;
- }
- else if (value == null) {
- return 0;
- }
- return Integer.parseInt(value.toString());
- }
-
- protected static short asShort(Object value) {
- if (value instanceof Short) {
- return (Short)value;
- }
- else if (value == null) {
- return 0;
- }
- return Short.parseShort(value.toString());
- }
-
-// protected static Time asTime(Object value) {
-// return (value instanceof Date) ? (Date)value : null;
-// }
-
- protected static String asString(Object value) {
- return (value == null) ? null : value.toString();
- }
-
- protected final AEntityMockDataGenerator mockDataGenerator;
- protected final String persistenceUnit;
-
- protected E entity;
-
- public ABaseMockEntity(AEntityMockDataGenerator mockDataGenerator, String persistenceUnit) {
- this.mockDataGenerator = mockDataGenerator;
- this.persistenceUnit = persistenceUnit;
- }
-
- public final String getPersistenceUnit() {
- return persistenceUnit;
- }
-
- public abstract E generateEntity(Object iteratorItem);
-
- protected final void generateAttribute(String key, Class<IDto> dtoClass, double optionalFor) {
- String mockEntityName = "Existing"+dtoClass.getSimpleName();
- if (mockDataGenerator.getMockObjects(mockEntityName) == null) {
- List<Object> existingDtos = new ArrayList<>();
- try {
- IDTOService dtoService = (IDTOService) DtoServiceAccess.getService(dtoClass);
- if (dtoService == null) {
- log.error("NO DTO SERVICE FOUND for "
- + dtoClass.getCanonicalName()
- + " in persistence " + persistenceUnit);
- }
- else {
- Query queryAll = new Query();
- Collection<?> dtoObjects = dtoService.find(queryAll);
- for (Object dtoObject : dtoObjects) {
- existingDtos.add(dtoObject);
- }
- }
- }
- catch (Exception e) {
- log.error("could not retrieve existing entities via dto service for "+dtoClass.getCanonicalName(), e);
- }
- mockDataGenerator.addMockObjects(mockEntityName, existingDtos);
- }
- generateAttribute(key, mockEntityName, optionalFor);
- }
-
- protected final void generateAttribute(String key, String mockEntityName, double optionalFor) {
- Object[] mockObjects = mockDataGenerator.getMockObjects(mockEntityName).toArray();
- // --- no objects are available ---
- if (mockObjects.length < 1) {
- mockData.put(key, null);
- }
- // --- if at least 100% have to be optional, EVERYTHING is optional ---
- else if (optionalFor >= 1.0) {
- mockData.put(key, null);
- }
- // --- if up to 0% have to be optional, EVERYTHING is mandatory ---
- else if (optionalFor <= 0.0) {
- mockData.put(key, mockObjects[fillerProvider.unsignedinteger(mockObjects.length-1)]);
- }
- // --- if a random is lower than the given optionalFor, this item is optional ---
- else if (fillerProvider.unsigneddouble(0) < optionalFor*100.0) {
- mockData.put(key, null);
- }
- // --- otherwise
- else {
- mockData.put(key, mockObjects[fillerProvider.unsignedinteger(mockObjects.length-1)]);
- }
- }
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/ABaseMockObject.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/ABaseMockObject.java
deleted file mode 100644
index 1ae0919..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/ABaseMockObject.java
+++ /dev/null
@@ -1,211 +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.utils.entitymock;
-
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.commons.lang3.StringUtils;
-import org.eclipse.osbp.dsl.common.datatypes.IDto;
-
-import org.eclipse.osbp.utils.fillertext.FillerTextProvider;
-
-public abstract class ABaseMockObject {
-
- protected final FillerTextProvider fillerProvider;
- protected Map<String,Object> mockData;
-
- public ABaseMockObject() {
- FillerTextProvider fillerProvider;
- try {
- fillerProvider = FillerTextProvider.get(Locale.getDefault());
- }
- catch (Exception e) {
- fillerProvider = null;
- e.printStackTrace();
- }
- this.fillerProvider = fillerProvider;
- }
-
- public final Object getAttribute(String... keys) {
- return mockData.get(StringUtils.join(keys, "."));
- }
-
- public final Object getAttribute(String key, AEntityMockDataGenerator mockDataGenerator, String peristenceUnit) {
- Object mockValue = mockData.get(key);
- if ((mockValue == null) && (mockDataGenerator instanceof AEntityMockDataGenerator)) {
- String[] keys = key.split("\\.", 2);
- if (keys.length == 2) {
- mockValue = mockData.get(keys[0]);
- if (mockValue instanceof IDto) {
- mockValue = mockDataGenerator.getDtoAttribute((IDto)mockValue, keys[1]);
- }
- else {
- mockValue = null;
- }
- }
- }
- return mockValue;
- }
-
- public final Set<String> getAttributeNames() {
- return mockData.keySet();
- }
-
- public final ABaseMockObject generateData() {
- fillerProvider.reset();
- try {
- generateDataRow();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- replaceDigits();
- replaceVariables();
- return this;
- }
-
- protected final void replaceDigits() {
- for (String key : mockData.keySet()) {
- Object value = mockData.get(key);
- if (value instanceof String) {
- if (((String)value).contains("#")) {
- try {
- mockData.put(key, fillerProvider.numerify((String)value));
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- }
-
- protected final void replaceVariables() {
- Pattern possibleVariable = Pattern.compile("(\\[.*\\])");
- boolean again = false;
- do {
- again = false;
- for (String key : mockData.keySet()) {
- Object value = mockData.get(key);
- if (value instanceof String) {
- boolean replaced = false;
- String text = (String) value;
- try {
- Matcher m = possibleVariable.matcher(text);
- while (m.find()) {
- String replace = m.group();
- String with = replace.substring(1, replace.length()-2);
- if (mockData.containsKey(with)) {
- with = mockData.get(with).toString();
- text = text.replaceAll(replace, with);
- replaced = true;
- }
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- if (replaced) {
- mockData.put(key, text);
- again = true;
- }
- }
- }
- } while (again);
- }
-
- protected abstract void generateDataRow();
-
- protected final void reset() {
- mockData = new TreeMap<String,Object>();
- }
-
- protected final void setFixAttribute(String key, Object value) {
- mockData.put(key, value);
- }
-
- protected final void generateAttribute(String key, String sourceKey) {
- mockData.put(key, mockData.get(sourceKey));
- }
-
- protected final void generateAttribute(String key, Object[] values) {
- mockData.put(key, values[fillerProvider.unsignedinteger(values.length-1)]);
- }
-
- protected final void generateAttribute(String key, String whenKey, Map valuesMap) {
- Object[] values = (Object[]) valuesMap.get(mockData.get(whenKey));
- if ((values == null) || values.length == 0) {
- mockData.put(key, null);
- }
- else {
- mockData.put(key, values[fillerProvider.unsignedinteger(values.length-1)]);
- }
- }
-
- protected final void generateAttribute(String key, double[] values) {
- mockData.put(key, values[fillerProvider.unsignedinteger(values.length-1)]);
- }
-
- protected final void generateSignedAttribute(String key, int decimals, double beginRange, double endRange, double rounded) {
- mockData.put(key, fillerProvider.signeddouble(decimals, beginRange, endRange, rounded));
- }
-
- protected final void generateUnsignedAttribute(String key, int decimals, double beginRange, double endRange, double rounded) {
- mockData.put(key, fillerProvider.signeddouble(decimals, beginRange, endRange, rounded));
- }
-
- protected final void generateAttribute(String key, int[] values) {
- mockData.put(key, values[fillerProvider.unsignedinteger(values.length-1)]);
- }
-
- protected final void generateSignedAttribute(String key, int beginRange, int endRange, double rounded) {
- mockData.put(key, fillerProvider.signedinteger(beginRange, endRange, rounded));
- }
-
- protected final void generateUnsignedAttribute(String key, int beginRange, int endRange, double rounded) {
- mockData.put(key, fillerProvider.signedinteger(beginRange, endRange, rounded));
- }
-
- protected final void generateAttribute(String key, ABaseMockObject subObject) {
- subObject.reset();
- subObject.generateData();
- for (String subkey : subObject.mockData.keySet()) {
- mockData.put(key+"."+subkey, subObject.mockData.get(subkey));
- }
- }
-
- protected final void generateBooleanAttribute(String key) {
- mockData.put(key, fillerProvider.trueOrFalse());
- }
-
- protected final void generateDateAttribute(String key, int pastYears, int futureYears) {
- mockData.put(key, fillerProvider.date(pastYears, futureYears));
- }
-
- protected final void generateParagraphsAttribute(String key, int count) {
- mockData.put(key, fillerProvider.paragraphs(count));
- }
-
- protected final void generateSentencesAttribute(String key, int count) {
- mockData.put(key, fillerProvider.sentences(count));
- }
-
- protected final void generateWordsAttribute(String key, int count) {
- mockData.put(key, fillerProvider.words(count));
- }
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/ABaseMockResource.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/ABaseMockResource.java
deleted file mode 100644
index 97e3154..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/ABaseMockResource.java
+++ /dev/null
@@ -1,65 +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.utils.entitymock;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public abstract class ABaseMockResource extends ABaseMockObject {
-
- protected Set<String> mockDataRows;
- protected List<String> mockAttributes;
-
- public ABaseMockResource() {
- mockDataRows = new HashSet<String>();
- mockAttributes = new ArrayList<String>();
- mockData = new HashMap<String, Object>();
- }
-
- public void setAttributes(String... attributes) {
- mockAttributes.clear();
- for (String attribute : attributes) {
- mockAttributes.add(attribute);
- }
- }
-
- public void addDataRow(String key, String... datarow) {
- mockDataRows.add(key);
- for (int i=0; i<mockAttributes.size(); i++) {
- if (i<datarow.length) {
- mockData.put(key+"."+mockAttributes.get(i), datarow[i]);
- }
- else {
- mockData.put(key+"."+mockAttributes.get(i), "");
- }
- }
- }
-
- public Set<String> getDataRows() {
- return new HashSet<>(mockDataRows);
- }
-
- public Set<String> getAttributes() {
- return new HashSet<>(mockAttributes);
- }
-
- public final Object getAttribute(String dataRow, String attribute) {
- return mockData.get(dataRow+"."+attribute);
- }
-
- protected void generateDataRow() {
- }
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/AEntityMockDataGenerator.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/AEntityMockDataGenerator.java
deleted file mode 100644
index db08e26..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/AEntityMockDataGenerator.java
+++ /dev/null
@@ -1,107 +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.utils.entitymock;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.osbp.dsl.common.datatypes.IDto;
-
-public abstract class AEntityMockDataGenerator extends ABaseMockObject implements IEntityMockDataGenerator {
-
- @Override
- public int compareTo(IEntityMockDataGenerator o) {
- if (getRunWithPriority() != o.getRunWithPriority()) {
- return (new Integer(getRunWithPriority())).compareTo((new Integer(o.getRunWithPriority())));
- }
- else {
- return getClass().getCanonicalName().compareTo(o.getClass().getCanonicalName());
- }
- }
-
- protected Map<MockedEntityDto,List<Object>> mockDataClassMap;
- protected Map<String,List<Object>> mockDataNamedMap;
- protected Map<IDto,Map<String,Object>> dtoMockDataMap;
-
- @Override
- public int getRunWithPriority() {
- return DEFAULT_PRIORITY;
- }
-
- protected void initialize() {
- mockDataClassMap = new LinkedHashMap<MockedEntityDto,List<Object>>();
- mockDataNamedMap = new LinkedHashMap<String,List<Object>>();
- dtoMockDataMap = new LinkedHashMap<IDto,Map<String,Object>>();
- }
-
- public void addDtoMockData(IDto dto, Map<String,Object> mockData) {
- dtoMockDataMap.put(dto, mockData);
- }
-
- public Object getDtoAttribute(IDto dto, String key) {
- Object value = null;
- Map<String,Object> mockData = dtoMockDataMap.get(dto);
- if (mockData != null) {
- value = mockData.get(key);
- }
- return value;
- }
-
- protected final String getClassMapIndex(Class<?> forClass, String persistenceUnit) {
- return forClass.getCanonicalName()+"@"+persistenceUnit;
- }
-
- protected List<Object> getMockObjects(Class<?> forClass, String persistenceUnit) {
- for (MockedEntityDto key : mockDataClassMap.keySet()) {
- if (key.equals(forClass, persistenceUnit)) {
- return mockDataClassMap.get(key);
- }
- }
- return null;
- }
-
- protected List<Object> getMockObjects(String mockEntityName) {
- return mockDataNamedMap.get(mockEntityName);
- }
-
- protected void addMockObjects(String mockEntityName, List<Object> objects) {
- mockDataNamedMap.put(mockEntityName, objects);
- }
-
- protected void addMockObjects(String mockEntityName, Class<?> forClass, String persistenceUnit, List<Object> addList) {
- List<Object> targetList;
- targetList = getMockObjects(forClass, persistenceUnit);
- if (targetList == null) {
- targetList = new ArrayList<>(addList);
- mockDataClassMap.put(new MockedEntityDto(forClass, persistenceUnit), targetList);
- }
- else {
- targetList.addAll(addList);
- }
- targetList = getMockObjects(mockEntityName);
- if (targetList == null) {
- targetList = new ArrayList<>(addList);
- mockDataNamedMap.put(mockEntityName, targetList);
- }
- else {
- targetList.addAll(addList);
- }
- }
-
- @Deprecated
- protected final void generateDataRow() {
- }
-
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/IEntityImportInitializationListener.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/IEntityImportInitializationListener.java
deleted file mode 100644
index 2e9f0bf..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/IEntityImportInitializationListener.java
+++ /dev/null
@@ -1,37 +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.utils.entitymock;
-
-/**
- * Interface, that each Entity import initialization provider should call regularly,
- * that may be called on startup via the entity mock generator.
- * <br>
- *
- */
-public interface IEntityImportInitializationListener {
- /**
- * Notify initialization step.
- *
- * @param stepTitle the step title
- * @param addSteps the add steps
- * @param progressOfStep the initial progress of step
- * @param count count of actual - sub - step
- * @param total total count of actual - sub - step
- */
- public void notifyInitializationStep(String stepTitle, double progressOfStep, double sizeOfSubProgress, int count, int total);
-
- /**
- * @return the size of count, after which a new notification should be sent
- */
- public int getInitializationSubStepNotifySize();
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/IEntityMockDataDbFiller.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/IEntityMockDataDbFiller.java
deleted file mode 100644
index da70641..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/IEntityMockDataDbFiller.java
+++ /dev/null
@@ -1,42 +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.utils.entitymock;
-
-
-/**
- * Interface, that each Entity Mock Data DB Filler has to implement
- */
-public interface IEntityMockDataDbFiller extends IEntityImportInitializationListener {
-
- /**
- * Set a filter for Entity Mock Data Generators to be used.<br>
- * comma separated and full canonical class names<br>
- * Empty, null => no Entity Mock Data Generator is allowed
- * "*" => every Entity Mock Data Generator is allowed
- */
- public void setMockDataGeneratorFilter(String filter);
-
- /**
- * Trigger filling of the DB with Entity Mock data
- */
- public void triggerDbFill();
-
- /**
- * Notify initialization step.
- *
- * @param stepTitle the step title
- * @param addSteps the add steps
- * @param progressOfStep the progress of step
- */
- public void notifyInitializationStep(String stepTitle, int addSteps, double progressOfStep);
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/IEntityMockDataGenerator.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/IEntityMockDataGenerator.java
deleted file mode 100644
index 1820209..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/IEntityMockDataGenerator.java
+++ /dev/null
@@ -1,59 +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.utils.entitymock;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.osbp.persistence.IPersistenceService;
-
-/**
- * Interface, that each Entity (DTO) Mock Generator has to implement
- */
-public interface IEntityMockDataGenerator extends Comparable<IEntityMockDataGenerator> {
-
- final static int DEFAULT_PRIORITY = 10;
-
- /**
- * The priority can be set in the entitymock model from 1 (highest) to 9 (almost lowest).<br>
- * If is not explicit set, it's default value is 10 (lowest).
- * @return the priority, this generator should run, compared to other generators
- */
- public int getRunWithPriority();
-
- /**
- * Run any datainterchanges references by the mock generator
- * @param persistenceService
- */
- public void runDataInterchanges(IPersistenceService persistenceService, IEntityMockDataDbFiller entityMockDbFiller);
-
- /**
- * Generate entity DTO mock data objects, depending on the base .entitymock DSL instance.<br>
- * The map key holds a MockedEntityDto instance, which holds both the entity DTO class - for example <code>org.eclipse.osbp.foodmart.dtos.McustomerDto.class</code> - and the target persistence unit.<br>
- * The map value is a list with generated entity DTO objects, in the example above instances of <code>org.eclipse.osbp.foodmart.dtos.McustomerDto</code>
- * @return the map and list of generated entity DTO objects
- */
- public Map<MockedEntityDto,List<Object>> getMockData(IEntityMockDataDbFiller entityMockDbFiller);
-
- /**
- * Gets the number of data interchange steps.
- * @return the data interchange steps
- */
- public int getDataInterchangeSteps();
-
- /**
- * Gets the number of entity mock steps.
- * @return the entity mock steps
- */
- public int getEntityMockSteps();
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/Iterators.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/Iterators.java
deleted file mode 100644
index f951c4a..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/Iterators.java
+++ /dev/null
@@ -1,147 +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.utils.entitymock;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-public class Iterators {
-
- public static class IntegerIterator extends Iterators implements Iterator<Integer> {
- private final int until;
- private final int step;
- private int position;
-
- public IntegerIterator(int from, int until) {
- this(from, until, 1);
- }
-
- public IntegerIterator(int from, int until, int step) {
- if (until < from) {
- int swap = until;
- until = from;
- from = swap;
- }
- if (step < 1) {
- step = 1;
- }
- this.until = until;
- this.step = step;
- position = from-step;
- }
-
- @Override
- public boolean hasNext() {
- return position < until;
- }
-
- @Override
- public Integer next() {
- if (!hasNext()) {
- throw new NoSuchElementException();
- }
- position += step;
- return position;
- }
- }
-
- public static class DateIterator extends Iterators implements Iterator<Date> {
- private final Calendar until;
- private final int stepCount;
- private final int stepType;
- private Calendar position;
-
- private static Date toDate(String text) {
- text = text.toLowerCase();
- Calendar date = Calendar.getInstance();
- if (text.equals("yesterday")) {
- date.add(Calendar.DAY_OF_YEAR, -1);
- }
- else if (text.equals("today")) {
- }
- else if (text.equals("tomorrow")) {
- date.add(Calendar.DAY_OF_YEAR, 1);
- }
- else {
- String[] tokens = text.split("-");
- try {
- if (tokens.length == 3) {
- date.set(
- Integer.parseInt(tokens[0]),
- Integer.parseInt(tokens[1])-1,
- Integer.parseInt(tokens[2]));
- }
- }
- catch (Exception e) {
- System.err.println(e.getLocalizedMessage());
- }
- }
- return date.getTime();
- }
-
- private static int toStepType(String text) {
- switch (text.toLowerCase().charAt(0)) {
- case 'y': return Calendar.YEAR;
- case 'm': return Calendar.MONTH;
- case 'w': return Calendar.WEEK_OF_YEAR;
- }
- return Calendar.DAY_OF_YEAR;
- }
-
- public DateIterator(String from, String until) {
- this(toDate(from), toDate(until), 1, Calendar.DAY_OF_YEAR);
- }
-
- public DateIterator(Date from, Date until) {
- this(from, until, 1, Calendar.DAY_OF_YEAR);
- }
-
- public DateIterator(String from, String until, int stepCount, String stepType) {
- this(toDate(from), toDate(until), 1, toStepType(stepType));
- }
-
- public DateIterator(Date from, Date until, int stepCount, int stepType) {
- if (until.before(from)) {
- Date swap = until;
- until = from;
- from = swap;
- }
- if (stepCount < 1) {
- stepCount = 1;
- }
- this.until = Calendar.getInstance();
- this.until.setTime(until);
- this.stepCount = stepCount;
- this.stepType = stepType;
- position = Calendar.getInstance();
- position.setTime(from);
- position.add(stepType, -stepCount);
- }
-
- @Override
- public boolean hasNext() {
- return position.before(until);
- }
-
- @Override
- public Date next() {
- if (!hasNext()) {
- throw new NoSuchElementException();
- }
- position.add(stepType, stepCount);
- return position.getTime();
- }
- }
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/MockedEntityDto.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/MockedEntityDto.java
deleted file mode 100644
index 8c36cce..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/entitymock/MockedEntityDto.java
+++ /dev/null
@@ -1,40 +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.utils.entitymock;
-
-public class MockedEntityDto {
-
- private final Class<?> entityDtoClass;
- private final String persistenceUnit;
-
- public static final String getClassMapIndex(Class<?> forClass, String persistenceUnit) {
- return forClass.getCanonicalName()+"@"+persistenceUnit;
- }
-
- public MockedEntityDto(Class<?> entityDtoClass, String persistenceUnit) {
- this.entityDtoClass = entityDtoClass;
- this.persistenceUnit = persistenceUnit;
- }
-
- public Class<?> getEntityDtoClass() {
- return entityDtoClass;
- }
-
- public String getPersistenceUnit() {
- return persistenceUnit;
- }
-
- public boolean equals(Class<?> forClass, String persistenceUnit) {
- return getClassMapIndex(forClass, persistenceUnit).equals(getClassMapIndex(this.entityDtoClass, this.persistenceUnit));
- }
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/FillerTextProvider.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/FillerTextProvider.java
deleted file mode 100644
index 091180e..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/FillerTextProvider.java
+++ /dev/null
@@ -1,686 +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.utils.fillertext;
-
-import java.sql.Date;
-import java.sql.Time;
-import java.util.HashMap;
-import java.util.Locale;
-
-import org.eclipse.osbp.utils.fillertext.provider.BaseProvider;
-import org.eclipse.osbp.utils.fillertext.provider.DateProvider;
-import org.eclipse.osbp.utils.fillertext.provider.TextProvider;
-import org.joda.time.DateTime;
-
-/**
- * Provides filler texts (german: Blindtext) for different data types,
- * depending on the locale set.
- * <br><br>
- * <b><u><i>Filler text</i> vs. <i>Mock object</i></u></b><br>
- * There is an essential difference between <i>Filler text</i> and <i>Mock object</i>!
- * <ul>
- * <li><b><a href="https://en.wikipedia.org/wiki/Filler_text">Filler text</a> (german: <a href="https://de.wikipedia.org/wiki/Blindtext">Blindtext</a>)</b><br>
- * [...] (also placeholder text or dummy text) is text that shares some characteristics of a real written text, but <b>is random or otherwise generated</b>. It may be used to display a sample of fonts, generate text for testing, or to spoof an e-mail spam filter. The process of using filler text is sometimes called Greeking, although <b>the text itself may be nonsense</b>, or largely Latin, as in Lorem ipsum.[...]<br>
- * [...] Mit Hilfe des Blindtextes kann die Verteilung des Textes auf der Seite (Layout oder Satzspiegel) sowie Lesbarkeit und Platzbedarf der verwendeten Schriftarten (Typografie) beurteilt werden. Er <b>besteht aus einer mehr oder minder sinnlosen Folge von Wörtern, oft auch nur aus wortähnlichen Silbenfolgen</b>. Ein bekanntes Beispiel dafür ist das „lateinische“ Lorem ipsum.[...]
- * </li>
- * <li><b><a href="https://en.wikipedia.org/wiki/Mock_object">Mock object</a> (german: <a href="https://de.wikipedia.org/wiki/Mock-Objekt">Mock-Objekt</a>)</b><br>
- * [...] are <b>simulated objects that mimic the behavior of real objects in controlled ways</b>. A programmer typically creates a mock object to test the behavior of some other object, in much the same way that a car designer uses a crash test dummy to simulate the dynamic behavior of a human in vehicle impacts.[...]<br>
- * [...] implementieren die Schnittstellen, über die das zu testende Objekt auf seine Umgebung zugreift. Sie <b>stellen sicher, dass die erwarteten Methodenaufrufe vollständig, mit den korrekten Parametern und in der erwarteten Reihenfolge durchgeführt werden</b>. Das Mock-Objekt liefert keine Echtdaten zurück, sondern <b>vorher zum Testfall passend festgelegte Werte</b>. Das Mock-Objekt kann somit dazu verwendet werden, <b>ein bestimmtes Verhalten nachzustellen</b>.[...]
- * </li>
- * </ul>
- */
-public class FillerTextProvider {
-
- private static HashMap<Locale, FillerTextProvider> sProviders = new HashMap<>();
- private final BaseProvider fBaseProducer;
- private final DateProvider fDateProducer;
- private final TextProvider fTextProducer;
- private final Locale fLocale;
-
- /**
- * Get the provider for the given locale. The provider will be cached!
- * @see #destroy()
- * @param locale
- * @return the provider
- */
- public static FillerTextProvider get(Locale locale) {
- FillerTextProvider provider = sProviders.get(locale);
- if (provider == null) {
- provider = new FillerTextProvider(locale);
- sProviders.put(locale, provider);
- }
- return provider;
- }
-
- private FillerTextProvider(Locale locale) {
- fLocale = locale;
- fBaseProducer = new BaseProvider();
- fDateProducer = new DateProvider(fBaseProducer);
- fTextProducer = new TextProvider(fBaseProducer, fLocale);
- }
-
- /**
- * The provider is removed from the cache
- * @see #get(Locale)
- */
- public void destroy() {
- sProviders.remove(this);
- }
-
- /**
- * The provider uses some internal objects to return consistent filled text,
- * for example first, last, full name and email.<br>
- * To force the provider to generate new internal objects, call {@link #reset()}!<br>
- * This could be necessary, if more than one data row has to be generated.
- */
- public void reset() {
-// fPerson = null;
- }
-
- /**
- * generate a filled text for the given {@link javax.sql.Types}
- * @see #generate(FillerTextType, Object...)
- * @param type any supported java.sql.Types
- * @param params
- * @return the generated filler text object
- */
- public Object generate(int type, Object...params) {
- return generate(FillerTextType.typeFor(type), params);
- }
-
- /**
- * generate a filled text for the given type string
- * @see #generate(FillerTextType, Object...)
- * @param type string, can be any <u>case insensitive</u> name of {@link FillerTextType}
- * @param params
- * @return the generated filler text object
- */
- public Object generate(String type, Object...params) {
- return generate(FillerTextType.typeFor(type), params);
- }
-
- /**
- * generate a filled text for the given {@link FillerTextType}
- * @param type
- * @param params, see source code and the corresponding methods for supported paramaters
- * @return the generated filler text object
- */
- public Object generate(FillerTextType type, Object...params) {
- if ((params.length == 1) && (params[0] instanceof Object[])) {
- params = (Object[]) params[0];
- }
- switch(type) {
- case TIMESTAMP:
- return timestamp(params);
- case DATE:
- return date(params);
- case TIME:
- return time();
- case SIGNEDINTEGER:
- return signedinteger(params);
- case UNSIGNEDINTEGER:
- return unsignedinteger(params);
- case SIGNEDDOUBLE:
- case SIGNEDDECIMAL:
- return signeddouble(params);
- case UNSIGNEDDOUBLE:
- case UNSIGNEDDECIMAL:
- return unsigneddouble(params);
- case TRUEORFALSE:
- return trueOrFalse();
- case BLOB:
- case PARAGRAPH:
- if ((params.length == 1) && (params[0] instanceof Integer)) {
- return paragraphs((int) params[0]);
- }
- else {
- return paragraph();
- }
- case OTHER:
- case SENTENCE:
- if ((params.length == 1) && (params[0] instanceof Integer)) {
- return sentences((int) params[0]);
- }
- else {
- return sentence();
- }
- case WORD:
- case TEXT:
- default:
- if ((params.length == 1) && (params[0] instanceof Integer)) {
- return words((int) params[0]);
- }
- else {
- return word();
- }
- }
- }
-
- /**
- * @see FillerTextType#UNSIGNEDINTEGER
- * @param params may be<ul>
- * <li>none - generate an unsigned (positive) integer in the range 0..100</li>
- * <li>(int)max - generate an unsigned (positive) integer in the range 0..max; same as {@link #unsignedinteger(int)}</li>
- * <li>(int)min,(int)max - generate an unsigned (positive) integer in the range min..max; same as {@link #unsignedinteger(int, int)}</li>
- * <li>(int)min,(int)max,(int)round - generate an unsigned (positive) integer in the range min..max rounding to round; same as {@link #unsignedinteger(int, int, int)}</li>
- * </ul>
- * @return the generated filler text object
- */
- public int unsignedinteger(Object...params) {
- if ((params.length == 1) && (params[0] instanceof Object[])) {
- params = (Object[]) params[0];
- }
- int length = 0;
- while ((params.length > length) && (params[length] instanceof Integer)) {
- length++;
- }
- switch (length) {
- case 0:
- return unsignedinteger(100);
- case 1:
- return unsignedinteger((int)params[0]);
- case 2:
- return unsignedinteger((int)params[0], (int)params[1]);
- case 3:
- default:
- return unsignedinteger((int)params[0], (int)params[1], (int)params[2]);
- }
- }
-
- /**
- * @see FillerTextType#UNSIGNEDINTEGER
- * @param max - generate an unsigned (positive) integer in the range 0..max
- * @return the generated filler text object
- */
- public int unsignedinteger(int max) {
- return unsignedinteger(0, Math.max(0, max));
- }
-
- /**
- * generate an unsigned (positive) integer in the range min..max
- * @see FillerTextType#UNSIGNEDINTEGER
- * @param min
- * @param max
- * @return the generated filler text object
- */
- public int unsignedinteger(int min, int max) {
- return unsignedinteger(min, max, 1);
- }
-
- /**
- * generate an unsigned (positive) integer in the range min..max
- * @see FillerTextType#UNSIGNEDINTEGER
- * @param min
- * @param max
- * @param round
- * @return the generated filler text object
- */
- public int unsignedinteger(int min, int max, int round) {
- int result = fBaseProducer.randomBetween(Math.min(min, max), Math.max(min, max));
- if (round > 1) {
- result = ((result + round/2) / round) * round;
- }
- return result;
- }
-
- /**
- * @see FillerTextType#SIGNEDINTEGER
- * @param params may be<ul>
- * <li>none - generate a signed (positive or negative) integer in the range -100..100</li>
- * <li>(int)max - generate a signed (positive or negative) integer in the range -max..max; same as {@link #signedinteger(int)}</li>
- * <li>(int)min,(int)max - generate a signed (positive or negative) integer in the range min..max; same as {@link #signedinteger(int, int)}</li>
- * <li>(int)min,(int)max,(int)round - generate an unsigned (positive) integer in the range min..max rounding to round; same as {@link #signedinteger(int, int, int)}</li>
- * </ul>
- * @return the generated filler text object
- */
- public int signedinteger(Object...params) {
- if ((params.length == 1) && (params[0] instanceof Object[])) {
- params = (Object[]) params[0];
- }
- int length = 0;
- while ((params.length > length) && (params[length] instanceof Integer)) {
- length++;
- }
- switch (length) {
- case 0:
- return signedinteger(100);
- case 1:
- return signedinteger((int)params[0]);
- case 2:
- return signedinteger((int)params[0], (int)params[1]);
- case 3:
- default:
- return signedinteger((int)params[0], (int)params[1], (int)params[2]);
- }
- }
-
- /**
- * @see FillerTextType#SIGNEDINTEGER
- * @param max - generate a signed (positive or negative) integer in the range -max..max
- * @return the generated filler text object
- */
- public int signedinteger(int range) {
- return signedinteger(-Math.abs(range), Math.abs(range));
- }
-
- /**
- * generate a signed (positive or negative) integer in the range min..max
- * @see FillerTextType#SIGNEDINTEGER
- * @param min
- * @param max
- * @return the generated filler text object
- */
- public int signedinteger(int min, int max) {
- return signedinteger(min, max, 1);
- }
-
- /**
- * generate a signed (positive or negative) integer in the range min..max
- * @see FillerTextType#SIGNEDINTEGER
- * @param min
- * @param max
- * @param round, must be positive
- * @return the generated filler text object
- */
- public int signedinteger(int min, int max, int round) {
- int result = fBaseProducer.randomBetween(Math.min(min, max), Math.max(min, max));
- if (round > 1) {
- result = ((result + round/2) / round) * round;
- }
- return result;
- }
-
- /**
- * @see FillerTextType#UNSIGNEDDOUBLE
- * @param params may be<ul>
- * <li>none - generate an unsigned (positive) double in the range 0.00..100.00 with two decimal digits</li>
- * <li>(int)decimals - generate an unsigned (positive) double in the range 0.00..100.00 with (decimal) decimal digits; same as {@link #unsigneddouble(int)}</li>
- * <li>(int)decimals,(double)max - generate an unsigned (positive) double in the range 0..max with (decimal) decimal digits; same as {@link #unsigneddouble(int,double)}</li>
- * <li>(int)decimals,(double)min,(double)max - generate an unsigned (positive) double in the range min..max with (decimal) decimal digits; same as {@link #unsigneddouble(int,double,double)}</li>
- * <li>(int)decimals,(double)min,(double)max,(double)round - generate an unsigned (positive) double in the range min..max with (decimal) decimal digits rounding; same as {@link #unsigneddouble(int,double,double,double)}</li>
- * </ul>
- * @return the generated filler text object
- */
- public double unsigneddouble(Object...params) {
- if ((params.length == 1) && (params[0] instanceof Object[])) {
- params = (Object[]) params[0];
- }
- int length = 0;
- int decimals = 2;
- if ((params.length > 0) && (params[0] instanceof Integer)) {
- decimals = (int)params[0];
- while ((params.length > length+1) && (params[length+1] instanceof Double)) {
- length++;
- }
- }
- switch (length) {
- case 0:
- return unsigneddouble(decimals);
- case 1:
- return unsigneddouble(decimals, (double)params[1]);
- case 2:
- return unsigneddouble(decimals, (double)params[1], (double)params[2]);
- case 3:
- default:
- return unsigneddouble(decimals, (double)params[1], (double)params[2], (double)params[3]);
- }
- }
-
- /**
- * @see FillerTextType#UNSIGNEDDOUBLE
- * @param decimals - generate an unsigned (positive) double in the range 0.00..100.00 with (decimal) decimal digits
- * @return the generated filler text object
- */
- public double unsigneddouble(int decimals) {
- return unsigneddouble(decimals, 100);
- }
-
- /**
- * generate an unsigned (positive) double in the range 0..max with (decimal) decimal digits
- * @see FillerTextType#UNSIGNEDDOUBLE
- * @param decimals
- * @param max
- * @return the generated filler text object
- */
- public double unsigneddouble(int decimals, double max) {
- return unsigneddouble(decimals, 0, Math.max(0, max));
- }
-
- /**
- * generate an unsigned (positive) double in the range min..max with (decimal) decimal digits
- * @see FillerTextType#UNSIGNEDDOUBLE
- * @param decimals
- * @param min
- * @param max
- * @return the generated filler text object
- */
- public double unsigneddouble(int decimals, double min, double max) {
- return unsigneddouble(decimals, min, max, 0.0);
- }
-
- /**
- * generate an unsigned (positive) double in the range min..max with (decimal) decimal digits
- * @see FillerTextType#UNSIGNEDDOUBLE
- * @param decimals
- * @param min
- * @param max
- * @param round; must be > 0.0
- * @return the generated filler text object
- */
- public double unsigneddouble(int decimals, double min, double max, double round) {
- double factor = Math.pow(10.0, Math.max(0, decimals));
- double result = fBaseProducer.randomBetween(Math.min(min, max), Math.max(min, max));
- if (round > 0.0) {
- result = Math.round((result + round/2) / round) * round;
- }
- return Math.rint (result * factor) / factor;
- }
-
- /**
- * @see FillerTextType#SIGNEDDOUBLE
- * @param params may be<ul>
- * <li>none - generate a signed (positive or negative) double in the range 0.00..100.00 with two decimal digits</li>
- * <li>(int)decimals - generate a signed (positive or negative) double in the range 0.00..100.00 with (decimal) decimal digits; same as {@link #signeddouble(int)}</li>
- * <li>(int)decimals,(double)max - generate signed (positive or negative) double in the range 0..max with (decimal) decimal digits; same as {@link #signeddouble(int,double)}</li>
- * <li>(int)decimals,(double)min,(double)max - generate a signed (positive or negative) double in the range min..max with (decimal) decimal digits; same as {@link #signeddouble(int,double,double)}</li>
- * <li>(int)decimals,(double)min,(double)max,(double)round - generate an signed (positive or negative) double in the range min..max with (decimal) decimal digits rounding; same as {@link #signeddouble(int,double,double,double)}</li>
- * </ul>
- * @return the generated filler text object
- */
- public double signeddouble(Object...params) {
- if ((params.length == 1) && (params[0] instanceof Object[])) {
- params = (Object[]) params[0];
- }
- int length = 0;
- int decimals = 2;
- if ((params.length > 0) && (params[0] instanceof Integer)) {
- decimals = (int)params[0];
- while ((params.length > length+1) && (params[length+1] instanceof Double)) {
- length++;
- }
- }
- switch (length) {
- case 0:
- return signeddouble(decimals);
- case 1:
- return signeddouble(decimals, (double)params[1]);
- case 2:
- return signeddouble(decimals, (double)params[1], (double)params[2]);
- case 3:
- default:
- return signeddouble(decimals, (double)params[1], (double)params[2], (double)params[3]);
- }
- }
-
- /**
- * @see FillerTextType#SIGNEDDOUBLE
- * @param decimals - generate a signed (positive or negative) double in the range 0.00..100.00 with (decimal) decimal digits
- * @return the generated filler text object
- */
- public double signeddouble(int decimals) {
- return signeddouble(decimals, 100);
- }
-
- /**
- * generate signed (positive or negative) double in the range 0..max with (decimal) decimal digits
- * @see FillerTextType#SIGNEDDOUBLE
- * @param decimals
- * @param max
- * @return the generated filler text object
- */
- public double signeddouble(int decimals, double range) {
- return signeddouble(decimals, -Math.abs(range), Math.abs(range));
- }
-
- /**
- * generate a signed (positive or negative) double in the range min..max with (decimal) decimal digits
- * @see FillerTextType#SIGNEDDOUBLE
- * @param decimals
- * @param max
- * @param min
- * @return the generated filler text object
- */
- public double signeddouble(int decimals, double min, double max) {
- return signeddouble(decimals, min, max, 0.0);
- }
-
- /**
- * generate a signed (positive or negative) double in the range min..max with (decimal) decimal digits
- * @see FillerTextType#SIGNEDDOUBLE
- * @param decimals
- * @param max
- * @param min
- * @param round; must be > 0.0
- * @return the generated filler text object
- */
- public double signeddouble(int decimals, double min, double max, double round) {
- double factor = Math.pow(10.0, Math.max(0, decimals));
- double result = fBaseProducer.randomBetween(Math.min(min, max), Math.max(min, max));
- if (round > 0.0) {
- result = Math.round((result + round/2) / round) * round;
- }
- return Math.rint (result * factor) / factor;
- }
-
- /**
- * @see FillerTextType#TRUEORFALSE
- * @return the generated filler text object
- */
- public Boolean trueOrFalse() {
- return fBaseProducer.trueOrFalse();
- }
-
- /**
- * @see FillerTextType#TIMESTAMP
- * @param params may be<ul>
- * <li>none - same as {@link #timestamp(int)} with parameter 0</li>
- * <li>(int)yearsToPastOrInFuture - generate a timestamp with a range of years from now; same as {@link #timestamp(int)}</li>
- * <li>(int)from,(int)to - generate a timestamp between two years including both years; same as {@link #timestamp(int, int)}</li>
- * </ul>
- * @return the generated filler text object
- */
- public DateTime timestamp(Object...params) {
- if ((params.length == 1) && (params[0] instanceof Object[])) {
- params = (Object[]) params[0];
- }
- int length = 0;
- while ((params.length > length) && (params[length] instanceof Integer)) {
- length++;
- }
- switch (length) {
- case 0:
- return timestamp(0);
- case 1:
- return timestamp((int) params[0]);
- case 2:
- default:
- return timestamp((int) params[0], (int) params[1]);
- }
- }
-
- /**
- * generate a timestamp between two years including both years
- * @see FillerTextType#TIMESTAMP
- * @param from may be<ul>
- * <li>either a year after 1900</li>
- * <li>otherwise it will be interpreted as an offset to the actual year</li>
- * </ul>
- * @param to may be<ul>
- * <li>either a year after 1900</li>
- * <li>otherwise it will be interpreted as an offset to the actual year</li>
- * </ul>
- * @return the generated filler text object
- */
- public DateTime timestamp(int from, int to) {
- if (from < 1900) {
- from += DateTime.now().getYear();
- }
- if (to < 1900) {
- to += DateTime.now().getYear();
- }
- return fDateProducer.randomDateBetweenYears(Math.min(from, to), Math.max(from, to));
- }
-
- /**
- * generate a timestamp with a range of years from now
- * @see FillerTextType#TIMESTAMP
- * @param yearsToPastOrInFuture may be<ul>
- * <li>0, then a timestamp inside the actual year will be generated
- * <li>negative, then a timestamp in the yearsToPastOrInFuture years before now = past will be generated
- * <li>postive, then a timestamp in the yearsToPastOrInFuture years before now = will be generated
- * </ul>
- * @return the generated filler text object
- */
- public DateTime timestamp(int yearsToPastOrInFuture) {
- if (yearsToPastOrInFuture == 0) {
- return timestamp(0, 0);
- }
- else if (yearsToPastOrInFuture < 0) {
- return fDateProducer.randomDateInThePast(-yearsToPastOrInFuture);
- }
- else {
- return fDateProducer.randomDateInTheFuture(yearsToPastOrInFuture);
- }
- }
-
- /**
- * @see FillerTextType#DATE
- * @param params may be<ul>
- * <li>none - same as {@link #date(int)} with parameter 0</li>
- * <li>(int)yearsToPastOrInFuture - generate a date with a range of years from now; same as {@link #date(int)}</li>
- * <li>(int)from,(int)to - generate a date between two years including both years; same as {@link #date(int, int)}</li>
- * </ul>
- * @return the generated filler text object
- */
- @SuppressWarnings("deprecation")
- public Date date(Object...params) {
- DateTime dt = timestamp(params);
- return (new Date(dt.getYear()-1900, dt.getMonthOfYear()-1, dt.getDayOfMonth()));
- }
-
- /**
- * generate a date (without time) between two years including both years
- * @see FillerTextType#DATE
- * @param from may be<ul>
- * <li>either a year after 1900</li>
- * <li>otherwise it will be interpreted as an offset to the actual year</li>
- * </ul>
- * @param to may be<ul>
- * <li>either a year after 1900</li>
- * <li>otherwise it will be interpreted as an offset to the actual year</li>
- * </ul>
- * @return the generated filler text object
- */
- @SuppressWarnings("deprecation")
- public Date date(int from, int to) {
- DateTime dt = timestamp(from, to);
- return (new Date(dt.getYear()-1900, dt.getMonthOfYear()-1, dt.getDayOfMonth()));
- }
-
- /**
- * generate a date (without time) with a range of years from now
- * @see FillerTextType#DATE
- * @param yearsToPastOrInFuture may be<ul>
- * <li>0, then a date inside the actual year will be generated
- * <li>negative, then a date in the yearsToPastOrInFuture years before now = past will be generated
- * <li>postive, then a date in the yearsToPastOrInFuture years before now = will be generated
- * </ul>
- * @return the generated filler text object
- */
- @SuppressWarnings("deprecation")
- public Date date(int yearsToPastOrInFuture) {
- DateTime dt = timestamp(yearsToPastOrInFuture);
- return (new Date(dt.getYear()-1900, dt.getMonthOfYear()-1, dt.getDayOfMonth()));
- }
-
- /**
- * generate a time (without date)
- * @see FillerTextType#TIME
- * @return the generated filler text object
- */
- @SuppressWarnings("deprecation")
- public Time time() {
- DateTime dt = fDateProducer.randomDateInThePast(1);
- return (new Time(dt.getHourOfDay(), dt.getMinuteOfHour(), dt.getSecondOfMinute()));
- }
-
- /**
- * @see FillerTextType#PARAGRAPH
- * @return the generated filler text object, containing one paragraph
- */
- public String paragraph() {
- return fTextProducer.paragraph(1);
- }
-
- /**
- * @see FillerTextType#PARAGRAPH
- * @param count 0 uses the internal default count value
- * @return the generated filler text object, containing count paragraph(s)
- */
- public String paragraphs(int count) {
- if (count > 0) {
- return fTextProducer.paragraph(count);
- }
- else {
- return paragraph();
- }
- }
-
- /**
- * @see FillerTextType#SENTENCE
- * @return the generated filler text object, containing one sentence
- */
- public String sentence() {
- return fTextProducer.sentence(1);
- }
-
- /**
- * @see FillerTextType#SENTENCE
- * @param count 0 uses the internal default count value
- * @return the generated filler text object, containing count sentence(s)
- */
- public String sentences(int count) {
- if (count > 0) {
- return fTextProducer.sentence(count);
- }
- else {
- return sentence();
- }
- }
-
- /**
- * @see FillerTextType#WORD
- * @return the generated filler text object, containing one word
- */
- public String word() {
- return fTextProducer.word(1);
- }
-
- /**
- * @see FillerTextType#WORD
- * @param count 0 uses the internal default count value
- * @return the generated filler text object, containing count word(s)
- */
- public String words(int count) {
- if (count > 0) {
- return fTextProducer.word(count);
- }
- else {
- return word();
- }
- }
-
- public String numerify(String numberString) {
- return fBaseProducer.numerify(numberString);
- }
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/FillerTextType.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/FillerTextType.java
deleted file mode 100644
index cba7ea1..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/FillerTextType.java
+++ /dev/null
@@ -1,162 +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.utils.fillertext;
-
-import java.sql.Time;
-import java.sql.Types;
-import java.sql.Date;
-
-import org.joda.time.DateTime;
-
-public enum FillerTextType {
- /** simple text */
- TEXT(Types.CHAR, String.class),
- /** timestamp or date & time */
- TIMESTAMP(Types.TIMESTAMP, DateTime.class),
- /** signed (positive) integer */
- SIGNEDINTEGER(Types.INTEGER, Integer.class),
- /** unsigned (positive or negative) integer */
- UNSIGNEDINTEGER(Types.INTEGER, Integer.class),
- /** date without time */
- DATE(Types.DATE, Date.class),
- /** time without date */
- TIME(Types.TIME, Time.class),
- /** boolean */
- TRUEORFALSE(Types.BOOLEAN, Boolean.class),
- /** signed (positive) double */
- SIGNEDDOUBLE(Types.DOUBLE, Double.class),
- /** unsigned (positive or negative) double */
- UNSIGNEDDOUBLE(Types.DOUBLE, Double.class),
-// JAVA_OBJECT(Types.JAVA_OBJECT),
-// BINARY(Types.BINARY),
- /** any other tex */
- OTHER(Types.OTHER, TEXT),
- /** any other text */
- BLOB(Types.BLOB, TEXT),
- /** signed (positive) double */
- SIGNEDDECIMAL(Types.DECIMAL, SIGNEDDOUBLE),
- /** unsigned (positive or negative) double */
- UNSIGNEDDECIMAL(Types.DECIMAL, UNSIGNEDDOUBLE),
- //
- /** word(s) */
- WORD(TEXT),
- /** sentence(s) */
- SENTENCE(TEXT),
- /** paragraph(s) */
- PARAGRAPH(TEXT),
-// /** localized first name */
-// FIRSTNAME(TEXT),
-// /** localized last name */
-// LASTNAME(TEXT),
-// /** localized full name = first & last name */
-// FULLNAME(TEXT),
-// /** localized email containing first & last name */
-// EMAIL(TEXT),
-// /** localized postal code */
-// POSTALCODE(TEXT),
-// /** localized city */
-// CITY(TEXT),
-// /** localized phone number */
-// PHONE(TEXT),
-// /** localized phone number */
-// GENDER_MALE(Types.BOOLEAN, Boolean.class),
- ;
-
- private final int fSqlType;
- private final FillerTextType fParentType;
- private final Class<?> fObjectClass;
-
- private FillerTextType(int sqlType, Class<?> objectClass) {
- this(sqlType, objectClass, null);
- }
-
- private FillerTextType(FillerTextType parentType) {
- this(0, null, parentType);
- }
-
- private FillerTextType(int sqlType, FillerTextType parentType) {
- this(sqlType, null, parentType);
- }
-
- private FillerTextType(int sqlType, Class<?> objectClass, FillerTextType parentType) {
- fSqlType = sqlType;
- fObjectClass = objectClass;
- fParentType = parentType;
- }
-
- /**
- * @param object to be checked, if it is compatible to the corresponding class
- * @return true/false
- */
- public boolean instanceOf(Object object) {
- if (fParentType == null) {
- return fObjectClass.isInstance(object);
- }
- else {
- return fParentType.instanceOf(object);
- }
- }
-
- /**
- * @return the corresponding {@link java.sql.Types}
- */
- public int getSqlType() {
- if (fParentType == null) {
- return fSqlType;
- }
- else {
- return fParentType.getSqlType();
- }
- }
-
- /**
- * @return the returning class
- */
- public Class<?> getObjectClass() {
- if (fParentType == null) {
- return fObjectClass;
- }
- else {
- return fParentType.getObjectClass();
- }
- }
-
- /**
- * @param name <u>case insensitive</u> name to searched for
- * @return the corresponding {@link FillerTextType}
- */
- public static FillerTextType typeFor(String name) {
- for (FillerTextType type : values()) {
- if (name.equalsIgnoreCase(type.toString())) {
- return type;
- }
- }
- return OTHER.fParentType;
- }
-
- /**
- * @param sqlType the {@link java.sql.Types} to be searched for
- * @return the <u>first</u> corresponding {@link FillerTextType}
- */
- public static FillerTextType typeFor(int sqlType) {
- for (FillerTextType type : values()) {
- if (type.fSqlType == sqlType) {
- while (type.fParentType != null) {
- type = type.fParentType;
- }
- return type;
- }
- }
- return OTHER.fParentType;
- }
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/provider/BaseProvider.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/provider/BaseProvider.java
deleted file mode 100644
index 257436f..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/provider/BaseProvider.java
+++ /dev/null
@@ -1,58 +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.utils.fillertext.provider;
-
-import java.util.Random;
-
-public class BaseProvider {
-
- private final Random fRandom;
-
- public BaseProvider() {
- fRandom = new Random();
- }
-
- public boolean trueOrFalse() {
- return fRandom.nextBoolean();
- }
-
- public int randomBetween(int min, int max) {
- int range = max - min + 1;
- int randomInt = range > 0 ? fRandom.nextInt(range) : 0;
- return min + randomInt;
- }
-
- public long randomBetween(long min, long max) {
- long range = (max - min) + 1;
- return min + (long) (fRandom.nextDouble() * range);
- }
-
- public double randomBetween(double min, double max) {
- double range = max - min;
- double randomDouble = range > 0 ? fRandom.nextDouble() * range : 0;
- return min + randomDouble;
- }
-
- public String numerify(String numberString) {
- String result = "";
- for (int i=0; i < numberString.length(); i++) {
- if (numberString.charAt(i) == '#') {
- result += '0'+randomBetween(0, 9);
- }
- else {
- result += numberString.charAt(i);
- }
- }
- return result;
- }
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/provider/DateProvider.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/provider/DateProvider.java
deleted file mode 100644
index 7042e3c..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/provider/DateProvider.java
+++ /dev/null
@@ -1,55 +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.utils.fillertext.provider;
-
-import org.joda.time.DateTime;
-
-public class DateProvider {
-
- private final BaseProvider fBaseProvider;
-
- public DateProvider(BaseProvider baseProvider) {
- fBaseProvider = baseProvider;
- }
-
- public DateTime randomDateInThePast(int yearsToPast) {
- DateTime now = DateTime.now();
- return randomDateBetweenTwoDates(
- firstDayOfYear(now.getYear()-yearsToPast),
- now
- );
- }
-
- public DateTime randomDateInTheFuture(int yearsInFuture) {
- DateTime now = DateTime.now();
- return randomDateBetweenTwoDates(
- now,
- new DateTime(firstDayOfYear(now.getYear()+yearsInFuture+1).getMillis() - 1)
- );
- }
-
- public DateTime randomDateBetweenYears(int startYear, int endYear) {
- return randomDateBetweenTwoDates(
- firstDayOfYear(startYear),
- new DateTime(firstDayOfYear(endYear+1).getMillis() - 1)
- );
- }
-
- private DateTime firstDayOfYear(int year) {
- return new DateTime(year, 1, 1, 0, 0);
- }
-
- private DateTime randomDateBetweenTwoDates(DateTime from, DateTime to) {
- return new DateTime(fBaseProvider.randomBetween(from.getMillis(), to.getMillis()));
- }
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/provider/TextConfigurator.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/provider/TextConfigurator.java
deleted file mode 100644
index b85de05..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/provider/TextConfigurator.java
+++ /dev/null
@@ -1,163 +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.utils.fillertext.provider;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-public class TextConfigurator {
-
- private Locale locale;
- private String alphabet = "abcdefghijklmnopqrstuvwxyz";
- private String loremipsum = "";
- private String text = "";
- private Set<String> words = null;
- private Set<String> sentences = null;
- private Set<String> paragraphs = null;
-
- private static final Locale DEFAULT = Locale.ENGLISH;
- private static final Map<Locale,String> ALPHABETS = new HashMap<Locale, String> ();
- private static final Map<Locale,String> LOREM_IPSUMS = new HashMap<Locale, String> ();
-
- static {
- ALPHABETS.put(Locale.ENGLISH, "abcdefghijklmnopqrstuvwxyz");
- ALPHABETS.put(Locale.GERMAN, "abcdefghijklmnopqrstuvwxyzäöüß");
- ALPHABETS.put(Locale.FRENCH, "abcdefghijklmnopqrstuvwxyzáàâéè");
-
- LOREM_IPSUMS.put(Locale.ENGLISH,
- "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean suscipit ullamcorper ipsum, at varius leo sagittis ut. Morbi varius nisl non eleifend imperdiet. Integer porttitor arcu sit amet elit rhoncus, eget bibendum felis mattis. Aenean nec accumsan metus. Fusce venenatis ipsum nec accumsan varius. Suspendisse vitae nisi cursus, pretium nulla id, tincidunt urna. Aenean porttitor lacus nec sapien commodo laoreet. Praesent tristique sagittis felis ut porta. Nam non diam urna. Nullam nec lorem iaculis, elementum elit ut, malesuada urna. Donec ac erat interdum, porta mi a, porttitor risus.\r\n"+
- "Phasellus vulputate molestie mattis. Donec lobortis nisl sit amet nunc venenatis fermentum. Nam accumsan dignissim cursus. Nullam ornare tristique dui tempor tincidunt. Aenean a dignissim erat. Fusce lacinia mauris sit amet ante convallis sodales. Sed eleifend posuere dui. Curabitur venenatis aliquam ex, vitae rhoncus quam scelerisque id. Quisque egestas diam urna, eget fringilla tortor tristique ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.\r\n"+
- "Maecenas volutpat ipsum vel pellentesque eleifend. Aenean felis lectus, consectetur vel lacinia nec, scelerisque a ex. Etiam placerat finibus odio, a mollis lorem congue in. Nullam laoreet nec odio eu venenatis. Sed convallis velit pulvinar, vestibulum neque sit amet, ultricies arcu. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut sit amet ex sit amet massa semper bibendum in id est.\r\n"+
- "In nulla velit, laoreet vitae bibendum eget, pulvinar sit amet arcu. Nunc fermentum metus at dui condimentum, id sodales elit vehicula. Vivamus consequat finibus felis, sed accumsan urna faucibus sit amet. Suspendisse at sagittis diam. Donec fermentum risus sed dignissim auctor. Phasellus vel est diam. Donec venenatis neque eget ex tempus ornare. Duis tellus magna, pharetra sit amet dui eu, interdum mollis ante. Maecenas malesuada pulvinar metus, quis posuere dui egestas in. Fusce quis lacus facilisis, feugiat eros a, accumsan ante. In et quam pharetra, varius mauris nec, commodo urna.\r\n"+
- "Nullam vel fermentum lectus. Sed vel mauris at sapien dictum sodales. Fusce a tristique tellus. Sed vel pulvinar odio. Nunc ut libero at nunc molestie consequat. Vivamus facilisis varius quam non vestibulum. Nullam volutpat interdum ipsum eu lacinia. Ut a ullamcorper neque. Morbi vulputate felis viverra lacinia blandit. In gravida, enim eu eleifend fermentum, lacus augue rutrum velit, vitae lacinia metus augue a neque.\r\n"+
- "Nulla in nulla dolor. Donec ac velit mollis nunc scelerisque pharetra. Phasellus id nisl et arcu eleifend commodo eget nec elit. Vestibulum at diam quam. Quisque vestibulum in erat vitae lacinia. Phasellus et iaculis dui. Quisque justo risus, feugiat et facilisis ut, sagittis ut sem.\r\n"+
- "Cras pretium nisl orci, vel blandit erat vestibulum in. Vestibulum vitae arcu consequat sem viverra consectetur eu a velit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus et ullamcorper felis, id luctus dolor. Vestibulum eu nulla et mi fermentum ultricies et in neque. Nam sollicitudin leo neque, vel efficitur massa dictum vitae. Praesent eget posuere est.\r\n"+
- "Integer eros leo, tincidunt a facilisis ut, imperdiet efficitur erat. Vivamus at nibh nulla. Etiam nisl orci, convallis quis metus sed, tincidunt aliquet nisl. Morbi posuere vehicula neque, lacinia pulvinar metus egestas nec. Nulla sodales mauris eget tellus sagittis porttitor. Aenean sed nunc id odio pharetra mattis quis ut purus. Sed sem velit, tempus vitae luctus eget, ullamcorper at odio. Etiam elit ipsum, iaculis non cursus at, elementum a augue. Ut sollicitudin fermentum lorem, in vestibulum ligula sodales sodales. Mauris sed sem pellentesque, bibendum lacus in, egestas justo. Etiam sit amet dui purus. Praesent et gravida purus. Aenean auctor tempus viverra. Quisque in sem id arcu consectetur eleifend. Cras at lorem in libero consectetur mollis id posuere justo. Sed finibus mauris nec metus fringilla luctus.\r\n"+
- "Nulla sagittis tortor id cursus auctor. Vivamus sagittis convallis metus, sed semper elit ultrices eu. Praesent sodales ante vitae nibh suscipit, nec accumsan felis euismod. Nulla at orci venenatis, semper magna vitae, rhoncus libero. Nunc ut consequat quam. Aenean dictum nibh eu lorem accumsan commodo. Praesent egestas aliquam velit, nec varius arcu sodales quis. Sed lobortis tellus nunc, eget suscipit dolor consequat a. Quisque laoreet consequat nisl, at rhoncus sem cursus feugiat. Suspendisse id ipsum at tellus rutrum facilisis. Nullam nec massa nec urna tincidunt ornare. In magna est, sagittis fringilla tempus eget, tempus sed eros. Proin elementum porta gravida.\r\n"+
- "Donec non lorem quis orci egestas semper a sed arcu. Donec vestibulum maximus mollis. Vestibulum vel lorem vel justo semper euismod. Nam pellentesque odio a odio varius molestie. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Mauris dapibus nibh et ornare pulvinar. Curabitur eget aliquet risus. Etiam sed pretium nulla. Duis sapien ipsum, lobortis non eros in, tristique hendrerit turpis.\r\n"+
- "Cras pharetra ac diam id viverra. Vivamus sit amet ex eleifend, volutpat ligula et, ullamcorper elit. Ut dignissim mollis elit, non eleifend felis pharetra quis. Proin pretium, est eu pharetra semper, ipsum ex volutpat felis, ut iaculis elit tortor eget est. Curabitur ut ullamcorper orci, in finibus massa. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed sed lacinia massa, sed dapibus velit. Donec eget bibendum purus. Sed suscipit ultricies accumsan. Aenean pellentesque facilisis felis, in lacinia mauris faucibus ac. Nunc mauris diam, posuere sed ullamcorper vitae, pharetra vel nisi. Nunc vehicula urna massa, vitae ultrices ex luctus sed.\r\n"+
- "Etiam pellentesque posuere leo, ac pellentesque justo. Pellentesque laoreet ipsum id nunc volutpat, ut consequat felis vestibulum. Nullam iaculis augue est, eu mattis ante condimentum non. Pellentesque quis tristique libero. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed a ipsum a odio pharetra egestas nec sit amet sem. Integer quis aliquam lectus.\r\n"+
- "Quisque at justo auctor, venenatis lacus sit amet, finibus tellus. Vivamus rhoncus lacinia lorem quis malesuada. Phasellus scelerisque vehicula ex. Fusce finibus purus placerat, rhoncus erat blandit, tincidunt dolor. Nam a justo iaculis enim auctor imperdiet vel sed libero. Nulla sit amet orci sollicitudin, facilisis mauris sit amet, dignissim turpis. Donec ut enim quis justo dictum consequat.\r\n"+
- "Sed eget augue consequat, pulvinar dui eget, suscipit arcu. Pellentesque et lacinia nisi, eu iaculis odio. Aenean fermentum quam a nibh hendrerit, accumsan hendrerit dui egestas. Ut sit amet nulla vitae risus pulvinar vestibulum non id lorem. Integer pretium condimentum interdum. Maecenas tincidunt vel ipsum vel accumsan. Sed finibus mi vel sem rhoncus consectetur. Donec malesuada, arcu id malesuada pulvinar, ex ante vehicula dolor, at pharetra massa leo ut felis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nunc efficitur ex ac tincidunt dignissim. Donec in nisi quis nulla scelerisque ullamcorper quis nec mi. Curabitur convallis eu enim vel mollis. Duis rhoncus, est id sagittis feugiat, tortor purus elementum nunc, in iaculis est erat fermentum orci. Proin cursus, lacus euismod finibus vulputate, ante dolor commodo dui, a dictum lacus justo vitae velit. Proin sit amet ex gravida, sodales justo non, ullamcorper ipsum. Nullam porta vehicula efficitur.\r\n"+
- "Mauris euismod finibus accumsan. Nulla ornare sagittis dignissim. Vestibulum eget aliquam augue. Aliquam malesuada eu dolor nec placerat. Nullam gravida eu eros non maximus. Aliquam vulputate libero eu maximus elementum. Fusce ex purus, pretium quis eros ut, consequat maximus ipsum. Aenean id ullamcorper turpis. Etiam efficitur et quam elementum viverra. Aenean lacinia, nisi eu faucibus efficitur, magna ligula dictum nulla, vel porta orci nibh id nisi. Morbi sit amet tempor magna. Praesent vitae orci eu est eleifend finibus. Aliquam vel nisi vel justo fermentum rutrum sit amet in mauris. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.\r\n"+
- "Proin ante urna, congue non orci a, vehicula tincidunt velit. In accumsan justo sed eros laoreet volutpat. Phasellus venenatis cursus nulla sed consectetur. Maecenas at dolor mauris. Nulla eget iaculis neque, in malesuada nisl. Etiam posuere enim vitae erat condimentum tristique. Nulla vitae tempus ante. Aenean iaculis nisl id accumsan dignissim. Proin iaculis quam eget augue commodo, in egestas ex semper. Praesent ut mauris tortor. Donec vestibulum ante id vulputate luctus. Ut eu accumsan metus. Integer in ligula nulla.\r\n"+
- "Nulla facilisi. Proin molestie erat eget dui volutpat tristique. Nullam accumsan dui sodales nunc consectetur semper. Duis posuere lacus id elit interdum, eu pellentesque dui blandit. Vestibulum eget rutrum urna. In lacus eros, mollis nec scelerisque ac, eleifend nec sapien. Ut varius pretium felis, eu rutrum libero feugiat in. Sed feugiat tristique nisi nec imperdiet. Vivamus quis pulvinar mauris, a tempor arcu. Maecenas auctor, tellus eget imperdiet suscipit, lacus velit eleifend nisi, ac tempus ipsum elit id tellus. Duis justo felis, placerat a finibus in, sodales sit amet ipsum. Nunc vel mauris eget sem tristique accumsan. Suspendisse libero enim, tincidunt nec imperdiet ut, finibus eget magna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce eleifend id dolor at fermentum.\r\n"+
- "Fusce lectus tortor, tincidunt id commodo et, mattis eu ipsum. Integer id magna nec dui rhoncus suscipit vel quis libero. Phasellus venenatis, libero ac congue facilisis, tellus ligula semper ligula, ac semper diam dolor sit amet diam. Curabitur ante nulla, placerat quis felis at, pretium condimentum ante. In ac felis quis orci consectetur condimentum. In eu odio venenatis, finibus urna et, tincidunt leo. Cras at urna id sapien pretium maximus. Proin quam nulla, porta vestibulum neque et, viverra mollis neque. Nam et viverra mauris. Proin sit amet placerat est, in blandit metus. Donec nec dui vel tortor commodo interdum sit amet at urna. Nunc ligula ex, molestie nec eleifend at, dapibus at ex. Interdum et malesuada fames ac ante ipsum primis in faucibus.\r\n"+
- "Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nunc rutrum leo dolor, eu auctor enim sagittis ac. Ut facilisis cursus ornare. Donec nec leo blandit, pellentesque elit a, suscipit sapien. Maecenas et risus scelerisque, rutrum ligula vel, pellentesque elit. Cras nec lobortis metus, id vehicula enim. Aliquam viverra ligula ligula, ut luctus nunc suscipit vitae. Pellentesque vel dictum leo. Aenean leo quam, convallis a varius nec, laoreet eget augue.\r\n"+
- "Phasellus viverra ante eu sem blandit, vel sagittis urna eleifend. Nunc facilisis tincidunt mauris vel gravida. Sed nec ipsum vel neque tempor bibendum sit amet sed mi. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In erat eros, porta sit amet varius sed, mattis ac risus. Donec maximus felis sed dictum faucibus. Ut tristique lacus eget felis venenatis ultrices. Nam luctus tortor quis est molestie, ac blandit sem dictum. Ut fermentum, diam ac pharetra imperdiet, dui enim eleifend orci, quis posuere ligula turpis vitae lorem. In vitae semper orci. Proin faucibus ligula vel arcu imperdiet laoreet. In purus felis, consectetur vel accumsan nec, vestibulum in sapien. Curabitur commodo nisi eu arcu scelerisque, eu laoreet orci tristique. Nullam in tellus dolor. Curabitur tempor quam a arcu posuere tincidunt. Integer id metus et lacus vestibulum pulvinar."
- );
- /*
- LOREM_IPSUMS.put(Locale.GERMAN,
- "Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans.\r\n"+
- "Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen.\r\n"+
- "Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik.\r\n"+
- "Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg.\r\n"+
- "Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse.\r\n"+
- "Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy.\r\n"+
- "Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort und und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren.\r\n"+
- "Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten.\r\n"+
- "Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch. Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans.\r\n"+
- "Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen.\r\n"+
- "Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik.\r\n"+
- "Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg.\r\n"+
- "Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse.\r\n"+
- "Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy.\r\n"+
- "Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort und und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren.\r\n"+
- "Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch.\r\n"+
- "Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien.\r\n"+
- "Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht – ein geradezu unorthographisches Leben. Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik.\r\n"+
- "Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg.\r\n"+
- "Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rhetorische Frage über die Wange, dann setzte es seinen Weg fort. Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort und und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren. Doch alles Gutzureden."
- );
- */
- }
-
- protected TextConfigurator(Locale locale) {
- this.locale = locale;
- Locale locale2 = new Locale(locale.getLanguage());
- if (ALPHABETS.containsKey(locale)) {
- alphabet = ALPHABETS.get(locale);
- }
- else if (ALPHABETS.containsKey(locale2)) {
- alphabet = ALPHABETS.get(locale2);
- }
- else {
- alphabet = ALPHABETS.get(DEFAULT);
- }
- if (LOREM_IPSUMS.containsKey(locale)) {
- loremipsum = LOREM_IPSUMS.get(locale);
- }
- else if (LOREM_IPSUMS.containsKey(locale2)) {
- loremipsum = LOREM_IPSUMS.get(locale2);
- }
- else {
- loremipsum = LOREM_IPSUMS.get(DEFAULT);
- }
- }
-
- protected String getAlphabet() {
- return alphabet;
- }
-
- protected String getLoremIpsum() {
- return loremipsum;
- }
-
- protected Set<String> getParagraphs() {
- if (paragraphs == null) {
- paragraphs = new HashSet<String>();
- String[] items = loremipsum.split("\r\n");
- for (String item : items) {
- paragraphs.add(item);
- }
- }
- return paragraphs;
- }
-
- protected Set<String> getSentences() {
- if (sentences == null) {
- sentences = new HashSet<String>();
- String[] items = loremipsum.split("[\\.,\\s!;?:]+");
- for (String item : items) {
- sentences.add(item.trim());
- }
- }
- return sentences;
- }
-
- protected Set<String> getWords() {
- if (words == null) {
- words = new HashSet<String>();
- String[] items;
- if (text.isEmpty()) {
- items = loremipsum.split(" ");
- }
- else {
- items = text.split(" ");
- }
- for (String item : items) {
- words.add(item
- .replace(".", "")
- .replace(",", "")
- .replace(";", "")
- .replace("!", "")
- .replace("?", "")
- );
- }
- }
- return words;
- }
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/provider/TextProvider.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/provider/TextProvider.java
deleted file mode 100644
index 4e6c261..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/fillertext/provider/TextProvider.java
+++ /dev/null
@@ -1,55 +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.utils.fillertext.provider;
-
-import java.util.Locale;
-import java.util.Set;
-
-
-public class TextProvider {
-
- private final TextConfigurator fConfigurator;
- private final BaseProvider fBaseProvider;
-
- public TextProvider(BaseProvider baseProvider, Locale locale) {
- fBaseProvider = baseProvider;
- fConfigurator = new TextConfigurator(locale);
- }
-
- public String paragraph(int count) {
- return combine(fConfigurator.getParagraphs(), "\r\n", count);
- }
-
- public String sentence(int count) {
- return combine(fConfigurator.getSentences(), " ", count);
- }
-
- public String word(int count) {
- return combine(fConfigurator.getWords(), " ", count);
- }
-
- private String combine(Set<String> options, String glue, int count) {
- String[] items = options.toArray(new String[0]);
- String result = null;
- for (int i = 0; i < count; i++) {
- if (result == null) {
- result = "";
- }
- else {
- result += glue;
- }
- result += items[fBaseProvider.randomBetween(0, items.length-1)];
- }
- return result;
- }
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/theme/EnumCssClass.java b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/theme/EnumCssClass.java
deleted file mode 100644
index 1ed9765..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/theme/EnumCssClass.java
+++ /dev/null
@@ -1,55 +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.utils.theme;
-
-/**
- * CSS Style Class Names for OSBP html components
- */
-public enum EnumCssClass {
- /** combobox with icon */
- COMBOBOX_WITH_ICON,
- VIEW_HEADER_H2,
- BOX,
- CHART,
- TABLE,
- HAS_FOCUS,
- SELECT_LANGUAGE,
- SELECTION_AREA,
- MULTI_SELECTION,
- MULTI_SELECTION_AREA,
- SINGLE_SELECTION,
- SINGLE_SELECTION_AREA,
- DATA_COMPONENT,
- DATA_AREA,
- MULTI_AREA,
- WORK_AREA,
- LOWER_AREA,
- TOP_AREA,
- SIDE_AREA,
- VIEW,
- CHART_VIEW,
- DIALOG_VIEW,
- ORGANIZATION_VIEW,
- REPORT_VIEW,
- TABLE_VIEW,
- TOPOLOGY_VIEW,
- MPARTTOOLBARAREA,
- MPARTTOOLBAR;
-
- public String styleName() {
- return toString();
- }
- public String toString() {
- return "os-"+super.toString().toLowerCase().replaceAll("_", "-");
- }
-}
diff --git a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/xtext/GenericFormatter.xtend b/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/xtext/GenericFormatter.xtend
deleted file mode 100644
index 175ab69..0000000
--- a/org.eclipse.osbp.utils/src/org/eclipse/osbp/utils/xtext/GenericFormatter.xtend
+++ /dev/null
@@ -1,204 +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
- *
- *
- * This copyright notice shows up in the generated Java code
- *
- */
-
-package org.eclipse.osbp.utils.xtext
-
-import org.eclipse.emf.ecore.impl.EClassImpl
-import org.eclipse.xtext.Grammar
-import org.eclipse.xtext.GrammarUtil
-import org.eclipse.xtext.IGrammarAccess
-import org.eclipse.xtext.ParserRule
-import org.eclipse.xtext.formatting.impl.FormattingConfig
-import org.eclipse.xtext.impl.ParserRuleImpl
-import org.eclipse.xtext.xbase.services.XtypeGrammarAccess
-
-class GenericFormatter {
-
- /**
- * <p>
- * Variant of method when no import block is specified. Then only one empty line before each
- * first level element of the given element name is inserted.
- * </p>
- *
- * @example <u>ReportDSLFormatter</u>:<br>
- * <code>
- * ...FormattingConfig cfg<br>
- * gf = new GenericFormatter()<br>
- * gf.formatFirstLevelBlocks( cfg, grammar.grammar, "PageTemplates" )
- * </code>
- *
- * @param config Dsl-specific FormattingConfig instance
- * @param grammarRaw Dsl-specific grammar
- * @param baseElementName Name of dsl-specific class of first level elements
- *
- * @return void
- *
- * @since 20160728, gu
- * @changed yymmdd, name
- */
- def formatFirstLevelBlocks ( FormattingConfig config, Grammar grammarRaw, String baseElementName ) {
- formatFirstLevelBlocks( config, grammarRaw, baseElementName, null )
- }
-
-
- /**
- * <p>
- * Formats intersection between first level elements (= first level underneath package
- * definition, i.e. import and following blocks).<br>
- * Inserts one empty line between two blocks each.
- * </p>
- *
- * @example <u>DatamartDSLFormatter</u>:<br>
- * <code>
- * ...FormattingConfig cfg<br>
- * gf = new GenericFormatter()<br>
- * gf.formatFirstLevelBlocks( cfg, grammar.grammar, "DatamartImport", "DatamartDefinition" )
- * </code>
- *
- * @param config Dsl-specific FormattingConfig instance
- * @param grammarRaw Dsl-specific grammar
- * @param baseElementName Name of dsl-specific class of first level elements
- * @param importClassName Name of dsl-specific import class
- *
- * @return void
- *
- * @since 20160728, gu
- * @changed yymmdd, name
- */
- def formatFirstLevelBlocks ( FormattingConfig config, Grammar grammarRaw, String baseElementName, String importClassName ) {
- var ParserRule baseElementDef = GrammarUtil.findRuleForName( grammarRaw, baseElementName ) as ParserRule
-
- if ( importClassName != null ) {
- var ParserRule importDef = GrammarUtil.findRuleForName( grammarRaw, importClassName ) as ParserRule
- config.setLinewrap( 2 ).between( importDef, baseElementDef )
- }
-
- config.setLinewrap( 2 ).before( baseElementDef )
-// config.setLinewrap( 1, 2, 2 ).before( baseElementDef )
- }
-
-
- /**
- * Overloaded variant for those who can't provide a <i>XtypeGrammarAccess</i> instance.
- */
- def genericFormatting ( FormattingConfig config, IGrammarAccess grammar ) {
- genericFormatting( config, grammar, null )
- }
-
- def genericFormatting ( FormattingConfig config, IGrammarAccess grammar, XtypeGrammarAccess grammarAccess ) {
- config.setAutoLinewrap(400)
-
- if ( grammarAccess != null ) {
- // It's usually a good idea to activate the following three statements.
- // They will add and preserve newlines around comments
- // c.setLinewrap( 0, 1, 2 ).before( SL_COMMENTRule )
- // c.setLinewrap( 0, 1, 2 ).before( ML_COMMENTRule )
- // c.setLinewrap( 0, 1, 1 ).after ( ML_COMMENTRule )
- config.setLinewrap( 0, 1, 2 ).before( grammarAccess.SL_COMMENTRule )
- config.setLinewrap( 0, 1, 1 ).after ( grammarAccess.SL_COMMENTRule )
- config.setLinewrap( 0, 1, 2 ).before( grammarAccess.ML_COMMENTRule )
- config.setLinewrap( 1, 1, 2 ).after ( grammarAccess.ML_COMMENTRule )
- }
-
- for(pair : grammar.findKeywordPairs("{", "}")) {
- // a space before the first '{'
- config.setSpace(" ").before(pair.getFirst()) //$NON-NLS-1$
- // indentation between
- config.setIndentation(pair.first, pair.second)
- config.setLinewrap().after(pair.first)
-// config.setLinewrap( 1, 1, 2 ).after(pair.first)
- config.setLinewrap( 1, 1, 2 ).around(pair.second)
-// config.setLinewrap(1,1,1).after(pair.first) 1 for all is default!
-// config.setLinewrap(1,1,1).around(pair.second)
- }
-
- for(kw : grammar.findKeywords(".")) {
- config.setNoSpace().around(kw)
- config.setNoLinewrap().around(kw)
- }
-
- for (kw : grammar.findKeywords(";")) {
- config.setNoSpace().before(kw)
- config.setLinewrap().after(kw)
- }
-
- for (kw : grammar.findKeywords(",")) {
- config.setNoSpace().before(kw)
- }
-
- for ( pair : grammar.findKeywordPairs( "(", ")" ) ) {
- config.setNoSpace().before(pair.first)
- config.setSpace(" ").after(pair.first)
- config.setNoLinewrap().around(pair.first)
- config.setSpace( " " ).before(pair.second)
-// config.setNoSpace().before(pair.second)
-// config.setNoLinewrap().around(pair.second)
- config.setNoLinewrap().before(pair.second)
- config.setLinewrap( 0, 0, 1 ).after( pair.second )
-// config.setNoLinewrap().bounds( pair.first, pair.second )
-// config.setNoLinewrap().range( pair.first, pair.second )
- }
-
- for(pair : grammar.findKeywordPairs("[", "]")) {
- config.setNoSpace().before(pair.first)
- config.setSpace(" ").after(pair.first)
-// config.setNoSpace().around(pair.first)
- config.setNoLinewrap().around(pair.first)
- config.setSpace( " " ).before(pair.second)
- config.setNoSpace().after(pair.second)
-// config.setNoSpace().around(pair.second)
- config.setNoLinewrap().around(pair.second)
- }
-
- var allRules = GrammarUtil.allRules(grammar.grammar)
- // linewrap before all rules
- var ruleCalls = grammar.findRuleCalls(allRules.toArray(newArrayOfSize(allRules.size)))
- for(ruleCall : ruleCalls) {
-
- // No newline before and after comparison operators (e.g. '=', '<', 'like', etc.)
- // (Currently only used for Datamart-DSL!)
- if ( ruleCall.rule.name.equals("OperatorEnum") ) {
- config.setNoLinewrap().around( ruleCall )
- }
-
- if (ruleCall.rule instanceof ParserRuleImpl &&
- ruleCall.rule.type.classifier instanceof EClassImpl ) {
- if ( ruleCall.rule.name.equals( "MessageDefaultFormat" ) ) {
- config.setSpace( " " ).before( ruleCall )
-// config.setNoLinewrap().before( ruleCall )
-// config.setLinewrap ().before( ruleCall )
- }
-
-// if ( ruleCall.rule.name.contains("Operator") ) {
-// config.setNoLinewrap().around( ruleCall )
-// }
-
- if ( ( !ruleCall.rule.name.startsWith("X") || ruleCall.rule.name.equals("XImportSection") ) &&
-// if ( !ruleCall.rule.name.startsWith("X") &&
- !ruleCall.rule.name.contains("Jvm") &&
-// !ruleCall.rule.name.contains("Addition") &&
-// !ruleCall.rule.name.contains("Operand") &&
-// !ruleCall.rule.name.contains("Operator") &&
-// !ruleCall.rule.name.contains("Property") &&
- !ruleCall.rule.name.contains("Expression") ) {
- config.setLinewrap( 0, 1, 2 ).before(ruleCall.rule)
-// config.setLinewrap(1,1,1).around(ruleCall.rule)
- }
- }
- }
- }
-}
diff --git a/org.eclipse.osbp.utils/test/org/eclipse/osbp/utils/fillertext/test/FillerTextExample.java b/org.eclipse.osbp.utils/test/org/eclipse/osbp/utils/fillertext/test/FillerTextExample.java
deleted file mode 100644
index d539d51..0000000
--- a/org.eclipse.osbp.utils/test/org/eclipse/osbp/utils/fillertext/test/FillerTextExample.java
+++ /dev/null
@@ -1,132 +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.utils.fillertext.test;
-
-import java.util.Locale;
-
-import org.eclipse.osbp.utils.fillertext.FillerTextProvider;
-import org.eclipse.osbp.utils.fillertext.FillerTextType;
-
-/**
- * Example generating some filler text ("Blindtext").<br>
- * It's not possible to unit test it, because everytime new values will be generated!
- */
-public class FillerTextExample {
-
- private static void result(String variable, Object...values) {
- System.out.format("%-50s >", variable);
- for (Object value : values) {
- System.out.print(" = "+value.toString());
- }
- System.out.println();
- }
-
- public static void main(String[] args) {
-
- Locale [] locales = new Locale[] {
- Locale.GERMAN,
- Locale.ENGLISH,
- Locale.forLanguageTag("pl")
- };
-
- // --- sample using the api in different ways ---
- System.out.println("=== api examples ===");
- {
- FillerTextProvider provider = FillerTextProvider.get(Locale.GERMAN);
-
- // --- it's possible to use either the generic {@link FillerTextProvider#generate()} or the specific methods ---
- System.out.println("--- some date and time filler texts ---");
- result("Date 'past 10 years' via enum", provider.generate(FillerTextType.DATE, -10));
- result("Date 'past 10 years' via string", provider.generate("date", -10));
- result("Date 'past 10 years' via string", provider.generate("DATE", -10));
- result("Date 'past 10 years' via API", provider.date(-10));
-
- result("Date 'future 5 years'", provider.generate("Date", 5));
-
- result("Date 'between 1980 and 1990'", provider.date(1980, 1990));
- result("Date 'between past 10 and future 20 years'", provider.date(-10, 20));
-
- result("Time", provider.time());
-
- result("Timestamp within this year", provider.timestamp());
-
- System.out.println("--- some integer and double filler texts ---");
- result("Unsigned Integer - default", (Integer)provider.unsignedinteger());
- result("Unsigned Integer - maximum 365", (Integer)provider.unsignedinteger(365), (Integer)provider.generate("unsignedinteger", 365), (Integer)provider.generate(FillerTextType.UNSIGNEDINTEGER, 365));
- result("Unsigned Integer - between 18 and 65", (Integer)provider.unsignedinteger(18, 65));
-
- result("Signed Integer - default", (Integer)provider.signedinteger());
- result("Signed Integer - range -365 to 365", (Integer)provider.signedinteger(365), (Integer)provider.generate("signedinteger", 365), (Integer)provider.generate(FillerTextType.SIGNEDINTEGER, 365));
- result("Signed Integer - between -18 and 65", (Integer)provider.signedinteger(-18, 65), (Integer)provider.generate("signedinteger", -18, 65), (Integer)provider.generate(FillerTextType.SIGNEDINTEGER, -18, 65));
-
- result("Unsigned Double - default", (Double)provider.unsigneddouble());
- result("Unsigned Double - 3 decimals", (Double)provider.unsigneddouble(3));
- result("Unsigned Double - 1 decimal, max 10", (Double)provider.unsigneddouble(1, 10.0), (Double)provider.generate("unsigneddouble", 1, 10.0), (Double)provider.generate(FillerTextType.UNSIGNEDDOUBLE, 1, 10.0));
- result("Unsigned Double - 1 decimal, between 10 and 20", (Double)provider.unsigneddouble(1, 10.0, 20.0), (Double)provider.generate("unsigneddouble", 1, 10.0, 20.0), (Double)provider.generate(FillerTextType.UNSIGNEDDOUBLE, 1, 10.0, 20.0));
-
- result("Unsigned Double - default", (Double)provider.signeddouble());
- result("Unsigned Double - 3 decimals", (Double)provider.signeddouble(3));
- result("Unsigned Double - 1 decimal, range -10 to 10", (Double)provider.signeddouble(1, 10.0), (Double)provider.generate("signeddouble", 1, 10.0), (Double)provider.generate(FillerTextType.SIGNEDDOUBLE, 1, 10.0));
- result("Unsigned Double - 1 decimal, between -10 and 20", (Double)provider.signeddouble(1, -10.0, 20.0), (Double)provider.generate("signeddouble", 1, -10.0, 20.0), (Double)provider.generate(FillerTextType.SIGNEDDOUBLE, 1, -10.0, 20.0));
-
- System.out.println("--- some text filler texts ---");
- result("one word", provider.word());
- result("5 words", provider.words(5));
- result("one sentence", provider.sentence());
- result("5 sentences", provider.sentences(5));
- result("one paragraph", provider.paragraph());
- result("5 paragraphs", provider.paragraphs(5));
-
-// System.out.println("--- a example person filler text ---");
-// result("First name", provider.firstName(), provider.generate("firstname"), provider.generate(FillerTextType.FIRSTNAME));
-// result("Last name", provider.lastName(), provider.generate("lastName"), provider.generate(FillerTextType.LASTNAME));
-// result("Full name", provider.fullName(), provider.generate("fullName"), provider.generate(FillerTextType.FULLNAME));
-// result("Email", provider.email(), provider.generate("email"), provider.generate(FillerTextType.EMAIL));
-// result("City", provider.city(), provider.generate("city"), provider.generate(FillerTextType.CITY));
-// result("Postal code", provider.postalCode(), provider.generate("postalCode"), provider.generate(FillerTextType.POSTALCODE));
-
-// System.out.println("--- THE SAME example person filler text ---");
-// result("First name", provider.firstName());
-// result("Last name", provider.generate(FillerTextType.LASTNAME));
-// result("Full name", provider.generate("fullname"));
-// result("Email", provider.email());
-// result("City", provider.city());
-// result("Postal code", provider.postalCode());
-
-// System.out.println("--- another example person filler text because of calling provider.reset() ---");
-// provider.reset();
-// result("First name", provider.firstName());
-// result("Last name", provider.generate(FillerTextType.LASTNAME));
-// result("Full name", provider.generate("fullname"));
-// result("Email", provider.email());
-// result("City", provider.city());
-// result("Postal code", provider.postalCode());
- }
-
- System.out.println("=== start ===");
- // --- traverse all requested locales ---
- for (Locale locale : locales) {
- System.out.println("--- locale: "+locale.toString());
-
- FillerTextProvider provider = FillerTextProvider.get(locale);
- provider.reset();
- // --- use every filler text type ---
- for (FillerTextType type : FillerTextType.values()) {
- result(type.toString(), provider.generate(type));
- }
- System.out.println();
- }
- System.out.println("=== done ===");
- }
-
-}
diff --git a/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/common/EntityUtils.java b/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/common/EntityUtils.java
index c745a54..35a670c 100644
--- a/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/common/EntityUtils.java
+++ b/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/common/EntityUtils.java
@@ -14,7 +14,9 @@
*/
package org.eclipse.osbp.utils.common;
+import java.util.Iterator;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.osbp.dsl.semantic.common.types.LEnum;
import org.eclipse.osbp.dsl.semantic.common.types.LType;
@@ -194,10 +196,26 @@ public class EntityUtils {
public static LEntity getEntityFromDto(final JvmType type) {
LEntity entity = null;
try {
- String qualifiedDtoName = type.getQualifiedName();
- ResourceSet resourceSet = type.eResource().getResourceSet();
+ String _qualifiedName = null;
+ if (type!=null) {
+ _qualifiedName=type.getQualifiedName();
+ }
+ String qualifiedDtoName = _qualifiedName;
+ Resource _eResource = null;
+ if (type!=null) {
+ _eResource=type.eResource();
+ }
+ ResourceSet _resourceSet = null;
+ if (_eResource!=null) {
+ _resourceSet=_eResource.getResourceSet();
+ }
+ ResourceSet resourceSet = _resourceSet;
final Iterable<IEObjectDescription> objectDescs = ServiceListener.getEObjectDescriptions(OSBPDtoPackage.Literals.LDTO, qualifiedDtoName);
- boolean _hasNext = objectDescs.iterator().hasNext();
+ Iterator<IEObjectDescription> _iterator = null;
+ if (objectDescs!=null) {
+ _iterator=objectDescs.iterator();
+ }
+ boolean _hasNext = _iterator.hasNext();
if (_hasNext) {
final IEObjectDescription eobjectDesc = objectDescs.iterator().next();
if ((resourceSet != null)) {
diff --git a/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/constants/GeneratorConstants.java b/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/constants/GeneratorConstants.java
deleted file mode 100644
index 4b53567..0000000
--- a/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/constants/GeneratorConstants.java
+++ /dev/null
@@ -1,41 +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
- *
- *
- * This copyright notice shows up in the generated Java code
- */
-package org.eclipse.osbp.utils.constants;
-
-import org.eclipse.xtend2.lib.StringConcatenation;
-import org.eclipse.xtext.xbase.lib.Functions.Function0;
-
-@SuppressWarnings("all")
-public class GeneratorConstants {
- public final static String GENERATED_CLASSES_DOCUMENTATION = new Function0<String>() {
- public String apply() {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("<b>This class was auto generated! Leave it unmodified to avoid unpredictable results!</b>");
- return _builder.toString();
- }
- }.apply();
-
- public final static String I18N_RESOURCE_PATH_NAME = "i18n";
-
- private final static String I18N_RESOURCE_FILE_NAME = "I18N";
-
- private final static String I18N_RESOURCE_FILE_EXTENSION = ".properties";
-
- public final static String I18N_RESOURCE_FULL_FILE_NAME = (GeneratorConstants.I18N_RESOURCE_FILE_NAME + GeneratorConstants.I18N_RESOURCE_FILE_EXTENSION);
-
- public final static String I18N_RESOURCE_FULL_PATH_NAME = (((GeneratorConstants.I18N_RESOURCE_PATH_NAME + "/") + GeneratorConstants.I18N_RESOURCE_FILE_NAME) + GeneratorConstants.I18N_RESOURCE_FILE_EXTENSION);
-
- public final static String I18N_RESOURCE_FULL_BUNDLE_NAME = ((GeneratorConstants.I18N_RESOURCE_PATH_NAME + ".") + GeneratorConstants.I18N_RESOURCE_FILE_NAME);
-}
diff --git a/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/constants/PathConstants.java b/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/constants/PathConstants.java
deleted file mode 100644
index 8d10986..0000000
--- a/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/constants/PathConstants.java
+++ /dev/null
@@ -1,38 +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
- *
- *
- * This copyright notice shows up in the generated Java code
- */
-package org.eclipse.osbp.utils.constants;
-
-import org.eclipse.xtend2.lib.StringConcatenation;
-import org.eclipse.xtext.xbase.lib.Functions.Function0;
-
-@SuppressWarnings("all")
-public class PathConstants {
- public final static String JS_PLUGIN_PREFIX = new Function0<String>() {
- public String apply() {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("theme://plugin/");
- return _builder.toString();
- }
- }.apply();
-
- public final static String COMPEX_UTILS_JS_PLUGIN_PATH = new Function0<String>() {
- public String apply() {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append(PathConstants.JS_PLUGIN_PREFIX, "");
- _builder.append("org.eclipse.osbp.utils.js/org/eclipse/osbp/utils/js/");
- return _builder.toString();
- }
- }.apply();
-}
diff --git a/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/entityhelper/DataType.java b/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/entityhelper/DataType.java
index 661f0c0..09df3a5 100644
--- a/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/entityhelper/DataType.java
+++ b/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/entityhelper/DataType.java
@@ -20,6 +20,7 @@ import java.util.Date;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.osbp.dsl.entity.xtext.extensions.ModelExtensions;
+import org.eclipse.osbp.dsl.semantic.common.types.LAttribute;
import org.eclipse.osbp.dsl.semantic.common.types.LDataType;
import org.eclipse.osbp.dsl.semantic.common.types.LEnum;
import org.eclipse.osbp.dsl.semantic.common.types.LKeyAndValue;
@@ -48,7 +49,7 @@ public class DataType {
@Inject
private IJvmTypeProvider.Factory typeProviderFactory;
- public LDataType getLDataType(final LEntityAttribute attributeRef) {
+ public LDataType getLDataType(final LAttribute attributeRef) {
LScalarType type = attributeRef.getType();
LDataType lDataType = ((LDataType) null);
if ((type instanceof LDataType)) {
@@ -57,7 +58,7 @@ public class DataType {
return lDataType;
}
- public JvmType getJvmType(final LEntityAttribute attributeRef) {
+ public JvmType getJvmType(final LAttribute attributeRef) {
LScalarType type = attributeRef.getType();
LDataType lDataType = ((LDataType) null);
JvmType ltype = ((JvmType) null);
@@ -92,7 +93,12 @@ public class DataType {
return typeProvider_2.findTypeByName(_plus_1);
}
}
- JvmTypeReference typeJvm = this.entityExtensions.toTypeReference(attributeRef);
+ JvmTypeReference typeJvm = null;
+ if ((attributeRef instanceof LEntityAttribute)) {
+ typeJvm = this.entityExtensions.toTypeReference(attributeRef);
+ } else {
+ typeJvm = this.entityExtensions.toTypeReference(attributeRef);
+ }
JvmType typeJvmType = typeJvm.getType();
return typeJvmType;
}
@@ -180,7 +186,7 @@ public class DataType {
return this.getBasicType(type.getIdentifier());
}
- public IDataMart.EType getBasicType(final LEntityAttribute attribute) {
+ public IDataMart.EType getBasicType(final LAttribute attribute) {
LDataType lDataType = this.getLDataType(attribute);
if ((lDataType != null)) {
boolean _isDate = lDataType.isDate();
@@ -197,17 +203,31 @@ public class DataType {
if (_exists) {
return IDataMart.EType.BLOPMAPPING;
}
+ final Function1<LKeyAndValue, Boolean> _function_1 = (LKeyAndValue it) -> {
+ return Boolean.valueOf(it.getValue().toLowerCase().equals("richtextarea"));
+ };
+ boolean _exists_1 = IterableExtensions.<LKeyAndValue>exists(lDataType.getProperties(), _function_1);
+ if (_exists_1) {
+ return IDataMart.EType.RICHTEXTAREA;
+ }
}
boolean _isNullOrEmpty_1 = IterableExtensions.isNullOrEmpty(attribute.getProperties());
boolean _not_1 = (!_isNullOrEmpty_1);
if (_not_1) {
- final Function1<LKeyAndValue, Boolean> _function_1 = (LKeyAndValue it) -> {
+ final Function1<LKeyAndValue, Boolean> _function_2 = (LKeyAndValue it) -> {
return Boolean.valueOf(it.getKey().toLowerCase().equals("blob"));
};
- boolean _exists_1 = IterableExtensions.<LKeyAndValue>exists(lDataType.getProperties(), _function_1);
- if (_exists_1) {
+ boolean _exists_2 = IterableExtensions.<LKeyAndValue>exists(attribute.getProperties(), _function_2);
+ if (_exists_2) {
return IDataMart.EType.BLOPMAPPING;
}
+ final Function1<LKeyAndValue, Boolean> _function_3 = (LKeyAndValue it) -> {
+ return Boolean.valueOf(it.getValue().toLowerCase().equals("richtextarea"));
+ };
+ boolean _exists_3 = IterableExtensions.<LKeyAndValue>exists(attribute.getProperties(), _function_3);
+ if (_exists_3) {
+ return IDataMart.EType.RICHTEXTAREA;
+ }
}
boolean _equalsIgnoreCase = "blobMapping".equalsIgnoreCase(lDataType.getName());
if (_equalsIgnoreCase) {
diff --git a/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/xtext/GenericFormatter.java b/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/xtext/GenericFormatter.java
deleted file mode 100644
index d529006..0000000
--- a/org.eclipse.osbp.utils/xtend-gen/org/eclipse/osbp/utils/xtext/GenericFormatter.java
+++ /dev/null
@@ -1,286 +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
- *
- *
- * This copyright notice shows up in the generated Java code
- */
-package org.eclipse.osbp.utils.xtext;
-
-import com.google.common.base.Objects;
-import java.util.List;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.impl.EClassImpl;
-import org.eclipse.xtext.AbstractRule;
-import org.eclipse.xtext.Grammar;
-import org.eclipse.xtext.GrammarUtil;
-import org.eclipse.xtext.IGrammarAccess;
-import org.eclipse.xtext.Keyword;
-import org.eclipse.xtext.ParserRule;
-import org.eclipse.xtext.RuleCall;
-import org.eclipse.xtext.TerminalRule;
-import org.eclipse.xtext.TypeRef;
-import org.eclipse.xtext.formatting.impl.FormattingConfig;
-import org.eclipse.xtext.impl.ParserRuleImpl;
-import org.eclipse.xtext.util.Pair;
-import org.eclipse.xtext.xbase.services.XtypeGrammarAccess;
-
-@SuppressWarnings("all")
-public class GenericFormatter {
- /**
- * <p>
- * Variant of method when no import block is specified. Then only one empty line before each
- * first level element of the given element name is inserted.
- * </p>
- *
- * @example <u>ReportDSLFormatter</u>:<br>
- * <code>
- * ...FormattingConfig cfg<br>
- * gf = new GenericFormatter()<br>
- * gf.formatFirstLevelBlocks( cfg, grammar.grammar, "PageTemplates" )
- * </code>
- *
- * @param config Dsl-specific FormattingConfig instance
- * @param grammarRaw Dsl-specific grammar
- * @param baseElementName Name of dsl-specific class of first level elements
- *
- * @return void
- *
- * @since 20160728, gu
- * @changed yymmdd, name
- */
- public void formatFirstLevelBlocks(final FormattingConfig config, final Grammar grammarRaw, final String baseElementName) {
- this.formatFirstLevelBlocks(config, grammarRaw, baseElementName, null);
- }
-
- /**
- * <p>
- * Formats intersection between first level elements (= first level underneath package
- * definition, i.e. import and following blocks).<br>
- * Inserts one empty line between two blocks each.
- * </p>
- *
- * @example <u>DatamartDSLFormatter</u>:<br>
- * <code>
- * ...FormattingConfig cfg<br>
- * gf = new GenericFormatter()<br>
- * gf.formatFirstLevelBlocks( cfg, grammar.grammar, "DatamartImport", "DatamartDefinition" )
- * </code>
- *
- * @param config Dsl-specific FormattingConfig instance
- * @param grammarRaw Dsl-specific grammar
- * @param baseElementName Name of dsl-specific class of first level elements
- * @param importClassName Name of dsl-specific import class
- *
- * @return void
- *
- * @since 20160728, gu
- * @changed yymmdd, name
- */
- public void formatFirstLevelBlocks(final FormattingConfig config, final Grammar grammarRaw, final String baseElementName, final String importClassName) {
- AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammarRaw, baseElementName);
- ParserRule baseElementDef = ((ParserRule) _findRuleForName);
- boolean _notEquals = (!Objects.equal(importClassName, null));
- if (_notEquals) {
- AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammarRaw, importClassName);
- ParserRule importDef = ((ParserRule) _findRuleForName_1);
- FormattingConfig.LinewrapLocator _setLinewrap = config.setLinewrap(2);
- _setLinewrap.between(importDef, baseElementDef);
- }
- FormattingConfig.LinewrapLocator _setLinewrap_1 = config.setLinewrap(2);
- _setLinewrap_1.before(baseElementDef);
- }
-
- /**
- * Overloaded variant for those who can't provide a <i>XtypeGrammarAccess</i> instance.
- */
- public void genericFormatting(final FormattingConfig config, final IGrammarAccess grammar) {
- this.genericFormatting(config, grammar, null);
- }
-
- public void genericFormatting(final FormattingConfig config, final IGrammarAccess grammar, final XtypeGrammarAccess grammarAccess) {
- config.setAutoLinewrap(400);
- boolean _notEquals = (!Objects.equal(grammarAccess, null));
- if (_notEquals) {
- FormattingConfig.LinewrapLocator _setLinewrap = config.setLinewrap(0, 1, 2);
- TerminalRule _sL_COMMENTRule = grammarAccess.getSL_COMMENTRule();
- _setLinewrap.before(_sL_COMMENTRule);
- FormattingConfig.LinewrapLocator _setLinewrap_1 = config.setLinewrap(0, 1, 1);
- TerminalRule _sL_COMMENTRule_1 = grammarAccess.getSL_COMMENTRule();
- _setLinewrap_1.after(_sL_COMMENTRule_1);
- FormattingConfig.LinewrapLocator _setLinewrap_2 = config.setLinewrap(0, 1, 2);
- TerminalRule _mL_COMMENTRule = grammarAccess.getML_COMMENTRule();
- _setLinewrap_2.before(_mL_COMMENTRule);
- FormattingConfig.LinewrapLocator _setLinewrap_3 = config.setLinewrap(1, 1, 2);
- TerminalRule _mL_COMMENTRule_1 = grammarAccess.getML_COMMENTRule();
- _setLinewrap_3.after(_mL_COMMENTRule_1);
- }
- List<Pair<Keyword, Keyword>> _findKeywordPairs = grammar.findKeywordPairs("{", "}");
- for (final Pair<Keyword, Keyword> pair : _findKeywordPairs) {
- {
- FormattingConfig.SpaceLocator _setSpace = config.setSpace(" ");
- Keyword _first = pair.getFirst();
- _setSpace.before(_first);
- Keyword _first_1 = pair.getFirst();
- Keyword _second = pair.getSecond();
- config.setIndentation(_first_1, _second);
- FormattingConfig.LinewrapLocator _setLinewrap_4 = config.setLinewrap();
- Keyword _first_2 = pair.getFirst();
- _setLinewrap_4.after(_first_2);
- FormattingConfig.LinewrapLocator _setLinewrap_5 = config.setLinewrap(1, 1, 2);
- Keyword _second_1 = pair.getSecond();
- _setLinewrap_5.around(_second_1);
- }
- }
- List<Keyword> _findKeywords = grammar.findKeywords(".");
- for (final Keyword kw : _findKeywords) {
- {
- FormattingConfig.NoSpaceLocator _setNoSpace = config.setNoSpace();
- _setNoSpace.around(kw);
- FormattingConfig.NoLinewrapLocator _setNoLinewrap = config.setNoLinewrap();
- _setNoLinewrap.around(kw);
- }
- }
- List<Keyword> _findKeywords_1 = grammar.findKeywords(";");
- for (final Keyword kw_1 : _findKeywords_1) {
- {
- FormattingConfig.NoSpaceLocator _setNoSpace = config.setNoSpace();
- _setNoSpace.before(kw_1);
- FormattingConfig.LinewrapLocator _setLinewrap_4 = config.setLinewrap();
- _setLinewrap_4.after(kw_1);
- }
- }
- List<Keyword> _findKeywords_2 = grammar.findKeywords(",");
- for (final Keyword kw_2 : _findKeywords_2) {
- FormattingConfig.NoSpaceLocator _setNoSpace = config.setNoSpace();
- _setNoSpace.before(kw_2);
- }
- List<Pair<Keyword, Keyword>> _findKeywordPairs_1 = grammar.findKeywordPairs("(", ")");
- for (final Pair<Keyword, Keyword> pair_1 : _findKeywordPairs_1) {
- {
- FormattingConfig.NoSpaceLocator _setNoSpace_1 = config.setNoSpace();
- Keyword _first = pair_1.getFirst();
- _setNoSpace_1.before(_first);
- FormattingConfig.SpaceLocator _setSpace = config.setSpace(" ");
- Keyword _first_1 = pair_1.getFirst();
- _setSpace.after(_first_1);
- FormattingConfig.NoLinewrapLocator _setNoLinewrap = config.setNoLinewrap();
- Keyword _first_2 = pair_1.getFirst();
- _setNoLinewrap.around(_first_2);
- FormattingConfig.SpaceLocator _setSpace_1 = config.setSpace(" ");
- Keyword _second = pair_1.getSecond();
- _setSpace_1.before(_second);
- FormattingConfig.NoLinewrapLocator _setNoLinewrap_1 = config.setNoLinewrap();
- Keyword _second_1 = pair_1.getSecond();
- _setNoLinewrap_1.before(_second_1);
- FormattingConfig.LinewrapLocator _setLinewrap_4 = config.setLinewrap(0, 0, 1);
- Keyword _second_2 = pair_1.getSecond();
- _setLinewrap_4.after(_second_2);
- }
- }
- List<Pair<Keyword, Keyword>> _findKeywordPairs_2 = grammar.findKeywordPairs("[", "]");
- for (final Pair<Keyword, Keyword> pair_2 : _findKeywordPairs_2) {
- {
- FormattingConfig.NoSpaceLocator _setNoSpace_1 = config.setNoSpace();
- Keyword _first = pair_2.getFirst();
- _setNoSpace_1.before(_first);
- FormattingConfig.SpaceLocator _setSpace = config.setSpace(" ");
- Keyword _first_1 = pair_2.getFirst();
- _setSpace.after(_first_1);
- FormattingConfig.NoLinewrapLocator _setNoLinewrap = config.setNoLinewrap();
- Keyword _first_2 = pair_2.getFirst();
- _setNoLinewrap.around(_first_2);
- FormattingConfig.SpaceLocator _setSpace_1 = config.setSpace(" ");
- Keyword _second = pair_2.getSecond();
- _setSpace_1.before(_second);
- FormattingConfig.NoSpaceLocator _setNoSpace_2 = config.setNoSpace();
- Keyword _second_1 = pair_2.getSecond();
- _setNoSpace_2.after(_second_1);
- FormattingConfig.NoLinewrapLocator _setNoLinewrap_1 = config.setNoLinewrap();
- Keyword _second_2 = pair_2.getSecond();
- _setNoLinewrap_1.around(_second_2);
- }
- }
- Grammar _grammar = grammar.getGrammar();
- List<AbstractRule> allRules = GrammarUtil.allRules(_grammar);
- int _size = allRules.size();
- AbstractRule[] _newArrayOfSize = new AbstractRule[_size];
- AbstractRule[] _array = allRules.<AbstractRule>toArray(_newArrayOfSize);
- List<RuleCall> ruleCalls = grammar.findRuleCalls(_array);
- for (final RuleCall ruleCall : ruleCalls) {
- {
- AbstractRule _rule = ruleCall.getRule();
- String _name = _rule.getName();
- boolean _equals = _name.equals("OperatorEnum");
- if (_equals) {
- FormattingConfig.NoLinewrapLocator _setNoLinewrap = config.setNoLinewrap();
- _setNoLinewrap.around(ruleCall);
- }
- boolean _and = false;
- AbstractRule _rule_1 = ruleCall.getRule();
- if (!(_rule_1 instanceof ParserRuleImpl)) {
- _and = false;
- } else {
- AbstractRule _rule_2 = ruleCall.getRule();
- TypeRef _type = _rule_2.getType();
- EClassifier _classifier = _type.getClassifier();
- _and = (_classifier instanceof EClassImpl);
- }
- if (_and) {
- AbstractRule _rule_3 = ruleCall.getRule();
- String _name_1 = _rule_3.getName();
- boolean _equals_1 = _name_1.equals("MessageDefaultFormat");
- if (_equals_1) {
- FormattingConfig.SpaceLocator _setSpace = config.setSpace(" ");
- _setSpace.before(ruleCall);
- }
- boolean _and_1 = false;
- boolean _and_2 = false;
- boolean _or = false;
- AbstractRule _rule_4 = ruleCall.getRule();
- String _name_2 = _rule_4.getName();
- boolean _startsWith = _name_2.startsWith("X");
- boolean _not = (!_startsWith);
- if (_not) {
- _or = true;
- } else {
- AbstractRule _rule_5 = ruleCall.getRule();
- String _name_3 = _rule_5.getName();
- boolean _equals_2 = _name_3.equals("XImportSection");
- _or = _equals_2;
- }
- if (!_or) {
- _and_2 = false;
- } else {
- AbstractRule _rule_6 = ruleCall.getRule();
- String _name_4 = _rule_6.getName();
- boolean _contains = _name_4.contains("Jvm");
- boolean _not_1 = (!_contains);
- _and_2 = _not_1;
- }
- if (!_and_2) {
- _and_1 = false;
- } else {
- AbstractRule _rule_7 = ruleCall.getRule();
- String _name_5 = _rule_7.getName();
- boolean _contains_1 = _name_5.contains("Expression");
- boolean _not_2 = (!_contains_1);
- _and_1 = _not_2;
- }
- if (_and_1) {
- FormattingConfig.LinewrapLocator _setLinewrap_4 = config.setLinewrap(0, 1, 2);
- AbstractRule _rule_8 = ruleCall.getRule();
- _setLinewrap_4.before(_rule_8);
- }
- }
- }
- }
- }
-}

Back to the top