bridgepoint/ooaofooa.py
def mk_class(m, o_obj, derived_attributes=False):
    '''
    Create a pyxtuml class from a BridgePoint class.
    '''
    first_filter = lambda selected: not one(selected).O_ATTR[103, 'succeeds']()
    o_attr = one(o_obj).O_ATTR[102](first_filter)
    attributes = list()
        
    while o_attr:
        s_dt = get_attribute_type(o_attr)
        ty = _get_data_type_name(s_dt)
        if not derived_attributes and one(o_attr).O_BATTR[106].O_DBATTR[107]():
            pass
#            logger.warning('Omitting derived attribute %s.%s ' %
#                           (o_obj.Key_Lett, o_attr.Name))
        elif not ty:
            logger.warning('Omitting unsupported attribute %s.%s ' %
                           (o_obj.Key_Lett, o_attr.Name))
        else:
            attributes.append((o_attr.Name, ty))
        
        o_attr = one(o_attr).O_ATTR[103, 'precedes']()
            
    metaclass = m.define_class(o_obj.Key_Lett, list(attributes), o_obj.Descrip)

    for o_id in many(o_obj).O_ID[104]():
        o_oida = many(o_id).O_OIDA[105]()
        o_attrs = many(o_oida).O_ATTR[105]()
        if not derived_attributes and one(o_attrs).O_BATTR[106].O_DBATTR[107]():
            logger.warning('Omitting unique identifier %s.I%d' %
                           (o_obj.Key_Lett, o_id.Oid_ID + 1))
            continue
        
        names = [o_attr.Name for o_attr in o_attrs]
        m.define_unique_identifier(o_obj.Key_Lett, o_id.Oid_ID + 1, *names)
    
    for o_tfr in many(o_obj).O_TFR[115]():
        fn = mk_operation(metaclass, o_tfr)
        setattr(metaclass.clazz, o_tfr.Name, fn)
        
    for o_dbattr in many(o_obj).O_ATTR[102].O_BATTR[106].O_DBATTR[107]():
        o_attr = one(o_dbattr).O_BATTR[107].O_ATTR[106]()
        fn = mk_derived_attribute(metaclass, o_dbattr)
        setattr(metaclass.clazz, o_attr.Name, fn)
            
    return metaclass
def mk_class(m, o_obj, derived_attributes=False):
    '''
    Create a pyxtuml class from a BridgePoint class.
    '''
    first_filter = lambda selected: not one(selected).O_ATTR[103, 'succeeds']()
    o_attr = one(o_obj).O_ATTR[102](first_filter)
    attributes = list()
        
    while o_attr:
        s_dt = get_attribute_type(o_attr)
        ty = _get_data_type_name(s_dt)
        if not derived_attributes and one(o_attr).O_BATTR[106].O_DBATTR[107]():
            pass
#            logger.warning('Omitting derived attribute %s.%s ' %
#                           (o_obj.Key_Lett, o_attr.Name))
        elif not ty:
            logger.warning('Omitting unsupported attribute %s.%s ' %
                           (o_obj.Key_Lett, o_attr.Name))
        else:
            attributes.append((o_attr.Name, ty))
        
        o_attr = one(o_attr).O_ATTR[103, 'precedes']()
            
    metaclass = m.define_class(o_obj.Key_Lett, list(attributes), o_obj.Descrip)

    for o_id in many(o_obj).O_ID[104]():
        o_oida = many(o_id).O_OIDA[105]()
        o_attrs = many(o_oida).O_ATTR[105]()
        if not derived_attributes and one(o_attrs).O_BATTR[106].O_DBATTR[107]():
            logger.warning('Omitting unique identifier %s.I%d' %
                           (o_obj.Key_Lett, o_id.Oid_ID + 1))
            continue
        
        names = [o_attr.Name for o_attr in o_attrs]
        m.define_unique_identifier(o_obj.Key_Lett, o_id.Oid_ID + 1, *names)
    
    for o_tfr in many(o_obj).O_TFR[115]():
        fn = mk_operation(metaclass, o_tfr)
        setattr(metaclass.clazz, o_tfr.Name, fn)
        
    for o_dbattr in many(o_obj).O_ATTR[102].O_BATTR[106].O_DBATTR[107]():
        o_attr = one(o_dbattr).O_BATTR[107].O_ATTR[106]()
        fn = mk_derived_attribute(metaclass, o_dbattr)
        setattr(metaclass.clazz, o_attr.Name, fn)
            
    return metaclass
def mk_class ( m , o_obj , derived_attributes = False ) : first_filter = lambda selected : not one ( selected ) . O_ATTR [ 103 , 'succeeds' ] ( ) o_attr = one ( o_obj ) . O_ATTR [ 102 ] ( first_filter ) attributes = list ( ) while o_attr : s_dt = get_attribute_type ( o_attr ) ty = _get_data_type_name ( s_dt ) if not derived_attributes and one ( o_attr ) . O_BATTR [ 106 ] . O_DBATTR [ 107 ] ( ) : pass #            logger.warning('Omitting derived attribute %s.%s ' % #                           (o_obj.Key_Lett, o_attr.Name)) elif not ty : logger . warning ( 'Omitting unsupported attribute %s.%s ' % ( o_obj . Key_Lett , o_attr . Name ) ) else : attributes . append ( ( o_attr . Name , ty ) ) o_attr = one ( o_attr ) . O_ATTR [ 103 , 'precedes' ] ( ) metaclass = m . define_class ( o_obj . Key_Lett , list ( attributes ) , o_obj . Descrip ) for o_id in many ( o_obj ) . O_ID [ 104 ] ( ) : o_oida = many ( o_id ) . O_OIDA [ 105 ] ( ) o_attrs = many ( o_oida ) . O_ATTR [ 105 ] ( ) if not derived_attributes and one ( o_attrs ) . O_BATTR [ 106 ] . O_DBATTR [ 107 ] ( ) : logger . warning ( 'Omitting unique identifier %s.I%d' % ( o_obj . Key_Lett , o_id . Oid_ID + 1 ) ) continue names = [ o_attr . Name for o_attr in o_attrs ] m . define_unique_identifier ( o_obj . Key_Lett , o_id . Oid_ID + 1 , * names ) for o_tfr in many ( o_obj ) . O_TFR [ 115 ] ( ) : fn = mk_operation ( metaclass , o_tfr ) setattr ( metaclass . clazz , o_tfr . Name , fn ) for o_dbattr in many ( o_obj ) . O_ATTR [ 102 ] . O_BATTR [ 106 ] . O_DBATTR [ 107 ] ( ) : o_attr = one ( o_dbattr ) . O_BATTR [ 107 ] . O_ATTR [ 106 ] ( ) fn = mk_derived_attribute ( metaclass , o_dbattr ) setattr ( metaclass . clazz , o_attr . Name , fn ) return metaclass
Create a pyxtuml class from a BridgePoint class.
Create a pyxtuml class from a BridgePoint class .