use of com.developmentontheedge.be5.metadata.model.base.BeModelElement in project be5 by DevelopmentOnTheEdge.
the class DpsHelper method addTags.
private <T extends DynamicPropertySet> T addTags(T dps, BeModelElement modelElements, Collection<String> columnNames) {
Map<String, ColumnDef> columns = meta.getColumns(getEntity(modelElements));
for (String propertyName : columnNames) {
DynamicProperty property = dps.getProperty(propertyName);
ColumnDef columnDef = columns.get(property.getName());
if (columnDef != null)
addTags(property, columnDef);
}
return dps;
}
use of com.developmentontheedge.be5.metadata.model.base.BeModelElement in project be5 by DevelopmentOnTheEdge.
the class Project method dump.
public static StringBuffer dump(BeModelCollection<?> collection, StringBuffer msg, String prefix, String shift) {
final String nl = System.getProperty("line.separator");
msg.append(prefix + collection.getName() + "[" + collection.getSize() + "], " + collection.getCompletePath() + nl);
final String newPrefix = prefix + shift;
for (BeModelElement de : collection) {
if (de instanceof BeModelCollection) {
dump((BeModelCollection<?>) de, msg, newPrefix, shift);
} else {
msg.append(newPrefix + de.getName() + nl);
}
}
return msg;
}
use of com.developmentontheedge.be5.metadata.model.base.BeModelElement in project be5 by DevelopmentOnTheEdge.
the class Project method getContext.
/**
* Creates and returns FreeMarker context for given element
* @param element to create context for (can be null)
* @return
*/
public Map<String, Object> getContext(TemplateElement element) {
Map<String, Object> context = new HashMap<>();
BeModelElement parent = element;
while (parent != null) {
if (parent instanceof PageCustomization) {
context.put("customization", parent);
} else if (parent instanceof Query) {
context.put("query", parent);
} else if (parent instanceof Operation) {
context.put("operation", parent);
} else if (parent instanceof Entity) {
context.put("entity", parent);
} else if (parent instanceof Module) {
context.put("module", parent);
}
parent = parent.getOrigin();
}
for (String name : getPropertyNames()) {
context.put(name, getProperty(name));
}
BeConnectionProfile profile = getConnectionProfile();
if (profile != null) {
for (String name : profile.getPropertyNames()) {
context.put(name, profile.getProperty(name));
}
}
return context;
}
use of com.developmentontheedge.be5.metadata.model.base.BeModelElement in project be5 by DevelopmentOnTheEdge.
the class DataElementUtils method moveBackToItsModule.
/**
* Moves the model element back to the its module if the element is an entity item.
*
* @param modelElement
*/
public static void moveBackToItsModule(final BeModelElement modelElement) {
if (modelElement instanceof BeElementWithOriginModule) {
BeElementWithOriginModule r = (BeElementWithOriginModule) modelElement;
r.setOriginModuleName(r.getModule().getName());
}
}
use of com.developmentontheedge.be5.metadata.model.base.BeModelElement in project be5 by DevelopmentOnTheEdge.
the class DataElementUtils method traversePath.
// pathIterator is mutable, but it's OK as we can see each its element (pathPart)
private static BeModelElement traversePath(Iterator<String> pathIterator, BeModelElement node) {
assert pathIterator != null;
assert node != null;
if (!pathIterator.hasNext())
// found
return node;
final String pathPart = pathIterator.next();
if (!(node instanceof BeModelCollection))
// need but can't go further
return null;
@SuppressWarnings("unchecked") final BeModelCollection<BeModelElement> collection = (BeModelCollection<BeModelElement>) node;
if (!collection.contains(pathPart))
// not found
return null;
final BeModelElement nextNode = collection.get(pathPart);
return traversePath(pathIterator, nextNode);
}
Aggregations