def start_file(self, file):
        Print.info("Start f!"+str(file))
        contentList = []
        fList=[]
        # self.file = file
        # self.filename = "D:/CASTTOOL/RuleDevelopment/Tibco/com.castsoftware.uc.tibco/com.castsoftware.uc.tibco/TibcoTest/TibcoSample/AdapterQueueStarter.process";
        self.filename = file.get_path();
        self.file = file;
        Print.info("###############printing file name############")
        Print.info("FileName--" + str(self.filename))
        file_ref = open(self.filename, encoding='UTF_8')
        # contentList=[];
        for i in file_ref:
            contentList.append(str(i));
        Print.info("contentList >> "+ str(contentList))
        fList=contentList
        '''
        for i in file_ref:
            fList.append(str(i).strip().lower())
            '''
        Print.info("Flist >> " + str(fList))
        Tibco_Process = CustomObject();
        self.saveObject(Tibco_Process, str(self.filename), self.filename + str(self.filename), "Tibco_Process",
                        self.file,
                        self.filename + "Tibco_Process")
        Tibco_Process.save();

        # Tibco_Process.save_position(Bookmark(self.file, indexOfClass + 1, 1, indexOfClass + 1, -1));
        Print.info("object saved" + self.filename)
        Print.info(str(fList))
        for line in range(0, len(fList)):
            if ("<pd:conditiontype" in fList[line]):
                # print(fList[line])
                if any(s in fList[line] for s in CondType_Rule):
                    Print.info("valid condition type>>" + fList[line] + " Line #" + str(line + 1))
                else:
                    Print.info("invalid condition type>>" + fList[line] + " Line #" + str(line + 1))
            if ("<pd:transition" in fList[line]):
                Print.info(fList[line])
                Act_invalid=self.masterdata()
                Print.info("Act_invalid >> "+str(Act_invalid))
                if any(s in fList[line + 1] for s in Act_invalid):
                    Print.info("activity type cannot be migrated>>" + fList[line + 1] + " Line #"+ str(line + 1))
                    Tibco_Process.save_position(Bookmark(self.file, line + 1, 1, line + 1, -1));
                    Tibco_Process.save_violation("Tibco_CustomMetrics.Activitycannotbemigrated",
                                                 Bookmark(file, 1, 1, -1, -1), additional_bookmarks=None)

                    Print.info('Tibco  Violation  Saved for demo')
                else:
                    Print.info("activity type can be migrated>>"+ fList[line + 1] + " Line #" + str(line + 1))
                    Tibco_Process.save_position(Bookmark(self.file, line + 1, 1, line + 1, -1));
                    Tibco_Process.save_violation("Tibco_CustomMetrics.Activitycannotbemigrated",
                                                 Bookmark(file, 1, 1, -1, -1), additional_bookmarks=None)
                    Print.info('Tibco  Violation  Saved for demo')
        pass
Beispiel #2
0
class Symbol:
    
    def __init__(self, name, parent=None):
        
        self.name = name
        self.parent = parent
        self.position = None
        self.kb_symbol= None

    def save(self, file):
        """
        Save the symbol
        """
        self.kb_symbol = CustomObject()
        self.kb_symbol.set_name(self.name)
        self.kb_symbol.set_type(self.type)
 
        self.kb_symbol.set_parent(self.parent.kb_symbol if self.parent else file)
        self.kb_symbol.save()
        
        self.kb_symbol.save_position(Bookmark(file, *self.position))
Beispiel #3
0
    def start_file(self, file):
        filename = file.get_path()
        #X.debug(filename)

        if filename.endswith('.xml'):
            tree = ET.parse(filename)
            root = tree.getroot()
            count = 0
            for k in list(root.iter()):
                data1 = re.sub('{.*?}', '', str(k.tag))
                if data1 == "from":
                    try:
                        X.debug(k.attrib['uri'])
                        fromObj = CustomObject()
                        self.saveObject(
                            fromObj, data1 + "." + k.attrib['uri'],
                            filename + '.' + data1, "Sender", file,
                            filename + "." + data1 + '.' + str(count))
                        count = count + 1
                        fromObj.save_position(Bookmark(file, 1, 1, -1, -1))
                        fromRef[fromObj] = [fromObj, k.attrib['uri']]
                    except (RuntimeError, TypeError, NameError):
                        pass
                elif data1 == "to":
                    try:
                        X.debug(k.attrib['uri'])
                        toObj = CustomObject()
                        self.saveObject(
                            toObj, data1 + "." + k.attrib['uri'],
                            filename + '.' + data1, "Receiver", file,
                            filename + "." + data1 + '.' + str(count))
                        count = count + 1
                        toObj.save_position(Bookmark(file, 1, 1, -1, -1))
                        toRef[toObj] = [toObj, k.attrib['uri']]
                    except (RuntimeError, TypeError, NameError):
                        pass
        elif filename.endswith('.java'):
            X.debug("")
Beispiel #4
0
 def checkOnmessage(self, bpel_invoke, operation_type, namespace_port,
                    onmessage_count):
     flag_link = 0
     for reference in bpel_onmessage_data:
         for data in bpel_onmessage_data[reference]:
             onmessage_data = str(data)
             onmessage_data = re.sub('(\[)|(\])|(\')|(\s+)', '',
                                     onmessage_data)
             onmessage_port_type = ""
             onmessage_operation_type = ""
             onmessage_namespace_port = ""
             process_data = ""
             for ele in list(onmessage_data.split(',')):
                 if "portType:" in ele:
                     onmessage_port_type = ele[ele.find(':') + 1:]
                 elif "operation:" in ele:
                     onmessage_operation_type = ele[ele.find(':') + 1:]
             if ':' in onmessage_port_type:
                 onmessage_namespace_port = onmessage_port_type[:
                                                                onmessage_port_type
                                                                .find(':') +
                                                                1]
             process_data = str(bpel_process_data[reference])
             process_data = re.sub('(\[)|(\])|(\')|(\s+)', '', process_data)
             process_data = process_data.replace('xmlns:map:', '')
             for ele in list(process_data.split(',')):
                 if onmessage_namespace_port in ele:
                     onmessage_namespace_port = ele[ele.find(':') + 1:]
                     onmessage_namespace_port = onmessage_namespace_port + onmessage_port_type[
                         onmessage_port_type.find(':') + 1:]
                     break
             if operation_type == onmessage_operation_type and namespace_port == onmessage_namespace_port:
                 if reference in wsdl_obj_reference:
                     #CAST.debug(onmessage_operation_type)
                     file_name = wsdl_obj_reference[
                         reference].parent.get_path()
                     wsdl_operation = CustomObject()
                     onmessage_count = onmessage_count + 1
                     self.saveObject(
                         wsdl_operation, onmessage_operation_type,
                         file_name + onmessage_operation_type,
                         "WSDL_Operation",
                         wsdl_obj_reference[reference].parent, file_name +
                         "WSDL_Operation" + str(onmessage_count))
                     wsdl_operation.save()
                     wsdl_operation.save_position(
                         Bookmark(reference.parent, 1, 1, -1, -1))
                     create_link('callLink', bpel_invoke, wsdl_operation,
                                 Bookmark(reference.parent, 1, 1, -1, -1))
                     create_link('callLink', wsdl_operation,
                                 wsdl_obj_reference[reference],
                                 Bookmark(reference.parent, 1, 1, -1, -1))
                     flag_link = 1
                     break
                 else:
                     pass
             else:
                 pass
         if flag_link == 1:
             break
     return onmessage_count
     pass
Beispiel #5
0
 def start_file(self, file):
     self.filename = file.get_path()
     CAST.debug(self.filename)
     file_ref = open(self.filename, 'r')
     file_data = []
     for child in file_ref:
         child = child.replace("\n", "")
         file_data.append(child)
     parser = CastOperation()
     if self.filename.endswith(".wsdl"):
         try:
             index = self.filename.rfind('\\')
             self.name = self.filename[index + 1:]
         except:
             index = -1
         wsdl_process = CustomObject()
         self.saveObject(wsdl_process, self.name, self.filename,
                         "WSDL_Process", file,
                         self.filename + "WSDL_Process")
         wsdl_process.save()
         wsdl_process.save_position(Bookmark(file, 1, 1, -1, -1))
         wsdl_file_data[wsdl_process] = parser.castParserWsdl(self.filename)
         #CAST.debug(self.name)
     else:
         self.invokeList = parser.getInvokeJavaCode(self.filename)
         for child in self.invokeList:
             self.intermediate_file.write(str(child) + '\n')
         bpel_data = parser.castParserBpel(file, self.filename)
         #CAST.debug(str(bpel_data["link"]))
         for child in bpel_data:
             #attrib_data = re.sub('(\[)|(\])|(\')','',str(bpel_file_data[child]))
             if "process" in child and not "bookmark" in child:
                 for subchild in bpel_data[child]:
                     if "name" in subchild:
                         self.name = subchild[subchild.find(':') + 1:]
                         break
         bpel_process = CustomObject()
         self.saveObject(bpel_process, self.name, self.filename,
                         "BPEL_Process", file,
                         self.filename + "BPEL_Process")
         bpel_process.save()
         if bpel_data["process.bookmark"]:
             bpel_process.save_position(bpel_data["process.bookmark"][0])
         else:
             bpel_process.save_position(Bookmark(file, 1, 1, -1, -1))
         bpel_process_data[bpel_process] = bpel_data["process"]
         bpel_bookmark_data[
             str(bpel_process) +
             "invoke.bookmark"] = bpel_data["invoke.bookmark"]
         bpel_invoke_data[bpel_process] = bpel_data["invoke"]
         bpel_bookmark_data[
             str(bpel_process) +
             "receive.bookmark"] = bpel_data["receive.bookmark"]
         bpel_receive_data[bpel_process] = bpel_data["receive"]
         bpel_bookmark_data[
             str(bpel_process) +
             "onMessage.bookmark"] = bpel_data["onMessage.bookmark"]
         bpel_onmessage_data[bpel_process] = bpel_data["onMessage"]
         self.file_loc_data = parser.fileLoc(self.filename)
         self.file_checksum_data = parser.fileChecksum(self.filename)
         qr_reference = QualityRule()
         qr_reference.BpelQrImplementation(file, bpel_process, bpel_data,
                                           file_data)
         pass
Beispiel #6
0
    def end_analysis(self):
        for child in bpel_process_data:
            bpel_target_name = ""
            bpel_name = ""
            for ele in bpel_process_data[child]:
                if "targetNamespace:" in ele:
                    bpel_target_name = ele[ele.find(':') + 1:]
                elif "name:" in ele:
                    bpel_name = ele[ele.find(':') + 1:]

            for ele in wsdl_file_data:
                wsdl_target_name = ""
                wsdl_name = ""
                for subele in wsdl_file_data[ele]["definitions"]:
                    if "targetNamespace:" in subele:
                        wsdl_target_name = subele[subele.find(':') + 1:]
                    elif "name:" in subele:
                        wsdl_name = subele[subele.find(':') + 1:]
                #CAST.debug(wsdl_name)
                if wsdl_target_name == bpel_target_name:
                    create_link('callLink', ele, child,
                                Bookmark(child.parent, 1, 1, -1, -1))
                    wsdl_obj_reference[child] = ele
                elif wsdl_name == bpel_name and len(wsdl_name) != 0 and len(
                        bpel_name) != 0:
                    #CAST.debug(bpel_name+wsdl_name)
                    create_link('callLink', ele, child,
                                Bookmark(child.parent, 1, 1, -1, -1))
                    wsdl_obj_reference[child] = ele
        invoke_count = 0
        operation_count = 0
        onmessage_count = 0
        for child in bpel_invoke_data:
            invoke_index = 0
            for ele in bpel_invoke_data[child]:
                port_type = ""
                operation_type = ""
                namespace_port = ""
                invoke_name = "null"
                patnerlink_name = ""
                ele_data = str(ele)
                ele_data = re.sub('(\[)|(\])|(\')|(\s+)', '', ele_data)
                bpel_invoke_list = []
                bpel_invoke_list = ele_data.split(',')
                for subele in bpel_invoke_list:
                    if 'portType:' in subele:
                        port_type = subele[subele.find(':') + 1:]
                    elif 'operation:' in subele:
                        operation_type = subele[subele.find(':') + 1:]
                    elif 'name:' in subele:
                        invoke_name = subele[subele.find(':') + 1:]
                    elif 'partnerLink:' in subele:
                        patnerlink_name = subele[subele.find(':') + 1:]
                filename = child.parent.get_path()
                invoke_fullname = ''
                if invoke_name == "null":
                    invoke_name = patnerlink_name
                    invoke_fullname = filename + '--null'
                else:
                    invoke_fullname = filename + '--' + invoke_name

                bpel_invoke = CustomObject()
                invoke_count = invoke_count + 1
                self.saveObject(bpel_invoke, invoke_name, invoke_fullname,
                                "BPEL_Invoke", child.parent,
                                filename + "BPEL_Invoke" + str(invoke_count))
                bpel_invoke.save()
                try:
                    bpel_invoke.save_position(
                        bpel_bookmark_data[str(child) +
                                           "invoke.bookmark"][invoke_index])
                except:
                    bpel_invoke.save_position(
                        Bookmark(child.parent, 1, 1, -1, -1))
                invoke_index = invoke_index + 1
                create_link('callLink', child, bpel_invoke,
                            Bookmark(child.parent, 1, 1, -1, -1))
                if not ("null" in port_type and "null" in operation_type):
                    if ':' in port_type:
                        namespace_port = port_type[:port_type.find(':') + 1]
                    ele_data = str(bpel_process_data[child])
                    ele_data = re.sub('(\[)|(\])|(\')|(\s+)', '', ele_data)
                    ele_data = ele_data.replace('xmlns:map:', '')
                    #CAST.debug(ele_data)
                    for invoke_data in list(ele_data.split(',')):
                        if namespace_port in invoke_data:
                            namespace_port = invoke_data[invoke_data.
                                                         find(':') + 1:]
                            namespace_port = namespace_port + port_type[
                                port_type.find(':') + 1:]
                            break
                    flag_link = 0
                    '''
                    CAST.debug(ele_data)
                    CAST.debug(operation_type+"--"+namespace_port)
                    CAST.debug('--XD')
                    '''
                    for subele in bpel_receive_data:
                        for bpel_ele in bpel_receive_data[subele]:
                            ele_data = str(bpel_ele)
                            ele_data = re.sub('(\[)|(\])|(\')|(\s+)', '',
                                              ele_data)
                            bpel_receive_list = []
                            bpel_receive_list = ele_data.split(',')
                            receive_port_type = ""
                            receive_operation_type = ""
                            receive_namespace_port = ""
                            for receive_data in bpel_receive_list:
                                if 'portType:' in receive_data:
                                    receive_port_type = receive_data[
                                        receive_data.find(':') + 1:]
                                elif 'operation:' in receive_data:
                                    receive_operation_type = receive_data[
                                        receive_data.find(':') + 1:]
                            if ':' in receive_port_type:
                                receive_namespace_port = receive_port_type[:
                                                                           receive_port_type
                                                                           .
                                                                           find(
                                                                               ':'
                                                                           ) +
                                                                           1]
                            ele_data = str(bpel_process_data[subele])
                            ele_data = re.sub('(\[)|(\])|(\')|(\s+)', '',
                                              ele_data)
                            ele_data = ele_data.replace('xmlns:map:', '')
                            for receive_data in list(ele_data.split(',')):
                                if receive_namespace_port in receive_data:
                                    receive_namespace_port = receive_data[
                                        receive_data.find(':') + 1:]
                                    receive_namespace_port = receive_namespace_port + receive_port_type[
                                        receive_port_type.find(':') + 1:]
                                    break
                            '''
                            for process_data in bpel_process_data[subele].split(','):
                                CAST.debug(str(process_data))
                            '''

                            if namespace_port == receive_namespace_port and operation_type == receive_operation_type:
                                if subele in wsdl_obj_reference:
                                    CAST.debug('Object linking.....')
                                    '''
                                    CAST.debug('XC')
                                    CAST.debug(filename)
                                    CAST.debug(invoke_name)
                                    CAST.debug(receive_namespace_operation+"--"+receive_namespace_port)
                                    '''
                                    file_name = wsdl_obj_reference[
                                        subele].parent.get_path()
                                    wsdl_operation = CustomObject()
                                    operation_count = operation_count + 1
                                    self.saveObject(
                                        wsdl_operation, receive_operation_type,
                                        file_name + receive_operation_type,
                                        "WSDL_Operation",
                                        wsdl_obj_reference[subele].parent,
                                        file_name + "WSDL_Operation" +
                                        str(operation_count))
                                    wsdl_operation.save()
                                    wsdl_operation.save_position(
                                        Bookmark(subele.parent, 1, 1, -1, -1))
                                    create_link(
                                        'callLink', bpel_invoke,
                                        wsdl_operation,
                                        Bookmark(subele.parent, 1, 1, -1, -1))
                                    create_link(
                                        'callLink', wsdl_operation,
                                        wsdl_obj_reference[subele],
                                        Bookmark(subele.parent, 1, 1, -1, -1))
                                    flag_link = 1
                                    break
                                else:
                                    pass
                            else:
                                pass
                        if flag_link == 1:
                            break
                    if flag_link != 1:
                        onmessage_count = self.checkOnmessage(
                            bpel_invoke, operation_type, namespace_port,
                            onmessage_count)
                else:
                    pass
        CAST.debug('End!!')
        '''               
        for child in bpel_file_data:
            for subchild in bpel_file_data[child]:
                CAST.debug(subchild+"->")
                for j in bpel_file_data[child][subchild]:
                    CAST.debug(str(j))           
        #for child in wsdl_file_data:
            #for subchild in wsdl_file_data[child]:
        #    CAST.debug(str(wsdl_file_data[child]))
        '''
        pass
Beispiel #7
0
    def start_file(self, file):

        self.filename = file.get_path()
        #CAST.debug("File Name:---- %s" %self.filename)
        file_ref = open(self.filename, encoding='ISO_8859_1')
        #file_ref = open(self.filename,'r')
        file_data = []
        for child in file_ref:
            try:
                child = child.replace("\n", "")
                file_data.append(child)
            except Exception as e:
                import traceback
                e = traceback.format_exc(e)
        parser = CastOperation()
        if self.filename.endswith(".wsdl"):
            try:
                index = self.filename.rfind('\\')
                self.name = self.filename[index + 1:]
            except:
                index = -1
            wsdl_process = CustomObject()
            #CAST.debug("Checking file extension---"+self.name)
            self.saveObject(wsdl_process, self.name, self.filename,
                            "WSDL_Process", file,
                            self.filename + "WSDL_Process")
            wsdl_process.save()
            wsdl_process.save_position(Bookmark(file, 1, 1, -1, -1))
            wsdl_file_data[wsdl_process] = parser.castParserWsdl(self.filename)
            #CAST.debug(str(wsdl_file_data[wsdl_process]))
            #CAST.debug("Check Name-----"+self.filename)
        else:
            #CAST.debug("************************** else")
            #CAST.debug (self.filename)
            self.invokeList = parser.getInvokeJavaCode(self.filename)
            for child in self.invokeList:
                #CAST.debug("Check Java object-------"+str(child))
                self.intermediate_file.write(str(child) + '\n')
            bpel_data = parser.castParserBpel(file, self.filename)
            #CAST.debug(str(bpel_data["link"]))
            for child in bpel_data:
                #CAST.debug("Check BPEL object-------"+str(child))
                #break
                #attrib_data = re.sub('(\[)|(\])|(\')','',str(bpel_file_data[child]))
                #CAST.debug("Atrribute is true-----"+str(attrib_data))
                if "process" in child and not "bookmark" in child:
                    #CAST.debug("Condition is true-----")
                    #CAST.debug(str(bpel_data))
                    #CAST.debug(str(child))
                    #CAST.debug("Condition is true-----"+str(bpel_data))
                    for subchild in bpel_data[child]:
                        #CAST.debug("Condition is true-----"+subchild)
                        if "name" in subchild:
                            self.name = subchild[subchild.find(':') + 1:]
                            #CAST.debug("Checking Name-----"+self.name)
                            break
            bpel_process = CustomObject()
            self.saveObject(bpel_process, self.name, self.filename,
                            "BPEL_Process", file,
                            self.filename + "BPEL_Process")
            bpel_process.save()
            if bpel_data["process.bookmark"]:
                bpel_process.save_position(bpel_data["process.bookmark"][0])
            else:
                bpel_process.save_position(Bookmark(file, 1, 1, -1, -1))
            bpel_process_data[bpel_process] = bpel_data["process"]
            bpel_bookmark_data[
                str(bpel_process) +
                "invoke.bookmark"] = bpel_data["invoke.bookmark"]
            bpel_invoke_data[bpel_process] = bpel_data["invoke"]
            bpel_bookmark_data[
                str(bpel_process) +
                "receive.bookmark"] = bpel_data["receive.bookmark"]
            bpel_receive_data[bpel_process] = bpel_data["receive"]
            bpel_bookmark_data[
                str(bpel_process) +
                "onMessage.bookmark"] = bpel_data["onMessage.bookmark"]
            bpel_onmessage_data[bpel_process] = bpel_data["onMessage"]

            #//Creating new object
            #bpel_bookmark_data[str(bpel_process)+"partnerLink.bookmark"] = bpel_data["partnerLink.bookmark"]
            #bpel_PartnerLink_data[bpel_process] = bpel_data["partnerLink"]
            '''
            bpel_bookmark_data[str(bpel_process)+"assign.bookmark"] = bpel_data["assign.bookmark"]
            bpel_assign_data[bpel_process] = bpel_data["assign"]
            bpel_bookmark_data[str(bpel_process)+"catch.bookmark"] = bpel_data["catch.bookmark"]
            bpel_catch_data[bpel_process] = bpel_data["catch"]
            bpel_bookmark_data[str(bpel_process)+"catchAll.bookmark"] = bpel_data["catchAll.bookmark"]
            bpel_catchAll_data[bpel_process] = bpel_data["catchAll"]
            bpel_bookmark_data[str(bpel_process)+"sequence.bookmark"] = bpel_data["sequence.bookmark"]
            bpel_sequence_data[bpel_process] = bpel_data["sequence"]
            bpel_bookmark_data[str(bpel_process)+"switch.bookmark"] = bpel_data["switch.bookmark"]
            bpel_switch_data[bpel_process] = bpel_data["switch"]
            bpel_bookmark_data[str(bpel_process)+"case.bookmark"] = bpel_data["case.bookmark"]
            bpel_case_data[bpel_process] = bpel_data["case"]
            bpel_bookmark_data[str(bpel_process)+"extension.bookmark"] = bpel_data["extension.bookmark"]
            bpel_extension_data[bpel_process] = bpel_data["extension"]
            bpel_bookmark_data[str(bpel_process)+"copy.bookmark"] = bpel_data["copy.bookmark"]
            bpel_copy_data[bpel_process] = bpel_data["copy"]
            '''

            self.file_loc_data = parser.fileLoc(self.filename)
            self.file_checksum_data = parser.fileChecksum(self.filename)
            qr_reference = QualityRule()
            qr_reference.BpelQrImplementation(file, bpel_process, bpel_data,
                                              file_data)
            pass
Beispiel #8
0
    def start_file(self, file):
        Print.info("Start f!")
        contentList = []
        #self.file = file
        #self.filename = "C:/Users/Angelin.mariya/Desktop/app.module.ts";
        self.filename = file.get_path()
        self.file = file
        #Print.info("###############printing file name############")
        #Print.info("FileName--" + str(self.filename))
        file_ref = open(self.filename, encoding='UTF_8')
        #contentList=[];
        for i in file_ref:
            contentList.append(str(i))

        indexOfClass = self.findIndex(contentList, "[c][l][a][s][s][\s]*.*[{]",
                                      0)
        indexOfFunction = self.findIndex(
            contentList,
            "([v][o][i][d][\s]*|[s][t][r][i][n][g][\s]*|[i][n][t][\s]*).*[(].*[)][\s]+[{]",
            0)
        Print.info(str(indexOfFunction))
        classNameLine = contentList[indexOfClass]
        #className=classNameLine.replace('{',' ');
        className = classNameLine.split("{")
        className = className[0].split(" ")
        classObject = "NA"
        abstractClassObject = "NA"
        functionConnections = []
        if className[0].strip() == "class":
            classObject = className[1]
            finalData["classObject"].append([classObject, indexOfClass])
            Groovy_class = CustomObject()
            self.saveObject(Groovy_class, str(classObject),
                            self.filename + str(classObject), "Groovy_class",
                            self.file, self.filename + "Groovy_class")
            Groovy_class.save()
            Groovy_class.save_position(
                Bookmark(self.file, indexOfClass + 1, 1, indexOfClass + 1, -1))
            functionList, functionConnections = self.getFunctionList(
                contentList,
                "([v][o][i][d][\s]*|[s][t][r][i][n][g][\s]*|[i][n][t][\s]*).*[(].*[)][\s]+[{]"
            )
            for i in functionConnections:
                finalData["functionLink"].append(i)
            for i in functionList:
                Groovy_Function = CustomObject()
                self.saveObject(Groovy_Function, str(i[0]),
                                self.filename + str(i[0]), "Groovy_Function",
                                self.file, self.filename + str(i[0]))
                Groovy_Function.save()
                Groovy_Function.save_position(
                    Bookmark(self.file, i[1], 1, i[1], -1))
                create_link('containLink', Groovy_class, Groovy_Function)
        elif className[0].strip() == "abstract":
            abstractClassObject = className[2]
            finalData["abstractObject"].append(
                [abstractClassObject, indexOfClass])
            Groovy_AbstractClass = CustomObject()
            self.saveObject(Groovy_AbstractClass, str(abstractClassObject),
                            self.filename + str(abstractClassObject),
                            "Groovy_AbstractClass", self.file,
                            self.filename + "Groovy_AbstractClass")
            Groovy_AbstractClass.save()
            Groovy_AbstractClass.save_position(
                Bookmark(self.file, indexOfClass + 1, 1, indexOfClass + 1, -1))
            functionList, functionConnections = self.getFunctionList(
                contentList,
                "([v][o][i][d][\s]*|[s][t][r][i][n][g][\s]*|[i][n][t][\s]*).*[(].*[)][\s]+[{]"
            )
            for i in functionConnections:
                finalData["functionLink"].append(i)
            for i in functionList:
                Groovy_Function = CustomObject()
                self.saveObject(Groovy_Function, str(i[0]),
                                self.filename + str(i[0]), "Groovy_Function",
                                self.file, self.filename + str(i[0]))
                print("groovy object saved")
                Groovy_Function.save()
                Groovy_Function.save_position(
                    Bookmark(self.file, i[1], 1, i[1], -1))
                create_link('containLink', Groovy_AbstractClass,
                            Groovy_Function)
        in1 = self.findIndex(
            contentList,
            "([v][o][i][d][\s]*|[s][t][r][i][n][g][\s]*|[i][n][t][\s]*).*[(].*[)][\s]+[{]",
            0)
        print("sad", in1)
        #print("to",functionList);
        # save violation rule
        Groovy_Function.save_violation(
            "Groovy_CustomMetrics.AssertWithinFinallyBlock",
            Bookmark(file, 1, 1, -1, -1),
            additional_bookmarks=None)

        Print.info('Groovy  Violation  Saved for demo')

        self.validate(file)
        Print.info(str(functionList))
        return contentList