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


Java LocaleImpl类代码示例

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


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

示例1: testRuleThatEvaluatesToTrue

import org.broadleafcommerce.common.locale.domain.LocaleImpl; //导入依赖的package包/类
/**
 * Test rule that evaluates to true
 */
public void testRuleThatEvaluatesToTrue() {
    // Locale used as an illustrative domain class only.  Any object could have been used.
    Locale testLocale = new LocaleImpl();
    testLocale.setLocaleCode("US");

    Map parameters = new HashMap();
    parameters.put("locale", testLocale);

    boolean result = MvelHelper.evaluateRule("locale.localeCode == 'US'", parameters);
    assertTrue(result);
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:15,代码来源:MvelHelperTest.java

示例2: testRuleThatEvaluatesToFalse

import org.broadleafcommerce.common.locale.domain.LocaleImpl; //导入依赖的package包/类
/**
 * Test rule that evaluates to true
 */
public void testRuleThatEvaluatesToFalse() {
    // Locale used as an illustrative domain class only.  Any object could have been used.
    Locale testLocale = new LocaleImpl();
    testLocale.setLocaleCode("GB");

    Map parameters = new HashMap();
    parameters.put("locale", testLocale);

    boolean result = MvelHelper.evaluateRule("locale.localeCode == 'US'", parameters);
    assertFalse(result);
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:15,代码来源:MvelHelperTest.java

示例3: createLightWeightCloneFromJson

import org.broadleafcommerce.common.locale.domain.LocaleImpl; //导入依赖的package包/类
/**
 * Resurrect the BroadleafRequestContext state based on a JSON representation.
 *
 * @param Json
 * @param em
 * @return
 */
public static BroadleafRequestContext createLightWeightCloneFromJson(String Json, EntityManager em) {
    BroadleafRequestContext context = new BroadleafRequestContext();
    JsonFactory factory = new JsonFactory();
    ObjectMapper mapper = new ObjectMapper(factory);
    TypeReference<HashMap<String,String>> typeRef = new TypeReference<HashMap<String,String>>() {};
    HashMap<String,String> json;
    try {
        json = mapper.readValue(Json, typeRef);
    } catch (IOException e) {
        throw ExceptionHelper.refineException(e);
    }
    if (!json.get("ignoreSite").equals("null")) {
        context.setIgnoreSite(Boolean.valueOf(json.get("ignoreSite")));
    }
    if (!json.get("sandBox").equals("null")) {
        context.setSandBox(em.find(SandBoxImpl.class, Long.parseLong(json.get("sandBox"))));
    }
    if (!json.get("nonPersistentSite").equals("null")) {
        context.setNonPersistentSite(em.find(SiteImpl.class, Long.parseLong(json.get("nonPersistentSite"))));
    }
    if (!json.get("enforceEnterpriseCollectionBehaviorState").equals("null")) {
        context.setEnforceEnterpriseCollectionBehaviorState(EnforceEnterpriseCollectionBehaviorState.valueOf(json
                .get("enforceEnterpriseCollectionBehaviorState")));
    }
    if (!json.get("admin").equals("null")) {
        context.setAdmin(Boolean.valueOf(json.get("admin")));
    }
    if (!json.get("adminUserId").equals("null")) {
        context.setAdminUserId(Long.parseLong(json.get("ignoreSite")));
    }
    if (!json.get("broadleafCurrency").equals("null")) {
        context.setBroadleafCurrency(em.find(BroadleafCurrencyImpl.class, json.get("broadleafCurrency")));
    }
    if (!json.get("currentCatalog").equals("null")) {
        context.setCurrentCatalog(em.find(CatalogImpl.class, Long.parseLong(json.get("currentCatalog"))));
    }
    if (!json.get("currentProfile").equals("null")) {
        context.setCurrentProfile(em.find(SiteImpl.class, Long.parseLong(json.get("currentProfile"))));
    }
    if (!json.get("deployBehavior").equals("null")) {
        context.setDeployBehavior(DeployBehavior.valueOf(json.get("deployBehavior")));
    }
    if (!json.get("deployState").equals("null")) {
        context.setDeployState(DeployState.valueOf(json.get("deployState")));
    }
    if (!json.get("internalIgnoreFilters").equals("null")) {
        context.setInternalIgnoreFilters(Boolean.valueOf(json.get("internalIgnoreFilters")));
    }
    if (!json.get("locale").equals("null")) {
        context.setLocale(em.find(LocaleImpl.class, json.get("locale")));
    }
    if (!json.get("validateProductionChangesState").equals("null")) {
        context.setValidateProductionChangesState(ValidateProductionChangesState.valueOf(json.get("validateProductionChangesState")));
    }
    if (!json.get("timeZone").equals("null")) {
        context.setTimeZone(TimeZone.getTimeZone(json.get("timeZone")));
    }

    return context;
}
 
开发者ID:takbani,项目名称:blcdemo,代码行数:68,代码来源:BroadleafRequestContext.java


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