public RequisitionNode getRequisitionAssets() {
   RequisitionNode template = new RequisitionNode();
   template.putAsset(new RequisitionAsset("username", getUsername()));
   template.putAsset(new RequisitionAsset("password", getPassword()));
   template.putAsset(new RequisitionAsset("enable", getEnable()));
   template.putAsset(new RequisitionAsset("connection", getConnection()));
   template.putAsset(new RequisitionAsset("autoenable", getAutoenable()));
   return template;
 }
  /** {@inheritDoc} */
  @Override
  public Requisition addAssetFieldToNode(
      final String groupName,
      final String pathToNode,
      final String assetName,
      final String assetValue) {
    m_writeLock.lock();
    try {
      final Requisition group = getProvisioningGroup(groupName);
      final RequisitionNode node =
          PropertyUtils.getPathValue(group, pathToNode, RequisitionNode.class);

      // final int assetCount = node.getAssetCount();
      final RequisitionAsset asset = new RequisitionAsset();
      asset.setName(assetName);
      asset.setValue(assetValue);
      node.putAsset(asset);
      // Assert.isTrue(node.getCategoryCount() == (assetCount + 1), "Asset was not added
      // correctly");

      m_pendingForeignSourceRepository.save(group);
      m_pendingForeignSourceRepository.flush();
      return m_pendingForeignSourceRepository.getRequisition(groupName);
    } finally {
      m_writeLock.unlock();
    }
  }
Exemplo n.º 3
0
 void addOrReplaceNodeAssetParameter(final String foreignId, final RequisitionAsset asset) {
   final Requisition req = getActiveRequisition(true);
   if (req != null) {
     final RequisitionNode node = req.getNode(foreignId);
     if (node != null) {
       req.updateDateStamp();
       node.putAsset(asset);
       save(req);
     }
   }
 }