/* * Validates that all required properties are filled in for a given node. */ private void validateNodeProperties(Node node, StringBuilder errBuilder) { if (Thread.currentThread().isInterrupted()) { return; } List<PropertyConstraint> violatedConstraints = controller.getDomainProfileService().validateProperties(node, node.getNodeType()); if (!violatedConstraints.isEmpty()) { markNodeAsInvalid(node); if (node.getFileInfo() != null) { errBuilder.append(node.getFileInfo().getLocation().toString()).append("\n"); } else { errBuilder.append(node.getIdentifier().toString()).append("\n"); } for (PropertyConstraint violation : violatedConstraints) { errBuilder.append("\t--").append(violation.getPropertyType().getLabel()).append("\n"); } errBuilder.append("\n"); } else { markNodeAsValid(node); } if (node.getChildren() != null) { for (Node child : node.getChildren()) { validateNodeProperties(child, errBuilder); if (Thread.currentThread().isInterrupted()) { break; } } } }
// Sorts the tree items in the provided list. //This has been made profile agnostic it now just // sorts based on whether the node is a directory private void sortChildren(ObservableList<TreeItem<Node>> children) { FXCollections.sort( children, (o1, o2) -> { Node nodeOne = o1.getValue(); Node nodeTwo = o2.getValue(); // File info is null if it's a data item created for a metadata file transformation. if (nodeOne.getFileInfo() == null) { if (nodeTwo.getFileInfo() == null) { return 0; } else if (nodeTwo.getFileInfo().isDirectory()) { return 1; } else { return -1; } } else if (nodeTwo.getFileInfo() == null) { if (nodeOne.getFileInfo().isDirectory()) { return -1; } else { return 1; } } if (nodeOne.getFileInfo().isDirectory() == nodeTwo.getFileInfo().isDirectory()) { return 0; } if (nodeOne.getFileInfo().isDirectory() && nodeTwo.getFileInfo().isFile()) { return -1; } return 1; }); }