private void readExclude(Exclude exclude, PceConstraints constraints) {
//TODO: Implement other exclude constraints: fiber-bundle, link-identifier
// and supporting-service-name
- List<NodeIdType> nodes = exclude.getNodeId();
- if (nodes != null) {
+ if (exclude.getNodeId() != null) {
List<String> elementsToExclude = new ArrayList<>();
- for (NodeIdType node : nodes) {
+ for (NodeIdType node : exclude.getNodeId()) {
elementsToExclude.add(node.getValue());
}
constraints.setExcludeSupNodes(elementsToExclude);
}
- List<Uint32> srlgs = exclude.getSrlgId();
- if (srlgs != null) {
+ if (exclude.getSrlgId() != null) {
List<Long> elementsToExclude = new ArrayList<>();
- for (Uint32 srlg : srlgs) {
+ for (Uint32 srlg : exclude.getSrlgId()) {
elementsToExclude.add(srlg.longValue());
}
constraints.setExcludeSRLG(elementsToExclude);
}
- List<String> sites = exclude.getSite();
- if (sites != null) {
- constraints.setExcludeCLLI(exclude.getSite());
+ if (exclude.getSite() != null) {
+ constraints.setExcludeCLLI(new ArrayList<>(exclude.getSite()));
}
if (exclude.getFiberBundle() != null || exclude.getLinkIdentifier() != null
|| exclude.getSupportingServiceName() != null) {
}
private void readInclude(Include include, PceConstraints constraints) {
- List<NodeIdType> nodes = include.getNodeId();
- if (nodes != null) {
- for (NodeIdType node : nodes) {
+ if (include.getNodeId() != null) {
+ for (NodeIdType node : include.getNodeId()) {
constraints.setListToInclude(new ResourcePair(PceConstraints.ResourceType.NODE, node.getValue()));
}
}
- List<Uint32> srlgs = include.getSrlgId();
- if (srlgs != null) {
- for (Uint32 srlg : srlgs) {
+ if (include.getSrlgId() != null) {
+ for (Uint32 srlg : include.getSrlgId()) {
constraints.setListToInclude(new ResourcePair(PceConstraints.ResourceType.SRLG, srlg.toString()));
}
}
- List<String> sites = include.getSite();
- if (sites != null) {
- for (String site : sites) {
+ if (include.getSite() != null) {
+ for (String site : include.getSite()) {
constraints.setListToInclude(new ResourcePair(PceConstraints.ResourceType.CLLI, site));
}
}