当前位置: 首页>>代码示例>>Java>>正文


Java OnmsNode.getCategories方法代码示例

本文整理汇总了Java中org.opennms.netmgt.model.OnmsNode.getCategories方法的典型用法代码示例。如果您正苦于以下问题:Java OnmsNode.getCategories方法的具体用法?Java OnmsNode.getCategories怎么用?Java OnmsNode.getCategories使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opennms.netmgt.model.OnmsNode的用法示例。


在下文中一共展示了OnmsNode.getCategories方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRequisitionedNode

import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/** {@inheritDoc} */
 @Transactional
 public OnmsNode getRequisitionedNode(final String foreignSource, final String foreignId) throws ForeignSourceRepositoryException {
 	final OnmsNodeRequisition nodeReq = m_foreignSourceRepository.getNodeRequisition(foreignSource, foreignId);
     if (nodeReq == null) {
warnf(this, "nodeReq for node %s:%s cannot be null!", foreignSource, foreignId);
         return null;
     }
     final OnmsNode node = nodeReq.constructOnmsNodeFromRequisition();
     
     // fill in real database categories
     final HashSet<OnmsCategory> dbCategories = new HashSet<OnmsCategory>();
     for(final OnmsCategory category : node.getCategories()) {
         dbCategories.add(createCategoryIfNecessary(category.getName()));
     }
     
     node.setCategories(dbCategories);
     
     // fill in real service types
     node.visit(new ServiceTypeFulfiller());
     
     return node;
 }
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:24,代码来源:DefaultProvisionService.java

示例2: getCategories

import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/**
 * <p>getCategories</p>
 *
 * @param nodeCriteria a {@link java.lang.String} object.
 * @return a {@link org.opennms.netmgt.model.OnmsCategoryCollection} object.
 */
@GET
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public OnmsCategoryCollection getCategories(@PathParam("nodeCriteria") String nodeCriteria) {
    readLock();
    
    try {
        OnmsNode node = m_nodeDao.get(nodeCriteria);
        if (node == null) {
            throw getException(Status.BAD_REQUEST, "getCategories: Can't find node " + nodeCriteria);
        }
        return new OnmsCategoryCollection(node.getCategories());
    } finally {
        readUnlock();
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:22,代码来源:OnmsCategoryResource.java

示例3: updateNode

import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Transactional
public void updateNode(final OnmsNode node, boolean rescanExisting) {

	final OnmsNode dbNode = m_nodeDao.getHierarchy(node.getId());

    final Set<OnmsCategory> existingCategories = dbNode.getCategories();
    final Set<OnmsCategory> newCategories = node.getCategories();

    dbNode.mergeNode(node, m_eventForwarder, false);

    m_nodeDao.update(dbNode);
    m_nodeDao.flush();

    final EntityVisitor eventAccumlator = new UpdateEventVisitor(m_eventForwarder, rescanExisting);

    node.visit(eventAccumlator);
    
    boolean categoriesChanged = false;
    if (existingCategories.size() != newCategories.size()) categoriesChanged = true;
    if (!categoriesChanged && !existingCategories.containsAll(newCategories)) categoriesChanged = true;
    if (!categoriesChanged && !newCategories.containsAll(existingCategories)) categoriesChanged = true;

    if (categoriesChanged) {
        final EventBuilder bldr = new EventBuilder(EventConstants.NODE_CATEGORY_MEMBERSHIP_CHANGED_EVENT_UEI, "OnmsNode.mergeNodeAttributes");
        bldr.setNode(dbNode);
        bldr.addParam(EventConstants.PARM_NODE_LABEL, dbNode.getLabel());
        m_eventForwarder.sendNow(bldr.getEvent());
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:31,代码来源:DefaultProvisionService.java

示例4: getTypeFromCategories

import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
private String getTypeFromCategories(OnmsNode node) {
    for (String rancidType: m_rancid_categories) {
        for (OnmsCategory nodecategory: node.getCategories()) {
            if (nodecategory.getName().equalsIgnoreCase(rancidType)) {
                log().debug("getTypeFromCategories: Found Matching Category: Rancid devicetype found: " + rancidType);
                return rancidType;
            }
        }
    }
    log().warn("getTypeFromCategories: No Matching Category found: trying to get devicetype using config file");
    return getTypeFromCategories(node);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:13,代码来源:RancidProvisioningAdapter.java

示例5: NodeEntry

import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
public NodeEntry(final OnmsNode node) {
    final OnmsAssetRecord assetRecord = node.getAssetRecord();
    if (assetRecord != null && assetRecord.getGeolocation() != null) {
        final OnmsGeolocation geolocation = assetRecord.getGeolocation();
        m_longitude = geolocation.getLongitude();
        m_latitude  = geolocation.getLatitude();
    }

    m_nodeId        = node.getId();
    m_nodeLabel     = node.getLabel();
    m_foreignSource = node.getForeignSource();
    m_foreignId     = node.getForeignId();
    
    if (assetRecord != null) {
        m_maintcontract = assetRecord.getMaintcontract();
        m_description   = assetRecord.getDescription();
    }

    if (node.getPrimaryInterface() != null) {
        m_ipAddress = InetAddressUtils.str(node.getPrimaryInterface().getIpAddress());
    }
    
    if (node.getCategories() != null && node.getCategories().size() > 0) {
        for (final OnmsCategory category : node.getCategories()) {
            m_categories.add(category.getName());
        }
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:29,代码来源:MapWidgetComponent.java

示例6: findByNode

import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/** {@inheritDoc} */
public List<OnmsCategory> findByNode(int nodeId) {
    final OnmsNode node = getNodeDao().get(nodeId);
    if (node == null) {
        throw new IllegalArgumentException("node with id of " + nodeId + "could not be found");
    }
    
    List<OnmsCategory> categories = new ArrayList<OnmsCategory>(node.getCategories());
    Collections.sort(categories);
    return categories;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:12,代码来源:DefaultAdminCategoryService.java

示例7: getCategory

import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
private OnmsCategory getCategory(OnmsNode node, String categoryName) {
    for (OnmsCategory category : node.getCategories()) {
        if (category.getName().equals(categoryName)) {
            return category;
        }
    }
    return null;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:9,代码来源:OnmsCategoryResource.java

示例8: declareBeans

import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
private void declareBeans(BSFManager bsfManager) throws BSFException {
    NodeDao nodeDao = Notifd.getInstance().getNodeDao();
    Integer nodeId;
    try {
        nodeId = Integer.valueOf(m_notifParams.get(NotificationManager.PARAM_NODE));
    } catch (NumberFormatException nfe) {
        nodeId = null;
    }

    OnmsNode node = null;
    OnmsAssetRecord assets = null;
    List<String> categories = new ArrayList<String>();
    String nodeLabel = null;
    String foreignSource = null;
    String foreignId = null;

    if (nodeId != null) {
        node = nodeDao.get(nodeId);
        nodeLabel = node.getLabel();
        assets = node.getAssetRecord();
        for (OnmsCategory cat : node.getCategories()) {
            categories.add(cat.getName());
        }
        foreignSource = node.getForeignSource();
        foreignId = node.getForeignId();
    }

    bsfManager.declareBean("bsf_notif_strategy", this, BSFNotificationStrategy.class);
    
    retrieveParams();
    bsfManager.declareBean("notif_params", m_notifParams, Map.class);

    bsfManager.declareBean("node_label", nodeLabel, String.class);
    bsfManager.declareBean("foreign_source", foreignSource, String.class);
    bsfManager.declareBean("foreign_id", foreignId, String.class);
    bsfManager.declareBean("node_assets", assets, OnmsAssetRecord.class);
    bsfManager.declareBean("node_categories", categories, List.class);
    bsfManager.declareBean("node", node, OnmsNode.class);

    for (Argument arg : m_arguments) {
        if (NotificationManager.PARAM_TEXT_MSG.equals(arg.getSwitch())) bsfManager.declareBean("text_message", arg.getValue(), String.class);
        if (NotificationManager.PARAM_NUM_MSG.equals(arg.getSwitch())) bsfManager.declareBean("numeric_message", arg.getValue(), String.class);
        if (NotificationManager.PARAM_NODE.equals(arg.getSwitch())) bsfManager.declareBean("node_id", arg.getValue(), String.class);
        if (NotificationManager.PARAM_INTERFACE.equals(arg.getSwitch())) bsfManager.declareBean("ip_addr", arg.getValue(), String.class);
        if (NotificationManager.PARAM_SERVICE.equals(arg.getSwitch())) bsfManager.declareBean("svc_name", arg.getValue(), String.class);
        if (NotificationManager.PARAM_SUBJECT.equals(arg.getSwitch())) bsfManager.declareBean("subject", arg.getValue(), String.class);
        if (NotificationManager.PARAM_EMAIL.equals(arg.getSwitch())) bsfManager.declareBean("email", arg.getValue(), String.class);
        if (NotificationManager.PARAM_PAGER_EMAIL.equals(arg.getSwitch())) bsfManager.declareBean("pager_email", arg.getValue(), String.class);
        if (NotificationManager.PARAM_XMPP_ADDRESS.equals(arg.getSwitch())) bsfManager.declareBean("xmpp_address", arg.getValue(), String.class);
        if (NotificationManager.PARAM_TEXT_PAGER_PIN.equals(arg.getSwitch())) bsfManager.declareBean("text_pin", arg.getValue(), String.class);
        if (NotificationManager.PARAM_NUM_PAGER_PIN.equals(arg.getSwitch())) bsfManager.declareBean("numeric_pin", arg.getValue(), String.class);
        if (NotificationManager.PARAM_WORK_PHONE.equals(arg.getSwitch())) bsfManager.declareBean("work_phone", arg.getValue(), String.class);
        if (NotificationManager.PARAM_HOME_PHONE.equals(arg.getSwitch())) bsfManager.declareBean("home_phone", arg.getValue(), String.class);
        if (NotificationManager.PARAM_MOBILE_PHONE.equals(arg.getSwitch())) bsfManager.declareBean("mobile_phone", arg.getValue(), String.class);
        if (NotificationManager.PARAM_TUI_PIN.equals(arg.getSwitch())) bsfManager.declareBean("phone_pin", arg.getValue(), String.class);
        if (NotificationManager.PARAM_MICROBLOG_USERNAME.equals(arg.getSwitch())) bsfManager.declareBean("microblog_username", arg.getValue(), String.class);
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:59,代码来源:BSFNotificationStrategy.java


注:本文中的org.opennms.netmgt.model.OnmsNode.getCategories方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。