本文整理汇总了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;
}
示例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 "";
}
示例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 "";
}
示例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();
}
示例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);
}
}
}
}
}
示例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;
}
示例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);
}
示例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);
}