Search in sources :

Example 11 with SchemaProperty

use of org.structr.core.entity.SchemaProperty in project structr by structr.

the class StructrDateProperty method createDatabaseSchema.

@Override
SchemaProperty createDatabaseSchema(final App app, final AbstractSchemaNode schemaNode) throws FrameworkException {
    final SchemaProperty property = super.createDatabaseSchema(app, schemaNode);
    final PropertyMap properties = new PropertyMap();
    properties.put(SchemaProperty.propertyType, Type.Date.name());
    properties.put(SchemaProperty.format, datePattern);
    property.setProperties(SecurityContext.getSuperUserInstance(), properties);
    return property;
}
Also used : SchemaProperty(org.structr.core.entity.SchemaProperty) PropertyMap(org.structr.core.property.PropertyMap)

Example 12 with SchemaProperty

use of org.structr.core.entity.SchemaProperty in project structr by structr.

the class StructrEnumProperty method createDatabaseSchema.

@Override
SchemaProperty createDatabaseSchema(final App app, final AbstractSchemaNode schemaNode) throws FrameworkException {
    final SchemaProperty property = super.createDatabaseSchema(app, schemaNode);
    final PropertyMap properties = new PropertyMap();
    properties.put(SchemaProperty.propertyType, Type.Enum.name());
    properties.put(SchemaProperty.fqcn, this.fqcn);
    properties.put(SchemaProperty.format, StringUtils.join(getEnums(), ", "));
    property.setProperties(SecurityContext.getSuperUserInstance(), properties);
    return property;
}
Also used : SchemaProperty(org.structr.core.entity.SchemaProperty) PropertyMap(org.structr.core.property.PropertyMap)

Example 13 with SchemaProperty

use of org.structr.core.entity.SchemaProperty in project structr by structr.

the class StructrIntegerArrayProperty method createDatabaseSchema.

@Override
SchemaProperty createDatabaseSchema(final App app, final AbstractSchemaNode schemaNode) throws FrameworkException {
    final SchemaProperty property = super.createDatabaseSchema(app, schemaNode);
    final PropertyMap properties = new PropertyMap();
    properties.put(SchemaProperty.propertyType, Type.IntegerArray.name());
    if (minimum != null && maximum != null) {
        final StringBuilder range = new StringBuilder();
        if (exclusiveMinimum) {
            range.append("]");
        } else {
            range.append("[");
        }
        range.append(minimum);
        range.append(",");
        range.append(maximum);
        if (exclusiveMaximum) {
            range.append("[");
        } else {
            range.append("]");
        }
        properties.put(SchemaProperty.format, range.toString());
    }
    property.setProperties(SecurityContext.getSuperUserInstance(), properties);
    return property;
}
Also used : SchemaProperty(org.structr.core.entity.SchemaProperty) PropertyMap(org.structr.core.property.PropertyMap)

Example 14 with SchemaProperty

use of org.structr.core.entity.SchemaProperty in project structr by structr.

the class StructrIntegerProperty method createDatabaseSchema.

@Override
SchemaProperty createDatabaseSchema(final App app, final AbstractSchemaNode schemaNode) throws FrameworkException {
    final SchemaProperty property = super.createDatabaseSchema(app, schemaNode);
    final PropertyMap properties = new PropertyMap();
    properties.put(SchemaProperty.propertyType, Type.Integer.name());
    if (minimum != null && maximum != null) {
        final StringBuilder range = new StringBuilder();
        if (exclusiveMinimum) {
            range.append("]");
        } else {
            range.append("[");
        }
        range.append(minimum);
        range.append(",");
        range.append(maximum);
        if (exclusiveMaximum) {
            range.append("[");
        } else {
            range.append("]");
        }
        properties.put(SchemaProperty.format, range.toString());
    }
    property.setProperties(SecurityContext.getSuperUserInstance(), properties);
    return property;
}
Also used : SchemaProperty(org.structr.core.entity.SchemaProperty) PropertyMap(org.structr.core.property.PropertyMap)

Example 15 with SchemaProperty

use of org.structr.core.entity.SchemaProperty in project structr by structr.

the class StructrLongArrayProperty method createDatabaseSchema.

@Override
SchemaProperty createDatabaseSchema(final App app, final AbstractSchemaNode schemaNode) throws FrameworkException {
    final SchemaProperty property = super.createDatabaseSchema(app, schemaNode);
    final PropertyMap properties = new PropertyMap();
    properties.put(SchemaProperty.propertyType, Type.LongArray.name());
    if (minimum != null && maximum != null) {
        final StringBuilder range = new StringBuilder();
        if (exclusiveMinimum) {
            range.append("]");
        } else {
            range.append("[");
        }
        range.append(minimum);
        range.append(",");
        range.append(maximum);
        if (exclusiveMaximum) {
            range.append("[");
        } else {
            range.append("]");
        }
        properties.put(SchemaProperty.format, range.toString());
    }
    property.setProperties(SecurityContext.getSuperUserInstance(), properties);
    return property;
}
Also used : SchemaProperty(org.structr.core.entity.SchemaProperty) PropertyMap(org.structr.core.property.PropertyMap)

Aggregations

SchemaProperty (org.structr.core.entity.SchemaProperty)34 PropertyMap (org.structr.core.property.PropertyMap)23 FrameworkException (org.structr.common.error.FrameworkException)7 SchemaNode (org.structr.core.entity.SchemaNode)7 Tx (org.structr.core.graph.Tx)7 LinkedList (java.util.LinkedList)5 App (org.structr.core.app.App)5 StructrApp (org.structr.core.app.StructrApp)5 Test (org.junit.Test)4 SchemaMethod (org.structr.core.entity.SchemaMethod)4 SchemaView (org.structr.core.entity.SchemaView)4 AbstractSchemaNode (org.structr.core.entity.AbstractSchemaNode)3 FrontendTest (org.structr.web.basic.FrontendTest)3 ResourceAccessTest (org.structr.web.basic.ResourceAccessTest)3 LinkedHashSet (java.util.LinkedHashSet)2 TreeSet (java.util.TreeSet)2 PropertyContainer (org.structr.api.graph.PropertyContainer)2 NodeAttribute (org.structr.core.graph.NodeAttribute)2 StructrPath (org.structr.files.ssh.filesystem.StructrPath)2 URI (java.net.URI)1