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


Java PersistenceHelper.isLoaded方法代码示例

本文整理汇总了Java中com.haulmont.cuba.core.global.PersistenceHelper.isLoaded方法的典型用法代码示例。如果您正苦于以下问题:Java PersistenceHelper.isLoaded方法的具体用法?Java PersistenceHelper.isLoaded怎么用?Java PersistenceHelper.isLoaded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.haulmont.cuba.core.global.PersistenceHelper的用法示例。


在下文中一共展示了PersistenceHelper.isLoaded方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCurrentPrice

import com.haulmont.cuba.core.global.PersistenceHelper; //导入方法依赖的package包/类
/**
 * Calculates the currentPrice value for the {@link Product} instance, considering {@link Product#rebates}
 * @return {@link BigDecimal} value representing the product price after rebates
 */
@MetaProperty
public BigDecimal getCurrentPrice() {
    if (msrp == null)
        return null;

    if (rebates != null && PersistenceHelper.isLoaded(this, "rebates")) {
        final Date now = new Date();
        BigDecimal totalRebate = rebates.stream()
                .filter(e ->
                        (e.rebateStart == null || now.after(e.rebateStart))
                        && (e.rebateEnd == null || now.before(e.rebateEnd))
                        && e.rebate != null
                )
                .map(ProductRebate::getRebate)
                .reduce(BigDecimal.ZERO, BigDecimal::add);
        return msrp.subtract(totalRebate);
    }
    return null;
}
 
开发者ID:aleksey-stukalov,项目名称:cuba-vision-clinic,代码行数:24,代码来源:Product.java

示例2: getDefaultTagsList

import com.haulmont.cuba.core.global.PersistenceHelper; //导入方法依赖的package包/类
@MetaProperty(related = {"defaultTags"})
public String getDefaultTagsList() {
    if (!PersistenceHelper.isLoaded(this, "defaultTags")) {
        return null;
    }

    if (defaultTags != null) {
        StringBuilder stringBuilder = new StringBuilder();
        for (Tag defaultTag : defaultTags) {
            stringBuilder.append(defaultTag.getInstanceName()).append(",");
        }
        return StringUtils.chop(stringBuilder.toString());
    }

    return "";
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:17,代码来源:Task.java

示例3: getRequiredTagTypesList

import com.haulmont.cuba.core.global.PersistenceHelper; //导入方法依赖的package包/类
@MetaProperty(related = {"requiredTagTypes"})
public String getRequiredTagTypesList() {
    if (!PersistenceHelper.isLoaded(this, "requiredTagTypes")) {
        return null;
    }

    if (requiredTagTypes != null) {
        StringBuilder stringBuilder = new StringBuilder();
        for (TagType requiredTagType : requiredTagTypes) {
            stringBuilder.append(requiredTagType.getInstanceName()).append(",");
        }
        return StringUtils.chop(stringBuilder.toString());
    }

    return "";
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:17,代码来源:Task.java

示例4: toString

import com.haulmont.cuba.core.global.PersistenceHelper; //导入方法依赖的package包/类
@Override
public String toString() {
    MoreObjects.ToStringHelper builder = MoreObjects.toStringHelper("ScheduledTask")
            .omitNullValues()
            .addValue(id);
    String[] fields = new String[]{"beanName", "methodName", "className", "scriptName", "singleton", "period", "cron", "startDate"};
    for (String field : fields) {
        if (PersistenceHelper.isLoaded(this, field)) {
            Object value = getValue(field);
            if (value instanceof Date) {
                DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
                value = df.format(value);
            }
            builder.add(field, value);
        }
    }
    return builder.toString();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:19,代码来源:ScheduledTask.java

示例5: clearPermissionsOnUser

import com.haulmont.cuba.core.global.PersistenceHelper; //导入方法依赖的package包/类
/**
 * INTERNAL
 */
public void clearPermissionsOnUser(UserSession session) {
    List<User> users = new ArrayList<>();
    users.add(session.getUser());
    if (session.getSubstitutedUser() != null) {
        users.add(session.getSubstitutedUser());
    }
    for (User user : users) {
        if (PersistenceHelper.isDetached(user) && user.getUserRoles() != null) {
            for (UserRole userRole : user.getUserRoles()) {
                Role role = userRole.getRole();
                if (userRole.getRole() != null && PersistenceHelper.isLoaded(role, "permissions")) {
                    userRole.getRole().setPermissions(null);
                }
            }
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:21,代码来源:UserSessionManager.java

示例6: getSubTotal

import com.haulmont.cuba.core.global.PersistenceHelper; //导入方法依赖的package包/类
/**
 * Aggregates {@link InvoiceDetails#getSubTotal()} values for all invoice lines included in the invoice
 * @return {@link BigDecimal} value representing the invoice subtotal
 */
@MetaProperty
public BigDecimal getSubTotal() {
    if (details != null && PersistenceHelper.isLoaded(this, "details")) {
        return details.stream()
                .map(InvoiceDetails::getSubTotal)
                .filter(e -> e != null)
                .reduce(BigDecimal.ZERO, BigDecimal::add);
    }
    return null;
}
 
开发者ID:aleksey-stukalov,项目名称:cuba-vision-clinic,代码行数:15,代码来源:Invoices.java

示例7: getOvertime

import com.haulmont.cuba.core.global.PersistenceHelper; //导入方法依赖的package包/类
@MetaProperty(related = {"user", "date"})
public Overtime getOvertime() {
    if (!PersistenceHelper.isLoaded(this, "user")
            || !PersistenceHelper.isLoaded(this, "date")) {
        return null;
    }

    return new Overtime(getUser(), getDate(), overtimeInHours);
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:10,代码来源:TimeEntry.java

示例8: isLoaded

import com.haulmont.cuba.core.global.PersistenceHelper; //导入方法依赖的package包/类
/**
 * Checks if the property is loaded from DB.
 *
 * @param entity   entity
 * @param property name of the property
 * @return true if loaded
 */
public boolean isLoaded(Object entity, String property) {
    return PersistenceHelper.isLoaded(entity, property);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:11,代码来源:PersistenceTools.java


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