| @@ 655-685 (lines=31) @@ | ||
| 652 | records[record.get("uid")] = record |
|
| 653 | return records |
|
| 654 | ||
| 655 | def remove_service(self, service): |
|
| 656 | """Remove the service from the template |
|
| 657 | ||
| 658 | If the service is not selected in the profile, returns False. |
|
| 659 | ||
| 660 | NOTE: This method is used when an Analysis Service was deactivated. |
|
| 661 | ||
| 662 | :param service: The service to be removed from this template |
|
| 663 | :type service: AnalysisService |
|
| 664 | :return: True if the AnalysisService has been removed successfully |
|
| 665 | """ |
|
| 666 | # get the UID of the service that should be removed |
|
| 667 | uid = api.get_uid(service) |
|
| 668 | # get the current raw value of the services field. |
|
| 669 | current_services = self.getRawServices() |
|
| 670 | # filter out the UID of the service |
|
| 671 | new_services = filter( |
|
| 672 | lambda record: record.get("uid") != uid, current_services) |
|
| 673 | ||
| 674 | # check if the service was removed or not |
|
| 675 | current_services_count = len(current_services) |
|
| 676 | new_services_count = len(new_services) |
|
| 677 | ||
| 678 | if current_services_count == new_services_count: |
|
| 679 | # service was not part of the profile |
|
| 680 | return False |
|
| 681 | ||
| 682 | # set the new services |
|
| 683 | self.setServices(new_services) |
|
| 684 | ||
| 685 | return True |
|
| 686 | ||
| @@ 505-535 (lines=31) @@ | ||
| 502 | # BBB: AT schema (computed) field property |
|
| 503 | TotalPrice = property(getTotalPrice) |
|
| 504 | ||
| 505 | def remove_service(self, service): |
|
| 506 | """Remove the service from the profile |
|
| 507 | ||
| 508 | If the service is not selected in the profile, returns False. |
|
| 509 | ||
| 510 | NOTE: This method is used when an Analysis Service was deactivated. |
|
| 511 | ||
| 512 | :param service: The service to be removed from this profile |
|
| 513 | :type service: AnalysisService |
|
| 514 | :return: True if the AnalysisService has been removed successfully |
|
| 515 | """ |
|
| 516 | # get the UID of the service that should be removed |
|
| 517 | uid = api.get_uid(service) |
|
| 518 | # get the current raw value of the services field. |
|
| 519 | current_services = self.getRawServices() |
|
| 520 | # filter out the UID of the service |
|
| 521 | new_services = filter( |
|
| 522 | lambda record: record.get("uid") != uid, current_services) |
|
| 523 | ||
| 524 | # check if the service was removed or not |
|
| 525 | current_services_count = len(current_services) |
|
| 526 | new_services_count = len(new_services) |
|
| 527 | ||
| 528 | if current_services_count == new_services_count: |
|
| 529 | # service was not part of the profile |
|
| 530 | return False |
|
| 531 | ||
| 532 | # set the new services |
|
| 533 | self.setServices(new_services) |
|
| 534 | ||
| 535 | return True |
|
| 536 | ||
| 537 | @security.protected(permissions.View) |
|
| 538 | def getRawSampleTypes(self): |
|