def fillTagValues(self, keyPath, tagValueList, operData): initialListSize = tagValueList.getLen() for logFunc in self._log("fill-tag-values").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize) # fill tag values up to current if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()): i = keyPath.getLen() while i < self.myKeyPath.getLen(): valBegin = Value() (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag() valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) for logFunc in self._log( "fill-tag-values-adding").debug3Func(): logFunc( "adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d", i, valBegin, self.myKeyPath.getLen()) i += 1 if operData.isColorRequested() and operData.hasColor(): val = Value() val.setEnum(operData.color.getValue()) tagValueList.push(("color", "http://qwilt.com/model/lake-example"), val) if operData.isPatternRequested() and operData.hasPattern(): val = Value() val.setString(operData.pattern) tagValueList.push( ("pattern", "http://qwilt.com/model/lake-example"), val) if operData.isMacAddressRequested() and operData.hasMacAddress(): val = Value() val.setBinary(operData.macAddress.getAddress()) tagValueList.push( ("mac-address", "http://qwilt.com/model/lake-example"), val) if operData.isLineWidthRequested() and operData.hasLineWidth(): val = Value() val.setInt8(operData.lineWidth) tagValueList.push( ("line-width", "http://qwilt.com/model/lake-example"), val) if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()): i = self.myKeyPath.getLen() - 1 while i >= keyPath.getLen(): valEnd = Value() (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) i -= 1 for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc( "ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d", operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen()) return ReturnCodes.kOk
def _fillWriteTagValues(self, tagValueList): self.myInitGuard.isInitOrCrash() for logFunc in self._log('fill-write-tag-values').debug3Func(): logFunc('called: tagValueList=%s', tagValueList) if self.hasValueConfigQ(): valValueConfigQ = Value() if self.valueConfigQ is not None: valValueConfigQ.setInt8(self.valueConfigQ) else: valValueConfigQ.setEmpty() tagValueList.push( ("value-config-q", "http://qwilt.com/model/oper"), valValueConfigQ) return ReturnCodes.kOk
def fillTagValues (self, keyPath, tagValueList, operData): initialListSize = tagValueList.getLen() for logFunc in self._log("fill-tag-values").debug3Func(): logFunc("called. operData=%s, keyPath=%s, initialListSize=%d", operData.debugStr(True), keyPath, initialListSize) # fill tag values up to current if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()): i = keyPath.getLen() while i < self.myKeyPath.getLen(): valBegin = Value() (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag() valBegin.setXmlBegin((tag, ns, prefix)) tagValueList.push((tag, ns), valBegin) for logFunc in self._log("fill-tag-values-adding").debug3Func(): logFunc("adding xml begin. i=%d, valBegin=%s, self.myKeyPath.getLen()=%d", i, valBegin, self.myKeyPath.getLen()) i+=1 if operData.isColorRequested() and operData.hasColor(): val = Value() val.setEnum(operData.color.getValue()) tagValueList.push(("color", "http://qwilt.com/model/lake-example"), val) if operData.isPatternRequested() and operData.hasPattern(): val = Value() val.setString(operData.pattern) tagValueList.push(("pattern", "http://qwilt.com/model/lake-example"), val) if operData.isMacAddressRequested() and operData.hasMacAddress(): val = Value() val.setBinary(operData.macAddress.getAddress()) tagValueList.push(("mac-address", "http://qwilt.com/model/lake-example"), val) if operData.isLineWidthRequested() and operData.hasLineWidth(): val = Value() val.setInt8(operData.lineWidth) tagValueList.push(("line-width", "http://qwilt.com/model/lake-example"), val) if self.myKeyPath.isEqualLen(keyPath, keyPath.getLen()): i = self.myKeyPath.getLen() - 1 while i >= keyPath.getLen(): valEnd = Value() (tag, ns, prefix) = self.myKeyPath.getAt(i).asXmlTag() valEnd.setXmlEnd((tag, ns, prefix)) tagValueList.push((tag, ns), valEnd) i-=1 for logFunc in self._log("fill-tag-values-ended").debug3Func(): logFunc("ended. operData=%s, keyPath=%s, initialListSize=%d, finalListSize=%d", operData.debugStr(True), keyPath, initialListSize, tagValueList.getLen()) return ReturnCodes.kOk