Project

General

Profile

« Previous | Next » 

Revision 541f08b0

Added by Katja Luther almost 8 years ago

remove updateSortindex and move removeNullValues to the mergeListener

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/FeatureNode.java
237 237
	 */
238 238
	@Override
239 239
    public List<FeatureNode> getChildNodes() {
240
	    HHH_9751_Util.removeAllNull(children);
241
	    updateSortIndex();
242
		return children;
240
	    return children;
243 241
	}
244 242

  
245 243
	/**
......
301 299
	 * @see				#removeChild(int)
302 300
	 */
303 301
	public void removeChild(FeatureNode child){
304
	    HHH_9751_Util.removeAllNull(children);
305
	    updateSortIndex();
306
		int index = children.indexOf(child);
302

  
303
	    int index = children.indexOf(child);
307 304
		if (index >= 0){
308 305
			removeChild(index);
309 306
		}
......
321 318
	 * @see				#removeChild(FeatureNode)
322 319
	 */
323 320
	public void removeChild(int index){
324
	    HHH_9751_Util.removeAllNull(children);
325
    	updateSortIndex();
326
		FeatureNode child = children.get(index);
327
		if (child != null){
321
	   FeatureNode child = children.get(index);
322
	   if (child != null){
328 323
			children.remove(index);
329 324
			child.setParent(null);
330 325
			child.setFeatureTree(null);
......
348 343
	 * @see					#removeChild(int)
349 344
	 */
350 345
	public FeatureNode getChildAt(int childIndex) {
351
	    HHH_9751_Util.removeAllNull(children);
352
	    updateSortIndex();
353
		return children.get(childIndex);
346
	    return children.get(childIndex);
354 347
	}
355 348

  
356 349
	/**
......
373 366
	 * @see			#removeChild(int)
374 367
	 */
375 368
	public int getIndex(FeatureNode node) {
376
	    HHH_9751_Util.removeAllNull(children);
377
	    updateSortIndex();
378

  
379
		if (! children.contains(node)){
369
	    if (! children.contains(node)){
380 370
			return -1;
381 371
		}else{
382 372
			return children.indexOf(node);
......
622 612
        }
623 613
	}
624 614

  
615
	public void removeNullValueFromChildren(){
616
	    HHH_9751_Util.removeAllNull(children);
617
	    updateSortIndex();
618
	}
619

  
625 620

  
626 621
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/PolytomousKeyNode.java
425 425
	 * <i>this</i> feature node.
426 426
	 */
427 427
	public List<PolytomousKeyNode> getChildren() {
428
	    HHH_9751_Util.removeAllNull(children);
429
	    updateSortIndex();
428

  
430 429
		return children;
431 430
	}
432 431

  
......
466 465
		if (index < 0 || index > children.size() + 1) {
467 466
			throw new IndexOutOfBoundsException("Wrong index: " + index);
468 467
		}
469
		HHH_9751_Util.removeAllNull(children);
470
		updateSortIndex();
471

  
472 468
		if(nodeNumber == null) {
473 469
            	nodeNumber = getMaxNodeNumberFromRoot() + 1;
474 470
        }
......
496 492
	 * @see #removeChild(int)
497 493
	 */
498 494
	public void removeChild(PolytomousKeyNode child) {
499
		HHH_9751_Util.removeAllNull(children);
500
		updateSortIndex();
501
		int index = children.indexOf(child);
495
	    int index = children.indexOf(child);
502 496
		if (index >= 0) {
503 497
			removeChild(index);
504 498
		}
......
895 889
        }
896 890
    }
897 891

  
892
    public void removeNullValueFromChildren(){
893
        HHH_9751_Util.removeAllNull(children);
894
        updateSortIndex();
895
    }
896

  
898 897

  
899 898
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/taxon/TaxonNode.java
197 197

  
198 198
    @Transient
199 199
    public Integer getSortIndex() {
200
        TaxonNode parent = HibernateProxyHelper.deproxy(this.parent, TaxonNode.class);
201
        parent.removeNullValueFromChildren();
202

  
203
		return sortIndex;
200
        return sortIndex;
204 201
	}
205 202
    /**
206 203
     * SortIndex shall be handled only internally, therefore not public.
......
492 489
     */
493 490
    protected boolean removeChildNode(TaxonNode childNode){
494 491
        boolean result = true;
495
        removeNullValueFromChildren();
492
        //removeNullValueFromChildren();
496 493
        if(childNode == null){
497 494
            throw new IllegalArgumentException("TaxonNode may not be null");
498 495
        }

Also available in: Unified diff