org.ogema.core.model.Resource.getReferencingNodes()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(79)

本文整理了Java中org.ogema.core.model.Resource.getReferencingNodes方法的一些代码示例,展示了Resource.getReferencingNodes的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.getReferencingNodes方法的具体详情如下:
包路径:org.ogema.core.model.Resource
类名称:Resource
方法名:getReferencingNodes

Resource.getReferencingNodes介绍

暂无

代码示例

代码示例来源:origin: org.ogema.ref-impl/resource-manager

private void buildActionsTree() {
  // subresources of references must no be deleted
  
  if (!target.isReference(false)) { 
    List<Resource> subresources = target.getSubResources(false);
    // subresources
    for (Resource sub: subresources) {
      subactions.add(new DeletionAction(sub,null));
    }
  }
  List<Resource> refs = target.getReferencingNodes(false); 
  for (Resource ref :refs) {
    subactions.add(new DeletionAction(ref, null));
  }
  
}

代码示例来源:origin: org.ogema.tools/resource-utils

for (Resource ref : target.getReferencingNodes(true)) {
  result.addAll(getContextResources(ref, targetType, inclusive, false, typePattern, namePattern));

代码示例来源: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;
}

相关文章