Changeset 805


Ignore:
Timestamp:
05/16/11 00:22:40 (2 years ago)
Author:
philsmart
Message:
 
Location:
raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/event/event.hbm.xml

    r800 r805  
    1212                <id name="persistantId" column="persistantId" type="long" 
    1313                        unsaved-value="0"> 
    14                         <generator class="native"> 
     14                        <!-- <generator class="native"> 
    1515                                <param name="sequence">hib_entity_seq</param> 
    16                         </generator> 
     16                        </generator> --> 
     17            <generator class="hilo"> 
     18 
     19            </generator> 
    1720                </id> 
    1821 
  • raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/report/AggregatorGraphModel.java

    r696 r805  
    33import java.io.Serializable; 
    44import java.util.ArrayList; 
     5import java.util.Arrays; 
     6import java.util.Collections; 
    57import java.util.List; 
    6  
    7  
    88 
    99/* 
     
    1212 */ 
    1313 
    14 public class AggregatorGraphModel implements Serializable{ 
     14public class AggregatorGraphModel implements Serializable { 
    1515 
    16         /** Class logger */ 
    17         private static final long serialVersionUID = 5372664739350074383L; 
    18      
    19         /** The list of <code>String</code> labels for the groups*/ 
    20         private List<String> groupLabels; 
    21          
    22         /** The list of <code>String</code> labels for each series*/ 
    23         private List<String> seriesLabels; 
    24          
    25         /** The list of <code>Double</code> values assigned to each series */ 
    26         private List<List<Double>> chartValues; 
     16    /** Class logger */ 
     17    private static final long serialVersionUID = 5372664739350074383L; 
    2718 
    28         /** A class that holds presentation information for this graph model*/ 
    29         private Presentation presentation; 
     19    /** The list of <code>String</code> labels for the groups */ 
     20    private List<String> groupLabels; 
    3021 
    31         public AggregatorGraphModel(){ 
    32             seriesLabels= new ArrayList<String>(); 
    33         } 
     22    /** The list of <code>String</code> labels for each series */ 
     23    private List<String> seriesLabels; 
    3424 
     25    /** The list of <code>Double</code> values assigned to each series */ 
     26    private List<List<Double>> chartValues; 
    3527 
    36         public List<String> getGroupLabels() { 
    37                   return groupLabels; 
     28    /** A class that holds presentation information for this graph model */ 
     29    private Presentation presentation; 
    3830 
    39         } 
     31    public AggregatorGraphModel() { 
     32        seriesLabels = new ArrayList<String>(); 
     33    } 
    4034 
    41         public void addGroupLabel(String label){ 
    42                 if (getGroupLabels()==null)setGroupLabels(new ArrayList<String>()); 
    43                 getGroupLabels().add(label); 
    44         } 
     35    public List<String> getGroupLabels() { 
     36        return groupLabels; 
    4537 
    46         public void addSeriesLabel(String label){ 
    47                 if (getSeriesLabels()==null)setSeriesLabels(new ArrayList<String>()); 
    48                 getSeriesLabels().add(label); 
    49         } 
     38    } 
    5039 
     40    public void addGroupLabel(String label) { 
     41        if (getGroupLabels() == null) 
     42            setGroupLabels(new ArrayList<String>()); 
     43        getGroupLabels().add(label); 
     44    } 
    5145 
    52         public List<String> getSeriesLabels() { 
    53             return seriesLabels; 
     46    public void addSeriesLabel(String label) { 
     47        if (getSeriesLabels() == null) 
     48            setSeriesLabels(new ArrayList<String>()); 
     49        getSeriesLabels().add(label); 
     50    } 
    5451 
    55         } 
     52    public void sortGroupLabelsAlphabetically() { 
     53        Collections.sort(groupLabels); 
    5654 
    57         public void addGroupValue(List<Double> values){ 
    58                 if (chartValues==null) setChartValues(new ArrayList<List<Double>>()); 
    59                 chartValues.add(values); 
    60         } 
     55    } 
    6156 
     57    public List<String> getSeriesLabels() { 
     58        return seriesLabels; 
    6259 
    63         public List<List<Double>> getYValues() { 
    64                     return chartValues; 
    65         } 
     60    } 
    6661 
    67         public void setYValues(List<List<Double>> values) { 
     62    public void addGroupValue(List<Double> values) { 
     63        if (chartValues == null) 
     64            setChartValues(new ArrayList<List<Double>>()); 
     65        chartValues.add(values); 
     66    } 
    6867 
    69         } 
     68    public List<List<Double>> getYValues() { 
     69        return chartValues; 
     70    } 
    7071 
     72    public void setYValues(List<List<Double>> values) { 
    7173 
    72         public void setGroupLabels(List<String> groupLabels) { 
    73                 this.groupLabels = groupLabels; 
    74         } 
     74    } 
    7575 
    76         public void setSeriesLabels(List<String> seriesLabels) { 
    77                 this.seriesLabels = seriesLabels; 
    78         } 
     76    public void setGroupLabels(List<String> groupLabels) { 
     77        this.groupLabels = groupLabels; 
     78    } 
    7979 
    80         public void setChartValues(List<List<Double>> chartValues) { 
    81                 this.chartValues = chartValues; 
    82         } 
     80    public void setSeriesLabels(List<String> seriesLabels) { 
     81        this.seriesLabels = seriesLabels; 
     82    } 
    8383 
    84         public List<List<Double>> getChartValues() { 
    85                 return chartValues; 
    86         } 
     84    public void setChartValues(List<List<Double>> chartValues) { 
     85        this.chartValues = chartValues; 
     86    } 
    8787 
    88         public void setPresentation(Presentation presentation) { 
    89             this.presentation = presentation; 
    90         } 
     88    public List<List<Double>> getChartValues() { 
     89        return chartValues; 
     90    } 
    9191 
    92         public Presentation getPresentation() { 
    93             return presentation; 
    94         } 
     92    public void setPresentation(Presentation presentation) { 
     93        this.presentation = presentation; 
     94    } 
    9595 
     96    public Presentation getPresentation() { 
     97        return presentation; 
     98    } 
    9699 
    97100} 
  • raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/resource/ResourceMetadata.java

    r759 r805  
    11package uk.ac.cardiff.model.resource; 
    22 
    3 public class ResourceMetadata { 
     3import java.io.Serializable; 
     4 
     5import org.slf4j.Logger; 
     6import org.slf4j.LoggerFactory; 
     7 
     8 
     9public class ResourceMetadata implements Serializable{ 
     10     
     11    /** Class logger. */ 
     12    private final Logger log = LoggerFactory.getLogger(ResourceMetadata.class); 
     13 
     14    /** Generated Serial UID */ 
     15    private static final long serialVersionUID = -6007311260031942309L; 
    416 
    517    /** Identifier for hibernate. */ 
     
    1426    /** Whether this resourceId represents a resource external to the organisation. */ 
    1527    private boolean external; 
     28     
     29     
     30    public String getInternalExternal(){         
     31        if (internal==true){ 
     32            return "Internal"; 
     33        } 
     34        else if (external==true){ 
     35            return "External"; 
     36        } 
     37        return "Unknown"; 
     38    } 
     39     
     40    public void setInternalExternal(String option){ 
     41        if (option.equals("Internal")){ 
     42            internal = true; 
     43            external = false;             
     44        } 
     45        else if (option.equals("External")){ 
     46            internal = false; 
     47            external = true; 
     48        } 
     49        else{ 
     50            internal = false; 
     51            external = true; 
     52        } 
     53    } 
     54     
     55    public int getResourceCategory() { 
     56        if (internal==true){ 
     57            return 1; 
     58        } 
     59        else if (external==true){ 
     60            return 2; 
     61        } 
     62        return 0; 
     63    } 
     64     
     65    public void setResourceCategory(int resourceCategory){ 
     66         
     67    } 
     68     
     69    public String toString(){ 
     70        StringBuilder sb = new StringBuilder(); 
     71        sb.append(this.getClass().getName()); 
     72        sb.append("["); 
     73        sb.append(persistantId); 
     74        sb.append(":"); 
     75        sb.append(resourceId); 
     76        sb.append(":"); 
     77        sb.append(internal); 
     78        sb.append(":"); 
     79        sb.append(external); 
     80        sb.append("]"); 
     81        return sb.toString(); 
     82         
     83    } 
    1684 
    1785    /** 
     
    70138        return persistantId; 
    71139    } 
     140 
     141 
    72142     
    73143     
  • raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/wsmodel/Capabilities.java

    r747 r805  
    88 
    99import uk.ac.cardiff.model.ServiceMetadata; 
     10import uk.ac.cardiff.model.resource.ResourceMetadata; 
    1011 
    1112 
     
    2526    private ServiceMetadata metadata; 
    2627    private SuggestionValues suggestionValues; 
     28    private List<ResourceMetadata> resourceMetadata; 
    2729 
    2830    private int numberOfEntries; 
     
    104106    } 
    105107 
     108    /** 
     109     * @param resourceMetadata the resourceMetadata to set 
     110     */ 
     111    public void setResourceMetadata(List<ResourceMetadata> resourceMetadata) { 
     112        this.resourceMetadata = resourceMetadata; 
     113    } 
     114 
     115    /** 
     116     * @return the resourceMetadata 
     117     */ 
     118    public List<ResourceMetadata> getResourceMetadata() { 
     119        return resourceMetadata; 
     120    } 
     121 
    106122 
    107123 
  • raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/wsmodel/StatisticParameters.java

    r743 r805  
    5252    private DateTime endTime; 
    5353 
    54     /** Its important that these dates (used for display in trinidad) are kept in sync with the 
     54    /** Its important that these dates (used for display in the view) are kept in sync with the 
    5555     * Joda DateTime classes above*/ 
    5656    private Date startTimeJava; 
    5757    private Date endTimeJava; 
     58     
     59    public enum ResourceCategory{ 
     60        /** For resources that are internal to the organisation*/ 
     61        INTERNAL(new int[]{1}),  
     62        /** For resources that are external to the organisation*/ 
     63        EXTERNAL(new int[]{2}), 
     64        /** For all resource categories */ 
     65        ALL(new int[]{1,2}); 
     66         
     67        private int[] resourceIdCategory; 
     68         
     69        ResourceCategory(int[] resourceIdCategory){ 
     70            this.resourceIdCategory = resourceIdCategory; 
     71        } 
     72 
     73        /** 
     74         * @return the resourceIdCategory 
     75         */ 
     76        public int[] getResourceIdCategory() { 
     77            return resourceIdCategory; 
     78        } 
     79 
     80        /**  
     81         * Returns a <code>String</code> value that represents 
     82         * an IN SQL operator which specifies the resourceIdCategory(s) 
     83         * for this <code>ResourceCategory</code> for use in SQL WHERE clauses 
     84         *  
     85         * @return an SQL IN clause 
     86         */ 
     87        public String getSql() { 
     88            StringBuilder sb = new StringBuilder(); 
     89            sb.append("in ("); 
     90            for (int i=0; i < resourceIdCategory.length; i++){ 
     91                sb.append(resourceIdCategory[i]); 
     92                if (i < resourceIdCategory.length-1){ 
     93                    sb.append(","); 
     94                } 
     95            } 
     96            sb.append(")"); 
     97            return sb.toString(); 
     98        } 
     99    } 
     100     
     101    private ResourceCategory resourceCategory; 
    58102 
    59103    /** either system or user types */ 
     
    109153     private List<Series> series; 
    110154 
     155     /** Default constructor. */ 
    111156     public StatisticParameters(){ 
    112157         presentation = new Presentation(); 
     
    115160         presentation.setyAxisLabel(""); 
    116161         setSeries(new ArrayList<Series>()); 
     162         resourceCategory = ResourceCategory.ALL; 
    117163     } 
    118164 
     
    397443    } 
    398444 
    399  
     445    /** 
     446     * @param resourceCategory the resourceCategory to set 
     447     */ 
     448    public void setResourceCategory(ResourceCategory resourceCategory) { 
     449        this.resourceCategory = resourceCategory; 
     450    } 
     451 
     452    /** 
     453     * @return the resourceCategory 
     454     */ 
     455    public ResourceCategory getResourceCategory() { 
     456        return resourceCategory; 
     457    } 
     458     
     459    public void setResourceCategoryString(String resourceCategory){ 
     460        for (ResourceCategory type : ResourceCategory.values()){ 
     461            if (type.toString().equals(resourceCategory)){ 
     462                this.resourceCategory = type; 
     463            } 
     464        } 
     465    } 
     466 
     467    public String getResourceCategoryString(){ 
     468        return resourceCategory.toString(); 
     469    } 
    400470 
    401471 
Note: See TracChangeset for help on using the changeset viewer.