@Test public void checkServiceCopySimple() { String name = "odap"; ServiceType serviceType = ServiceType.OPENDAP; String base = "/thredds/dodsC/"; String suffix = ".dods"; String description = "description"; InvService service = new InvService( name, serviceType.toString(), base, suffix, description ); InvService serviceCopy = DeepCopyUtils.copyService( service ); assertFalse( service == serviceCopy); assertEquals( name, serviceCopy.getName() ); assertEquals( serviceType, serviceCopy.getServiceType() ); assertEquals( base, serviceCopy.getBase() ); assertEquals( suffix, serviceCopy.getSuffix()); assertEquals( description, serviceCopy.getDescription()); }
public static InvService copyService( InvService service ) { if ( service == null ) throw new IllegalArgumentException( "Service may not be null."); InvService resultService = new InvService( service.getName(), service.getServiceType().toString(), service.getBase(), service.getSuffix(), service.getDescription() ); for ( InvService curService : service.getServices()) { resultService.addService( copyService( curService ) ); } for ( InvProperty curProperty : service.getProperties()) { resultService.addProperty( copyProperty( curProperty ) ); } for ( InvProperty curDatasetRoot : service.getDatasetRoots()) { resultService.addDatasetRoot( copyProperty( curDatasetRoot) ); } return resultService; }
DeepCopyUtils { public static InvService copyService( InvService service ) { if ( service == null ) throw new IllegalArgumentException( "Service may not be null."); InvService resultService = new InvService( service.getName(), service.getServiceType().toString(), service.getBase(), service.getSuffix(), service.getDescription() ); for ( InvService curService : service.getServices()) { resultService.addService( copyService( curService ) ); } for ( InvProperty curProperty : service.getProperties()) { resultService.addProperty( copyProperty( curProperty ) ); } for ( InvProperty curDatasetRoot : service.getDatasetRoots()) { resultService.addDatasetRoot( copyProperty( curDatasetRoot) ); } return resultService; } }
DeepCopyUtils { public static InvService copyService( InvService service ) { if ( service == null ) throw new IllegalArgumentException( "Service may not be null."); InvService resultService = new InvService( service.getName(), service.getServiceType().toString(), service.getBase(), service.getSuffix(), service.getDescription() ); for ( InvService curService : service.getServices()) { resultService.addService( copyService( curService ) ); } for ( InvProperty curProperty : service.getProperties()) { resultService.addProperty( copyProperty( curProperty ) ); } for ( InvProperty curDatasetRoot : service.getDatasetRoots()) { resultService.addDatasetRoot( copyProperty( curDatasetRoot) ); } return resultService; } private  DeepCopyUtils(); }
DeepCopyUtils { public static InvService copyService( InvService service ) { if ( service == null ) throw new IllegalArgumentException( "Service may not be null."); InvService resultService = new InvService( service.getName(), service.getServiceType().toString(), service.getBase(), service.getSuffix(), service.getDescription() ); for ( InvService curService : service.getServices()) { resultService.addService( copyService( curService ) ); } for ( InvProperty curProperty : service.getProperties()) { resultService.addProperty( copyProperty( curProperty ) ); } for ( InvProperty curDatasetRoot : service.getDatasetRoots()) { resultService.addDatasetRoot( copyProperty( curDatasetRoot) ); } return resultService; } private  DeepCopyUtils(); static InvCatalog copyCatalog( InvCatalog catalog ); static InvCatalog subsetCatalogOnDataset( InvCatalog catalog, String datasetId ); static InvCatalog subsetCatalogOnDataset( InvCatalog catalog, InvDataset dataset); static InvDataset copyDataset( InvDataset dataset, List<InvService> availableServices,
                                        boolean copyInheritedMetadataFromParents ); static InvAccess copyAccess( InvAccess access, InvDataset parentDataset, List<InvService> availableServices ); static InvService copyService( InvService service ); static InvProperty copyProperty( InvProperty property); }
DeepCopyUtils { public static InvService copyService( InvService service ) { if ( service == null ) throw new IllegalArgumentException( "Service may not be null."); InvService resultService = new InvService( service.getName(), service.getServiceType().toString(), service.getBase(), service.getSuffix(), service.getDescription() ); for ( InvService curService : service.getServices()) { resultService.addService( copyService( curService ) ); } for ( InvProperty curProperty : service.getProperties()) { resultService.addProperty( copyProperty( curProperty ) ); } for ( InvProperty curDatasetRoot : service.getDatasetRoots()) { resultService.addDatasetRoot( copyProperty( curDatasetRoot) ); } return resultService; } private  DeepCopyUtils(); static InvCatalog copyCatalog( InvCatalog catalog ); static InvCatalog subsetCatalogOnDataset( InvCatalog catalog, String datasetId ); static InvCatalog subsetCatalogOnDataset( InvCatalog catalog, InvDataset dataset); static InvDataset copyDataset( InvDataset dataset, List<InvService> availableServices,
                                        boolean copyInheritedMetadataFromParents ); static InvAccess copyAccess( InvAccess access, InvDataset parentDataset, List<InvService> availableServices ); static InvService copyService( InvService service ); static InvProperty copyProperty( InvProperty property);  }