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


Java SandBoxImpl类代码示例

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


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

示例1: createUserSandBox

import org.broadleafcommerce.common.sandbox.domain.SandBoxImpl; //导入依赖的package包/类
@Override
public SandBox createUserSandBox(Long authorId, SandBox approvalSandBox) {
    TransactionStatus status = TransactionUtils.createTransaction("createSandBox",
                    TransactionDefinition.PROPAGATION_REQUIRES_NEW, transactionManager);
    try {
        SandBox userSandBox = new SandBoxImpl();
        userSandBox.setName(approvalSandBox.getName());
        userSandBox.setAuthor(authorId);
        userSandBox.setParentSandBox(approvalSandBox);
        userSandBox.setSandBoxType(SandBoxType.USER);
        userSandBox = persist(userSandBox);

        SandBoxManagement mgmt = new SandBoxManagementImpl();
        mgmt.setSandBox(userSandBox);
        sandBoxEntityManager.persist(mgmt);
        sandBoxEntityManager.flush();

        TransactionUtils.finalizeTransaction(status, transactionManager, false);
        return userSandBox;
    } catch (Exception ex) {
        TransactionUtils.finalizeTransaction(status, transactionManager, true);
        throw new RuntimeException(ex);
    }
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:25,代码来源:SandBoxDaoImpl.java

示例2: createDefaultSandBox

import org.broadleafcommerce.common.sandbox.domain.SandBoxImpl; //导入依赖的package包/类
@Override
public SandBox createDefaultSandBox() {
    TransactionStatus status = TransactionUtils.createTransaction("createSandBox",
                    TransactionDefinition.PROPAGATION_REQUIRES_NEW, transactionManager);
    try {
        SandBox defaultSB = new SandBoxImpl();
        defaultSB.setName("Default");
        defaultSB.setSandBoxType(SandBoxType.DEFAULT);
        defaultSB.setColor("#0B9098");
        defaultSB = persist(defaultSB);

        SandBoxManagement mgmt = new SandBoxManagementImpl();
        mgmt.setSandBox(defaultSB);
        sandBoxEntityManager.persist(mgmt);
        sandBoxEntityManager.flush();

        TransactionUtils.finalizeTransaction(status, transactionManager, false);
        return defaultSB;
    } catch (Exception ex) {
        TransactionUtils.finalizeTransaction(status, transactionManager, true);
        throw new RuntimeException(ex);
    }
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:24,代码来源:SandBoxDaoImpl.java

示例3: retrieve

import org.broadleafcommerce.common.sandbox.domain.SandBoxImpl; //导入依赖的package包/类
@Override
public SandBox retrieve(Long id) {
    //Need to not create a query through SandBoxManagement here. Otherwise, a Hibernate exception can occur
    //(i.e. org.hibernate.HibernateException: Found two representations of same collection: org.broadleafcommerce.core.catalog.domain.ProductImpl.additionalSkus
    //when saving a change to product).
    return sandBoxEntityManager.find(SandBoxImpl.class, id);
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:8,代码来源:SandBoxDaoImpl.java

示例4: createLightWeightCloneFromJson

import org.broadleafcommerce.common.sandbox.domain.SandBoxImpl; //导入依赖的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.sandbox.domain.SandBoxImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。