当前位置: 首页>>代码示例>>Java>>正文


Java RemoteTenant类代码示例

本文整理汇总了Java中org.easyrec.model.core.web.RemoteTenant的典型用法代码示例。如果您正苦于以下问题:Java RemoteTenant类的具体用法?Java RemoteTenant怎么用?Java RemoteTenant使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RemoteTenant类属于org.easyrec.model.core.web包,在下文中一共展示了RemoteTenant类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get

import org.easyrec.model.core.web.RemoteTenant; //导入依赖的package包/类
@Override
public Item get(RemoteTenant remoteTenant, String itemId, String itemType) {
    String cacheId = makeCacheKey(remoteTenant.getId(), itemType, itemId);

    Element e = cache.get(cacheId);

    if (e != null) {
        return (Item) e.getValue();
    } else {
        Object[] args = {remoteTenant.getId(), itemId, itemType};

        try {
            Item i = getJdbcTemplate().query(PS_GET_ITEM.newPreparedStatementCreator(args), itemRowMapper).get(0);
            i.setUrl(Text.matchMax(remoteTenant.getUrl(), i.getUrl()));
            i.setImageUrl(Text.matchMax(remoteTenant.getUrl(), i.getImageUrl()));
            cache.put(new Element(cacheId, i));

            return i;
        } catch (Exception ex) {
            if (logger.isDebugEnabled())
                logger.debug("failed to get item or failed to insert it into the cache", ex);
            return null;
        }
    }
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:26,代码来源:ItemDAOMysqlImpl.java

示例2: getItems

import org.easyrec.model.core.web.RemoteTenant; //导入依赖的package包/类
@Override
public List<Item> getItems(RemoteTenant remoteTenant, String description, int start, int end) {
    List<Item> items;

    Object[] args = {remoteTenant.getId(), Item.DEFAULT_STRING_ITEM_TYPE};
    int[] argTypes = {Types.INTEGER, Types.VARCHAR};

    StringBuilder sql = new StringBuilder(SQL_GET_ITEMS);
    sql = MySQL.addLikeClause(sql, "DESCRIPTION", description);
    sql = MySQL.addLimitClause(sql, start, end);

    try {
        items = getJdbcTemplate().query(sql.toString(), args, argTypes, itemRowMapper);

        for (final Object item1 : items) {
            Item item = (Item) item1;
            item.setUrl(Text.matchMax(remoteTenant.getUrl(), item.getUrl()));
            item.setImageUrl(Text.matchMax(remoteTenant.getUrl(), item.getImageUrl()));
        }

        return items;
    } catch (Exception e) {
        logger.warn("An error occurred!", e);
        return null;
    }
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:27,代码来源:ItemDAOMysqlImpl.java

示例3: getHotItems

import org.easyrec.model.core.web.RemoteTenant; //导入依赖的package包/类
@Override
public List<Item> getHotItems(RemoteTenant remoteTenant, Integer start, Integer end) {
    List<Item> items;

    Object[] args = {remoteTenant.getId()};
    int[] argTypes = {Types.INTEGER};

    try {
        items = getJdbcTemplate()
                .query(new StringBuilder(SQL_HOT_ITEMS).append(" LIMIT ").append(start).append(", ").append(end)
                        .toString(), args, argTypes, itemRowMapper);
        for (final Object item1 : items) {
            Item item = (Item) item1;
            item.setUrl(Text.matchMax(remoteTenant.getUrl(), item.getUrl()));
            item.setImageUrl(Text.matchMax(remoteTenant.getUrl(), item.getImageUrl()));
        }
        return items;
    } catch (Exception e) {
        logger.warn("An error occurred!", e);
        return null;
    }
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:23,代码来源:ItemDAOMysqlImpl.java

示例4: doEndTag

import org.easyrec.model.core.web.RemoteTenant; //导入依赖的package包/类
public int doEndTag() throws JspException {

        if (this.remoteTenantDAO == null) {
            ServletContext servletContext = this.pageContext.getServletContext();
            ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
            this.remoteTenantDAO= (RemoteTenantDAO) context.getBean("remoteTenantDAO");
        }

        try {
            RemoteTenant rt = this.remoteTenantDAO.get(operatorId, tenantId);
            String stringRep = Text.matchMax(rt.getUrl(), itemUrl);
            String result = encodeForHTMLAttribute(stringRep);
            this.pageContext.getOut().write(result);
        } catch (java.io.IOException e) {
            throw new JspTagException("IO Error: " + e.getMessage());
        }
        return EVAL_PAGE;
    }
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:19,代码来源:AbsoluteUrl.java

示例5: removetenant

import org.easyrec.model.core.web.RemoteTenant; //导入依赖的package包/类
public ModelAndView removetenant(HttpServletRequest request, HttpServletResponse httpServletResponse) {
    String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
    String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");

    ModelAndView mav = new ModelAndView("page");

    mav.addObject("title", "easyrec :: administration");

    mav.addObject("operatorId", operatorId);
    mav.addObject("tenantId", tenantId);

    if (Security.isDeveloper(request)) {
        RemoteTenant remoteTenant = remoteTenantDAO.get(operatorId, tenantId);

        if (remoteTenant != null) {
            remoteTenantService.removeTenant(remoteTenant.getId());

            Security.setAttribute(request, "tenantId", null);
            return MessageBlock.createSingle(mav, MSG.TENANT_REMOVED, REMOVE_TENANT, MSG.SUCCESS);
        }

        return MessageBlock.createSingle(mav, MSG.TENANT_REMOVE_FAILED, REMOVE_TENANT, MSG.ERROR);
    } else {
        return MessageBlock.createSingle(mav, MSG.NOT_SIGNED_IN, REMOVE_TENANT, MSG.ERROR);
    }
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:27,代码来源:TenantsController.java

示例6: get

import org.easyrec.model.core.web.RemoteTenant; //导入依赖的package包/类
public RemoteTenant get(Integer tenantId) {
    RemoteTenant r = remoteTenantIntCache.get(tenantId);

    if (r != null) {
        return r;
    } else {

        Object[] args = {tenantId};
        int[] argTypes = {Types.INTEGER};
        try {
            r = getJdbcTemplate()
                    .queryForObject(SQL_GET_REMOTE_TENANT_BY_ID, args, argTypes, remoteTenantRowMapper);

            remoteTenantCache.put(r.getStringId() + ":::" + r.getOperatorId(), r);
            remoteTenantIntCache.put(tenantId, r);

            return r;

        } catch (Exception e) {
            logger.warn("Could not fetch tenant with id '" + tenantId + "'!", e);
            return r;
        }
    }
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:25,代码来源:RemoteTenantDAOMysqlImpl.java

示例7: storesessionmapping

import org.easyrec.model.core.web.RemoteTenant; //导入依赖的package包/类
public ModelAndView storesessionmapping(HttpServletRequest request, HttpServletResponse httpServletResponse) {
    String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
    String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
    String sessionmapping = ServletUtils.getSafeParameter(request, "sessionmapping", "");

    ModelAndView mav = new ModelAndView("page");

    mav.addObject("title", "easyrec :: administration");

    mav.addObject("operatorId", operatorId);
    mav.addObject("tenantId", tenantId);

    if (Security.isDeveloper(request)) {
        RemoteTenant r = remoteTenantDAO.get(operatorId, tenantId);
        if (r != null) {

            r.setSessionMapping(sessionmapping);
            tenantService.storeTenantConfig(r.getId(), r.getTenantConfigProperties());

        }
        return MessageBlock.createSingle(mav, MSG.SESSIONMAPPING_CONFIG_CHANGED, SESSION_MAPPING, MSG.SUCCESS);
    } else {
        return MessageBlock.createSingle(mav, MSG.NOT_SIGNED_IN, SESSION_MAPPING, MSG.ERROR);
    }
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:26,代码来源:TenantsController.java

示例8: storepluginsactive

import org.easyrec.model.core.web.RemoteTenant; //导入依赖的package包/类
public ModelAndView storepluginsactive(HttpServletRequest request, HttpServletResponse httpServletResponse) {
    String tenantId = ServletUtils.getSafeParameter(request, "tenantId", "");
    String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");
    String pluginsactive = ServletUtils.getSafeParameter(request, "pluginsactive", "");

    ModelAndView mav = new ModelAndView("page");

    mav.addObject("title", "easyrec :: administration");

    mav.addObject("operatorId", operatorId);
    mav.addObject("tenantId", tenantId);

    if (Security.isDeveloper(request)) {
        mav.setViewName("dev/page");
        RemoteTenant r = remoteTenantDAO.get(operatorId, tenantId);
        if (r != null) {
            tenantService.updateConfigProperty(r.getId(), PluginRegistry.PLUGINS_ENABLED_PROP, pluginsactive);
            r.setPlugins(pluginsactive);
            remoteTenantDAO.updateTenantInCache(r);
        }
        return MessageBlock.createSingle(mav, MSG.OPERATION_SUCCESSFUL, STORE_PLUGINS_ACTIVE, MSG.SUCCESS);
    } else {
        return MessageBlock.createSingle(mav, MSG.NOT_SIGNED_IN, STORE_PLUGINS_ACTIVE, MSG.ERROR);
    }
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:26,代码来源:TenantsController.java

示例9: viewitemstatistics

import org.easyrec.model.core.web.RemoteTenant; //导入依赖的package包/类
/**
 * Return a mav with itemstatistic to a given itemid
 * (first action, last action,
 * nr of Users acted on item, number of actions on item)
 *
 * @param request
 * @param response
 *
 */
public ModelAndView viewitemstatistics(HttpServletRequest request, HttpServletResponse response) {

    ModelAndView mav = security(request, "viewItemStatistics");

    if (!Web.validated(mav)) return mav;

    mav.setViewName("item/itemstatistics");
    RemoteTenant r = remoteTenantDAO.get(request);

    try {
        Item item = itemService.get(request);
        mav.addObject("item", item);
        mav.addObject("itemDetails", itemDAO.getItemDetails(r.getId(), item.getItemId(), item.getItemType()));
    } catch (Exception ex) {
        logger.debug("viewitemstatistics", ex);
    }

    return mav;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:29,代码来源:ItemController.java

示例10: typemanager

import org.easyrec.model.core.web.RemoteTenant; //导入依赖的package包/类
public ModelAndView typemanager(HttpServletRequest request, HttpServletResponse httpServletResponse) {
    ModelAndView mav = new ModelAndView("page");
    mav.addObject("page", "easyrec/typemanager");
    mav.addObject("menubar", "itemtypes");
    mav.addObject("selectedMenu", "myEasyrec");

    Operator signedInOperator = Security.signedInOperator(request);
    RemoteTenant remoteTenant = viewInitializationService.initializeView(request, mav);

    if (signedInOperator != null) {
        mav.addObject("apiKey", signedInOperator.getApiKey());
        mav.addObject("tenants", remoteTenantDAO.getTenantsFromOperator(remoteTenant.getOperatorId()));
    }

    return mav;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:17,代码来源:TypeManagerController.java

示例11: removeitemfromcluster

import org.easyrec.model.core.web.RemoteTenant; //导入依赖的package包/类
public ModelAndView removeitemfromcluster(HttpServletRequest request, HttpServletResponse httpServletResponse) {
    ModelAndView mav = new ModelAndView("clustermanager/ajax/message");
    RemoteTenant remoteTenant = viewInitializationService.initializeView(request, mav);

    String clusterId = ServletUtils.getSafeParameter(request, "clusterId", "");
    String itemId = ServletUtils.getSafeParameter(request, "itemId", "");
    String itemType = ServletUtils.getSafeParameter(request, "itemType", "");

    Integer itemTypeId = itemTypeDAO.getIdOfType(remoteTenant.getId(), itemType);
    Integer itemIdInt = idMappingDAO.lookup(itemId);

    try {
        clusterService.removeItemFromCluster(remoteTenant.getId(), clusterId, itemIdInt, itemTypeId);
    } catch (ClusterException e) {
        // This exception can be thrown when the given item already is in this cluster
        mav.addObject("text", e.getMessage());
        return mav;
    }

    return mav;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:22,代码来源:ClusterManagerController.java

示例12: getTenants

import org.easyrec.model.core.web.RemoteTenant; //导入依赖的package包/类
@Override
public List<RemoteTenant> getTenants(int offset, int limit, boolean filterDemoTenants, String searchString) {
    try {
        String filter = "";

        if (Strings.isNullOrEmpty(searchString)) {
            searchString = "%";
        } else {
            searchString = "%" + searchString + "%";
        }
        
        if (filterDemoTenants) {
            filter = "EASYREC_DEMO";
        }

        Object[] args = {filter, searchString, offset, limit};
        int[] argTypes = {Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER};
        return getJdbcTemplate()
                .query(SQL_GET_TENANTS_SEARCH, args, argTypes, remoteTenantRowMapper);

    } catch (Exception e) {
        logger.warn("An error occurred!", e);
        return null;
    }
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:26,代码来源:RemoteTenantDAOMysqlImpl.java

示例13: changeclusterparent

import org.easyrec.model.core.web.RemoteTenant; //导入依赖的package包/类
public ModelAndView changeclusterparent(HttpServletRequest request, HttpServletResponse httpServletResponse) {
    ModelAndView mav = new ModelAndView("clustermanager/ajax/message");
    RemoteTenant remoteTenant = viewInitializationService.initializeView(request, mav);

    String clusterId = ServletUtils.getSafeParameter(request, "clusterId", "");
    String newParent = ServletUtils.getSafeParameter(request, "newParent", "");


    if (remoteTenant == null) {
        logger.warn("no tenantId supplied");
        return mav;
    }

    if (clusterId.length() == 0) {
        logger.warn("no clusterId supplied");
        return mav;
    }

    clusterService.moveCluster(remoteTenant.getId(), clusterId, newParent);
    return mav;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:22,代码来源:ClusterManagerController.java

示例14: updateform

import org.easyrec.model.core.web.RemoteTenant; //导入依赖的package包/类
public ModelAndView updateform(HttpServletRequest request, HttpServletResponse httpServletResponse) {
    ModelAndView mav = security(request);

    String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");

    if (operatorId.length() == 0) {
        TenantVO tenantVO =
                tenantService.getTenantByStringId(ServletUtils.getSafeParameter(request, "tenantId", ""));
        RemoteTenant remoteTenant = remoteTenantDAO.get(tenantVO.getId());
        operatorId = remoteTenant.getOperatorId();


    }

    Operator operator = operatorDAO.get(operatorId);
    mav.addObject("operator", operator);

    mav.addObject("title", "easyrec :: update account");
    mav.addObject("page", "operator/update");
    mav.addObject("selectedMenu", "");
    return mav;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:23,代码来源:OperatorController.java

示例15: remove

import org.easyrec.model.core.web.RemoteTenant; //导入依赖的package包/类
public ModelAndView remove(HttpServletRequest request, HttpServletResponse httpServletResponse) {

        ModelAndView mav = security(request);
        String operatorId = ServletUtils.getSafeParameter(request, "operatorId", "");

        if (Security.isDeveloper(request)) {
            Operator operator = operatorDAO.get(operatorId);
            if (operator != null) {
                if (!operator.getOperatorId().equals(Operator.DEFAULT_OPERATORID)) {
                    List<RemoteTenant> tenants = remoteTenantDAO.getTenantsFromOperator(operatorId);
                    for (RemoteTenant remoteTenant : tenants) {
                        remoteTenantService.removeTenant(remoteTenant.getId());
                    }
                    operatorDAO.remove(operatorId);

                    return MessageBlock.createSingle(mav, MSG.OPERATOR_REMOVED, "removeOperator", MSG.SUCCESS);
                }
            }
        }
        return MessageBlock.createSingle(mav, MSG.OPERATOR_REMOVE_FAILED, "removeOperator", MSG.ERROR);

    }
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:23,代码来源:OperatorController.java


注:本文中的org.easyrec.model.core.web.RemoteTenant类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。