本文整理了Java中org.ogema.core.model.Resource.getReferencingResources
方法的一些代码示例,展示了Resource.getReferencingResources
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.getReferencingResources
方法的具体详情如下:
包路径:org.ogema.core.model.Resource
类名称:Resource
方法名:getReferencingResources
暂无
代码示例来源:origin: org.ogema.widgets/widget-extended
private void addResource(Resource res, List<String> paths) {
paths.add(res.getPath());
if (showDirectReferences) {
List<Resource> references = res.getReferencingResources(null);
int sz = references.size();
// this may equal to 1 even though no reference exist... the actual parent is always contained, if it is not a toplevel res
if (sz < 1) return;
Class<? extends Resource> currentType = res.getResourceType();
for (Resource refParent: references) {
Resource ref = getReferencingSubresource(refParent, res, currentType);
if (ref == null || ref.equals(res))
continue;
if (ref.isReference(false) && !paths.contains(ref.getPath()))
addResource(ref, paths);
}
}
}
代码示例来源:origin: org.ogema.ref-impl/resource-manager
@Override
public void execute() throws Exception {
if (done || setBack)
throw new IllegalStateException("Transaction has been executed already");
done = true;
buildActionsTree(); // we cannot do this earlier, e.g. in the constructor, since at that time no resource lock is held
executeSubActions();
existed = target.exists();
if (!existed)
return;
wasActive = target.isActive();
if (target.isReference(false))
oldReferenceTarget = target.getLocationResource();
else if (target instanceof ValueResource)
oldValue = ValueResourceUtils.getValue((ValueResource) target);
oldReferences = target.getReferencingResources(Resource.class);
oldMode = target.getAccessMode();
oldPriority = target.getAccessPriority();
target.delete();
}
代码示例来源:origin: org.ogema.drivers/homematic-xmlrpc-hl
/**
* Returns the HmDevice element controlling the given OGEMA resource, or
* null if the resource is not controlled by the HomeMatic driver.
*
* @param ogemaDevice
* @return HomeMatic device resource controlling the given resource or
* null.
*/
@SuppressWarnings("rawtypes")
@Override
public HmDevice findControllingDevice(Resource ogemaDevice) {
//XXX: review this mess
for (ResourceList l : ogemaDevice.getReferencingResources(ResourceList.class)) {
if (l.getParent() != null && l.getParent() instanceof HmDevice) {
return l.getParent();
}
}
for (Resource ref : ogemaDevice.getLocationResource().getReferencingNodes(true)) {
if (ref.getParent() != null && ref.getParent().getParent() instanceof HmDevice) {
return ref.getParent().getParent();
}
for (ResourceList l : ref.getReferencingResources(ResourceList.class)) {
if (l.getParent() != null && l.getParent() instanceof HmDevice) {
return l.getParent();
}
}
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!