forked from Coded/SIPRP
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							60 lines
						
					
					
						
							1.4 KiB
						
					
					
				
			
		
		
	
	
							60 lines
						
					
					
						
							1.4 KiB
						
					
					
				/*
 | 
						|
 * To change this template, choose Tools | Templates
 | 
						|
 * and open the template in the editor.
 | 
						|
 */
 | 
						|
 | 
						|
package siprp.images.servlet;
 | 
						|
 | 
						|
import com.evolute.application.initializer.DefaultDatabaseInitializer;
 | 
						|
import com.evolute.entity.ProviderInterface;
 | 
						|
import com.evolute.utils.Singleton;
 | 
						|
import com.evolute.utils.dataedition.persistence.Persistent;
 | 
						|
import com.evolute.utils.error.ErrorLogger;
 | 
						|
import shst.data.outer.ImageData;
 | 
						|
 | 
						|
/**
 | 
						|
 *
 | 
						|
 * @author dneves
 | 
						|
 */
 | 
						|
public class ImageDataProvider
 | 
						|
{
 | 
						|
	private static ImageDataProvider INSTANCE = null;
 | 
						|
 | 
						|
	private ProviderInterface< Persistent< ? >, Exception > ENTITY_PROVIDER = null;
 | 
						|
 | 
						|
	private ImageDataProvider() throws Exception
 | 
						|
	{
 | 
						|
		if ( Singleton.getInstance( Singleton.DEFAULT_EVO_DATA_PROVIDER ) == null )
 | 
						|
		{
 | 
						|
			new DefaultDatabaseInitializer( DBConstants.SERVER, DBConstants.PORT, DBConstants.DATABASE,
 | 
						|
				DBConstants.USER, DBConstants.PASSWORD ).doInit();
 | 
						|
		}
 | 
						|
 | 
						|
		ENTITY_PROVIDER = ( ProviderInterface< Persistent< ? >, Exception > ) Singleton.getInstance( Singleton.DEFAULT_EVO_DATA_PROVIDER );
 | 
						|
	}
 | 
						|
 | 
						|
	public static synchronized ImageDataProvider getProvider() throws Exception
 | 
						|
	{
 | 
						|
		if ( INSTANCE == null )
 | 
						|
		{
 | 
						|
			INSTANCE = new ImageDataProvider();
 | 
						|
		}
 | 
						|
		return INSTANCE;
 | 
						|
	}
 | 
						|
 | 
						|
	public ImageData loadImageDataByID( Integer imageID )
 | 
						|
	{
 | 
						|
		ImageData result = null;
 | 
						|
		try
 | 
						|
		{
 | 
						|
			result = ENTITY_PROVIDER.load( ImageData.class, imageID, ImageData.ID );
 | 
						|
		}
 | 
						|
		catch ( Exception e )
 | 
						|
		{
 | 
						|
			ErrorLogger.logException( e );
 | 
						|
		}
 | 
						|
		return result;
 | 
						|
	}
 | 
						|
 | 
						|
}
 |