iipRequestGetAttributes method
void
iipRequestGetAttributes(
- int callback,
- int resourceId,
- DC attributes, [
- bool all = false,
])
Implementation
void iipRequestGetAttributes(int callback, int resourceId, DC attributes,
[bool all = false]) {
Warehouse.getById(resourceId).then((r) {
if (r == null) {
sendError(ErrorType.Management, callback,
ExceptionCode.ResourceNotFound.index);
return;
}
// if (!r.instance.store.instance.applicable(r, session, ActionType.InquireAttributes, null))
if (r.instance?.applicable(
_session as Session, ActionType.InquireAttributes, null) !=
Ruling.Allowed) {
sendError(ErrorType.Management, callback,
ExceptionCode.ViewAttributeDenied.index);
return;
}
List<String>? attrs = null;
if (!all) attrs = attributes.getStringArray(0, attributes.length);
var st = r.instance?.getAttributes(attrs);
if (st != null)
sendReply(
all
? IIPPacketAction.GetAllAttributes
: IIPPacketAction.GetAttributes,
callback)
..addDC(Codec.composeStructure(st, this, true, true, true))
..done();
else
sendError(ErrorType.Management, callback,
ExceptionCode.GetAttributesFailed.index);
});
}