Project

General

Profile

« Previous | Next » 

Revision bd10f42b

Added by Andreas Müller over 8 years ago

Cleanup DeleteOperation

View differences:

eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/DeleteOperation.java
105 105
		monitor.worked(20);
106 106
		ICdmApplicationConfiguration controller = CdmStore.getCurrentApplicationConfiguration();
107 107
		ITaxonNodeService service = controller.getTaxonNodeService();
108
			if(taxonNode != null && taxonNode instanceof TaxonNode){
109
				//((TaxonNode) treeNode).delete();
110

  
111
				element = ((TaxonNode)taxonNode).getTaxon();
112

  
113
				DeleteResult result = service.deleteTaxonNode((TaxonNode)taxonNode, config);
114
				if (result.isError() && !result.getExceptions().isEmpty()){
115

  
116
					DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode could not be deleted.", TaxeditorNavigationPlugin.PLUGIN_ID);
117
				} else if (!result.getExceptions().isEmpty()){
118
					String separator = ", ";
119
				    String exceptionString = "";
120
				    for (Exception exception : result.getExceptions()) {
121
			            exceptionString += exception.getLocalizedMessage()+separator;
122
			        }
123
				    DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode was successfully deleted, but related object(s) could not be deleted", TaxeditorNavigationPlugin.PLUGIN_ID);
124
				}
108
		if(taxonNode != null && taxonNode instanceof TaxonNode){
109
			//((TaxonNode) treeNode).delete();
110

  
111
			element = ((TaxonNode)taxonNode).getTaxon();
112

  
113
			DeleteResult result = service.deleteTaxonNode((TaxonNode)taxonNode, config);
114
			if (result.isError() && !result.getExceptions().isEmpty()){
115

  
116
				DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode could not be deleted.", TaxeditorNavigationPlugin.PLUGIN_ID);
117
			} else if (!result.getExceptions().isEmpty()){
118
				String separator = ", ";
119
			    String exceptionString = "";
120
			    for (Exception exception : result.getExceptions()) {
121
		            exceptionString += exception.getLocalizedMessage()+separator;
122
		        }
123
			    DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode was successfully deleted, but related object(s) could not be deleted", TaxeditorNavigationPlugin.PLUGIN_ID);
124
			}
125 125

  
126 126

  
127
			}else if(taxonNode != null && taxonNode instanceof Classification){
128
				Classification taxonomicTree = (Classification) taxonNode;
127
		}else if(taxonNode != null && taxonNode instanceof Classification){
128
			Classification taxonomicTree = (Classification) taxonNode;
129 129

  
130
				DeleteResult result = CdmStore.getService(IClassificationService.class).delete(taxonomicTree.getUuid());
131
                if (result.isError() && !result.getExceptions().isEmpty()){
132
                    //TODO:Error message!
133
                    DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode could not be deleted.", TaxeditorNavigationPlugin.PLUGIN_ID);
134
                }
130
			DeleteResult result = CdmStore.getService(IClassificationService.class).delete(taxonomicTree.getUuid());
131
            if (result.isError() && !result.getExceptions().isEmpty()){
132
                //TODO:Error message!
133
                DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode could not be deleted.", TaxeditorNavigationPlugin.PLUGIN_ID);
134
            }
135 135
        } else {
136 136
            Set<UUID> treeNodeUuids = new HashSet<UUID>();
137 137
            ITaxonTreeNode entity = null;

Also available in: Unified diff