Exemplo n.º 1
0
 def getXml(self):
     elt = Element("USBThrottle")
     for mi in self.ctrlMenuItem:
         if (mi.isSelected()):
             elt.setAttribute("DesiredController", mi.getText())
             break
     return elt
Exemplo n.º 2
0
 def getXml(self):
    elt = Element("USBThrottle")
    for mi in self.ctrlMenuItem :
        if (mi.isSelected()) :
            elt.setAttribute("DesiredController", mi.getText())
            break
    return elt
Exemplo n.º 3
0
def buildIntermediateCiXML(theCiElement, objectFromARIS):
    try:
        theCiElement.setAttribute('type', objectFromARIS.type)
        objectAttributeMap = objectFromARIS.attMap
        ## Add CI attributes
        if objectAttributeMap:
            for objectAttributeName in objectAttributeMap.keys():
                if objectAttributeName and objectAttributeMap[
                        objectAttributeName]:
                    fieldElement = Element('field')
                    fieldElement.setAttribute('name', objectAttributeName)
                    fieldElement.setText(
                        objectAttributeMap[objectAttributeName])
                    theCiElement.addContent(fieldElement)
                else:
                    debugPrint(
                        3, '[' + SCRIPT_NAME +
                        ':buildIntermediateCiXML] Skipping attribute <%s> with invalid value'
                        % objectAttributeName)
        return 1
    except:
        excInfo = logger.prepareJythonStackTrace('')
        debugPrint('[' + SCRIPT_NAME +
                   ':buildIntermediateCiXML] Exception: <%s>' % excInfo)
        return -1
Exemplo n.º 4
0
def buildIntermediateXML(objectMapFromARIS):
    try:
        ## Build XML
        intermediateXML = Document()
        rootElement = Element('data')
        intermediateXML.setRootElement(rootElement)
        cisElement = Element('cis')
        linksElement = Element('links')
        rootElement.addContent(cisElement)
        rootElement.addContent(linksElement)

        if objectMapFromARIS:
            ## Add CIs
            for objectFromARIS in objectMapFromARIS.values():
                ciElement = Element('ci')
                if buildIntermediateCiXML(ciElement, objectFromARIS):
                    cisElement.addContent(ciElement)
                ## Add relationships
                relationshipsFromObject = objectFromARIS.links
                if relationshipsFromObject:
                    for relationshipFromObject in relationshipsFromObject:
                        linkElement = Element('link')
                        linkElement.setAttribute('type',
                                                 relationshipFromObject.type)
                        linkEndCount = 1
                        for linkEndCi in [
                                objectMapFromARIS[relationshipFromObject.end1],
                                objectMapFromARIS[relationshipFromObject.end2]
                        ]:
                            endCiElement = Element('end' + str(linkEndCount) +
                                                   'ci')
                            linkEndCount = linkEndCount + 1
                            if buildIntermediateCiXML(endCiElement, linkEndCi):
                                linkElement.addContent(endCiElement)
                            else:
                                debugPrint(
                                    3, '[' + SCRIPT_NAME +
                                    ':buildIntermediateXML] Error building link end for link with GUID <%s>! Skipping...'
                                    % relationshipFromObject.id)
                        linksElement.addContent(linkElement)
        return intermediateXML
    except:
        excInfo = logger.prepareJythonStackTrace('')
        debugPrint('[' + SCRIPT_NAME +
                   ':buildIntermediateXML] Exception: <%s>' % excInfo)
        pass
Exemplo n.º 5
0
def buildIntermediateCiXML(theCiElement, objectFromARIS):
	try:
		theCiElement.setAttribute('type', objectFromARIS.type)
		objectAttributeMap = objectFromARIS.attMap
		## Add CI attributes
		if objectAttributeMap:
			for objectAttributeName in objectAttributeMap.keys():
				if objectAttributeName and objectAttributeMap[objectAttributeName]:
					fieldElement = Element('field')
					fieldElement.setAttribute('name', objectAttributeName)
					fieldElement.setText(objectAttributeMap[objectAttributeName])
					theCiElement.addContent(fieldElement)
				else:
					debugPrint(3, '[' + SCRIPT_NAME + ':buildIntermediateCiXML] Skipping attribute <%s> with invalid value' % objectAttributeName)
		return 1
	except:
		excInfo = logger.prepareJythonStackTrace('')
		debugPrint('[' + SCRIPT_NAME + ':buildIntermediateCiXML] Exception: <%s>' % excInfo)
		return -1
Exemplo n.º 6
0
def buildIntermediateXML(objectMapFromARIS):
	try:
		## Build XML
		intermediateXML = Document()
		rootElement = Element('data')
		intermediateXML.setRootElement(rootElement)
		cisElement = Element('cis')
		linksElement = Element('links')
		rootElement.addContent(cisElement)
		rootElement.addContent(linksElement)

		if objectMapFromARIS:
			## Add CIs
			for objectFromARIS in objectMapFromARIS.values():
				ciElement = Element('ci')
				if buildIntermediateCiXML(ciElement, objectFromARIS):
					cisElement.addContent(ciElement)
				## Add relationships
				relationshipsFromObject = objectFromARIS.links
				if relationshipsFromObject:
					for relationshipFromObject in relationshipsFromObject:
						linkElement = Element('link')
						linkElement.setAttribute('type', relationshipFromObject.type)
						linkEndCount = 1
						for linkEndCi in [objectMapFromARIS[relationshipFromObject.end1], objectMapFromARIS[relationshipFromObject.end2]]:
							endCiElement = Element('end' + str(linkEndCount) + 'ci')
							linkEndCount = linkEndCount + 1
							if buildIntermediateCiXML(endCiElement, linkEndCi):
								linkElement.addContent(endCiElement)
							else:
								debugPrint(3, '[' + SCRIPT_NAME + ':buildIntermediateXML] Error building link end for link with GUID <%s>! Skipping...' % relationshipFromObject.id)
						linksElement.addContent(linkElement)
		return intermediateXML
	except:
		excInfo = logger.prepareJythonStackTrace('')
		debugPrint('[' + SCRIPT_NAME + ':buildIntermediateXML] Exception: <%s>' % excInfo)
		pass