/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you 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.
*/

package org.apache.stratos.common.partition;

import java.io.Serializable;
import java.util.Arrays;

/**
 * The model class for NetworkPartition information passed in deployment policy.
 */
public class NetworkPartitionRef implements Serializable {

    private static final long serialVersionUID = -8043298009352097370L;

    private String id;
    private String provider;
    private PartitionRef[] partitions;
    private String partitionAlgo;

    public void setPartitions(PartitionRef[] partitions) {
        if (partitions == null) {
            this.partitions = partitions;
        } else {
            this.partitions = Arrays.copyOf(partitions, partitions.length);
        }
    }

    /**
     * Gets the value of the partitions.
     */
    public PartitionRef[] getPartitions() {
        if (partitions == null) {
            partitions = new PartitionRef[0];
        }
        return this.partitions;
    }

    /**
     * Gets the value of the id.
     */
    public String getId() {
        return id;
    }

    /**
     * sets the value of the id.
     */
    public void setId(String id) {
        this.id = id;
    }

    public PartitionRef getPartition(String partitionId) {
        for (PartitionRef partition : partitions) {
            if (partition.getId().equals(partitionId)) {
                return partition;
            }
        }
        return null;
    }

    public String getProvider() {
        return provider;
    }

    public void setProvider(String provider) {
        this.provider = provider;
    }

    public String getPartitionAlgo() {
        return partitionAlgo;
    }

    public void setPartitionAlgo(String partitionAlgo) {
        this.partitionAlgo = partitionAlgo;
    }
}

@@ -1134,37 +1134,8 @@
 id;%0A
-    private String provider;%0A
     
@@ -1162,24 +1162,27 @@
 %5B%5D partition
+Ref
 s;%0A    priva
@@ -1253,32 +1253,35 @@
 nRef%5B%5D partition
+Ref
 s) %7B%0A        if 
@@ -1282,32 +1282,35 @@
    if (partition
+Ref
 s == null) %7B%0A   
@@ -1328,24 +1328,27 @@
 is.partition
+Ref
 s = partitio
@@ -1344,24 +1344,27 @@
  = partition
+Ref
 s;%0A        %7D
@@ -1393,24 +1393,27 @@
 is.partition
+Ref
 s = Arrays.c
@@ -1427,16 +1427,19 @@
 artition
+Ref
 s, parti
@@ -1442,16 +1442,19 @@
 artition
+Ref
 s.length
@@ -1519,16 +1519,19 @@
 artition
+Ref
 s.%0A     
@@ -1571,16 +1571,19 @@
 artition
+Ref
 s() %7B%0A  
@@ -1601,16 +1601,19 @@
 artition
+Ref
 s == nul
@@ -1638,16 +1638,19 @@
 artition
+Ref
 s = new 
@@ -1705,16 +1705,19 @@
 artition
+Ref
 s;%0A    %7D
@@ -2028,16 +2028,19 @@
 artition
+Ref
  : parti
@@ -2043,16 +2043,19 @@
 artition
+Ref
 s) %7B%0A   
@@ -2076,16 +2076,19 @@
 artition
+Ref
 .getId()
@@ -2143,16 +2143,19 @@
 artition
+Ref
 ;%0A      
@@ -2204,162 +2204,8 @@
  %7D%0A%0A
-    public String getProvider() %7B%0A        return provider;%0A    %7D%0A%0A    public void setProvider(String provider) %7B%0A        this.provider = provider;%0A    %7D%0A%0A
     

Remove provider from NW partition reference