forked from Coded/SIPRP
git-svn-id: https://svn.coded.pt/svn/SIPRP@1258 bb69d46d-e84e-40c8-a05a-06db0d633741
parent
b436003aba
commit
be2248472e
@ -0,0 +1,6 @@
|
|||||||
|
#SIPRPSoft versioning file
|
||||||
|
#Fri Jun 25 17:32:18 WEST 2010
|
||||||
|
major=0
|
||||||
|
name=SIPRPSoft
|
||||||
|
minor=0
|
||||||
|
build=1
|
||||||
@ -1,49 +0,0 @@
|
|||||||
package siprp.database.cayenne.providers;
|
|
||||||
|
|
||||||
import org.apache.cayenne.DataObjectUtils;
|
|
||||||
|
|
||||||
import siprp.MedicinaConstants;
|
|
||||||
import siprp.database.cayenne.objects.Empresas;
|
|
||||||
import siprp.database.cayenne.objects.Image;
|
|
||||||
|
|
||||||
public class ImageDAO extends MainDAO implements MedicinaConstants
|
|
||||||
{
|
|
||||||
|
|
||||||
public Image getImageForEmpresaID( Integer id )
|
|
||||||
{
|
|
||||||
Image result = null;
|
|
||||||
Empresas empresa = (Empresas) DataObjectUtils.objectForPK( context, Empresas.class, id );
|
|
||||||
if( empresa != null )
|
|
||||||
{
|
|
||||||
result = empresa.getToLogotipo();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImageForEmpresaID( Integer id, byte [] imageData )
|
|
||||||
{
|
|
||||||
if( id != null )
|
|
||||||
{
|
|
||||||
Empresas empresa = (Empresas) DataObjectUtils.objectForPK( context, Empresas.class, id );
|
|
||||||
if( empresa != null )
|
|
||||||
{
|
|
||||||
Image logo = null;
|
|
||||||
if( imageData != null )
|
|
||||||
{
|
|
||||||
logo = (Image) context.newObject( Image.class );
|
|
||||||
logo.setImageData( imageData );
|
|
||||||
logo.setName( "Logotipo: " + empresa.getDesignacaoSocial() );
|
|
||||||
}
|
|
||||||
empresa.setToLogotipo( logo );
|
|
||||||
context.commitChanges();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Image getImageForID( Integer id )
|
|
||||||
{
|
|
||||||
Image result = (Image) DataObjectUtils.objectForPK( context, Image.class, id );
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
Reference in new issue