public static Entity getEntity(EntityWidget widget, StorageService storageService) {
		Entity entity = widget.getEntity();				
		if (entity == null) {	
            String entityId = widget.getInternalSettings().get(EntityWidget.ENTITY_ID);
            try {
                entity = storageService.getEntityById(entityId);
            } catch (NotFoundException e) {                
                e.printStackTrace();
            }      
            widget.setEntity(entity);
        }
		return entity;
	}
public static Entity getEntity ( EntityWidget widget , StorageService storageService ) { Entity entity = widget . getEntity ( ) ; if ( entity == null ) { String entityId = widget . getInternalSettings ( ) . get ( EntityWidget . ENTITY_ID ) ; try { entity = storageService . getEntityById ( entityId ) ; } catch ( NotFoundException e ) { e . printStackTrace ( ) ; } widget . setEntity ( entity ) ; } return entity ; }
if it is not set, we load it and we set it on widget