All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gov.nasa.pds.citool.registry.client.DebugUtils Maven / Gradle / Ivy

Go to download

The Legacy Catalog Tool provides functionality for ingesting PDS3 catalog files into the PDS4 infrastructure including the Registry Service.

There is a newer version: 3.1.0
Show newest version
package gov.nasa.pds.citool.registry.client;

import java.util.List;
import java.util.Map;

import gov.nasa.pds.citool.registry.model.RegistryObject;


public class DebugUtils 
{
	public static void print(RegistryObject ro, int maxLen)
	{
		for(Map.Entry> item: ro.getSlots().entrySet())
		{
			System.out.print(item.getKey() + " = ");
			List vals = item.getValue(); 
			if(vals.size() == 1)
			{
				System.out.println(truncate(vals.get(0), maxLen));
			}
			else
			{
				System.out.print("[");
				for(String val: vals)
				{
					System.out.print(truncate(val, maxLen) + " | ");
				}
				System.out.println("]");
			}
		}
	}
	
	private static String truncate(String str, int maxLen)
	{
		if(str == null) return "null";
		return (str.length() > maxLen) ? str.substring(0, maxLen) : str;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy