summaryrefslogtreecommitdiffstats
path: root/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewandinspect/entity/ActiveInventoryNode.java
blob: eec9de3cd8e5fc6841efeef1552cbf986faed491 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
/**
 * ============LICENSE_START=======================================================
 * org.onap.aai
 * ================================================================================
 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
 * Copyright © 2017-2018 Amdocs
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */
package org.onap.aai.sparky.viewandinspect.entity;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.atomic.AtomicBoolean;

import org.onap.aai.cl.api.Logger;
import org.onap.aai.cl.eelf.LoggerFactory;
import org.onap.aai.restclient.client.OperationResult;
import org.onap.aai.sparky.config.oxm.OxmEntityLookup;
import org.onap.aai.sparky.config.oxm.OxmModelLoader;
import org.onap.aai.sparky.logging.AaiUiMsgs;
import org.onap.aai.sparky.viewandinspect.config.VisualizationConfigs;
import org.onap.aai.sparky.viewandinspect.enumeration.NodeProcessingAction;
import org.onap.aai.sparky.viewandinspect.enumeration.NodeProcessingState;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * The Class ActiveInventoryNode.
 */
public class ActiveInventoryNode {

  private static final Logger LOG = LoggerFactory.getInstance().getLogger(
      ActiveInventoryNode.class);

  public static final int DEFAULT_INIT_NODE_DEPTH = 1000;

  private String nodeId;
  private String selfLink;

  private boolean isRootNode;
  private ConcurrentLinkedDeque<String> inboundNeighbors;
  private ConcurrentLinkedDeque<String> outboundNeighbors;
  
  private ConcurrentLinkedDeque<String> inboundNeighborSelfLinks;
  private ConcurrentLinkedDeque<String> outboundNeighborSelfLinks;
  
  private List<JsonNode> complexGroups;
  private List<RelationshipList> relationshipLists;
  private int nodeDepth;
  private OperationResult opResult;

  private boolean processingErrorOccurred;
  private List<String> errorCauses;
  private boolean selflinkRetrievalFailure;
  private NodeProcessingState state;

  private boolean processedNeighbors;

  private boolean selfLinkPendingResolve;
  
  /*
   * I think we shouldn't be using this crutch flags.  If these things are meant
   * to represent the current state of the node, then they should be legitimate 
   * state transitions.
   */
  
  private boolean selfLinkDeterminationPending;

  private AtomicBoolean selfLinkProcessed;
  private AtomicBoolean nodeIntegrityProcessed;

  private OxmModelLoader oxmModelLoader;
  private VisualizationConfigs visualizationConfigs;

  private String entityType;
  private String primaryKeyName;
  private String primaryKeyValue;

  private boolean nodeValidated;
  private boolean nodeIssue;
  private boolean ignoredByFilter;

  private boolean resolvedSelfLink;

  private Map<String, String> properties;
  private ArrayList<String> queryParams;

  private ObjectMapper mapper;
  
  private OxmEntityLookup oxmEntityLookup;
 
  /**
   * Instantiates a new active inventory node.
   *
   * @param key the key
   */
  public ActiveInventoryNode(VisualizationConfigs visualizationConfigs, OxmEntityLookup oxmEntityLookup) {
    this.oxmEntityLookup = oxmEntityLookup;
    this.nodeId = null;
    this.entityType = null;
    this.selfLink = null;
    this.properties = new HashMap<String, String>();
    this.processingErrorOccurred = false;
    this.errorCauses = new ArrayList<String>();
    this.selflinkRetrievalFailure = false;
    this.nodeIssue = false;
    this.nodeValidated = false;
    this.state = NodeProcessingState.INIT;
    this.selfLinkPendingResolve = false;
    this.selfLinkDeterminationPending = false;

    selfLinkProcessed = new AtomicBoolean(Boolean.FALSE);
    nodeIntegrityProcessed = new AtomicBoolean(Boolean.FALSE);
    oxmModelLoader = null;
    this.visualizationConfigs = visualizationConfigs ;

    isRootNode = false;
    inboundNeighbors = new ConcurrentLinkedDeque<String>();
    outboundNeighbors = new ConcurrentLinkedDeque<String>();
    
    inboundNeighborSelfLinks = new ConcurrentLinkedDeque<String>();
    outboundNeighborSelfLinks = new ConcurrentLinkedDeque<String>();
    
    complexGroups = new ArrayList<JsonNode>();
    relationshipLists = new ArrayList<RelationshipList>();
    nodeDepth = DEFAULT_INIT_NODE_DEPTH;
    queryParams = new ArrayList<String>();

    mapper = new ObjectMapper();

    processedNeighbors = false;
    resolvedSelfLink = false;


  }
  
  public void clearQueryParams() {
    queryParams.clear();
  }
  
  public void addQueryParam(String queryParam) {
    if ( queryParam!= null) {
      if( !queryParams.contains(queryParam)) {
        queryParams.add(queryParam);
      }
    }
  }
  
	public void addInboundSelfLink(String link) {

		if (link == null) {
			return;
		}

		if (!inboundNeighborSelfLinks.contains(link)) {
			inboundNeighborSelfLinks.add(link);
		}

	}

	public void addOutboundSelfLink(String link) {

		if (link == null) {
			return;
		}

		if (!outboundNeighborSelfLinks.contains(link)) {
			outboundNeighborSelfLinks.add(link);
		}

	}

	public Collection<String> getInboundNeighborSelfLinks() {
		return inboundNeighborSelfLinks;
	}

	public Collection<String> getOutboundNeighborSelfLinks() {
		return outboundNeighborSelfLinks;
	}
  
  public void addQueryParams(Collection<String> params) {

    if (params != null && params.size() > 0) {

      for (String param : params) {
        addQueryParam(param);
      }
    }
  }

  
  public List<String> getQueryParams() {
    return queryParams;
  }

  public void setSelfLinkDeterminationPending(boolean selfLinkDeterminationPending) {
    this.selfLinkDeterminationPending = selfLinkDeterminationPending;
  }

  public boolean isSelfLinkDeterminationPending() {
    return selfLinkDeterminationPending;
  }

  public NodeProcessingState getState() {
    return state;
  }

  public List<JsonNode> getComplexGroups() {
    return complexGroups;
  }

  public List<RelationshipList> getRelationshipLists() {
    return relationshipLists;
  }

  public OperationResult getOpResult() {
    return opResult;
  }

  public void setOpResult(OperationResult opResult) {
    this.opResult = opResult;
  }

  public String getPrimaryKeyName() {
    return primaryKeyName;
  }

  /**
   * Gets the visualization config.
   *
   * @return the visualization config
   */
  public VisualizationConfigs getvisualizationConfigs() {
    return visualizationConfigs;
  }

  public int getNodeDepth() {
    return nodeDepth;
  }

  public void setNodeDepth(int nodeDepth) {
    this.nodeDepth = nodeDepth;
  }

  /**
   * Sets the visualization config.
   *
   * @param visualizationConfig the new visualization config
   */
  public void setvisualizationConfig(VisualizationConfigs visualizationConfigs) {
    this.visualizationConfigs = visualizationConfigs;
  }

  public OxmModelLoader getOxmModelLoader() {
    return oxmModelLoader;
  }

  public void setPrimaryKeyName(String primaryKeyName) {
    this.primaryKeyName = primaryKeyName;
  }

  public String getPrimaryKeyValue() {
    return primaryKeyValue;
  }

  public void setPrimaryKeyValue(String primaryKeyValue) {
    this.primaryKeyValue = primaryKeyValue;
  }

  public boolean isNodeValidated() {
    return nodeValidated;
  }

  public void setNodeValidated(boolean nodeValidated) {
    this.nodeValidated = nodeValidated;
  }

  public boolean isNodeIssue() {
    return nodeIssue;
  }

  public boolean isIgnoredByFilter() {
    return ignoredByFilter;
  }

  public void setIgnoredByFilter(boolean ignoredByFilter) {
    this.ignoredByFilter = ignoredByFilter;
  }

  public void setNodeIssue(boolean nodeIssue) {
    this.nodeIssue = nodeIssue;
  }

  /**
   * Checks for processed neighbors.
   *
   * @return true, if successful
   */
  public boolean hasProcessedNeighbors() {
    return processedNeighbors;
  }

  public void setProcessedNeighbors(boolean processedNeighbors) {
    this.processedNeighbors = processedNeighbors;
  }

  /**
   * Checks for resolved self link.
   *
   * @return true, if successful
   */
  public boolean hasResolvedSelfLink() {
    return resolvedSelfLink;
  }

  public void setResolvedSelfLink(boolean resolvedSelfLink) {
    this.resolvedSelfLink = resolvedSelfLink;
  }

  /**
   * Checks for neighbors.
   *
   * @return true, if successful
   */
  public boolean hasNeighbors() {
    return (inboundNeighbors.size() > 0 || outboundNeighbors.size() > 0);
  }

  /**
   * Adds the inbound neighbor.
   *
   * @param nodeId the node id
   */
  public void addInboundNeighbor(String nodeId) {

    if (nodeId == null) {
      return;
    }

    if (!inboundNeighbors.contains(nodeId)) {
      inboundNeighbors.add(nodeId);
    }

  }

  /**
   * Adds the outbound neighbor.
   *
   * @param nodeId the node id
   */
  public void addOutboundNeighbor(String nodeId) {

    if (nodeId == null) {
      return;
    }

    if (!outboundNeighbors.contains(nodeId)) {
      outboundNeighbors.add(nodeId);
    }

  }

  public boolean isAtMaxDepth() {
    return (nodeDepth >= this.visualizationConfigs.getMaxSelfLinkTraversalDepth());
  }

  public ConcurrentLinkedDeque<String> getInboundNeighbors() {
    return inboundNeighbors;
  }

  public void setInboundNeighbors(ConcurrentLinkedDeque<String> inboundNeighbors) {
    this.inboundNeighbors = inboundNeighbors;
  }

  public Collection<String> getOutboundNeighbors() {
    List<String> result = new ArrayList<String>();

    Iterator<String> neighborIterator = outboundNeighbors.iterator();

    while (neighborIterator.hasNext()) {
      result.add(neighborIterator.next());
    }

    return result;
  }

  /**
   * Change depth.
   *
   * @param newDepth the new depth
   * @return true, if successful
   */
  public boolean changeDepth(int newDepth) {

    boolean nodeDepthWasChanged = false;

    if (newDepth < nodeDepth) {
      LOG.info(AaiUiMsgs.ACTIVE_INV_NODE_CHANGE_DEPTH, nodeId,
          String.valueOf(this.nodeDepth), String.valueOf(newDepth));
      this.nodeDepth = newDepth;
      nodeDepthWasChanged = true;
    }

    return nodeDepthWasChanged;

  }

  public void setOutboundNeighbors(ConcurrentLinkedDeque<String> outboundNeighbors) {
    this.outboundNeighbors = outboundNeighbors;
  }

  public boolean isRootNode() {
    return isRootNode;
  }

  public void setRootNode(boolean isRootNode) {
    this.isRootNode = isRootNode;
  }

  /**
   * Change state.
   *
   * @param newState the new state
   * @param action the action
   */
  public void changeState(NodeProcessingState newState, NodeProcessingAction action) {
    /*
     * NodeId may be null depending on the current node life-cycle state 
     */
    
    if (getNodeId() != null) {
      LOG.info(AaiUiMsgs.ACTIVE_INV_NODE_CHANGE_STATE, state.toString(), newState.toString(), action.toString());
    } else {
      LOG.info(AaiUiMsgs.ACTIVE_INV_NODE_CHANGE_STATE_NO_NODE_ID, state.toString(), newState.toString(), action.toString());
    }
    this.state = newState;
  }

  public boolean isSelfLinkPendingResolve() {
    return selfLinkPendingResolve;
  }

  public void setSelfLinkPendingResolve(boolean selfLinkPendingResolve) {
    this.selfLinkPendingResolve = selfLinkPendingResolve;
  }

  public boolean isSelflinkRetrievalFailure() {
    return selflinkRetrievalFailure;
  }

  public void setSelflinkRetrievalFailure(boolean selflinkRetrievalFailure) {
    this.selflinkRetrievalFailure = selflinkRetrievalFailure;
  }

  public void setOxmModelLoader(OxmModelLoader loader) {
    this.oxmModelLoader = loader;
  }

  public boolean getSelfLinkProcessed() {
    return selfLinkProcessed.get();
  }

  public void setSelfLinkProcessed(boolean selfLinkProcessed) {
    this.selfLinkProcessed.set(selfLinkProcessed);
  }

  public boolean getNodeIntegrityProcessed() {
    return nodeIntegrityProcessed.get();
  }

  public void setNodeIntegrityProcessed(boolean nodeIntegrityProcessed) {
    this.nodeIntegrityProcessed.set(nodeIntegrityProcessed);
  }

  public boolean isDirectSelfLink() {
    return isDirectSelfLink(this.selfLink);
  }

  /**
   * Checks if is direct self link.
   *
   * @param link the link
   * @return true, if is direct self link
   */
  public static boolean isDirectSelfLink(String link) {
    
    if (link == null) {
      return false;
    }

    return link.contains("/resources/id/");

  }

  public Map<String, String> getProperties() {
    return properties;
  }

  /**
   * Adds the error cause.
   *
   * @param error the error
   */
  public void addErrorCause(String error) {
    if (!errorCauses.contains(error)) {
      errorCauses.add(error);
    }
  }

  /**
   * Adds the property.
   *
   * @param key the key
   * @param value the value
   */
  public void addProperty(String key, String value) {
    properties.put(key, value);
  }

  public boolean isProcessingErrorOccurred() {
    return processingErrorOccurred;
  }

  public void setProcessingErrorOccurred(boolean processingErrorOccurred) {
    this.processingErrorOccurred = processingErrorOccurred;
  }

  public String getNodeId() {
    return nodeId;
  }

  public void setNodeId(String nodeId) {
    this.nodeId = nodeId;
  }

  public String getEntityType() {
    return entityType;
  }

  public void setEntityType(String entityType) {
    this.entityType = entityType;
  }

  public String getSelfLink() {
    return selfLink;
  }

  /**
   * Analyze self link relationship list.
   *
   * @param jsonResult the json result
   * @return the relationship list
   */
  private RelationshipList analyzeSelfLinkRelationshipList(String jsonResult) {


    RelationshipList relationshipList = null;

    try {
      relationshipList = mapper.readValue(jsonResult, RelationshipList.class);
    } catch (Exception exc) {
      LOG.error(AaiUiMsgs.SELF_LINK_RELATIONSHIP_LIST_ERROR, exc.toString());
    }

    return relationshipList;
  }

  /**
   * Adds the relationship list.
   *
   * @param relationshipList the relationship list
   */
  public void addRelationshipList(RelationshipList relationshipList) {

    if (!relationshipLists.contains(relationshipList)) {
      relationshipLists.add(relationshipList);
    }

  }

  /**
   * Process pathed self link response.
   *
   * @param selfLinkJsonResponse the self link json response
   * @param startNodeType the start node type
   * @param startNodeResourceKey the start node resource key
   */
  public void processPathedSelfLinkResponse(String selfLinkJsonResponse, String startNodeType,
      String startNodeResourceKey) {

    if (selfLinkJsonResponse == null || selfLinkJsonResponse.length() == 0) {
      LOG.error(AaiUiMsgs.SELF_LINK_NULL_EMPTY_RESPONSE);
      return;
    }

    try {
      JsonNode jsonNode = mapper.readValue(selfLinkJsonResponse, JsonNode.class);

      Iterator<Entry<String, JsonNode>> fieldNames = jsonNode.fields();
      Entry<String, JsonNode> field = null;

      while (fieldNames.hasNext()) {

        field = fieldNames.next();

        /*
         * Is there a way to tell if the field is an aggregate or an atomic value? This is where our
         * flattening code needs to live
         */

        String fieldName = field.getKey();

        if ("relationship-list".equals(fieldName)) {

          /*
           * Parse the relationship list like we were doing before, so we can determine whether or
           * not to keep it or traverse it after we have performed the evaluative node depth logic.
           */
          RelationshipList relationshipList =
              analyzeSelfLinkRelationshipList(field.getValue().toString());

          if (relationshipList != null) {
            this.relationshipLists.add(relationshipList);
          } else {
            LOG.info(AaiUiMsgs.NO_RELATIONSHIP_DISCOVERED, nodeId);
          }
        } else {
          JsonNode nodeValue = field.getValue();

          if (nodeValue != null) {
            if (nodeValue.isValueNode()) {

              /*
               * before we blindly add the fieldName and value to our property set, let's do one more
               * check to see if the field name is an entity type. If it is, then our complex
               * attribute processing code will pick it up and process it instead, but this is
               * probably more likely just for array node types, but we'll see.
               */

              handleNodeValue(fieldName, nodeValue.asText());

            } else if (nodeValue.isArray()) {

              /*
               * make sure array entity-type collection is not an entityType before adding it to the
               * property set. The expetation is that it will be added the visualization through a
               * complex group or relationship.
               */

              handleNodeValue(field.getKey(), nodeValue.toString());
            } else {
              complexGroups.add(nodeValue);
            }

          }
        }
      }

    } catch (IOException exc) {
      LOG.error(AaiUiMsgs.JSON_CONVERSION_ERROR, "POJO", exc.getLocalizedMessage());
      this.setProcessingErrorOccurred(true);
      this.addErrorCause(
          "An error occurred while converting JSON into POJO = " + exc.getLocalizedMessage());
    }

  }

  private void handleNodeValue(String fieldName, String fieldValue) {
    if (oxmEntityLookup.getEntityDescriptors().get(fieldName) == null) {
      /*
       * this is no an entity type as far as we can tell, so we can add it to our property
       * set.
       */

      addProperty(fieldName, fieldValue);

    }
  }

  public void setSelfLink(String selfLink) {
    this.selfLink = selfLink;
  }

  /**
   * Adds the complex group.
   *
   * @param complexGroup the complex group
   */
  public void addComplexGroup(JsonNode complexGroup) {

    if (!complexGroups.contains(complexGroup)) {
      complexGroups.add(complexGroup);
    }

  }

  /**
   * Gets the padding.
   *
   * @param level the level
   * @param paddingString the padding string
   * @return the padding
   */
  private static String getPadding(int level, String paddingString) {
    StringBuilder sb = new StringBuilder(32);
    for (int x = 0; x < level; x++) {
      sb.append(paddingString);
    }
    return sb.toString();
  }

  /**
   * Dump node tree.
   *
   * @param showProperties the show properties
   * @return the string
   */
  public String dumpNodeTree(boolean showProperties) {
    return dumpNodeTree(0, showProperties);
  }
  
  /**
   * Dump node tree.
   *
   * @param level the level
   * @param showProperties the show properties
   * @return the string
   */
  private String dumpNodeTree(int level, boolean showProperties) {
    StringBuilder sb = new StringBuilder(128);
    String padding = getPadding(level, "   ");

    sb.append(padding + " -> " + getNodeId() + "]").append("\n");
    sb.append(padding + " -> primaryKeyName = " + primaryKeyName + "]").append("\n");
    sb.append(padding + " -> primaryKeyValue = " + primaryKeyValue + "]").append("\n");
    sb.append(padding + " -> entityType = " + entityType + "]").append("\n");

    if (showProperties) {
      Set<Entry<String, String>> entries = properties.entrySet();
      for (Entry<String, String> entry : entries) {
        sb.append(
            padding + " ----> " + String.format("[ %s => %s ]", entry.getKey(), entry.getValue()))
            .append("\n");
      }
    }

    sb.append(padding + " ----> " + String.format("[ selfLink => %s ]", getSelfLink()))
        .append("\n");

    sb.append("\n").append(padding + " ----> Inbound Neighbors:").append("\n");

    for (String inboundNeighbor : inboundNeighbors) {
      sb.append("\n").append(inboundNeighbor.toString());
    }

    sb.append(padding + " ----> Outbound Neighbors:").append("\n");
    sb.append("\n").append(padding + " ----> Outbound Neighbors:").append("\n");

    for (String outboundNeighbor : outboundNeighbors) {
      sb.append("\n").append(outboundNeighbor.toString());
    }

    return sb.toString();

  }

  public String getProcessingErrorCauses() {

    StringBuilder sb = new StringBuilder(128);

    for (String c : this.errorCauses) {
      sb.append(c).append("\n");
    }

    return sb.toString();
  }
}