# -*- coding:utf-8 -*-
# Copyright (c) 2017, System Engineering Software Society
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#     * Redistributions of source code must retain the above copyright
#       notice, this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above copyright
#       notice, this list of conditions and the following disclaimer in the
#       documentation and/or other materials provided with the distribution.
#     * Neither the name of the System Engineering Software Society nor the
#       names of its contributors may be used to endorse or promote products
#       derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.
# IN NO EVENT SHALL SYSTEM ENGINEERING SOFTWARE SOCIETY BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from sympathy.api import node as synode
from sympathy.api.nodeconfig import Port, Ports, deprecated_node
from sympathy.api import report
class SuperNodeGeneric(synode.Node):
    author = 'Erik der Hagopian <erik.hagopian@sysess.org>'
    copyright = '(C) 2015 System Engineering Software Society'
    version = '1.0'
    description = (
        'Type conversion node, no longer needed. '
        'Simply remove the node from your workflow and connect the resulting '
        'disconnected ports.')
def extend(destination, source):
    for element in source:
        destination.append(element)
[docs]@deprecated_node('1.5.0')
class ADAFs2List(SuperNodeGeneric):
    """
    Convert ADAFs to [ADAF].
    No longer needed. Simply remove the node from your workflow  and connect
    the resulting disconnected ports.
    """
    name = 'ADAFs to [ADAF]'
    nodeid = 'org.sysess.sympathy.list.adafs2list'
    inputs = Ports([
        Port.ADAFs('Input ADAFs', name='adafs')])
    outputs = Ports([
        Port.Custom('[adaf]', 'Input ADAFs converted to List', name='list')])
    def execute(self, node_context):
        extend(node_context.output['list'], node_context.input['adafs']) 
[docs]@deprecated_node('1.5.0')
class List2ADAFs(SuperNodeGeneric):
    """
    Convert [ADAF] to ADAFs.
    No longer needed. Simply remove the node from your workflow  and connect
    the resulting disconnected ports.
    """
    name = '[ADAF] to ADAFs'
    nodeid = 'org.sysess.sympathy.list.list2adafs'
    inputs = Ports([
        Port.Custom('[adaf]', 'Input List', name='list')])
    outputs = Ports([
        Port.ADAFs('Input List converted to ADAFs', name='adafs')])
    def execute(self, node_context):
        extend(node_context.output['adafs'], node_context.input['list']) 
[docs]@deprecated_node('1.5.0')
class Tables2List(SuperNodeGeneric):
    """
    Convert Tables to [Table].
    No longer needed. Simply remove the node from your workflow  and connect
    the resulting disconnected ports.
    """
    name = 'Tables to [Table]'
    nodeid = 'org.sysess.sympathy.list.tables2list'
    inputs = Ports([
        Port.Tables('Input Tables', name='tables')])
    outputs = Ports([
        Port.Custom('[table]', 'Input Tables converted to List', name='list')])
    def execute(self, node_context):
        extend(node_context.output['list'], node_context.input['tables']) 
[docs]@deprecated_node('1.5.0')
class List2Tables(SuperNodeGeneric):
    """
    Convert [Table] to Tables.
    No longer needed. Simply remove the node from your workflow  and connect
    the resulting disconnected ports.
    """
    name = '[Table] to Tables'
    nodeid = 'org.sysess.sympathy.list.list2tables'
    inputs = Ports([
        Port.Custom('[table]', 'Input List', name='list')])
    outputs = Ports([
        Port.Tables('Input List converted to Tables', name='tables')])
    def execute(self, node_context):
        extend(node_context.output['tables'], node_context.input['list']) 
[docs]@deprecated_node('1.5.0')
class Texts2List(SuperNodeGeneric):
    """
    Convert Texts to [Text].
    No longer needed. Simply remove the node from your workflow  and connect
    the resulting disconnected ports.
    """
    name = 'Texts to [Text]'
    nodeid = 'org.sysess.sympathy.list.texts2list'
    inputs = Ports([
        Port.Texts('Input Texts', name='texts')])
    outputs = Ports([
        Port.Custom('[text]', 'Input Texts converted to List', name='list')])
    def execute(self, node_context):
        extend(node_context.output['list'], node_context.input['texts']) 
[docs]@deprecated_node('1.5.0')
class List2Texts(SuperNodeGeneric):
    """
    Convert [Text] to Texts.
    No longer needed. Simply remove the node from your workflow  and connect
    the resulting disconnected ports.
    """
    name = '[Text] to Texts'
    nodeid = 'org.sysess.sympathy.list.list2texts'
    inputs = Ports([
        Port.Custom('[text]', 'Input List', name='list')])
    outputs = Ports([
        Port.Texts('Input List converted to Texts', name='texts')])
    def execute(self, node_context):
        extend(node_context.output['texts'], node_context.input['list']) 
[docs]@deprecated_node('1.5.0')
class Datasources2List(SuperNodeGeneric):
    """
    Convert Datasources to [Datasource].
    No longer needed. Simply remove the node from your workflow  and connect
    the resulting disconnected ports.
    """
    name = 'Datasources to [Datasource]'
    nodeid = 'org.sysess.sympathy.list.datasources2list'
    inputs = Ports([
        Port.Datasources('Input Datasources', name='datasources')])
    outputs = Ports([
        Port.Custom(
            '[datasource]', 'Input Datasources converted to List', name='list',
            scheme='text')])
    def execute(self, node_context):
        extend(node_context.output['list'], node_context.input['datasources']) 
[docs]@deprecated_node('1.5.0')
class List2Datasources(SuperNodeGeneric):
    """
    Convert [Datasource] to Datasources.
    No longer needed. Simply remove the node from your workflow  and connect
    the resulting disconnected ports.
    """
    name = '[Datasource] to Datasources'
    nodeid = 'org.sysess.sympathy.list.list2datasources'
    inputs = Ports([
        Port.Custom('[datasource]', 'Input List', name='list', scheme='text')])
    outputs = Ports([
        Port.Datasources(
            'Input List converted to Datasources', name='datasources')])
    def execute(self, node_context):
        extend(node_context.output['datasources'], node_context.input['list']) 
[docs]@deprecated_node('1.5.0')
class Reports2List(SuperNodeGeneric):
    """
    Convert Reports to [Report].
    No longer needed. Simply remove the node from your workflow  and connect
    the resulting disconnected ports.
    """
    name = 'Reports to [Report]'
    nodeid = 'org.sysess.sympathy.list.reports2list'
    inputs = Ports([
        report.Reports('Input Reports', name='reports')])
    outputs = Ports([
        Port.Custom(
            '[report]', 'Input Reports converted to List', name='list')])
    def execute(self, node_context):
        extend(node_context.output['list'], node_context.input['reports']) 
[docs]@deprecated_node('1.5.0')
class List2Reports(SuperNodeGeneric):
    """
    Convert [Report] to Reports.
    No longer needed. Simply remove the node from your workflow  and connect
    the resulting disconnected ports.
    """
    name = '[Report] to Reports'
    nodeid = 'org.sysess.sympathy.list.list2reports'
    inputs = Ports([
        Port.Custom('[report]', 'Input List', name='list')])
    outputs = Ports([
        report.Reports('Input List converted to Reports', name='reports')])
    def execute(self, node_context):
        extend(node_context.output['reports'], node_context.input['list'])