Deleting a CodeValue
I am now able to remove a CodeValue
entry even if it is used in the database.
Please update CodeValueServiceImpl#remove(CodeValue)
and refuse to delete when there exists any record in the database of any entity that has @CodeValueField
with value == codeValue.groupName
and uses this codeValue.value
.
If there are no classes using this @CodeValueField
it can be deleted.
@CodeValueField
Update for missing First, in a separate commit, add any missing @CodeValueField
:
table_name | field_name | group_name |
---|---|---|
accession | improvement_status_code | IMPROVEMENT_LEVEL |
accession | initial_received_date_code | DATE_FORMAT |
accession | initial_received_form_code | GERMPLASM_FORM |
accession | life_form_code | ACCESSION_LIFE_FORM |
accession | reproductive_uniformity_code | REPRODUCTIVE_UNIFORMITY |
accession | status_code | ACCESSION_STATUS |
accession_action | action_name_code | ACCESSION_ACTION |
accession_action | completed_date_code | DATE_FORMAT |
accession_action | started_date_code | DATE_FORMAT |
accession_inv_annotation | annotation_date_code | DATE_FORMAT |
accession_inv_annotation | annotation_type_code | ANNOTATION_TYPE |
accession_inv_attach | attach_date_code | DATE_FORMAT |
accession_inv_attach | category_code | ATTACH_CATEGORY |
accession_inv_attach | description_code | ATTACH_DESCRIPTION_CODE |
accession_inv_name | category_code | ACCESSION_NAME_TYPE |
accession_inv_voucher | vouchered_date_code | DATE_FORMAT |
accession_ipr | type_code | ACCESSION_RESTRICTION_TYPE |
accession_pedigree | cross_code | PEDIGREE_CROSS |
accession_pedigree | released_date_code | DATE_FORMAT |
accession_quarantine | progress_status_code | ACCESSION_QUARANTINE_STATUS |
accession_quarantine | quarantine_type_code | ACCESSION_QUARANTINE_TYPE |
accession_source | acquisition_source_code | ACCESSION_SOURCE_HABITAT_TYPE |
accession_source | collected_form_code | GERMPLASM_FORM |
accession_source | georeference_protocol_code | GEOREFERENCE_PROTOCOL |
accession_source | source_date_code | DATE_FORMAT |
accession_source | source_type_code | ACCESSION_SOURCE_TYPE |
accession_source | unit_quantity_collected_code | UNIT_OF_QUANTITY |
citation | type_code | CITATION_TYPE |
cooperator | category_code | COOPERATOR_CATEGORY |
cooperator | discipline_code | COOPERATOR_DISCIPLINE |
cooperator | organization_region_code | ORGANIZATION_REGION |
cooperator | status_code | COOPERATOR_STATUS |
cooperator | title | COOPERATOR_TITLE |
cooperator_group | category_code | COOPERATOR_CATEGORY |
crop_attach | attach_date_code | DATE_FORMAT |
crop_attach | category_code | ATTACH_CATEGORY |
crop_trait | category_code | DESCRIPTOR_CATEGORY |
crop_trait | data_type_code | CROP_TRAIT_DATA_TYPE |
crop_trait | original_value_type_code | CROP_TRAIT_DATA_TYPE |
crop_trait_attach | attach_date_code | DATE_FORMAT |
crop_trait_attach | category_code | ATTACH_CATEGORY |
crop_trait_code_attach | attach_date_code | DATE_FORMAT |
crop_trait_code_attach | category_code | ATTACH_CATEGORY |
crop_trait_observation | data_quality_code | OBSERVATION_DATA_QUALITY |
feedback_form_field | field_type_code | FIELD_TYPE |
feedback_report | interval_length_code | INTERVAL_LENGTH |
feedback_report | interval_type_code | INTERVAL_TYPE |
feedback_result_attach | category_code | ATTACH_CATEGORY |
feedback_result_trait_obs | data_quality_code | OBSERVATION_DATA_QUALITY |
genetic_marker | poly_type_code | MARKER_POLY_TYPE |
genetic_observation | data_quality_code | OBSERVATION_DATA_QUALITY |
geography | adm1_type_code | GEOGRAPHY_ADMIN1_TYPE |
geography | adm2_type_code | GEOGRAPHY_ADMIN2_TYPE |
geography | country_code | GEOGRAPHY_COUNTRY_CODE |
inventory | availability_status_code | INVENTORY_AVAILABILITY_STATUS |
inventory | distribution_default_form_code | GERMPLASM_FORM |
inventory | distribution_unit_code | UNIT_OF_QUANTITY |
inventory | form_type_code | GERMPLASM_FORM |
inventory | pathogen_status_code | PATHOGEN_STATUS |
inventory | plant_sex_code | INVENTORY_PLANT_SEX |
inventory | pollination_method_code | INVENTORY_POLLINATION_METHOD |
inventory | pollination_vector_code | INVENTORY_POLLINATION_VECTOR |
inventory | propagation_date_code | DATE_FORMAT |
inventory | quantity_on_hand_unit_code | UNIT_OF_QUANTITY |
inventory_action | action_name_code | INVENTORY_ACTION |
inventory_action | completed_date_code | DATE_FORMAT |
inventory_action | form_code | GERMPLASM_FORM |
inventory_action | quantity_unit_code | UNIT_OF_QUANTITY |
inventory_action | started_date_code | DATE_FORMAT |
inventory_maint_policy | distribution_default_form_code | GERMPLASM_FORM |
inventory_maint_policy | distribution_unit_code | UNIT_OF_QUANTITY |
inventory_maint_policy | form_type_code | GERMPLASM_FORM |
inventory_maint_policy | quantity_on_hand_unit_code | UNIT_OF_QUANTITY |
inventory_maint_policy | regeneration_method_code | REGENERATION_METHOD |
inventory_quality_status | completed_date_code | DATE_FORMAT |
inventory_quality_status | contaminant_code | PATHOLOGY_TEST |
inventory_quality_status | plant_part_tested_code | GERMPLASM_FORM |
inventory_quality_status | started_date_code | DATE_FORMAT |
inventory_quality_status | test_result_code | PATHOLOGY_TEST_RESULT |
inventory_quality_status | test_results_score_type_code | PATH_TEST_SCORE_TYPE |
inventory_quality_status | test_type_code | PATHOLOGY_TEST_TYPE |
inventory_viability | tested_date_code | DATE_FORMAT |
inventory_viability | vigor_rating_code | INVENTORY_VIGOR |
inventory_viability_rule | category_code | GERMINATION_CATEGORY |
literature | literature_type_code | LITERATURE_TYPE |
method | georeference_protocol_code | GEOREFERENCE_PROTOCOL |
method | study_reason_code | METHOD_STUDY_TYPE |
order_request | intended_use_code | ORDER_INTENDED_USE |
order_request | order_type_code | ORDER_REQUEST_TYPE |
order_request_action | action_name_code | ORDER_REQUEST_ACTION |
order_request_action | completed_date_code | DATE_FORMAT |
order_request_action | started_date_code | DATE_FORMAT |
order_request_attach | attach_date_code | DATE_FORMAT |
order_request_attach | category_code | ATTACH_CATEGORY |
order_request_item | distribution_form_code | GERMPLASM_FORM |
order_request_item | quantity_shipped_unit_code | UNIT_OF_QUANTITY |
order_request_item | status_code | ORDER_REQUEST_ITEM_STATUS |
order_request_item_action | action_name_code | ORDER_REQUEST_ACTION |
order_request_item_action | completed_date_code | DATE_FORMAT |
order_request_item_action | started_date_code | DATE_FORMAT |
order_request_phyto_log | phyto_certificate_type_code | PHYTO_CERT_TYPE |
site | type_code | SITE_TYPE |
source_descriptor | category_code | SOURCE_DESCRIPTOR_CATEGORY |
source_descriptor | data_type_code | CROP_TRAIT_DATA_TYPE |
source_descriptor | original_value_type_code | CROP_TRAIT_DATA_TYPE |
sys_dataview | category_code | DATAVIEW_CATEGORY |
sys_dataview | database_area_code | DATAVIEW_DATABASE_AREA |
sys_permission | create_permission | SYS_PERMISSION_CODE |
sys_permission | delete_permission | SYS_PERMISSION_CODE |
sys_permission | read_permission | SYS_PERMISSION_CODE |
sys_permission | update_permission | SYS_PERMISSION_CODE |
sys_table | database_area_code | DATAVIEW_DATABASE_AREA |
taxonomy_attach | category_code | ATTACH_CATEGORY |
taxonomy_cwr | breeding_type_code | CWR_BREEDING_TYPE |
taxonomy_cwr | genepool_code | CWR_GENEPOOL |
taxonomy_cwr | trait_class_code | CWR_TRAIT_CLASS |
taxonomy_cwr_map | genepool_code | CWR_GENEPOOL |
taxonomy_cwr_priority | ex_situ_code | CWR_PRIORITY_SITU |
taxonomy_cwr_priority | in_situ_code | CWR_PRIORITY_SITU |
taxonomy_cwr_priority | status_code | CWR_PRIORITY_STATUS |
taxonomy_cwr_trait | breeding_type_code | CWR_BREEDING_TYPE |
taxonomy_cwr_trait | trait_class_code | CWR_TRAIT_CLASS |
taxonomy_family | suprafamily_rank_code | TAXONOMY_SUPRAFAMILY |
taxonomy_genus | hybrid_code | GENUS_HYBRID |
taxonomy_genus | qualifying_code | TAXONOMY_GENUS_QUALIFIER |
taxonomy_geography_map | geography_status_code | TAXONOMY_GEOGRAPHY_STATUS |
taxonomy_noxious | noxious_level_code | TAXONOMY_NOXIOUS_LEVEL |
taxonomy_noxious | noxious_type_code | TAXONOMY_NOXIOUS_TYPE |
taxonomy_regulation | regulation_level_code | TAXONOMY_NOXIOUS_LEVEL |
taxonomy_regulation | regulation_type_code | TAXONOMY_NOXIOUS_TYPE |
taxonomy_species | common_fertilization_code | TAXONOMY_FERTILIZATION_METHOD |
taxonomy_species | life_form_code | ACCESSION_LIFE_FORM |
taxonomy_species | restriction_code | TAXONOMY_RESTRICTION |
taxonomy_species | synonym_code | TAXONOMY_SPECIES_QUALIFIER |
taxonomy_use | economic_usage_code | TAXONOMY_USAGE |
taxonomy_use | plant_part_code | TAXONOMY_PLANT_PART |
web_cooperator | category_code | COOPERATOR_CATEGORY |
web_order_request | intended_use_code | WEB_ORDER_INTENDED_USE |
web_order_request_action | action_code | ORDER_REQUEST_ACTION |
web_order_request_item | distribution_form_code | GERMPLASM_FORM |
web_order_request_item | status_code | ORDER_REQUEST_ITEM_STATUS |
web_order_request_item | unit_of_shipped_code | UNIT_OF_QUANTITY |
web_user_cart | cart_type_code | CART_TYPE_CODE |
web_user_cart_item | form_type_code | GERMPLASM_FORM |
web_user_cart_item | usage_code | WEB_FAVORITE_USAGE |