use of lucee.runtime.type.StructImpl in project Lucee by lucee.
the class Mapping method getResult.
public Result getResult(PageContext pc, String path, Struct matrix, int format, boolean hasFormatExtension, List<MimeType> accept, MimeType contentType, Result defaultValue) throws PageException {
List<Source> sources = init(pc, false);
Iterator<Source> it = sources.iterator();
Source src;
String[] arrPath, subPath;
int index;
while (it.hasNext()) {
src = it.next();
Struct variables = new StructImpl();
arrPath = RestUtil.splitPath(path);
index = RestUtil.matchPath(variables, src.getPath(), arrPath);
if (index != -1) {
subPath = new String[(arrPath.length - 1) - index];
System.arraycopy(arrPath, index + 1, subPath, 0, subPath.length);
return new Result(src, variables, subPath, matrix, format, hasFormatExtension, accept, contentType);
}
}
return defaultValue;
}
use of lucee.runtime.type.StructImpl in project Lucee by lucee.
the class Caster method toStruct.
public static Struct toStruct(Query qry, int row) {
Key[] names = qry.getColumnNames();
Struct sct = new StructImpl();
for (int i = 0; i < names.length; i++) {
sct.setEL(names[i], qry.getAt(names[i], row, null));
}
return sct;
}
use of lucee.runtime.type.StructImpl in project Lucee by lucee.
the class DatSourceDefImpl method getAllowedSQL.
@Override
public Struct getAllowedSQL() {
Struct allow = new StructImpl();
allow.setEL(KeyConstants._alter, Caster.toBoolean(ds.hasAllow(DataSource.ALLOW_ALTER)));
allow.setEL(KeyConstants._create, Caster.toBoolean(ds.hasAllow(DataSource.ALLOW_CREATE)));
allow.setEL(KeyConstants._delete, Caster.toBoolean(ds.hasAllow(DataSource.ALLOW_DELETE)));
allow.setEL(KeyConstants._drop, Caster.toBoolean(ds.hasAllow(DataSource.ALLOW_DROP)));
allow.setEL(KeyConstants._grant, Caster.toBoolean(ds.hasAllow(DataSource.ALLOW_GRANT)));
allow.setEL(KeyConstants._insert, Caster.toBoolean(ds.hasAllow(DataSource.ALLOW_INSERT)));
allow.setEL(KeyConstants._revoke, Caster.toBoolean(ds.hasAllow(DataSource.ALLOW_REVOKE)));
allow.setEL(KeyConstants._select, Caster.toBoolean(ds.hasAllow(DataSource.ALLOW_SELECT)));
// TODO
allow.setEL("storedproc", Caster.toBoolean(true));
allow.setEL(KeyConstants._update, Caster.toBoolean(ds.hasAllow(DataSource.ALLOW_UPDATE)));
return allow;
}
use of lucee.runtime.type.StructImpl in project Lucee by lucee.
the class DataSourceServiceImpl method getDrivers.
@Override
public Struct getDrivers() throws ServiceException, SecurityException {
checkReadAccess();
Struct rtn = new StructImpl();
Struct driver;
try {
Resource luceeContext = ResourceUtil.toResourceExisting(pc(), "/lucee/admin/dbdriver/");
Resource[] children = luceeContext.listResources(new ExtensionResourceFilter(Constants.getComponentExtensions()));
String name;
for (int i = 0; i < children.length; i++) {
driver = new StructImpl();
name = ListFirst.call(pc(), children[i].getName(), ".");
driver.setEL(KeyConstants._name, name);
driver.setEL("handler", children[i].getName());
rtn.setEL(name, driver);
}
} catch (ExpressionException e) {
throw new ServiceException(e.getMessage());
}
return rtn;
}
use of lucee.runtime.type.StructImpl in project Lucee by lucee.
the class DataSourceServiceImpl method getDatasources.
@Override
public Struct getDatasources() throws SecurityException {
// MUST muss struct of struct zurueckgeben!!!
checkReadAccess();
lucee.runtime.db.DataSource[] sources = config().getDataSources();
Struct rtn = new StructImpl();
for (int i = 0; i < sources.length; i++) {
rtn.setEL(sources[i].getName(), new DataSourceImpl(sources[i]));
}
return rtn;
}
Aggregations