WebReq constructor

WebReq(
  1. {String id,
  2. String name,
  3. bool encrypt,
  4. String serverUrl,
  5. Map<String, dynamic> commonHeaders,
  6. SslPinningCri sslPinningCri,
  7. DfQuery query,
  8. bool success,
  9. Map<String, dynamic> headers}
)

Implementation

WebReq ({String id, String name, bool encrypt, String serverUrl, Map<String,dynamic> commonHeaders, SslPinningCri sslPinningCri, DfQuery query, bool success, Map<String,dynamic> headers}) : super(name: "log_webreq") {
  String sslPinningKeys;
  String sslPinningTypeStr;
  if (sslPinningCri != null) {
    sslPinningKeys = DfConverter.arrToString(sslPinningCri.shakeys);
    sslPinningTypeStr = sslPinningCri.shatype.name;
  }

  String contextPath;
  String pathVariablesStr;
  String reqParamStr;
  String reqBodyStr;
  if (query.entityJoin != null && query.entityJoin.entities != null && query.entityJoin.entities.length > 0) {
    DfWebEntity entity = query.entityJoin.entities[0] as DfWebEntity;
    final reqParam = entity.convertToWebReqParam(query);
    if (reqParam != null) {
      pathVariablesStr = DfConverter.arrToString(reqParam.pathVariables);
      reqParamStr = DfConverter.dictToJsonString(reqParam.reqParams);
      reqBodyStr = DfConverter.dictToJsonString(reqParam.reqBody);
    }

    contextPath = entity.entityName;
  }


  fId = DfDbField(entity: this, name: "id", primaryKey: true, joinKey: false, fieldType: DfFieldType.text(), value: id);
  fName = DfDbField(entity: this, name: "name", primaryKey: false, joinKey: false, fieldType: DfFieldType.text(), value: name);
  fEncrypt = DfDbField(entity: this, name: "encrypt", primaryKey: false, joinKey: false, fieldType: DfFieldType.integer(), value: DfConverter.boolToInt(encrypt));
  fServerUrl = DfDbField(entity: this, name: "serverurl", primaryKey: false, joinKey: true, fieldType: DfFieldType.text(), value: serverUrl);
  fCommonHeaders = DfDbField(entity: this, name: "commonheaders", primaryKey: false, joinKey: false, fieldType: DfFieldType.text(), value: DfConverter.dictToJsonString(commonHeaders));
  fSslPinningList = DfDbField(entity: this, name: "sslpinninglist", primaryKey: false, joinKey: false, fieldType: DfFieldType.text(), value: sslPinningKeys);
  fSslPinningType = DfDbField(entity: this, name: "sslpinningtype", primaryKey: false, joinKey: false, fieldType: DfFieldType.text(), value: sslPinningTypeStr);
  fContextPath = DfDbField(entity: this, name: "contextpath", primaryKey: false, joinKey: false, fieldType: DfFieldType.text(), value: contextPath);
  fHttpMethod = DfDbField(entity: this, name: "httpmethod", primaryKey: false, joinKey: false, fieldType: DfFieldType.text(), value: query.purpose.name);
  fPathVariables = DfDbField(entity: this, name: "pathvariables", primaryKey: false, joinKey: false, fieldType: DfFieldType.text(), value: pathVariablesStr);
  fReqParams = DfDbField(entity: this, name: "reqparams", primaryKey: false, joinKey: false, fieldType: DfFieldType.text(), value: reqParamStr);
  fReqBody = DfDbField(entity: this, name: "reqbody", primaryKey: false, joinKey: false, fieldType: DfFieldType.text(), value: reqBodyStr);
  fCreatedAt = DfDbField(entity: this, name: "createdat", primaryKey: false, joinKey: false, fieldType: DfFieldType.datetime(), value: DateTime.now());
  fSuccess = DfDbField(entity: this, name: "success", primaryKey: false, joinKey: false, fieldType: DfFieldType.integer(), value: DfConverter.boolToInt(success));
  fHeaders = DfDbField(entity: this, name: "headers", primaryKey: false, joinKey: false, fieldType: DfFieldType.text(), value: DfConverter.dictToJsonString(headers));
}