本文整理汇总了Java中org.oscm.app.domain.CustomAttribute类的典型用法代码示例。如果您正苦于以下问题:Java CustomAttribute类的具体用法?Java CustomAttribute怎么用?Java CustomAttribute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CustomAttribute类属于org.oscm.app.domain包,在下文中一共展示了CustomAttribute类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCustomAttribute
import org.oscm.app.domain.CustomAttribute; //导入依赖的package包/类
/**
* Creates and persists a custom attribute.
*
* @param key
* @param value
* @throws Exception
*/
private void createCustomAttribute(final String key, final String value,
final boolean encrypted, final String organizationId)
throws Exception {
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
String val = value == null ? "testValue" : value;
CustomAttribute ca = new CustomAttribute();
ca.setAttributeKey(key);
ca.setOrganizationId(organizationId);
ca.setEncrypted(encrypted);
ca.setAttributeValue(val);
em.persist(ca);
return null;
}
});
}
示例2: createCustomAttribute
import org.oscm.app.domain.CustomAttribute; //导入依赖的package包/类
/**
* Creates and persists a custom attribute.
*
* @param key
* @param value
* @throws Exception
*/
private void createCustomAttribute(final String key, final String value,
final String organizationId) throws Exception {
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
String val = value == null ? "testValue" : value;
CustomAttribute cs = new CustomAttribute();
cs.setAttributeKey(key);
cs.setOrganizationId(organizationId);
cs.setAttributeValue(val);
em.persist(cs);
return null;
}
});
}
示例3: getCustomAttributes
import org.oscm.app.domain.CustomAttribute; //导入依赖的package包/类
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public HashMap<String, Setting> getCustomAttributes(String organizationId)
throws ConfigurationException {
LOGGER.debug("Retrieving custom settings for organization '{}'",
organizationId);
HashMap<String, Setting> result = new HashMap<>();
if (organizationId != null) {
TypedQuery<CustomAttribute> query = em.createNamedQuery(
"CustomAttribute.getForOrg", CustomAttribute.class);
query.setParameter("oid", organizationId);
List<CustomAttribute> resultList = query.getResultList();
try {
for (CustomAttribute entry : resultList) {
result.put(entry.getAttributeKey(), new Setting(
entry.getAttributeKey(), entry.getDecryptedValue(),
entry.isEncrypted(), entry.getControllerId()));
}
} catch (BadResultException e) {
throw new ConfigurationException(e.getMessage());
}
}
return result;
}