@@ 603-633 (lines=31) @@ | ||
600 | records[record.get("uid")] = record |
|
601 | return records |
|
602 | ||
603 | def remove_service(self, service): |
|
604 | """Remove the service from the template |
|
605 | ||
606 | If the service is not selected in the profile, returns False. |
|
607 | ||
608 | NOTE: This method is used when an Analysis Service was deactivated. |
|
609 | ||
610 | :param service: The service to be removed from this template |
|
611 | :type service: AnalysisService |
|
612 | :return: True if the AnalysisService has been removed successfully |
|
613 | """ |
|
614 | # get the UID of the service that should be removed |
|
615 | uid = api.get_uid(service) |
|
616 | # get the current raw value of the services field. |
|
617 | current_services = self.getRawServices() |
|
618 | # filter out the UID of the service |
|
619 | new_services = filter( |
|
620 | lambda record: record.get("uid") != uid, current_services) |
|
621 | ||
622 | # check if the service was removed or not |
|
623 | current_services_count = len(current_services) |
|
624 | new_services_count = len(new_services) |
|
625 | ||
626 | if current_services_count == new_services_count: |
|
627 | # service was not part of the profile |
|
628 | return False |
|
629 | ||
630 | # set the new services |
|
631 | self.setServices(new_services) |
|
632 | ||
633 | return True |
|
634 |
@@ 477-507 (lines=31) @@ | ||
474 | # BBB: AT schema (computed) field property |
|
475 | TotalPrice = property(getTotalPrice) |
|
476 | ||
477 | def remove_service(self, service): |
|
478 | """Remove the service from the profile |
|
479 | ||
480 | If the service is not selected in the profile, returns False. |
|
481 | ||
482 | NOTE: This method is used when an Analysis Service was deactivated. |
|
483 | ||
484 | :param service: The service to be removed from this profile |
|
485 | :type service: AnalysisService |
|
486 | :return: True if the AnalysisService has been removed successfully |
|
487 | """ |
|
488 | # get the UID of the service that should be removed |
|
489 | uid = api.get_uid(service) |
|
490 | # get the current raw value of the services field. |
|
491 | current_services = self.getRawServices() |
|
492 | # filter out the UID of the service |
|
493 | new_services = filter( |
|
494 | lambda record: record.get("uid") != uid, current_services) |
|
495 | ||
496 | # check if the service was removed or not |
|
497 | current_services_count = len(current_services) |
|
498 | new_services_count = len(new_services) |
|
499 | ||
500 | if current_services_count == new_services_count: |
|
501 | # service was not part of the profile |
|
502 | return False |
|
503 | ||
504 | # set the new services |
|
505 | self.setServices(new_services) |
|
506 | ||
507 | return True |
|
508 | ||
509 | @security.protected(permissions.View) |
|
510 | def getRawSampleTypes(self): |