use of lucee.runtime.type.Array in project Lucee by lucee.
the class Feed method propTag.
private void propTag(Struct props, StringBuffer xml, int count, String[] srcNames, String trgName, String[][] attrNames, boolean childrenAsTag) throws PageException {
Object value;
for (int i = 0; i < srcNames.length; i++) {
value = props.get(srcNames[i], null);
if (value instanceof Array) {
Array arr = (Array) value;
int size = arr.size();
for (int y = 1; y <= size; y++) {
propTag(xml, count, arr.get(y, null), trgName, attrNames, childrenAsTag);
}
break;
}
if (value != null) {
propTag(xml, count, value, trgName, attrNames, childrenAsTag);
break;
}
}
}
use of lucee.runtime.type.Array in project Lucee by lucee.
the class FileTag method actionUploadAll.
public static Array actionUploadAll(PageContext pageContext, lucee.runtime.security.SecurityManager securityManager, String strDestination, int nameconflict, String accept, boolean strict, int mode, String attributes, Object acl, String serverPassword) throws PageException {
FormItem[] items = getFormItems(pageContext);
Struct sct = null;
Array arr = new ArrayImpl();
for (int i = 0; i < items.length; i++) {
sct = _actionUpload(pageContext, securityManager, items[i], strDestination, nameconflict, accept, strict, mode, attributes, acl, serverPassword);
arr.appendEL(sct);
}
return arr;
}
use of lucee.runtime.type.Array in project Lucee by lucee.
the class FileTag method actionUploadAll.
public void actionUploadAll() throws PageException {
Array arr = actionUploadAll(pageContext, securityManager, strDestination, nameconflict, accept, strict, mode, attributes, acl, serverPassword);
if (StringUtil.isEmpty(result)) {
Struct sct;
if (arr != null && arr.size() > 0)
sct = (Struct) arr.getE(1);
else
sct = new StructImpl();
pageContext.undefinedScope().set(KeyConstants._file, sct);
pageContext.undefinedScope().set("cffile", sct);
} else {
pageContext.setVariable(result, arr);
}
}
use of lucee.runtime.type.Array in project Lucee by lucee.
the class ThreadTag method setRetryinterval.
public void setRetryinterval(Object obj) throws PageException {
if (StringUtil.isEmpty(obj))
return;
Array arr = Caster.toArray(obj, null);
if (arr == null) {
plans = new ExecutionPlan[] { toExecutionPlan(obj, 1) };
} else {
Iterator<Object> it = arr.valueIterator();
plans = new ExecutionPlan[arr.size()];
int index = 0;
while (it.hasNext()) {
plans[index++] = toExecutionPlan(it.next(), index == 1 ? 1 : 0);
}
}
}
use of lucee.runtime.type.Array in project Lucee by lucee.
the class FeedQuery method toStruct.
private static Struct toStruct(Object value) {
if (value instanceof Struct)
return (Struct) value;
if (value instanceof Array) {
Struct sct = new StructImpl(), row;
Array arr = (Array) value;
int len = arr.size();
// Key[] keys;
Iterator<Entry<Key, Object>> it;
Entry<Key, Object> e;
String nw;
Object ext;
for (int i = 1; i <= len; i++) {
row = Caster.toStruct(arr.get(i, null), null, false);
if (row == null)
continue;
it = row.entryIterator();
// keys = row.keys();
while (it.hasNext()) {
e = it.next();
ext = sct.get(e.getKey(), null);
nw = Caster.toString(e.getValue(), null);
if (nw != null) {
if (ext == null)
sct.setEL(e.getKey(), nw);
else if (ext instanceof CastableArray) {
((CastableArray) ext).appendEL(nw);
} else {
CastableArray ca = new CastableArray();
ca.appendEL(Caster.toString(ext, null));
ca.appendEL(nw);
sct.setEL(e.getKey(), ca);
}
}
}
}
return sct;
}
return null;
}
Aggregations