TrackbackDAO(TgwEntity trackback) { dao = daoService.getDAO(trackback); }
public CounterDAO(TgwEntity entity) { this.dao = daoService.getDAO(entity); this.entity = entity; }
protected EntityDAO getEntityDAO(TgwEntity entity) { DAOService service = (DAOService) getService(DAOService.class); return service.getDAO(entity); }
public DataAccessUtil getDataAccessUtil(Class clazz) { TgwEntity entity = model.getEntityByClass(clazz); if (entity == null) { entity = TgwRequestUtils.getCurrent().getChildRequest( TgwBuriContext.class).getCurrentEntity(); } DataAccessUtil util = dataAccessMap.get(entity); if (util == null) { EntityDAO dao = daoService.getDAO(entity); util = new TuigwaaDataAccessUtils(dao); dataAccessMap.put(entity, util); } return util; } }
public void run(Object obj) { DAOService daoService = (DAOService) SingletonS2ContainerFactory .getContainer().getComponent(DAOService.class); ModelService entityService = (ModelService) SingletonS2ContainerFactory .getContainer().getComponent(ModelService.class); String siteName = TgwContext.getSiteName(); HttpServletRequest request = TgwContext.getRequest(); Map map = TgwContext.getEntityNameMapFromRequest(request); String idStr = (String) map.get(entityName); if (idStr == null) { return; } Long id = Long.valueOf(idStr); if (id.longValue() > 0) { TgwEntity entity = entityService.getEntity(siteName, entityName); daoService.getDAO(entity).delete(id); } } }
public void run(Object obj) { DAOService daoService = (DAOService) SingletonS2ContainerFactory .getContainer().getComponent(DAOService.class); ModelService entityService = (ModelService) SingletonS2ContainerFactory .getContainer().getComponent(ModelService.class); String siteName = TgwContext.getSiteName(); TgwEntity entity = entityService.getEntity(siteName, entityName); DaoMethod daoMethod = daoService.getDAO(entity) .getMethod(updateDaoName); // get id directly from httprequest HttpServletRequest request = TgwContext.getRequest(); Map<String, String> map = TgwContext .getEntityNameMapFromRequest(request); String idStr = map.get(entityName); if (idStr == null) { return; } Long id = Long.valueOf(idStr); // Long id = TgwPluginUtils.getEntityId(entity); if (id != null && id.longValue() > 0) { // ignore logic daoMethod.evaluate(id); } } }
public boolean test(Object obj) { // Ignore Input "obj" ModelService entityService = (ModelService) SingletonS2ContainerFactory .getContainer().getComponent(ModelService.class); DAOService daoService = (DAOService) SingletonS2ContainerFactory .getContainer().getComponent(DAOService.class); String domainName = TgwContext.getDomainName(); // TgwEntity entity = entityService.getEntity(siteName, entityName); TgwEntity entity = entityService.getEntity(domainName, entityName); EntityDAO dao = daoService.getDAO(entity); Object ret = (Object) dao.getMethod(aggregationFuncName).evaluate(); Double testValue = null; if(ret instanceof Integer){ double doubleValue = ((Integer)ret).doubleValue(); testValue = new Double(doubleValue); }else{ testValue = (Double)ret; } BinaryPredicate predicate = Op.getInstance(getOpcode()); return predicate.test(testValue, value); } }
public String createAdminUser(String domainName) throws TgwException { TgwDomain domain = model.getDomain(domainName); TgwEntity tgwRole = domain.findEntityByAnnotaion("builtin", "role"); EntityDAO roleDao = dao.getDAO(tgwRole); String adminRoleName = TgwResource.getProperty("ldap.admin.rolename"); Object roleObj = null; EntityDAO userDao = dao.getDAO(tgwUser); String adminUserName = TgwResource.getProperty("ldap.admin.username"); Object userObj = null; EntityDAO userRoleDao = dao.getDAO(tgwUserRole); Object userroleObj = tgwUserRole.newInstance(); P.set(userroleObj, "tgw_user", userObj);