示例#1
0
文件: net.py 项目: mleist/ict-ok.org
                if i_NetIp in myNetIp and \
                    oobj.object != dummy_context:
                    validObjects.append(oobj.object)
    else:
        for (oid, oobj) in uidutil.items():
            if INet.providedBy(oobj.object):
                validObjects.append(oobj.object)
    return ComponentsFromObjList(dummy_context,
                                 validObjects,
                                 additionalAttrNames=['ipv4'])



Net_Nets_RelManager = \
       FieldRelationManager(INet['subnets'],
                            INet['parentnet'],
                            relType='parentnet:subnets')


class Net(Component):
    """
    the template instance
    """

    implements(INet, IEventIfEventNet)
    shortName = "net"
    # for ..Contained we have to:
    __name__ = __parent__ = None
    ipv4 = FieldProperty(INet['ipv4'])

    subnets = RelationPropertyOut(Net_Nets_RelManager)
示例#2
0

def AllContacts(dummy_context):
    return AllComponents(dummy_context, IContact)


def AllUnusedOrUsedWorkOrderContacts(dummy_context):
    return AllUnusedOrSelfComponents(dummy_context, IContact, 'workOrder')


#def AllUnusedOrUsedContactContacts(dummy_context):
#return AllUnusedOrSelfComponents(dummy_context, IContact, 'workOrder')

Contact_ContactItems_RelManager = \
       FieldRelationManager(IContact['contactItems'],
                            IContactItem['contact'],
                            relType='contact:contactItems')


class Contact(Component):
    """
    the template instance
    """
    implements(IContact)
    shortName = "contact"
    # for ..Contained we have to:
    __name__ = __parent__ = None

    workOrder = RelationPropertyIn(WorkOrder_Contacts_RelManager)
    contactItems = RelationPropertyOut(Contact_ContactItems_RelManager)
示例#3
0
# pylint: disable-msg=E1101,E0611,W0702,W0221
#
"""implementation of a "Object-Message-Queue-Utility" 
"""

__version__ = "$Id$"

# python imports

# zope imports

# lovely imports
from lovely.relation.property import FieldRelationManager

# ict_ok.org imports
from org.ict_ok.admin_utils.categories.interfaces import ICategory
from org.ict_ok.admin_utils.compliance.interfaces import IRequirement
from org.ict_ok.components.interfaces import IComponent


Categories_Components_RelManager = \
       FieldRelationManager(ICategory['components'],
                            IComponent['categories'],
                            relType='categories:components')


Categories_Requirements_RelManager = \
       FieldRelationManager(ICategory['requirements'],
                            IRequirement['categories'],
                            relType='categories:requirements')
示例#4
0
#def AllUnusedOrUsedPhysicalConnectorPhysicalConnectors(dummy_context):
#    return AllUnusedOrSelfComponents(dummy_context, IPhysicalConnector, 'physicalConnector')

#PhysicalConnector_PhysicalConnector_RelManager = \
#    FieldRelationManager(IPhysicalConnector['remote'],
#                         IPhysicalConnector['remote'],
#                         relType='physicalConnector:physicalConnector')
#PhysicalConnector_PhysicalConnector_RelManager = \
#    FieldRelationManager(IPhysicalConnector['local'],
#                         IPhysicalConnector['remote'],
#                         relType='physicalConnector:local:remote')

PhysicalLinks_PhysicalConnectors_RelManager = \
       FieldRelationManager(IPhysicalLink['connectors'],
                            IPhysicalConnector['links'],
                            relType='links:connectors')


class PhysicalLink(Component):
    """
    the template instance
    """
    implements(IPhysicalLink)
    shortName = "physicallink"
    # for ..Contained we have to:
    __name__ = __parent__ = None

    length = FieldProperty(IPhysicalLink['length'])
    maxLength = FieldProperty(IPhysicalLink['maxLength'])
    mediaType = FieldProperty(IPhysicalLink['mediaType'])
示例#5
0
    return AllUnusedOrSelfComponents(dummy_context,
                                     IInterface,
                                     'device',
                                     additionalAttrNames=['device'])


def AllUnusedOrUsedPhysicalConnectorInterfaces(dummy_context):
    return AllUnusedOrSelfComponents(dummy_context,
                                     IInterface,
                                     'physicalConnector',
                                     additionalAttrNames=['device'])


Interface_IpAddresses_RelManager = \
       FieldRelationManager(IInterface['ipAddresses'],
                            IIpAddress['interface'],
                            relType='interface:ipAddresses')


class Interface(PhysicalComponent):
    """
    the template instance
    """

    implements(IInterface)
    shortName = "interface"
    # for ..Contained we have to:
    __name__ = __parent__ = None
    netType = FieldProperty(IInterface['netType'])
    mac = FieldProperty(IInterface['mac'])
    #ipv4List = FieldProperty(IInterface['ipv4List'])
示例#6
0
def AllLocationTemplates(dummy_context):
    """Which MobilePhone templates exists
    """
    terms = []
    for object in objectsWithInterface(ILocation):
        if object.isTemplate:
            myString = u"%s [T]" % (object.getDcTitle())
            terms.append(
                SimpleTerm(object,
                           token=getattr(object, 'objectID'),
                           title=myString))
    return SimpleVocabulary(terms)


Location_Buildings_RelManager = FieldRelationManager(
    ILocation['buildings'],
    IBuilding['location'],
    relType='location:buildings')


class Location(Component):
    """
    the template instance
    """

    implements(ILocation)
    shortName = "location"
    containerIface = ILocationFolder
    # for ..Contained we have to:
    __name__ = __parent__ = None
    #ikAttr = FieldProperty(ILocation['ikAttr'])
    coordinates = FieldProperty(ILocation['coordinates'])
示例#7
0
def AllUnusedOrUsedContactContactItems(dummy_context):
    return AllUnusedOrSelfComponents(dummy_context, IContactItem, 'contact')


def AllUnusedOrUsedWorkOrderContactItems(dummy_context):
    return AllUnusedOrSelfComponents(dummy_context, IContactItem, 'workOrder')


def AllUnusedOrUsedRolesContactItems(dummy_context):
    return AllUnusedOrSelfComponents(dummy_context, IContactItem, 'roles')


ContactItem_Addresses_RelManager = \
       FieldRelationManager(IContactItem['adresses'],
                            IAddress['contactItem'],
                            relType='contactItem:adresses')


class ContactItem(Component):
    """
    the template instance
    """
    implements(IContactItem)
    shortName = "contact_item"
    # for ..Contained we have to:
    __name__ = __parent__ = None

    contact = RelationPropertyIn(Contact_ContactItems_RelManager)
    workOrder = RelationPropertyIn(WorkOrder_ContactItems_RelManager)
    adresses = RelationPropertyOut(ContactItem_Addresses_RelManager)
示例#8
0
    IImportCsvData, IImportXlsData
from org.ict_ok.components.component import \
    AllComponents, AllComponentTemplates, AllUnusedOrSelfComponents
from org.ict_ok.components.contact_item.interfaces import IContactItem

def AllRoleTemplates(dummy_context):
    return AllComponentTemplates(dummy_context, IRole)

def AllRoles(dummy_context):
    return AllComponents(dummy_context, IRole)



Roles_ContactItems_RelManager = \
       FieldRelationManager(IRole['contactItems'],
                            IContactItem['roles'],
                            relType='roles:contactItems')


class Role(Component):
    """
    the template instance
    """
    implements(IRole)
    shortName = "role"
    # for ..Contained we have to:
    __name__ = __parent__ = None

    contactItems = RelationPropertyOut(Roles_ContactItems_RelManager)

    fullTextSearchFields = []
示例#9
0

def AllBuildingTemplates(dummy_context):
    return AllComponentTemplates(dummy_context, IBuilding)


def AllBuildings(dummy_context):
    return AllComponents(dummy_context, IBuilding)


def AllUnusedOrSelfBuildings(dummy_context):
    return AllUnusedOrSelfComponents(dummy_context, IBuilding, 'location')


Building_Rooms_RelManager = FieldRelationManager(IBuilding['rooms'],
                                                 IRoom['building'],
                                                 relType='building:rooms')


class Building(Component):
    """
    the template instance
    """

    implements(IBuilding)
    shortName = "building"
    # for ..Contained we have to:
    __name__ = __parent__ = None
    #ikAttr = FieldProperty(IBuilding['ikAttr'])
    coordinates = FieldProperty(IBuilding['coordinates'])
    gmapsurl = FieldProperty(IBuilding['gmapsurl'])
示例#10
0
def AllRackTemplates(dummy_context):
    return AllComponentTemplates(dummy_context, IRack)


def AllRacks(dummy_context):
    return AllComponents(dummy_context, IRack)


def AllUnusedOrUsedRoomRacks(dummy_context):
    return AllUnusedOrSelfComponents(dummy_context, IRack, 'room')


Rack_PatchPanels_RelManager = \
       FieldRelationManager(IRack['patchpanels'],
                            IPatchPanel['rack'],
                            relType='rack:patchpanels')

Rack_Switches_RelManager = \
       FieldRelationManager(IRack['patchpanels'],
                            ISwitch['rack'],
                            relType='rack:switches')


class Rack(PhysicalComponent):
    """
    the template instance
    """
    implements(IRack)
    shortName = "rack"
    # for ..Contained we have to:
示例#11
0
    AllComponents, AllComponentTemplates, AllUnusedOrSelfComponents
from org.ict_ok.components.contact_item.contact_item import ContactItem
from org.ict_ok.components.organisational_unit.interfaces import \
    IOrganisationalUnit


def AllPersonTemplates(dummy_context):
    return AllComponentTemplates(dummy_context, IPerson)


def AllPersons(dummy_context):
    return AllComponents(dummy_context, IPerson)

Persons_OrganisationalUnits_RelManager = \
       FieldRelationManager(IPerson['inOUs'],
                            IOrganisationalUnit['members'],
                            relType='members:inOUs')


class Person(ContactItem):
    """
    the template instance
    """
    implements(IPerson)
    shortName = "person"
    # for ..Contained we have to:
    __name__ = __parent__ = None

    firstName = FieldProperty(IPerson['firstName'])
    lastName = FieldProperty(IPerson['lastName'])
    title = FieldProperty(IPerson['title'])
示例#12
0
def AllPatchPanelTemplates(dummy_context):
    return AllComponentTemplates(dummy_context, IPatchPanel)


def AllPatchPanels(dummy_context):
    return AllComponents(dummy_context, IPatchPanel)


def AllUnusedOrUsedRackPatchPanels(dummy_context):
    return AllUnusedOrSelfComponents(dummy_context, IPatchPanel, 'rack')


PatchPanel_PatchPorts_RelManager = \
       FieldRelationManager(IPatchPanel['patchports'],
                            IPatchPort['patchpanel'],
                            relType='patchpanel:patchports')


class PatchPanel(PhysicalComponent):
    """
    the template instance
    """
    implements(IPatchPanel)
    shortName = "patchpanel"
    # for ..Contained we have to:
    __name__ = __parent__ = None

    portCount = FieldProperty(IPatchPanel['portCount'])
    rack = RelationPropertyIn(Rack_PatchPanels_RelManager)
    patchports = RelationPropertyOut(PatchPanel_PatchPorts_RelManager)
示例#13
0
"""implementation of Contract"""

__version__ = "$Id: template.py_cog 465 2009-03-05 02:34:02Z markusleist $"

# python imports

# zope imports

# lovely imports
from lovely.relation.property import FieldRelationManager

# ict_ok.org imports
from org.ict_ok.components.contract.interfaces import IContract
from org.ict_ok.components.contact_item.interfaces import IContactItem
from org.ict_ok.components.interfaces import IComponent

ClosedContracts_ContactItems_RelManager = \
       FieldRelationManager(IContract['contractors'],
                            IContactItem['closedContracts'],
                            relType='closedContracts:contractors')

Responsible4Contracts_ContactItems_RelManager = \
       FieldRelationManager(IContract['responsibles'],
                            IContactItem['responsible4Contracts'],
                            relType='responsible4Contracts:responsibles')

Contracts_Component_RelManager = \
       FieldRelationManager(IContract['component'],
                            IComponent['contracts'],
                            relType='contracts:component')
示例#14
0
        for (oid, oobj) in uidutil.items():
            if IIpNet.providedBy(oobj.object):
                i_IpNetIp = IP(oobj.object.ipv4)
                if i_IpNetIp in myIpNetIp and \
                    oobj.object != dummy_context:
                    validObjects.append(oobj.object)
    else:
        for (oid, oobj) in uidutil.items():
            if IIpNet.providedBy(oobj.object):
                validObjects.append(oobj.object)
    return ComponentsFromObjList(dummy_context, validObjects, 'ipv4')


IpNet_IpNets_RelManager = \
       FieldRelationManager(IIpNet['subnets'],
                            IIpNet['parentnet'],
                            relType='parentnet:subnets')

IpNet_IpAddresses_RelManager = \
       FieldRelationManager(IIpNet['ipAddresses'],
                            IIpAddress['ipNet'],
                            relType='ipNet:ipAddresses')


class IpNet(Component):
    """
    the template instance
    """

    implements(IIpNet, IEventIfEventIpNet)
    shortName = "ipnet"
示例#15
0

#    listOs = AllOrganizations(dummy_context)
    vocabReg = vocabulary.getVocabularyRegistry()
    if vocabReg is not None:
        vocab = vocabReg.get(None, 'AllOrganizations')
        if vocab is not None:
            for term in vocab:
                terms.append(term)
    terms.sort(lambda l, r: cmp(l.title.lower(), r.title.lower()))
    return SimpleVocabulary(terms)


OrganisationalUnit_OrganisationalUnits_RelManager = \
       FieldRelationManager(IOrganisationalUnit['subOUs'],
                            IOrganisationalUnit['parent_O_OU'],
                            relType='parent_O_OU:subOUs')


class OrganisationalUnit(ContactItem):
    """
    the template instance
    """
    implements(IOrganisationalUnit)
    shortName = "organisational_unit"
    # for ..Contained we have to:
    __name__ = __parent__ = None

    name = FieldProperty(IOrganisationalUnit['name'])
    subOUs = RelationPropertyOut(\
         OrganisationalUnit_OrganisationalUnits_RelManager)
示例#16
0
                            dotted = u'...)'
                        else:
                            dotted = u')'
                        myString = myString + u" (%s" % \
                            additionalAttribute[:70] + dotted
        terms.append(\
            SimpleTerm(i_obj,
                       token=uidutil.getId(i_obj),
                       title=myString))
    terms.sort(lambda l, r: cmp(l.title.lower(), r.title.lower()))
    return SimpleVocabulary(terms)    


Contracts_Component_RelManager = \
       FieldRelationManager(IContract['component'],
                            IComponent['contracts'],
                            relType='contracts:component')



class Component(Supernode):
    """
    the general component instance
    """

    implements(IComponent, IDocumentAddable)
    isTemplate = FieldProperty(IComponent['isTemplate'])
#    requirement = FieldProperty(IComponent['requirement'])
    requirements = FieldProperty(IComponent['requirements'])
    contracts = RelationPropertyIn(Contracts_Component_RelManager)
示例#17
0
def AllProducts(dummy_context):
    return AllComponents(dummy_context, IProduct)


def AllUnusedOrUsedProductProducts(dummy_context):
    return AllUnusedOrSelfComponents(dummy_context, IProduct, 'mainProduct')


def AllUnusedOrUsedWorkOrderProducts(dummy_context):
    return AllUnusedOrSelfComponents(dummy_context, IProduct, 'workOrder')


Product_Products_RelManager = \
       FieldRelationManager(IProduct['subProducts'],
                            IProduct['mainProduct'],
                            relType='mainProduct:subProducts')


def getFirstLevelObjectList(foldername):
    i_list = [object for object in objectsWithInterface(IProduct) \
              if object.mainProduct is None]
    i_list.sort(cmp=lambda x, y: x.ikName < y.ikName)
    return (foldername, i_list)


class Product(Component):
    """
    the template instance
    """
    implements(IProduct)
示例#18
0
    AllComponents, AllComponentTemplates
from org.ict_ok.components.contact_item.interfaces import IContactItem


def AllGroupTemplates(dummy_context):
    return AllComponentTemplates(dummy_context, IGroup)


def AllGroups(dummy_context):
    return AllComponents(dummy_context, IGroup)



Group_ContactItems_RelManager = \
       FieldRelationManager(IGroup['contactItems'],
                            IContactItem['groups'],
                            relType='groups:contactItems')


class Group(Component):
    """
    the template instance
    """
    implements(IGroup)
    shortName = "group"
    # for ..Contained we have to:
    __name__ = __parent__ = None

    contactItems = RelationPropertyOut(Group_ContactItems_RelManager)

    fullTextSearchFields = []
示例#19
0

def AllDeviceTemplates(dummy_context):
    return AllComponentTemplates(dummy_context, IDevice)


def AllDevices(dummy_context):
    return AllComponents(dummy_context, IDevice)


def AllUnusedOrUsedRoomDevices(dummy_context):
    return AllUnusedOrSelfComponents(dummy_context, IDevice, 'room')

Device_Interface_RelManager = \
    FieldRelationManager(IDevice['interfaces'],
                         IInterface['device'],
                         relType='device:interfaces')
Device_AppSoftware_RelManager = \
    FieldRelationManager(IDevice['appsoftwares'],
                         IApplicationSoftware['device'],
                         relType='device:appsoftwares')
Device_OSoftware_RelManager = \
    FieldRelationManager(IDevice['osoftwares'],
                         IOperatingSoftware['device'],
                         relType='device:osoftwares')
#Device_LogicalDevices_RelManager = \
#    FieldRelationManager(IDevice['logicalDevices'],
#                         ILogicalDevice['device'],
#                         relType='device:logicalDevices')
Devices_LogicalDevices_RelManager = \
    FieldRelationManager(IDevice['logicalDevices'],
示例#20
0
def AllWorkOrderTemplates(dummy_context):
    return AllComponentTemplates(dummy_context, IWorkOrder)


def AllWorkOrders(dummy_context):
    return AllComponents(dummy_context, IWorkOrder)


def AllUnusedOrUsedWorkOrderWorkOrders(dummy_context):
    return AllUnusedOrSelfComponents(dummy_context, IWorkOrder,
                                     'mainWorkOrder')

WorkOrder_Products_RelManager = \
       FieldRelationManager(IWorkOrder['products'],
                            IProduct['workOrder'],
                            relType='workOrder:products')
WorkOrder_ContactItems_RelManager = \
       FieldRelationManager(IWorkOrder['contactItems'],
                            IContactItem['workOrder'],
                            relType='workOrder:contactItems')
WorkOrder_Contacts_RelManager = \
       FieldRelationManager(IWorkOrder['contacts'],
                            IContact['workOrder'],
                            relType='workOrder:contacts')
WorkOrder_WorkOrders_RelManager = \
       FieldRelationManager(IWorkOrder['subWorkOrders'],
                            IWorkOrder['mainWorkOrder'],
                            relType='mainWorkOrder:subWorkOrders')