Ignore:
Timestamp:
09/20/11 03:16:11 (8 months ago)
Author:
delmitz
Branch:
default
Convert:
svn:7c3792e6-d75b-4784-96a6-b298f655ee64/trunk@2782
Message:

modified API interfaces.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kraken-dom/src/main/java/org/krakenapps/dom/api/impl/WidgetApiImpl.java

    r2 r348  
    4545        @Requires 
    4646        private ThreadLocalEntityManagerService entityManagerService; 
     47 
    4748        @Requires 
    4849        private ProgramApi programApi; 
     50 
    4951        @Requires 
    5052        private AdminApi adminApi; 
     
    8284 
    8385        @Override 
    84         public void removeWidget(int adminId, int widgetId) throws WidgetNotFoundException { 
     86        public Widget removeWidget(int adminId, int widgetId) throws WidgetNotFoundException { 
    8587                Widget widget = removeWidgetInternal(adminId, widgetId); 
    8688                fireEntityRemoved(widget); 
     89                return widget; 
    8790        } 
    8891 
     
    98101        } 
    99102 
     103        @Override 
     104        public WidgetConfig setConfig(int adminId, int widgetId, String name, String value) throws WidgetNotFoundException { 
     105                WidgetConfig config = setConfigInternal(adminId, widgetId, name, value); 
     106                Widget widget = config.getWidget(); 
     107                widget.getWidgetConfigs().size(); 
     108                fireEntityUpdated(widget); 
     109                return config; 
     110        } 
     111 
    100112        @Transactional 
    101         @Override 
    102         public void setConfig(int adminId, int widgetId, String name, String value) throws WidgetNotFoundException { 
     113        private WidgetConfig setConfigInternal(int adminId, int widgetId, String name, String value) 
     114                        throws WidgetNotFoundException { 
    103115                EntityManager em = entityManagerService.getEntityManager(); 
    104116 
     
    121133                        em.persist(config); 
    122134                } 
     135                return config; 
    123136        } 
    124137 
     
    132145        } 
    133146 
     147        @Override 
     148        public WidgetConfig unsetConfig(int adminId, int widgetId, String key) throws WidgetConfigNotFoundException { 
     149                WidgetConfig config = unsetConfigInternal(adminId, widgetId, key); 
     150                Widget widget = config.getWidget(); 
     151                widget.getWidgetConfigs().size(); 
     152                fireEntityUpdated(widget); 
     153                return config; 
     154        } 
     155 
    134156        @Transactional 
    135         @Override 
    136         public void unsetConfig(int adminId, int widgetId, String key) throws WidgetConfigNotFoundException { 
     157        private WidgetConfig unsetConfigInternal(int adminId, int widgetId, String key) 
     158                        throws WidgetConfigNotFoundException { 
    137159                EntityManager em = entityManagerService.getEntityManager(); 
    138160                try { 
    139                         WidgetConfig config = (WidgetConfig) em.createQuery( 
    140                                         "FROM WidgetConfig c WHERE c.widget.id = ? AND c.name = ?").setParameter(1, widgetId).setParameter( 
    141                                         2, key).getSingleResult(); 
     161                        WidgetConfig config = (WidgetConfig) em 
     162                                        .createQuery("FROM WidgetConfig c WHERE c.widget.id = ? AND c.name = ?").setParameter(1, widgetId) 
     163                                        .setParameter(2, key).getSingleResult(); 
    142164                        if (config.getWidget().getAdmin().getId() != adminId) 
    143165                                throw new WidgetConfigNotFoundException(); 
    144166 
    145167                        em.remove(config); 
     168                        return config; 
    146169                } catch (NoResultException e) { 
    147170                        throw new WidgetConfigNotFoundException(); 
Note: See TracChangeset for help on using the changeset viewer.