Source code for xerparser.model.classes.acttype

# PyP6XER
# Copyright (C) 2020, 2021 Hassan Emam <hassan@constology.com>
#
# This file is part of PyP6XER.
#
# PyP6XER library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License v2.1 as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PyP6XER is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with PyP6XER.  If not, see <https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html>.

import locale
[docs] class ActType:
[docs] obj_list =[]
def __init__(self, params): # Unique ID generated by the system.
[docs] self.actv_code_type_id = int(params.get('actv_code_type_id').strip()) if params.get('actv_code_type_id') else None
# The maximum number of characters allowed for values of this Activity Code.
[docs] self.actv_short_len = locale.atof(params.get('actv_short_len').strip()) if params.get('actv_short_len') else None
# Sequence number for sorting.
[docs] self.seq_num = int(params.get('seq_num').strip()) if params.get('seq_num') else None
# Each Activity Code has a list of possible values, any of which can be assigned to an activity. Activity # Codes allow you to classify and categorize activities.
[docs] self.actv_code_type = params.get('actv_code_type').strip() if params.get('actv_code_type') else None
# Identifies the project which owns this Activity Code (if this is a project-level Activity Code).
[docs] self.proj_id = int(params.get('proj_id')) if params.get('proj_id') else None
# EPS Id element that
[docs] self.wbs_id = params.get('wbs_id').strip() if params.get('wbs_id') else None
[docs] self.actv_code_type_scope = params.get('actv_code_type_scope').strip() if params.get('actv_code_type_scope') else None
ActType.obj_list.append(self)
[docs] def get_id(self): return self.actv_code_type_id
[docs] def get_tsv(self): tsv = ['%R', self.actv_code_type_id, self.actv_short_len, self.seq_num, self.actv_code_type, self.proj_id, self.wbs_id, self.actv_code_type_scope] return tsv
@classmethod
[docs] def find_by_id(cls, id): """ Function to search list of activity code type by an ID Args: id: Unique ID generated by the system. Returns: ActType that matches the ID """ obj = list(filter(lambda x: x.actv_code_type_id == id, cls.obj_list)) if len(obj) > 0: return obj[0] else: obj = None return obj
[docs] def __repr__(self): return self.actv_code_type