}
public static String extractProperties(final Schema entity, final Set<String> propertyNames, final Set<Validator> validators, final Set<String> enums, final Map<String, Set<String>> views, final Map<Actions.Type, List<ActionEntry>> actions, final ErrorBuffer errorBuffer) throws FrameworkException {
final PropertyContainer propertyContainer = entity.getPropertyContainer();
final StringBuilder src = new StringBuilder();
// output property source code and collect views
for (String propertyName : SchemaHelper.getProperties(propertyContainer)) {
if (!propertyName.startsWith("__") && propertyContainer.hasProperty(propertyName)) {
String rawType = propertyContainer.getProperty(propertyName).toString();
String dbName = null;
// detect optional db name
if (rawType.contains("|")) {
dbName = rawType.substring(0, rawType.indexOf("|"));
rawType = rawType.substring(rawType.indexOf("|")+1);
}
boolean notNull = false;
// detect and remove not-null constraint
if (rawType.startsWith("+")) {
rawType = rawType.substring(1);
notNull = true;
}
String defaultValue = null;
// detect and remove default value
if (rawType.contains(":") && !rawType.startsWith(Type.Cypher.name())) {
final int lastIndex = rawType.lastIndexOf(":");
defaultValue = rawType.substring(lastIndex+1);
rawType = rawType.substring(0, lastIndex);
}
PropertyParser parser = SchemaHelper.getParserForRawValue(errorBuffer, entity.getClassName(), propertyName, dbName, rawType, notNull, defaultValue);
if (parser != null) {
// add property name to set for later use
propertyNames.add(parser.getPropertyName());
// append created source from parser
src.append(parser.getPropertySource(entity, errorBuffer));
// register global elements created by parser
validators.addAll(parser.getGlobalValidators());
enums.addAll(parser.getEnumDefinitions());
// register property in default view
//addPropertyToView(PropertyView.Public, propertyName.substring(1), views);
addPropertyToView(PropertyView.Ui, propertyName.substring(1), views);
}
}
}
for (final String rawViewName : getViews(propertyContainer)) {
if (!rawViewName.startsWith("___") && propertyContainer.hasProperty(rawViewName)) {
final String value = propertyContainer.getProperty(rawViewName).toString();
final String[] parts = value.split("[,\\s]+");
final String viewName = rawViewName.substring(2);
// clear view before filling it again
Set<String> view = views.get(viewName);
if (view == null) {
view = new LinkedHashSet<>();
views.put(viewName, view);
} else {
view.clear();
}
// add parts to view, overrides defaults (because of clear() above)
for (int i = 0; i < parts.length; i++) {
view.add(parts[i].trim());
}
}
}
for (final String rawActionName : getActions(propertyContainer)) {
if (propertyContainer.hasProperty(rawActionName)) {
// split value on ";"
final String value = propertyContainer.getProperty(rawActionName).toString();
final String[] parts1 = value.split("[;]+");
final int parts1Length = parts1.length;
for (int i=0; i<parts1Length; i++) {