projectal.entities.task_template API documentation

# projectal.entities.task_template

View Source

    from projectal import api
    from projectal.entity import Entity
    from projectal.linkers import *

    class TaskTemplate(Entity, ResourceLinker, SkillLinker, FileLinker, StaffLinker, RebateLinker,
                       NoteLinker):
        """
        Implementation of the
        [Task Template](https://projectal.com/docs/latest/#tag/Task-Template) API.
        """
        _path = 'template/task'
        _name = 'task_template'
        _links = [ResourceLinker, SkillLinker, FileLinker, StaffLinker, RebateLinker, NoteLinker]

        def clone(self, holder, entity):
            url = '/api/template/task/clone?holder={}&reference={}'\
                .format(holder['uuId'], self['uuId'])
            response = api.post(url, entity)
            return response['jobClue']['uuId']

        @classmethod
        def create(cls, holder, entity):
            """Create a Task Template

            `holder`: `uuId` of the owner

            `entity`: The fields of the entity to be created
            """
            holder = holder['uuId'] if isinstance(holder, dict) else holder
            params = "?holder=" + holder
            return super().create(entity, params)

        @classmethod
        def link_predecessor_task(cls, task, predecessor_task):
            return cls.__plan(task, predecessor_task, 'add')

        @classmethod
        def relink_predecessor_task(cls, task, predecessor_task):
            return cls.__plan(task, predecessor_task, 'update')

        @classmethod
        def unlink_predecessor_task(cls, task, predecessor_task):
            return cls.__plan(task, predecessor_task, 'delete')

        @classmethod
        def __plan(cls, from_task, to_task, operation):
            url = '/api/template/task/plan/task/{}'.format(operation)
            payload = {
                'uuId': from_task['uuId'],
                'taskList': [to_task]
            }
            api.post(url, payload=payload)
            return True

class TaskTemplate(projectal.entity.Entity, projectal.linkers.ResourceLinker, projectal.linkers.SkillLinker, projectal.linkers.FileLinker, projectal.linkers.StaffLinker, projectal.linkers.RebateLinker, projectal.linkers.NoteLinker):
View Source

    class TaskTemplate(Entity, ResourceLinker, SkillLinker, FileLinker, StaffLinker, RebateLinker,
                       NoteLinker):
        """
        Implementation of the
        [Task Template](https://projectal.com/docs/latest/#tag/Task-Template) API.
        """
        _path = 'template/task'
        _name = 'task_template'
        _links = [ResourceLinker, SkillLinker, FileLinker, StaffLinker, RebateLinker, NoteLinker]

        def clone(self, holder, entity):
            url = '/api/template/task/clone?holder={}&reference={}'\
                .format(holder['uuId'], self['uuId'])
            response = api.post(url, entity)
            return response['jobClue']['uuId']

        @classmethod
        def create(cls, holder, entity):
            """Create a Task Template

            `holder`: `uuId` of the owner

            `entity`: The fields of the entity to be created
            """
            holder = holder['uuId'] if isinstance(holder, dict) else holder
            params = "?holder=" + holder
            return super().create(entity, params)

        @classmethod
        def link_predecessor_task(cls, task, predecessor_task):
            return cls.__plan(task, predecessor_task, 'add')

        @classmethod
        def relink_predecessor_task(cls, task, predecessor_task):
            return cls.__plan(task, predecessor_task, 'update')

        @classmethod
        def unlink_predecessor_task(cls, task, predecessor_task):
            return cls.__plan(task, predecessor_task, 'delete')

        @classmethod
        def __plan(cls, from_task, to_task, operation):
            url = '/api/template/task/plan/task/{}'.format(operation)
            payload = {
                'uuId': from_task['uuId'],
                'taskList': [to_task]
            }
            api.post(url, payload=payload)
            return True

Implementation of the Task Template API.

def clone(self, holder, entity):
View Source

        def clone(self, holder, entity):
            url = '/api/template/task/clone?holder={}&reference={}'\
                .format(holder['uuId'], self['uuId'])
            response = api.post(url, entity)
            return response['jobClue']['uuId']

Clones an entity and returns its `uuId`.

Each entity has its own set of required values when cloning. Check the API documentation of that entity for details.

@classmethod
def create(cls, holder, entity):
View Source

        @classmethod
        def create(cls, holder, entity):
            """Create a Task Template

            `holder`: `uuId` of the owner

            `entity`: The fields of the entity to be created
            """
            holder = holder['uuId'] if isinstance(holder, dict) else holder
            params = "?holder=" + holder
            return super().create(entity, params)

Create a Task Template

`holder`: `uuId` of the owner

`entity`: The fields of the entity to be created

@classmethod
def link_predecessor_task(cls, task, predecessor_task):
View Source

        @classmethod
        def link_predecessor_task(cls, task, predecessor_task):
            return cls.__plan(task, predecessor_task, 'add')

@classmethod
def relink_predecessor_task(cls, task, predecessor_task):
View Source

        @classmethod
        def relink_predecessor_task(cls, task, predecessor_task):
            return cls.__plan(task, predecessor_task, 'update')

@classmethod
def unlink_predecessor_task(cls, task, predecessor_task):
View Source

        @classmethod
        def unlink_predecessor_task(cls, task, predecessor_task):
            return cls.__plan(task, predecessor_task, 'delete')

##### Inherited Members

projectal.entity.Entity
  Entity
  get
  update
  delete
  history
  save
  list
  match
  match_startswith
  match_endswith
  match_one
  match_startswith_one
  match_endswith_one
  search
  query
  profile_get
  profile_set
  changes
  set_readonly
  entity_name
projectal.linkers.ResourceLinker
  link_resource
  relink_resource
  unlink_resource
projectal.linkers.SkillLinker
  link_skill
  relink_skill
  unlink_skill
projectal.linkers.FileLinker
  link_file
  unlink_file
projectal.linkers.StaffLinker
  link_staff
  relink_staff
  unlink_staff
projectal.linkers.RebateLinker
  link_rebate
  unlink_rebate
builtins.dict
  setdefault
  pop
  popitem
  keys
  items
  values
  fromkeys
  clear
  copy