本文整理汇总了Java中com.haulmont.cuba.core.global.Metadata类的典型用法代码示例。如果您正苦于以下问题:Java Metadata类的具体用法?Java Metadata怎么用?Java Metadata使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Metadata类属于com.haulmont.cuba.core.global包,在下文中一共展示了Metadata类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: fromUrlParam
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
/**
* Used by the framework to transfer file between application tiers.
*/
public static FileDescriptor fromUrlParam(String urlParam) {
String[] parts = urlParam.split(",");
if (parts.length != 3 && parts.length != 4) {
throw new IllegalArgumentException("Invalid FileDescriptor format");
}
Metadata metadata = AppBeans.get(Metadata.NAME);
FileDescriptor fd = metadata.create(FileDescriptor.class);
fd.setId(UuidProvider.fromString(parts[0]));
fd.setExtension(parts[1]);
fd.setCreateDate(new Date(Long.parseLong(parts[2])));
if (parts.length == 4) {
fd.setSize(Long.parseLong(parts[3]));
}
return fd;
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:19,代码来源:FileDescriptor.java
示例2: KeyValueMetaProperty
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
public KeyValueMetaProperty(MetaClass metaClass, String name, Class javaClass) {
this.name = name;
this.javaClass = javaClass;
this.metaClass = metaClass;
this.mandatory = false;
Metadata metadata = AppBeans.get(Metadata.NAME);
Session metadataSession = metadata.getSession();
if (Entity.class.isAssignableFrom(javaClass)) {
range = new ClassRange(metadataSession.getClass(javaClass));
this.type = Type.ASSOCIATION;
} else if (EnumClass.class.isAssignableFrom(javaClass)) {
@SuppressWarnings("unchecked")
EnumerationImpl enumeration = new EnumerationImpl(javaClass);
this.range = new EnumerationRange(enumeration);
this.type = Type.ENUM;
} else {
this.range = new DatatypeRange(Datatypes.getNN(javaClass));
this.type = Type.DATATYPE;
}
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:22,代码来源:KeyValueMetaProperty.java
示例3: DynamicAttributesMetaProperty
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
public DynamicAttributesMetaProperty(MetaClass metaClass, CategoryAttribute attribute) {
this.attribute = attribute;
this.javaClass = DynamicAttributesUtils.getAttributeClass(attribute);
this.metaClass = metaClass;
this.name = DynamicAttributesUtils.encodeAttributeCode(attribute.getCode());
this.mandatory = attribute.getRequired();
Metadata metadata = AppBeans.get(Metadata.NAME);
Session metadataSession = metadata.getSession();
if (Entity.class.isAssignableFrom(javaClass)) {
range = new ClassRange(metadataSession.getClass(javaClass));
this.type = Type.ASSOCIATION;
} else {
this.range = new DatatypeRange(Datatypes.getNN(javaClass));
this.type = Type.DATATYPE;
}
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:18,代码来源:DynamicAttributesMetaProperty.java
示例4: loadComponent
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
@Override
public void loadComponent() {
super.loadComponent();
SearchPickerField searchPickerField = (SearchPickerField) resultComponent;
String metaClass = element.attributeValue("metaClass");
if (!StringUtils.isEmpty(metaClass)) {
Metadata metadata = AppBeans.get(Metadata.NAME);
searchPickerField.setMetaClass(metadata.getSession().getClass(metaClass));
}
loadActions(searchPickerField, element);
if (searchPickerField.getActions().isEmpty()) {
searchPickerField.addLookupAction();
searchPickerField.addOpenAction();
}
String minSearchStringLength = element.attributeValue("minSearchStringLength");
if (StringUtils.isNotEmpty(minSearchStringLength)) {
searchPickerField.setMinSearchStringLength(Integer.parseInt(minSearchStringLength));
}
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:24,代码来源:SearchPickerFieldLoader.java
示例5: EntityCacheConnection
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
public EntityCacheConnection(RemoteCommandManager rcm, ClusterManagerAPI clusterManager) {
super(rcm);
this.metadata = AppBeans.get(Metadata.NAME);
this.queryCacheManager = AppBeans.get(QueryCacheManager.NAME);
this.clusterManager = clusterManager;
rcm.logDebug("creating_broadcast_connection", getInfo());
try {
this.clusterManager.addListener(Message.class, new ClusterListenerAdapter<Message>() {
@Override
public void receive(Message message) {
onMessage(message);
}
});
rcm.logDebug("broadcast_connection_created", getInfo());
} catch (RuntimeException ex) {
rcm.logDebug("failed_to_create_broadcast_connection", getInfo());
close();
throw ex;
}
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:21,代码来源:EntityCacheConnection.java
示例6: setUp
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
try {
if (!initialized) {
System.setProperty("cuba.unitTestMode", "true");
cont = new CommonTestContainer();
cont.setAppComponents(getTestAppComponents());
cont.setAppPropertiesFiles(getTestAppProperties());
cont.setSpringConfig(getTestSpringConfig());
((CommonTestContainer) cont).before();
initialized = true;
}
((CommonTestContainer) cont).setupContext();
persistence = AppBeans.get(Persistence.class);
metadata = AppBeans.get(Metadata.class);
passwordEncryption = AppBeans.get(PasswordEncryption.class);
} catch (Throwable throwable) {
if (throwable instanceof Exception)
throw (Exception) throwable;
else
throw new RuntimeException(throwable);
}
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:27,代码来源:CubaTestCase.java
示例7: isInversePropertyAssignableFromDsClass
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
protected boolean isInversePropertyAssignableFromDsClass(MetaProperty inverseProp) {
Metadata metadata = AppBeans.get(Metadata.NAME);
ExtendedEntities extendedEntities = metadata.getExtendedEntities();
Class inversePropClass = extendedEntities.getEffectiveClass(inverseProp.getDomain());
Class dsClass = extendedEntities.getEffectiveClass(datasource.getMetaClass());
//noinspection unchecked
return inversePropClass.isAssignableFrom(dsClass);
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:11,代码来源:WebTokenList.java
示例8: getCollectionString
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
private String getCollectionString(Object collection) {
if (DynamicAttributesUtils.isDynamicAttribute(propertyName)) {
Metadata metadata = AppBeans.get(Metadata.class);
com.haulmont.chile.core.model.MetaClass metaClass = metadata.getClassNN(metaClassName);
MetaPropertyPath path = DynamicAttributesUtils.getMetaPropertyPath(metaClass, propertyName);
return metadata.getTools().format(collection, path.getMetaProperty());
}
return String.valueOf(beforeValue);
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:10,代码来源:EntityBasicPropertyDiff.java
示例9: addLocalProperties
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
public EntityImportView addLocalProperties() {
Metadata metadata = AppBeans.get(Metadata.class);
MetaClass metaClass = metadata.getClassNN(entityClass);
MetadataTools metadataTools = metadata.getTools();
metaClass.getProperties().stream()
.filter(property -> !property.getRange().isClass() && !metadataTools.isSystem(property))
.forEach(metaProperty -> addLocalProperty(metaProperty.getName()));
return this;
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:10,代码来源:EntityImportView.java
示例10: addSystemProperties
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
public EntityImportView addSystemProperties() {
Metadata metadata = AppBeans.get(Metadata.class);
MetaClass metaClass = metadata.getClassNN(entityClass);
MetadataTools metadataTools = metadata.getTools();
metaClass.getProperties().stream()
.filter(metadataTools::isSystem)
.forEach(metaProperty -> addLocalProperty(metaProperty.getName()));
return this;
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:10,代码来源:EntityImportView.java
示例11: resolveTargetMetaClass
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
protected MetaClass resolveTargetMetaClass(MetaClass metaClass) {
if (metaClass == null) {
return null;
}
Metadata metadata = AppBeans.get(Metadata.NAME);
MetaClass targetMetaClass = metadata.getExtendedEntities().getOriginalMetaClass(metaClass);
if (targetMetaClass == null) {
targetMetaClass = metaClass;
}
return targetMetaClass;
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:13,代码来源:DynamicAttributesCache.java
示例12: isEntityClass
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
private boolean isEntityClass(String className) {
Metadata metadata = AppBeans.get(Metadata.NAME);
try {
Class entityClass = ReflectionHelper.loadClass(className);
MetaClass metaClass = metadata.getClass(entityClass);
return metaClass != null;
} catch (ClassNotFoundException e) {
return false;
}
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:11,代码来源:EntitySerializationExceptionHandler.java
示例13: MetaPropertyInfo
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
public MetaPropertyInfo(MetaProperty metaProperty) {
Messages messages = AppBeans.get(Messages.class);
Metadata metadata = AppBeans.get(Metadata.class);
this.name = metaProperty.getName();
this.attributeType = metaProperty.getType();
switch (attributeType) {
case DATATYPE:
Datatype<Object> datatype = metaProperty.getRange().asDatatype();
try {
this.type = metadata.getDatatypes().getId(datatype);
} catch (Exception e) {
this.type = datatype.toString();
}
break;
case ASSOCIATION:
case COMPOSITION:
this.type = metaProperty.getRange().asClass().getName();
break;
case ENUM:
this.type = metaProperty.getRange().asEnumeration().getJavaClass().getName();
break;
}
this.cardinality = metaProperty.getRange().getCardinality();
this.readOnly = metaProperty.isReadOnly();
this.mandatory = metaProperty.isMandatory();
this.isPersistent = metadata.getTools().isPersistent(metaProperty);
this.isTransient = metadata.getTools().isNotPersistent(metaProperty);
this.description = messages.getTools().getPropertyCaption(metaProperty);
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:30,代码来源:MetaPropertyInfo.java
示例14: InstanceRef
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
public InstanceRef(EntityLoadInfo loadInfo) throws InstantiationException, IllegalAccessException {
if (loadInfo == null)
throw new NullPointerException("No load info passed");
this.loadInfo = loadInfo;
MetaClass childMetaClass = loadInfo.getMetaClass();
if (!Strings.isNullOrEmpty(loadInfo.getViewName()) && !loadInfo.isNewEntity()) {
DataService dataService = AppBeans.get(DataService.class);
LoadContext<BaseGenericIdEntity<Object>> ctx = new LoadContext<>(loadInfo.getMetaClass());
ctx.setId(loadInfo.getId()).setView(loadInfo.getViewName());
instance = dataService.load(ctx);
if (instance == null) {
throw new RuntimeException("Entity with loadInfo " + loadInfo + " not found");
}
} else {
//noinspection unchecked
instance = (BaseGenericIdEntity<Object>) AppBeans.get(Metadata.class).create(childMetaClass);
if (!loadInfo.isNewEntity()) {
for (MetaProperty metaProperty : childMetaClass.getProperties()) {
if (!metaProperty.getRange().isClass()) {
try {
instance.setValue(metaProperty.getName(), null);
} catch (Exception ignored) {
}
}
}
}
}
instance.setId(this.loadInfo.getId());
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:31,代码来源:InstanceRef.java
示例15: OperationPermissionTarget
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
public OperationPermissionTarget(Class entityClass, String id, String caption, String permissionValue) {
super(id, caption);
Metadata metadata = AppBeans.get(Metadata.class);
Messages messages = AppBeans.get(Messages.class);
MetaClass metaclass = metadata.getClassNN(entityClass);
this.entityMetaClass = metaclass;
this.entityMetaClassName = metaclass.getName();
this.localName = messages.getTools().getEntityCaption(metaclass);
this.permissionValue = permissionValue;
this.entityClass = entityClass;
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:13,代码来源:OperationPermissionTarget.java
示例16: MultiplePermissionTarget
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
public MultiplePermissionTarget(Class entityClass, String id, String caption, String permissionValue) {
super(id, caption);
Metadata metadata = AppBeans.get(Metadata.class);
Messages messages = AppBeans.get(Messages.class);
MetaClass metaclass = metadata.getClassNN(entityClass);
this.entityMetaClass = metaclass;
this.entityMetaClassName = metaclass.getName();
this.localName = messages.getTools().getEntityCaption(metaclass);
this.entityClass = entityClass;
this.caption = caption;
this.permissionValue = permissionValue;
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:14,代码来源:MultiplePermissionTarget.java
示例17: EntityNameFilter
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
public EntityNameFilter(Metadata metadata, CheckBox assignedOnlyCheckBox, CheckBox systemLevelCheckBox,
TextField entityFilter) {
this.metadata = metadata;
this.assignedOnlyCheckBox = assignedOnlyCheckBox;
this.systemLevelCheckBox = systemLevelCheckBox;
this.entityFilter = entityFilter;
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:8,代码来源:EntityNameFilter.java
示例18: createPermissionItem
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
/**
* Add or edit permission item in datasource
* @param ds Datasource
* @param roleDs Role datasource
* @param permissionTarget Permission identifier
* @param type Permission type
* @param value Permission value
*/
public static void createPermissionItem(CollectionDatasource<Permission, UUID> ds, Datasource<Role> roleDs,
final String permissionTarget, PermissionType type, Integer value) {
Permission permission = null;
for (Permission p : ds.getItems()) {
if (Objects.equals(p.getTarget(), permissionTarget)) {
permission = p;
break;
}
}
if (permission == null) {
// workaround for idx_sec_permission_unique
// restore entity instead of create
if (ds instanceof RestorablePermissionDatasource) {
RestorablePermissionDatasource datasource = (RestorablePermissionDatasource) ds;
permission = datasource.findRemovedEntity(p ->
p != null && Objects.equals(p.getTarget(), permissionTarget)
);
if (permission != null) {
datasource.restoreEntity(permission);
}
}
}
if (permission == null) {
Metadata metadata = AppBeans.get(Metadata.NAME);
Permission newPermission = metadata.create(Permission.class);
newPermission.setRole(roleDs.getItem());
newPermission.setTarget(permissionTarget);
newPermission.setType(type);
newPermission.setValue(value);
ds.addItem(newPermission);
} else {
permission.setValue(value);
}
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:48,代码来源:PermissionUiHelper.java
示例19: loadMetaClass
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
protected void loadMetaClass(SuggestionPickerField suggestionField, Element element) {
String metaClass = element.attributeValue("metaClass");
if (!StringUtils.isEmpty(metaClass)) {
Metadata metadata = AppBeans.get(Metadata.NAME);
suggestionField.setMetaClass(metadata.getSession().getClass(metaClass));
}
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:8,代码来源:SuggestionPickerFieldLoader.java
示例20: loadComponent
import com.haulmont.cuba.core.global.Metadata; //导入依赖的package包/类
@Override
public void loadComponent() {
super.loadComponent();
loadTabIndex(resultComponent, element);
String captionProperty = element.attributeValue("captionProperty");
if (!StringUtils.isEmpty(captionProperty)) {
resultComponent.setCaptionMode(CaptionMode.PROPERTY);
resultComponent.setCaptionProperty(captionProperty);
}
final String metaClass = element.attributeValue("metaClass");
if (!StringUtils.isEmpty(metaClass)) {
Metadata metadata = AppBeans.get(Metadata.NAME);
resultComponent.setMetaClass(metadata.getClassNN(metaClass));
}
loadActions(resultComponent, element);
if (resultComponent.getActions().isEmpty()) {
boolean actionsByMetaAnnotations = ComponentsHelper.createActionsByMetaAnnotations(resultComponent);
if (!actionsByMetaAnnotations) {
resultComponent.addLookupAction();
resultComponent.addClearAction();
}
}
loadBuffered(resultComponent, element);
}
开发者ID:cuba-platform,项目名称:cuba,代码行数:30,代码来源:PickerFieldLoader.java
注:本文中的com.haulmont.cuba.core.global.Metadata类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论