Ejemplo n.º 1
0
 def execute(self):
     try:
         request = GetRequest(
             self.connection,
             str(URL(f"{self.CONTEXT}", [Filters(self.filters)])))
         return FindListCommand(self.connection, request,
                                Membership).execute()
         # for membership in json_obj['_embedded']['elements']:
         #     yield mem.Membership(membership)
     except RequestError as re:
         raise BusinessError("Error finding all memberships") from re
Ejemplo n.º 2
0
 def execute(self):
     try:
         request = GetRequest(
             self.connection,
             str(URL(f"{self.CONTEXT}", [Filters(self.filters)])))
         return FindListCommand(self.connection, request,
                                Principal).execute()
         # for principal in json_obj["_embedded"]["elements"]:
         #     yield p.Principal(principal)
     except RequestError as re:
         raise BusinessError("Error finding all principals") from re
Ejemplo n.º 3
0
 def execute(self):
     try:
         json_obj = PatchRequest(connection=self.connection,
                                 headers={"Content-Type": "application/json"},
                                 context=str(URL(f"{self.CONTEXT}{self.work_package.id}",
                                                 [
                                                     URLParameter("notify", self.notify)
                                                 ])),
                                 json=self.work_package.__dict__).execute()
         return wp.WorkPackage(json_obj)
     except RequestError as re:
         raise BusinessError(f"Error updating work package: {self.work_package.id}") from re
Ejemplo n.º 4
0
 def execute(self):
     try:
         request = GetRequest(self.connection, str(URL(f"{self.CONTEXT}",
                                                        [
                                                            Filters(
                                                                self.filters)
                                                        ])))
         return FindListCommand(self.connection, request, Query).execute()
         # for tEntry in json_obj["_embedded"]["elements"]:
         #     yield Query(tEntry)
     except RequestError as re:
         raise BusinessError(f"Error finding all queries with filters: {self.filters}") from re
Ejemplo n.º 5
0
    def execute(self):
        try:
            request = GetRequest(self.connection, str(URL(f"{self.CONTEXT}",
                                                          [
                                                              Filters([
                                                                  Filter("spentOn", "<>d",
                                                                         [self.start_date, self.end_date])])
                                                          ])))
            return FindListCommand(self.connection, request, TimeEntry).execute()

        except RequestError as re:
            raise BusinessError(f"Error finding time entries between {self.start_date} and {self.end_date}") from re
Ejemplo n.º 6
0
 def execute(self):
     try:
         request = GetRequest(self.connection, str(URL(f"{self.CONTEXT}/schemas",
                                                        [
                                                            Filters(
                                                                self.filters)
                                                        ])))
         return FindListCommand(self.connection, request, Schema).execute()
         # for schema in json_obj["_embedded"]["elements"]:
         #     yield Schema(schema)
     except RequestError as re:
         raise BusinessError(f"Error finding all schemas by filters: {self.filters}") from re
Ejemplo n.º 7
0
 def execute(self):
     try:
         request = GetRequest(
             self.connection,
             str(
                 URL(f"{self.CONTEXT}",
                     [URLParameter("sortBy", self.sort_by)])))
         return FindListCommand(self.connection, request,
                                Document).execute()
         # for document in json_obj["_embedded"]["elements"]:
         #     yield Document(document)
     except RequestError as re:
         raise BusinessError("Error finding all documents") from re
Ejemplo n.º 8
0
 def execute(self):
     try:
         request = GetRequest(connection=self.connection,
                              context=str(
                                  URL(f"{self.CONTEXT}", [
                                      Filters(self.filters),
                                      URLParameter("sortBy", self.sort_by)
                                  ])))
         return FindListCommand(self.connection, request, New).execute()
         # for news in json_obj['_embedded']['elements']:
         #     yield New(news)
     except RequestError as re:
         raise BusinessError("Error finding all news") from re
Ejemplo n.º 9
0
 def execute(self):
     try:
         request = GetRequest(
             self.connection,
             str(
                 URL(f"{self.CONTEXT}", [
                     Filters(self.filters),
                     URLParameter("sortBy", self.sort_by)
                 ])))
         return FindListCommand(self.connection, request, Grid).execute()
         # for grid in json_obj["_embedded"]["elements"]:
         #     yield Grid(grid)
     except RequestError as re:
         raise BusinessError("Error finding all grids") from re
Ejemplo n.º 10
0
    def execute(self):
        try:
            request = GetRequest(
                self.connection,
                str(
                    URL(f"{self.CONTEXT}", [
                        Filters(self.filters),
                        URLParameter("sortBy", self.sort_by)
                    ])))
            return FindListCommand(self.connection, request,
                                   TimeEntry).execute()

        except RequestError as re:
            raise BusinessError("Error finding all time entries") from re
Ejemplo n.º 11
0
 def execute(self):
     try:
         json_obj = PostRequest(
             connection=self.connection,
             headers={
                 "Content-Type": "application/json"
             },
             context=str(
                 URL(f"{self.CONTEXT}{self.work_package.id}/activities",
                     [URLParameter("notify", self.notify)])),
             json=self.comment).execute()
         return activity.Activity(json_obj)
     except RequestError as re:
         raise BusinessError(
             f"Error creating activity for the work package {self.work_package.id}"
         ) from re
Ejemplo n.º 12
0
    def execute(self):
        try:
            request = GetRequest(
                self.connection,
                str(
                    URL(f"{self.CONTEXT}/available_parent_projects", [
                        Filters(self.filters),
                        URLParameter("of", self.of),
                        URLParameter("sortBy", self.sort_by)
                    ])))
            return FindListCommand(self.connection, request, Project).execute()
            # for tEntry in json_obj["_embedded"]["elements"]:
            #     yield p.Project(tEntry)

        except RequestError as re:
            raise BusinessError(
                "Error finding parent project candidates") from re
 def execute(self):
     try:
         request = GetRequest(connection=self.connection,
                               context=str(URL(f"{self.CONTEXT}"
                                               f"{self.work_package.id}/available_relation_candidates",
                                               [
                                                   Filters(
                                                       self.filters),
                                                   URLParameter
                                                   ("query", self.query),
                                                   URLParameter
                                                   ("type", self.type)
                                               ])))
         return FindListCommand(self.connection, request, Relation).execute()
         # for relation in json_obj["_embedded"]["elements"]:
         #     yield rel.Relation(relation)
     except RequestError as re:
         raise BusinessError(f"Error finding relation candidates for work package {self.work_package.id}") from re
Ejemplo n.º 14
0
 def execute(self):
     try:
         request = GetRequest(
             self.connection,
             str(
                 URL(f"{self.CONTEXT}", [
                     Filters(self.filters),
                     URLParameter("sortBy", self.sort_by),
                     URLParameter("groupBy", self.group_by),
                     URLParameter("showSums", self.show_sums)
                 ])))
         return FindListCommand(self.connection, request,
                                WorkPackage).execute()
         # json_obj = request.execute()
         # for work_package in json_obj["_embedded"]["elements"]:
         #     yield wp.WorkPackage(work_package)
     except RequestError as re:
         raise BusinessError("Error finding all work packages") from re