Changeset 2153
- Timestamp:
- 08/27/12 10:04:08 (12 years ago)
- Location:
- ComponentRegistry/branches/ComponentRegistry-1.13.0-olha/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/branches/ComponentRegistry-1.13.0-olha/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/CMDComponentTypeWrapper.java
r2152 r2153 5 5 package clarin.cmdi.componentregistry; 6 6 7 import clarin.cmdi.componentregistry.components.CMDComponentSpec; 7 8 import clarin.cmdi.componentregistry.components.CMDComponentType; 8 9 import java.util.List; … … 12 13 * @author olhsha 13 14 */ 14 public class CMDComponentTypeWrapper { // extending CMDComponentType does not work :( does not want to cast15 public class CMDComponentTypeWrapper { // extending CMDComponentType does not work :( does not want to downcast 15 16 16 /** 17 * Olha: null fileName of *this*, also in children 18 * 19 */ 17 CMDComponentType component; 18 List<CMDComponentType> listofcomponents; 20 19 21 // may be do this method static? 22 public void setFileNamesToNull(CMDComponentType component){ 23 //public void setFileNamesToNull(){ 20 public CMDComponentTypeWrapper(CMDComponentType newcomponent){ 21 component = newcomponent; 22 listofcomponents = newcomponent.getCMDComponent(); 23 } 24 25 26 public CMDComponentTypeWrapper(CMDComponentSpec newspec){ 27 component = null; 28 listofcomponents = newspec.getCMDComponent(); 29 } 30 31 32 public void setFileNamesToNull(){ 33 34 if (component != null) {component.setFilename(null);} 24 35 25 // null the filename of component 26 component.setFilename(null); 27 //filename=null; 28 29 // and now null filenames in all children's components 30 List<CMDComponentType> cildrencomponents = component.getCMDComponent(); 31 CMDComponentTypeWrapper childwrapper = new CMDComponentTypeWrapper(); 32 for (CMDComponentType currentcomponent : cildrencomponents) { 33 //for (CMDComponentType currentcomponent : cmdComponent) { 34 childwrapper.setFileNamesToNull(currentcomponent); 35 //((CMDComponentTypeWrapper) currentcomponent).setFileNamesToNull(); 36 for (CMDComponentType currentcomponent : listofcomponents) { 37 CMDComponentTypeWrapper currentwrapper = new CMDComponentTypeWrapper(currentcomponent); 38 currentwrapper.setFileNamesToNull(); 36 39 } 37 40 -
ComponentRegistry/branches/ComponentRegistry-1.13.0-olha/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java
r2152 r2153 799 799 800 800 // Olha: removing filename from spec before it gets extended!!! recursion over all the components 801 List<CMDComponentType> listofcomponents=spec.getCMDComponent(); 802 CMDComponentTypeWrapper setnulls= new CMDComponentTypeWrapper(); 803 804 for (CMDComponentType currentcomponent : listofcomponents) { 805 setnulls.setFileNamesToNull(currentcomponent); 806 } 801 CMDComponentTypeWrapper setnull = new CMDComponentTypeWrapper(spec); 807 802 808 //for (CMDComponentType currentcomponent : listofcomponents) { 809 //((CMDComponentTypeWrapper) currentcomponent). setFileNamesToNull(); 810 811 //} 803 812 804 813 805 try {
Note: See TracChangeset
for help on using the changeset viewer.