View Javadoc
1   package org.exoplatform.services.wcm.extensions.utils;
2   
3   import java.util.Comparator;
4   
5   import org.exoplatform.services.wcm.extensions.publication.context.impl.ContextConfig.Context;
6   /**
7    * Created by The eXo Platform MEA Author :
8    * haikel.thamri@exoplatform.com
9    */
10  public class ContextComparator implements Comparator{
11  
12      public int compare(Object arg0, Object arg1) {
13    Context context1=(Context)arg1;
14    Context context0=(Context)arg0;
15    int priority0=Integer.parseInt(context0.getPriority());
16    int priority1=Integer.parseInt(context1.getPriority());
17  
18    if(priority0<priority1) {
19        return -1;
20    }
21    else if (priority0>priority1) {
22        return 1;
23    }
24    return 0;
25      }
26  
27  }