Project

General

Profile

Revision 179a8467

ID179a846773ab7eec76e786dfafe5a84cdbdf7103
Parent 8e653279
Child de051e6a

Added by Andreas Müller over 2 years ago

fix #8257 remove remaining deprecated FeatureNode.NewInstance method

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/sdd/in/SDDImport.java
1824 1824
		}
1825 1825

  
1826 1826
		// Leaves of CharacterTrees in SDD are always CharNodes (referring to Characters)
1827
		List<Element> listCharNodes = elNodes.getChildren("CharNode", sddNamespace);
1827
		@SuppressWarnings("unchecked")
1828
        List<Element> listCharNodes = elNodes.getChildren("CharNode", sddNamespace);
1828 1829
		if (listCharNodes != null) {
1829 1830
			for (Element elCharNode : listCharNodes){
1830 1831
				Element elParent = elCharNode.getChild("Parent", sddNamespace);
1831 1832
				Element elCharacter = elCharNode.getChild("Character", sddNamespace);
1832 1833
				Element elDependencyRules = elCharNode.getChild("DependencyRules", sddNamespace);
1833
				FeatureNode<Feature> fn = FeatureNode.NewInstance();
1834
				FeatureNode<Feature> fn = null;
1835

  
1836
                if (elParent!=null){
1837
                    String refP = elParent.getAttributeValue("ref");
1838
                    if ((refP!=null)&&(!refP.equals(""))) {
1839
                        FeatureNode<Feature> parent = featureNodes.get(refP);
1840
                        if (parent==null){
1841
                            parent = root; // if no parent found or the reference is broken, add the node to the root of the tree
1842
                        }
1843
                        fn = parent.addChild();
1844
                    }
1845
                }
1846
                if (fn == null){  //TODO check if correct, added when solving #8257
1847
                    fn = root.addChild();
1848
                }
1834 1849

  
1835 1850
				if (elDependencyRules!=null){
1836 1851
					Element elInapplicableIf = elCharNode.getChild("InapplicableIf", sddNamespace);
......
1857 1872
					}
1858 1873
				}
1859 1874

  
1860
				if (elParent!=null){
1861
					String refP = elParent.getAttributeValue("ref");
1862
					if ((refP!=null)&&(!refP.equals(""))) {
1863
					FeatureNode<Feature> parent = featureNodes.get(refP);
1864
						if (parent==null){
1865
						parent = root; // if no parent found or the reference is broken, add the node to the root of the tree
1866
						}
1867
						parent.addChild(fn);
1868
					}
1869
				}
1870 1875
				String refC = elCharacter.getAttributeValue("ref");
1871 1876
				if ((refC!=null)&&(!refC.equals(""))){
1872 1877
					Feature character = features.get(refC);
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/term/FeatureNode.java
162 162

  
163 163
// ***************************** FACTORY *********************************/
164 164

  
165
	/**
166
	 * Creates a new empty feature node instance.
167
	 *
168
	 * @see #NewInstance(Feature)
169
	 * @deprecated will be removed in future
170
	 */
171
	@Deprecated
172
	public static FeatureNode<Feature> NewInstance(){
173
		return new FeatureNode<>(TermType.Feature);
174
	}
165
	//no factory methods should be provided as FeatureNodes should only
166
	//be created as children of their parent node (#8257)
175 167

  
176 168
// ******************** CONSTRUCTOR ***************************************/
177 169

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)