Changeset 1178


Ignore:
Timestamp:
10/26/11 23:08:01 (19 months ago)
Author:
philsmart
Message:
 
Location:
raptor-information-model/trunk/src/main/java/uk/ac/cardiff
Files:
1 deleted
10 edited

Legend:

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

    r1172 r1178  
    4040    private Long persistantId; 
    4141 
    42     /** attributes generic to all entries. */ 
     42    /** The date and time the event was generated. */ 
    4343    private DateTime eventTime; 
    4444 
     
    8787     */ 
    8888    public Event(Event event) { 
    89         // this has a defensive getter, so a direct assignment is possible 
     89        // this has a defensive getter, so direct assignment is possible 
    9090        this.eventTime = event.getEventTime(); 
    9191        this.eventId = event.getEventId(); 
  • raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/report/AggregatorGraphModel.java

    r1172 r1178  
    1212public class AggregatorGraphModel implements Serializable { 
    1313 
    14     /** Class logger */ 
     14    /** Class logger. */ 
    1515    private static final long serialVersionUID = 5372664739350074383L; 
    1616 
    17     /** The list of <code>String</code> labels for the groups */ 
     17    /** The list of <code>String</code> labels for the groups. */ 
    1818    private List<String> groupLabels; 
    1919 
    20     /** The list of <code>String</code> labels for each series */ 
     20    /** The list of <code>String</code> labels for each series. */ 
    2121    private List<String> seriesLabels; 
    2222 
    23     /** The list of <code>Double</code> values assigned to each series */ 
     23    /** The list of <code>Double</code> values assigned to each series. */ 
    2424    private List<List<Double>> chartValues; 
    2525 
    26     /** A class that holds presentation information for this graph model */ 
     26    /** A class that holds presentation information for this graph model. */ 
    2727    private Presentation presentation; 
    2828 
     29    /** 
     30     * Instantiates a new aggregator graph model. 
     31     */ 
    2932    public AggregatorGraphModel() { 
    3033        seriesLabels = new ArrayList<String>(); 
    3134    } 
    3235 
     36    /** 
     37     * Gets the group labels. 
     38     *  
     39     * @return the group labels 
     40     */ 
    3341    public List<String> getGroupLabels() { 
    3442        return groupLabels; 
     
    3644    } 
    3745 
     46    /** 
     47     * Adds the group label. 
     48     *  
     49     * @param label 
     50     *            the label 
     51     */ 
    3852    public void addGroupLabel(String label) { 
    3953        if (getGroupLabels() == null) 
     
    4256    } 
    4357 
     58    /** 
     59     * Adds the series label. 
     60     *  
     61     * @param label 
     62     *            the label 
     63     */ 
    4464    public void addSeriesLabel(String label) { 
    4565        if (getSeriesLabels() == null) 
     
    4868    } 
    4969 
     70    /** 
     71     * Sort group labels alphabetically. 
     72     */ 
    5073    public void sortGroupLabelsAlphabetically() { 
    5174        Collections.sort(groupLabels); 
     
    5376    } 
    5477 
     78    /** 
     79     * Gets the series labels. 
     80     *  
     81     * @return the series labels 
     82     */ 
    5583    public List<String> getSeriesLabels() { 
    5684        return seriesLabels; 
     
    5886    } 
    5987 
     88    /** 
     89     * Adds the group value. 
     90     *  
     91     * @param values 
     92     *            the values 
     93     */ 
    6094    public void addGroupValue(List<Double> values) { 
    6195        if (chartValues == null) 
     
    6498    } 
    6599 
     100    /** 
     101     * Gets the y values. 
     102     *  
     103     * @return the y values 
     104     */ 
    66105    public List<List<Double>> getYValues() { 
    67106        return chartValues; 
    68107    } 
    69108 
     109    /** 
     110     * Sets the y values. 
     111     *  
     112     * @param values 
     113     *            the new y values 
     114     */ 
    70115    public void setYValues(List<List<Double>> values) { 
    71116 
    72117    } 
    73118 
     119    /** 
     120     * Sets the group labels. 
     121     *  
     122     * @param groupLabels 
     123     *            the new group labels 
     124     */ 
    74125    public void setGroupLabels(List<String> groupLabels) { 
    75126        this.groupLabels = groupLabels; 
    76127    } 
    77128 
     129    /** 
     130     * Sets the series labels. 
     131     *  
     132     * @param seriesLabels 
     133     *            the new series labels 
     134     */ 
    78135    public void setSeriesLabels(List<String> seriesLabels) { 
    79136        this.seriesLabels = seriesLabels; 
    80137    } 
    81138 
     139    /** 
     140     * Sets the chart values. 
     141     *  
     142     * @param chartValues 
     143     *            the new chart values 
     144     */ 
    82145    public void setChartValues(List<List<Double>> chartValues) { 
    83146        this.chartValues = chartValues; 
    84147    } 
    85148 
     149    /** 
     150     * Gets the chart values. 
     151     *  
     152     * @return the chart values 
     153     */ 
    86154    public List<List<Double>> getChartValues() { 
    87155        return chartValues; 
    88156    } 
    89157 
     158    /** 
     159     * Sets the presentation. 
     160     *  
     161     * @param presentation 
     162     *            the new presentation 
     163     */ 
    90164    public void setPresentation(Presentation presentation) { 
    91165        this.presentation = presentation; 
    92166    } 
    93167 
     168    /** 
     169     * Gets the presentation. 
     170     *  
     171     * @return the presentation 
     172     */ 
    94173    public Presentation getPresentation() { 
    95174        return presentation; 
  • raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/wsmodel/EventPushMessage.java

    r1172 r1178  
    2424    private ServiceMetadata clientMetadata; 
    2525 
    26     /** The time instant the message was created push. */ 
     26    /** The time instant the message was created. */ 
    2727    private Date timeOfPush; 
    2828 
  • raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/wsmodel/LogFileUpload.java

    r1172 r1178  
    1111    private static final long serialVersionUID = -6283086431616419079L; 
    1212 
    13     /** The Name. */ 
     13    /** The filename of the file that has been uploaded. */ 
    1414    private String Name; 
    1515 
    16     /** The mime. */ 
     16    /** The mime type. */ 
    1717    private String mime; 
    1818 
    19     /** The length. */ 
     19    /** The length of the file. */ 
    2020    private long length; 
    2121 
     
    6565    private String processingStatus; 
    6666 
    67     /** The processed. */ 
     67    /** Whether this file has be proccessed (parsed and stored). */ 
    6868    private boolean processed; 
    6969 
  • raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/wsmodel/LogFileUploadResult.java

    r1172 r1178  
    1414    private long id; 
    1515 
    16     /** The status. */ 
     16    /** The status message from the agent that processed this message. */ 
    1717    private String status; 
    1818 
  • raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/wsmodel/StatisticParameters.java

    r815 r1178  
    99import java.util.List; 
    1010 
    11 import org.slf4j.Logger; 
    12 import org.slf4j.LoggerFactory; 
    1311import org.joda.time.DateTime; 
    1412import org.joda.time.format.DateTimeFormat; 
    1513import org.joda.time.format.DateTimeFormatter; 
     14import org.slf4j.Logger; 
     15import org.slf4j.LoggerFactory; 
    1616 
    1717import uk.ac.cardiff.model.report.Presentation; 
     
    2020/** 
    2121 * @author philsmart 
    22  * 
     22 *  
    2323 */ 
    24 public class StatisticParameters implements Serializable{ 
    25  
    26     /** generated serial ID  */ 
     24public class StatisticParameters implements Serializable { 
     25 
     26    /** generated serial ID */ 
    2727    private static final long serialVersionUID = 9135524508369102248L; 
    2828 
     
    3030    private final Logger log = LoggerFactory.getLogger(StatisticParameters.class); 
    3131 
    32     private static final String OUTPUT_DATE_FORMAT ="dd/MM/yyyy HH:mm:ss";; 
    33  
     32    /** 
     33     * a constant date format used to convert start and end times into a formant suitable for human consumption. 
     34     */ 
     35    private static final String OUTPUT_DATE_FORMAT = "dd/MM/yyyy HH:mm:ss";; 
     36 
     37    /** 
     38     * The name of the statistic unit this {@link uk.ac.cardiff.model.wsmodel.StatisticParameters} is recording information about. 
     39     */ 
    3440    private String unitName; 
    3541 
    36     /** List of parameters passed into the <code>performStatistic</code> method*/ 
     42    /** List of parameters passed into the <code>performStatistic</code> method */ 
    3743    private List<MethodParameter> methodParameters; 
    3844 
     
    4652    private DateTime endTime; 
    4753 
    48     /** Its important that these dates (used for display in the view) are kept in sync with the 
    49      * Joda DateTime classes above*/ 
     54    /** 
     55     *  
     56     * The start date as a Java Date object. Its important that these dates (used for display in the view) are kept in sync with the Joda DateTime classes 
     57     * above. Used for remoting 
     58     */ 
    5059    private Date startTimeJava; 
     60 
     61    /** 
     62     * The end date as a Java Date objects. Its important that these dates (used for display in the view) are kept in sync with the Joda DateTime classes above. 
     63     * Used for remoting 
     64     */ 
    5165    private Date endTimeJava; 
    5266 
    53     public enum ResourceCategory{ 
    54         /** For resources that are internal to the organisation*/ 
    55         INTERNAL(new int[]{1}), 
    56         /** For resources that are external to the organisation*/ 
    57         EXTERNAL(new int[]{2}), 
     67    public enum ResourceCategory { 
     68        /** For resources that are internal to the organisation */ 
     69        INTERNAL(new int[] { 1 }), 
     70        /** For resources that are external to the organisation */ 
     71        EXTERNAL(new int[] { 2 }), 
    5872        /** For all resource categories */ 
    59         ALL(new int[]{1,2}); 
     73        ALL(new int[] { 1, 2 }); 
    6074 
    6175        private int[] resourceIdCategory; 
    6276 
    63         ResourceCategory(int[] resourceIdCategory){ 
     77        ResourceCategory(int[] resourceIdCategory) { 
    6478            this.resourceIdCategory = resourceIdCategory; 
    6579        } 
     
    7387 
    7488        /** 
    75          * Returns a <code>String</code> value that represents 
    76          * an IN SQL operator which specifies the resourceIdCategory(s) 
    77          * for this <code>ResourceCategory</code> for use in SQL WHERE clauses 
    78          * 
     89         * Returns a <code>String</code> value that represents an IN SQL operator which specifies the resourceIdCategory(s) for this 
     90         * <code>ResourceCategory</code> for use in SQL WHERE clauses 
     91         *  
    7992         * @return an SQL IN clause 
    8093         */ 
     
    8295            StringBuilder sb = new StringBuilder(); 
    8396            sb.append("in ("); 
    84             for (int i=0; i < resourceIdCategory.length; i++){ 
     97            for (int i = 0; i < resourceIdCategory.length; i++) { 
    8598                sb.append(resourceIdCategory[i]); 
    86                 if (i < resourceIdCategory.length-1){ 
     99                if (i < resourceIdCategory.length - 1) { 
    87100                    sb.append(","); 
    88101                } 
     
    97110    /** either system or user types */ 
    98111    public enum StatisticType { 
    99         /** 
    100          * A statistic for use by the USER. Possibly removed in the future, in favour of individual 
    101          * user based statistics 
    102          */ 
    103          USER, 
    104          /** 
    105           * A statistic for use by the system level processes, e.g. to generate dashboard 
    106           * statistics 
    107           */ 
    108          SYSTEM}; 
     112        /** 
     113         * A statistic for use by the USER. Possibly removed in the future, in favour of individual user based statistics 
     114         */ 
     115        USER, 
     116        /** 
     117         * A statistic for use by the system level processes, e.g. to generate dashboard statistics 
     118         */ 
     119        SYSTEM 
     120    }; 
    109121 
    110122    /** The type of statistic */ 
    111123    private StatisticType type; 
    112124 
    113     //TODO should be constructed in XML 
    114     /** The type of event from the information model this statistic should be performed over*/ 
    115     public enum EventType{ 
    116         /** A Shibboleth Authentication Event Type*/ 
    117         SHIBBOLETH_AUTHENTICATION("ShibbolethIdpAuthenticationEvent", new String[]{"uk.ac.cardiff.model.event.ShibbolethIdpAuthenticationEvent","uk.ac.cardiff.model.event.AuthenticationEvent","uk.ac.cardiff.model.event.Event"}), 
     125    // TODO should be constructed in XML 
     126    /** The type of event from the information model this statistic should be performed over */ 
     127    public enum EventType { 
     128        /** A Shibboleth Authentication Event Type */ 
     129        SHIBBOLETH_AUTHENTICATION("ShibbolethIdpAuthenticationEvent", new String[] { "uk.ac.cardiff.model.event.ShibbolethIdpAuthenticationEvent", "uk.ac.cardiff.model.event.AuthenticationEvent", 
     130                "uk.ac.cardiff.model.event.Event" }), 
    118131        /** An Ezproxy Authentication Event Type */ 
    119         EZPROXY_AUTHENTICATION("EzproxyAuthenticationEvent", new String[]{"uk.ac.cardiff.model.event.EzproxyAuthenticationEvent","uk.ac.cardiff.model.event.AuthenticationEvent","uk.ac.cardiff.model.event.Event"}); 
     132        EZPROXY_AUTHENTICATION("EzproxyAuthenticationEvent", new String[] { "uk.ac.cardiff.model.event.EzproxyAuthenticationEvent", "uk.ac.cardiff.model.event.AuthenticationEvent", 
     133                "uk.ac.cardiff.model.event.Event" }); 
    120134 
    121135        private String hibernateSimpleClassName; 
     
    123137        private String[] classHierarchy; 
    124138 
    125         private EventType(String hibernateSimpleClassName, String[] classHierarchy){ 
     139        private EventType(String hibernateSimpleClassName, String[] classHierarchy) { 
    126140            this.hibernateSimpleClassName = hibernateSimpleClassName; 
    127141            this.classHierarchy = classHierarchy; 
    128142        } 
    129143 
    130         public String getHibernateSimpleClassName(){ 
     144        public String getHibernateSimpleClassName() { 
    131145            return hibernateSimpleClassName; 
    132146        } 
    133147 
    134         public String[] getClassHierarchy(){ 
     148        public String[] getClassHierarchy() { 
    135149            return classHierarchy; 
    136150        } 
     
    140154    private EventType eventType; 
    141155 
    142  
    143     /* Configures the parameters used to view a graphical representation*/ 
     156    /** Configures the parameters used to view a graphical representation */ 
    144157    private Presentation presentation; 
    145158 
    146     /* A series to plot on the graph*/ 
    147      private List<Series> series; 
    148  
    149      /** Default constructor. */ 
    150      public StatisticParameters(){ 
    151         presentation = new Presentation(); 
    152         presentation.setGraphTitle(""); 
    153         presentation.setxAxisLabel(""); 
    154         presentation.setyAxisLabel(""); 
    155         setSeries(new ArrayList<Series>()); 
    156         resourceCategory = ResourceCategory.ALL; 
    157      } 
     159    /** A series to plot on the graph */ 
     160    private List<Series> series; 
     161 
     162    /** Default constructor. */ 
     163    public StatisticParameters() { 
     164        presentation = new Presentation(); 
     165        presentation.setGraphTitle(""); 
     166        presentation.setxAxisLabel(""); 
     167        presentation.setyAxisLabel(""); 
     168        setSeries(new ArrayList<Series>()); 
     169        resourceCategory = ResourceCategory.ALL; 
     170    } 
    158171 
    159172    public void setUnitName(String unitName) { 
    160         this.unitName = unitName; 
     173        this.unitName = unitName; 
    161174    } 
    162175 
    163176    public String getUnitName() { 
    164         return unitName; 
    165     } 
    166  
     177        return unitName; 
     178    } 
    167179 
    168180    public void setMethodParams(List<MethodParameter> methodParams) { 
    169         this.methodParameters = methodParams; 
     181        this.methodParameters = methodParams; 
    170182    } 
    171183 
    172184    public List<MethodParameter> getMethodParams() { 
    173         return methodParameters; 
    174     } 
    175  
    176     /** 
    177      * This method should be used as the primary method for setting the startTime on 
    178      * this class 
     185        return methodParameters; 
     186    } 
     187 
     188    /** 
     189     * This method should be used as the primary method for setting the startTime on this class 
     190     *  
    179191     * @param startTime 
    180192     */ 
    181193    public void setStartTime(DateTime startTime) { 
    182         this.startTime = startTime; 
    183         this.startTimeJava = new Date (this.startTime.getMillis()); 
     194        this.startTime = startTime; 
     195        this.startTimeJava = new Date(this.startTime.getMillis()); 
    184196    } 
    185197 
    186198    public DateTime getStartTimeAsDate() { 
    187         return startTime; 
    188     } 
    189  
    190     /** 
    191      * This method should be used as the primary method for setting the endTime on 
    192      * this class 
     199        return startTime; 
     200    } 
     201 
     202    /** 
     203     * This method should be used as the primary method for setting the endTime on this class 
     204     *  
    193205     * @param endTime 
    194206     */ 
    195207    public void setEndTime(DateTime endTime) { 
    196         this.endTime = endTime; 
     208        this.endTime = endTime; 
    197209    } 
    198210 
    199211    public DateTime getEndTimeAsDate() { 
    200         return endTime; 
     212        return endTime; 
    201213    } 
    202214 
    203215    public void setStartTime(String startTime) { 
    204         this.startTime = formatDate(startTime, false); 
    205         this.startTimeJava = new Date (this.startTime.getMillis()); 
     216        this.startTime = formatDate(startTime, false); 
     217        this.startTimeJava = new Date(this.startTime.getMillis()); 
    206218 
    207219    } 
    208220 
    209221    public String getStartTime() { 
    210         if (startTime!=null)return startTime.toString(OUTPUT_DATE_FORMAT); 
    211         return null; 
     222        if (startTime != null) 
     223            return startTime.toString(OUTPUT_DATE_FORMAT); 
     224        return null; 
    212225    } 
    213226 
    214227    public void setEndTime(String endTime) { 
    215         this.endTime = formatDate(endTime, true); 
    216         this.endTimeJava = new Date (this.endTime.getMillis()); 
     228        this.endTime = formatDate(endTime, true); 
     229        this.endTimeJava = new Date(this.endTime.getMillis()); 
    217230    } 
    218231 
    219232    public String getEndTime() { 
    220         if (endTime!=null)return endTime.toString(OUTPUT_DATE_FORMAT); 
    221         return null; 
    222     } 
    223  
     233        if (endTime != null) 
     234            return endTime.toString(OUTPUT_DATE_FORMAT); 
     235        return null; 
     236    } 
    224237 
    225238    /** 
    226239     * for output on the web page (just a date that can be rendered by trinidad) 
     240     *  
    227241     * @return 
    228242     */ 
    229     public Date getEndTimeAsJavaDate(){ 
    230         return endTimeJava; 
     243    public Date getEndTimeAsJavaDate() { 
     244        return endTimeJava; 
    231245 
    232246    } 
     
    234248    /** 
    235249     * for output on the web page 
     250     *  
    236251     * @param date 
    237252     */ 
    238     public Date getStartTimeAsJavaDate(){ 
    239         return startTimeJava; 
    240     } 
    241  
    242  
    243     public void setEndTimeAsJavaDate(Date date){ 
    244         this.endTimeJava = date; 
    245         this.endTime = new DateTime(date); 
    246     } 
    247  
    248     public void setStartTimeAsJavaDate(Date date){ 
    249         this.startTimeJava = date; 
    250         this.startTime = new DateTime(date); 
    251     } 
    252  
    253     /* human consumable outputs */ 
     253    public Date getStartTimeAsJavaDate() { 
     254        return startTimeJava; 
     255    } 
     256 
     257    public void setEndTimeAsJavaDate(Date date) { 
     258        this.endTimeJava = date; 
     259        this.endTime = new DateTime(date); 
     260    } 
     261 
     262    public void setStartTimeAsJavaDate(Date date) { 
     263        this.startTimeJava = date; 
     264        this.startTime = new DateTime(date); 
     265    } 
    254266 
    255267    public String getStartTimeAsFormattedString() { 
    256         DateTimeFormatter dtf = DateTimeFormat.forPattern(OUTPUT_DATE_FORMAT); 
    257         if (getStartTime() != null) 
    258             return getStartTimeAsDate().toString(dtf); 
    259         else 
    260             return "First Entry"; 
     268        DateTimeFormatter dtf = DateTimeFormat.forPattern(OUTPUT_DATE_FORMAT); 
     269        if (getStartTime() != null) 
     270            return getStartTimeAsDate().toString(dtf); 
     271        else 
     272            return "First Entry"; 
    261273    } 
    262274 
    263275    public String getEndTimeAsFormattedString() { 
    264         DateTimeFormatter dtf = DateTimeFormat.forPattern(OUTPUT_DATE_FORMAT); 
    265         if (getEndTime() != null) 
    266             return getEndTimeAsDate().toString(dtf); 
    267         else 
    268             return "Last Entry"; 
    269     } 
    270  
     276        DateTimeFormatter dtf = DateTimeFormat.forPattern(OUTPUT_DATE_FORMAT); 
     277        if (getEndTime() != null) 
     278            return getEndTimeAsDate().toString(dtf); 
     279        else 
     280            return "Last Entry"; 
     281    } 
    271282 
    272283    /** 
    273284     * <p> 
    274285     * </p> 
    275      * 
     286     *  
    276287     * @param date 
    277      * @param isEndTime- if is endTime and only ddMMyyyy is given, then the endTime should be 23.59 as opposed to 00.00 as this is the end of the day 
     288     * @param isEndTime 
     289     *            - if is endTime and only ddMMyyyy is given, then the endTime should be 23.59 as opposed to 00.00 as this is the end of the day 
    278290     * @return 
    279291     */ 
    280292    private DateTime formatDate(String date, boolean isEndTime) { 
    281         /* this is not a nice hack, please tidy */ 
    282         //log.debug("Date format being parsed {} with {} characters",date,date.length()); 
    283         if (date.length() == 8) { 
    284             // assume ddMMyyy 
    285             String format = "ddMMyyyy"; 
    286             DateTimeFormatter dtf = DateTimeFormat.forPattern(format); 
    287             DateTime dt = dtf.parseDateTime(date.substring(0, date.length())); 
    288             if (isEndTime) { 
    289                 dt = new DateTime(dt.getMillis() + 86340000); // where 86340000 is 23.59 hours 
    290             } 
    291          //   log.debug("time set to " + dt.getDayOfMonth() + "th " + dt.getMonthOfYear() + " " + dt.getYear() + " " + dt.getHourOfDay() + ":" + dt.getMinuteOfHour() + ":" + dt.getSecondOfMinute() + " for " + getUnitName()); 
    292             return dt; 
    293         } else if (date.length() == 15) { 
    294             // assume yyyyMMdd'T'HHmmss 
    295             String format = "yyyyMMdd'T'HHmmss"; 
    296             DateTimeFormatter dtf = DateTimeFormat.forPattern(format); 
    297             DateTime dt = dtf.parseDateTime(date.substring(0, date.length())); 
    298         //    log.debug("time set to " + dt.getDayOfMonth() + "th " + dt.getMonthOfYear() + " " + dt.getYear() + " " + dt.getHourOfDay() + ":" + dt.getMinuteOfHour() + ":" + dt.getSecondOfMinute() + " for " + getUnitName()); 
    299             return dt; 
    300         } else if (date.length()==19){ 
    301             // assume outputDateFormat 
    302             String format = OUTPUT_DATE_FORMAT; 
    303             DateTimeFormatter dtf = DateTimeFormat.forPattern(format); 
    304             DateTime dt = dtf.parseDateTime(date.substring(0, date.length())); 
    305          //   log.debug("time set to " + dt.getDayOfMonth() + "th " + dt.getMonthOfYear() + " " + dt.getYear() + " " + dt.getHourOfDay() + ":" + dt.getMinuteOfHour() + ":" + dt.getSecondOfMinute() + " for " + getUnitName()); 
    306             return dt; 
    307         } 
    308         //which is instantiated with the current date and time 
    309         return new DateTime(); 
    310     } 
    311  
    312     /** methods to get and set the minutes seconds and hours of end and start time (for the web interface)*/ 
    313  
    314     public void setEndTimeHour(int hour){ 
    315         DateTime newTime = new DateTime(endTime.getYear(),endTime.getMonthOfYear(),endTime.getDayOfMonth(), 
    316                 hour, endTime.getMinuteOfHour(), endTime.getSecondOfMinute(), endTime.getMillisOfSecond()); 
    317         endTime = newTime; 
    318         endTimeJava = new Date(endTime.getMillis()); 
    319     } 
    320     public void setEndTimeMinute(int minutes){ 
    321         DateTime newTime = new DateTime(endTime.getYear(),endTime.getMonthOfYear(),endTime.getDayOfMonth(), 
    322                 endTime.getHourOfDay(), minutes, endTime.getSecondOfMinute(), endTime.getMillisOfSecond()); 
    323         endTime = newTime; 
    324         endTimeJava = new Date(endTime.getMillis()); 
    325     } 
    326     public void setEndTimeSecond(int seconds){ 
    327         DateTime newTime = new DateTime(endTime.getYear(),endTime.getMonthOfYear(),endTime.getDayOfMonth(), 
    328                 endTime.getHourOfDay(), endTime.getMinuteOfHour(), seconds, endTime.getMillisOfSecond()); 
    329         endTime = newTime; 
    330         endTimeJava = new Date(endTime.getMillis()); 
    331     } 
    332     public int getEndTimeHour(){ 
    333         if (endTime!=null) 
    334             return endTime.getHourOfDay(); 
    335         return 0; 
    336     } 
    337     public int getEndTimeMinute(){ 
    338         if (endTime!=null) 
    339             return endTime.getMinuteOfHour(); 
    340         return 0; 
    341     } 
    342     public int getEndTimeSecond(){ 
    343         if (endTime!=null) 
    344             return endTime.getSecondOfMinute(); 
    345         return 0; 
    346     } 
    347  
    348     public void setStartTimeHour(int hour){ 
    349         DateTime newTime = new DateTime(startTime.getYear(),startTime.getMonthOfYear(),startTime.getDayOfMonth(), 
    350                 hour, startTime.getMinuteOfHour(), startTime.getSecondOfMinute(), startTime.getMillisOfSecond()); 
    351         startTime = newTime; 
    352         startTimeJava = new Date(startTime.getMillis()); 
    353     } 
    354     public void setStartTimeMinute(int minutes){ 
    355         DateTime newTime = new DateTime(startTime.getYear(),startTime.getMonthOfYear(),startTime.getDayOfMonth(), 
    356                 startTime.getHourOfDay(), minutes, startTime.getSecondOfMinute(), startTime.getMillisOfSecond()); 
    357         startTime = newTime; 
    358         startTimeJava = new Date(startTime.getMillis()); 
    359     } 
    360     public void setStartTimeSecond(int seconds){ 
    361         DateTime newTime = new DateTime(startTime.getYear(),startTime.getMonthOfYear(),startTime.getDayOfMonth(), 
    362                 startTime.getHourOfDay(), startTime.getMinuteOfHour(), seconds, startTime.getMillisOfSecond()); 
    363         startTime = newTime; 
    364         startTimeJava = new Date(startTime.getMillis()); 
    365     } 
    366     public int getStartTimeHour(){ 
    367         if (startTime!=null) 
    368             return startTime.getHourOfDay(); 
    369         return 0; 
    370     } 
    371     public int getStartTimeMinute(){ 
    372         if (startTime!=null) 
    373             return startTime.getMinuteOfHour(); 
    374         return 0; 
    375     } 
    376     public int getStartTimeSecond(){ 
    377         if (startTime!=null) 
    378             return startTime.getSecondOfMinute(); 
    379         return 0; 
     293        // TODO this is not a nice hack, please tidy 
     294        // log.debug("Date format being parsed {} with {} characters",date,date.length()); 
     295        if (date.length() == 8) { 
     296            // assume ddMMyyy 
     297            String format = "ddMMyyyy"; 
     298            DateTimeFormatter dtf = DateTimeFormat.forPattern(format); 
     299            DateTime dt = dtf.parseDateTime(date.substring(0, date.length())); 
     300            if (isEndTime) { 
     301                dt = new DateTime(dt.getMillis() + 86340000); // where 86340000 is 23.59 hours 
     302            } 
     303            // log.debug("time set to " + dt.getDayOfMonth() + "th " + dt.getMonthOfYear() + " " + dt.getYear() + " " + dt.getHourOfDay() + ":" + 
     304            // dt.getMinuteOfHour() + ":" + dt.getSecondOfMinute() + " for " + getUnitName()); 
     305            return dt; 
     306        } else if (date.length() == 15) { 
     307            // assume yyyyMMdd'T'HHmmss 
     308            String format = "yyyyMMdd'T'HHmmss"; 
     309            DateTimeFormatter dtf = DateTimeFormat.forPattern(format); 
     310            DateTime dt = dtf.parseDateTime(date.substring(0, date.length())); 
     311            // log.debug("time set to " + dt.getDayOfMonth() + "th " + dt.getMonthOfYear() + " " + dt.getYear() + " " + dt.getHourOfDay() + ":" + 
     312            // dt.getMinuteOfHour() + ":" + dt.getSecondOfMinute() + " for " + getUnitName()); 
     313            return dt; 
     314        } else if (date.length() == 19) { 
     315            // assume outputDateFormat 
     316            String format = OUTPUT_DATE_FORMAT; 
     317            DateTimeFormatter dtf = DateTimeFormat.forPattern(format); 
     318            DateTime dt = dtf.parseDateTime(date.substring(0, date.length())); 
     319            // log.debug("time set to " + dt.getDayOfMonth() + "th " + dt.getMonthOfYear() + " " + dt.getYear() + " " + dt.getHourOfDay() + ":" + 
     320            // dt.getMinuteOfHour() + ":" + dt.getSecondOfMinute() + " for " + getUnitName()); 
     321            return dt; 
     322        } 
     323        // which is instantiated with the current date and time 
     324        return new DateTime(); 
     325    } 
     326 
     327    /** methods to get and set the minutes seconds and hours of end and start time (for the web interface) */ 
     328 
     329    public void setEndTimeHour(int hour) { 
     330        DateTime newTime = new DateTime(endTime.getYear(), endTime.getMonthOfYear(), endTime.getDayOfMonth(), hour, endTime.getMinuteOfHour(), endTime.getSecondOfMinute(), endTime.getMillisOfSecond()); 
     331        endTime = newTime; 
     332        endTimeJava = new Date(endTime.getMillis()); 
     333    } 
     334 
     335    public void setEndTimeMinute(int minutes) { 
     336        DateTime newTime = new DateTime(endTime.getYear(), endTime.getMonthOfYear(), endTime.getDayOfMonth(), endTime.getHourOfDay(), minutes, endTime.getSecondOfMinute(), endTime.getMillisOfSecond()); 
     337        endTime = newTime; 
     338        endTimeJava = new Date(endTime.getMillis()); 
     339    } 
     340 
     341    public void setEndTimeSecond(int seconds) { 
     342        DateTime newTime = new DateTime(endTime.getYear(), endTime.getMonthOfYear(), endTime.getDayOfMonth(), endTime.getHourOfDay(), endTime.getMinuteOfHour(), seconds, endTime.getMillisOfSecond()); 
     343        endTime = newTime; 
     344        endTimeJava = new Date(endTime.getMillis()); 
     345    } 
     346 
     347    public int getEndTimeHour() { 
     348        if (endTime != null) 
     349            return endTime.getHourOfDay(); 
     350        return 0; 
     351    } 
     352 
     353    public int getEndTimeMinute() { 
     354        if (endTime != null) 
     355            return endTime.getMinuteOfHour(); 
     356        return 0; 
     357    } 
     358 
     359    public int getEndTimeSecond() { 
     360        if (endTime != null) 
     361            return endTime.getSecondOfMinute(); 
     362        return 0; 
     363    } 
     364 
     365    public void setStartTimeHour(int hour) { 
     366        DateTime newTime = new DateTime(startTime.getYear(), startTime.getMonthOfYear(), startTime.getDayOfMonth(), hour, startTime.getMinuteOfHour(), startTime.getSecondOfMinute(), 
     367                startTime.getMillisOfSecond()); 
     368        startTime = newTime; 
     369        startTimeJava = new Date(startTime.getMillis()); 
     370    } 
     371 
     372    public void setStartTimeMinute(int minutes) { 
     373        DateTime newTime = new DateTime(startTime.getYear(), startTime.getMonthOfYear(), startTime.getDayOfMonth(), startTime.getHourOfDay(), minutes, startTime.getSecondOfMinute(), 
     374                startTime.getMillisOfSecond()); 
     375        startTime = newTime; 
     376        startTimeJava = new Date(startTime.getMillis()); 
     377    } 
     378 
     379    public void setStartTimeSecond(int seconds) { 
     380        DateTime newTime = new DateTime(startTime.getYear(), startTime.getMonthOfYear(), startTime.getDayOfMonth(), startTime.getHourOfDay(), startTime.getMinuteOfHour(), seconds, 
     381                startTime.getMillisOfSecond()); 
     382        startTime = newTime; 
     383        startTimeJava = new Date(startTime.getMillis()); 
     384    } 
     385 
     386    public int getStartTimeHour() { 
     387        if (startTime != null) 
     388            return startTime.getHourOfDay(); 
     389        return 0; 
     390    } 
     391 
     392    public int getStartTimeMinute() { 
     393        if (startTime != null) 
     394            return startTime.getMinuteOfHour(); 
     395        return 0; 
     396    } 
     397 
     398    public int getStartTimeSecond() { 
     399        if (startTime != null) 
     400            return startTime.getSecondOfMinute(); 
     401        return 0; 
    380402    } 
    381403 
    382404    public void setStatisticType(String type) { 
    383         type = type.toUpperCase(); 
    384         for (StatisticType thisType : StatisticType.values()){ 
    385             if (thisType.toString().equals(type)){ 
    386                 this.type=thisType; 
    387                 return; 
    388             } 
    389         } 
    390         //set default 
    391         this.type = StatisticType.USER; 
     405        type = type.toUpperCase(); 
     406        for (StatisticType thisType : StatisticType.values()) { 
     407            if (thisType.toString().equals(type)) { 
     408                this.type = thisType; 
     409                return; 
     410            } 
     411        } 
     412        // set default 
     413        this.type = StatisticType.USER; 
    392414    } 
    393415 
    394416    public void setType(StatisticType type) { 
    395         this.type = type; 
     417        this.type = type; 
    396418    } 
    397419 
    398420    public StatisticType getType() { 
    399         return type; 
     421        return type; 
    400422    } 
    401423 
    402424    public void setPresentation(Presentation presentation) { 
    403         this.presentation = presentation; 
     425        this.presentation = presentation; 
    404426    } 
    405427 
    406428    public Presentation getPresentation() { 
    407         return presentation; 
    408     } 
    409  
     429        return presentation; 
     430    } 
    410431 
    411432    public void setSeries(List<Series> series) { 
    412         this.series = series; 
     433        this.series = series; 
    413434    } 
    414435 
    415436    public List<Series> getSeries() { 
    416         return series; 
     437        return series; 
    417438    } 
    418439 
     
    422443 
    423444    public void setEventTypeString(String eventType) { 
    424         for (EventType type : EventType.values()){ 
    425             if (type.toString().equals(eventType)){ 
     445        for (EventType type : EventType.values()) { 
     446            if (type.toString().equals(eventType)) { 
    426447                this.eventType = type; 
    427448            } 
     
    429450    } 
    430451 
    431     public String getEventTypeString(){ 
     452    public String getEventTypeString() { 
    432453        return eventType.toString(); 
    433454    } 
     
    438459 
    439460    /** 
    440      * @param resourceCategory the resourceCategory to set 
     461     * @param resourceCategory 
     462     *            the resourceCategory to set 
    441463     */ 
    442464    public void setResourceCategory(ResourceCategory resourceCategory) { 
     
    451473    } 
    452474 
    453     public void setResourceCategoryString(String resourceCategory){ 
    454         for (ResourceCategory type : ResourceCategory.values()){ 
    455             if (type.toString().equals(resourceCategory)){ 
     475    public void setResourceCategoryString(String resourceCategory) { 
     476        for (ResourceCategory type : ResourceCategory.values()) { 
     477            if (type.toString().equals(resourceCategory)) { 
    456478                this.resourceCategory = type; 
    457479            } 
     
    459481    } 
    460482 
    461     public String getResourceCategoryString(){ 
     483    public String getResourceCategoryString() { 
    462484        return resourceCategory.toString(); 
    463485    } 
    464486 
    465  
    466  
    467  
    468487} 
  • raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/wsmodel/SuggestionValues.java

    r1023 r1178  
    88import org.slf4j.LoggerFactory; 
    99 
     10/** 
     11 * The Class SuggestionValues. 
     12 */ 
    1013public class SuggestionValues implements Serializable { 
    1114 
    12     /** 
    13      * default serial UId 
    14      */ 
     15    /** default serial UId. */ 
    1516    private static final long serialVersionUID = 7312337340123235532L; 
    1617 
    17     /** Class logger */ 
     18    /** Class logger. */ 
    1819    private final Logger log = LoggerFactory.getLogger(SuggestionValues.class); 
    1920 
    20     /** The names of all fields from the information model */ 
     21    /** The names of all fields from the information model. */ 
    2122    private List<Suggestion> possibleFieldNameValues; 
    2223 
    23     /** The possible values of all known fields from the information model */ 
     24    /** The possible values of all known fields from the information model. */ 
    2425    private List<Suggestion> possibleFieldValues; 
    2526 
     27    /** The possible post processors. */ 
    2628    private List<Suggestion> possiblePostProcessors; 
    2729 
     30    /** 
     31     * Sets the possible field name values. 
     32     *  
     33     * @param possibleFieldNameValues 
     34     *            the new possible field name values 
     35     */ 
    2836    public void setPossibleFieldNameValues(List<Suggestion> possibleFieldNameValues) { 
    2937        this.possibleFieldNameValues = possibleFieldNameValues; 
    3038    } 
    3139 
     40    /** 
     41     * Gets the possible field name values. 
     42     *  
     43     * @return the possible field name values 
     44     */ 
    3245    public List<Suggestion> getPossibleFieldNameValues() { 
    3346        return possibleFieldNameValues; 
    3447    } 
    3548 
     49    /** 
     50     * Gets the possible field name values list. 
     51     *  
     52     * @return the possible field name values list 
     53     */ 
    3654    public List<String> getPossibleFieldNameValuesList() { 
    3755        ArrayList<String> fields = new ArrayList<String>(); 
     
    4462    } 
    4563 
     64    /** 
     65     * Gets the possible field name values list. 
     66     *  
     67     * @param classFilters 
     68     *            the class filters 
     69     * @return the possible field name values list 
     70     */ 
    4671    public List<String> getPossibleFieldNameValuesList(String[] classFilters) { 
    4772        ArrayList<String> fields = new ArrayList<String>(); 
     
    5883    } 
    5984 
     85    /** 
     86     * Autocomplete. 
     87     *  
     88     * @param fieldName 
     89     *            the field name 
     90     * @return the array list 
     91     */ 
    6092    public ArrayList<String> autocomplete(String fieldName) { 
    6193        log.debug("Suggesting values for selectedfield {}", fieldName); 
     
    71103 
    72104    /** 
     105     * Sets the possible field values. 
     106     *  
    73107     * @param possibleFieldValues 
    74108     *            the possibleFieldValues to set 
     
    79113 
    80114    /** 
     115     * Gets the possible field values. 
     116     *  
    81117     * @return the possibleFieldValues 
    82118     */ 
     
    86122 
    87123    /** 
     124     * Sets the possible post processors. 
     125     *  
    88126     * @param possiblePostProcessors 
    89127     *            the possiblePostProcessors to set 
     
    94132 
    95133    /** 
     134     * Gets the possible post processors. 
     135     *  
    96136     * @return the possiblePostProcessors 
    97137     */ 
     
    100140    } 
    101141 
     142    /** 
     143     * Gets the possible post processor values list. 
     144     *  
     145     * @return the possible post processor values list 
     146     */ 
    102147    public ArrayList<String> getPossiblePostProcessorValuesList() { 
    103148        ArrayList<String> fields = new ArrayList<String>(); 
  • raptor-information-model/trunk/src/main/java/uk/ac/cardiff/utility/EqualsUtil.java

    r367 r1178  
    44package uk.ac.cardiff.utility; 
    55 
    6 import java.util.Arrays; 
    76 
    87/** 
    9 * Collected methods which allow easy implementation of <code>equals</code>. 
    10 * taken from http://www.javapractices.com/ 
    11 * 
    12 * Example use case in a class called Car: 
    13 * <pre> 
    14 public boolean equals(Object aThat){ 
    15   if ( this == aThat ) return true; 
    16   if ( !(aThat instanceof Car) ) return false; 
    17   Car that = (Car)aThat; 
    18   return 
    19     EqualsUtil.areEqual(this.fName, that.fName) && 
    20     EqualsUtil.areEqual(this.fNumDoors, that.fNumDoors) && 
    21     EqualsUtil.areEqual(this.fGasMileage, that.fGasMileage) && 
    22     EqualsUtil.areEqual(this.fColor, that.fColor) && 
    23     Arrays.equals(this.fMaintenanceChecks, that.fMaintenanceChecks); //array! 
    24 } 
    25 * </pre> 
    26 * 
    27 * <em>Arrays are not handled by this class</em>. 
    28 * This is because the <code>Arrays.equals</code> methods should be used for 
    29 * array fields. 
    30 */ 
     8 * Collected methods which allow easy implementation of <code>equals</code>. taken from http://www.javapractices.com/ 
     9 *  
     10 * Example use case in a class called Car: 
     11 *  
     12 * <pre> 
     13 * public boolean equals(Object aThat) { 
     14 *     if (this == aThat) 
     15 *         return true; 
     16 *     if (!(aThat instanceof Car)) 
     17 *         return false; 
     18 *     Car that = (Car) aThat; 
     19 *     return EqualsUtil.areEqual(this.fName, that.fName) &amp;&amp; EqualsUtil.areEqual(this.fNumDoors, that.fNumDoors) &amp;&amp; EqualsUtil.areEqual(this.fGasMileage, that.fGasMileage) 
     20 *             &amp;&amp; EqualsUtil.areEqual(this.fColor, that.fColor) &amp;&amp; Arrays.equals(this.fMaintenanceChecks, that.fMaintenanceChecks); // array! 
     21 * } 
     22 * </pre> 
     23 *  
     24 * <em>Arrays are not handled by this class</em>. This is because the <code>Arrays.equals</code> methods should be used for array fields. 
     25 */ 
    3126public final class EqualsUtil { 
    3227 
    33   static public boolean areEqual(boolean aThis, boolean aThat){ 
    34     //System.out.println("boolean"); 
    35     return aThis == aThat; 
    36   } 
     28    static public boolean areEqual(boolean aThis, boolean aThat) { 
     29        return aThis == aThat; 
     30    } 
    3731 
    38   static public boolean areEqual(char aThis, char aThat){ 
    39     //System.out.println("char"); 
    40     return aThis == aThat; 
    41   } 
     32    static public boolean areEqual(char aThis, char aThat) { 
     33        return aThis == aThat; 
     34    } 
    4235 
    43   static public boolean areEqual(long aThis, long aThat){ 
    44     /* 
    45     * Implementation Note 
    46     * Note that byte, short, and int are handled by this method, through 
    47     * implicit conversion. 
    48     */ 
    49     //System.out.println("long"); 
    50     return aThis == aThat; 
    51   } 
     36    static public boolean areEqual(long aThis, long aThat) { 
     37        /* 
     38         * Implementation Note Note that byte, short, and int are handled by this method, through implicit conversion. 
     39         */ 
     40        return aThis == aThat; 
     41    } 
    5242 
    53   static public boolean areEqual(float aThis, float aThat){ 
    54     //System.out.println("float"); 
    55     return Float.floatToIntBits(aThis) == Float.floatToIntBits(aThat); 
    56   } 
     43    static public boolean areEqual(float aThis, float aThat) { 
     44        return Float.floatToIntBits(aThis) == Float.floatToIntBits(aThat); 
     45    } 
    5746 
    58   static public boolean areEqual(double aThis, double aThat){ 
    59     //System.out.println("double"); 
    60     return Double.doubleToLongBits(aThis) == Double.doubleToLongBits(aThat); 
    61   } 
     47    static public boolean areEqual(double aThis, double aThat) { 
     48        return Double.doubleToLongBits(aThis) == Double.doubleToLongBits(aThat); 
     49    } 
    6250 
    63   /** 
    64   * Possibly-null object field. 
    65   * 
    66   * Includes type-safe enumerations and collections, but does not include 
    67   * arrays. See class comment. 
    68   */ 
    69   static public boolean areEqual(Object aThis, Object aThat){ 
    70     //System.out.println("Object"); 
    71     return aThis == null ? aThat == null : aThis.equals(aThat); 
    72   } 
     51    /** 
     52     * Possibly-null object field. 
     53     *  
     54     * Includes type-safe enumerations and collections, but does not include arrays. See class comment. 
     55     */ 
     56    static public boolean areEqual(Object aThis, Object aThat) { 
     57        // System.out.println("Object"); 
     58        return aThis == null ? aThat == null : aThis.equals(aThat); 
     59    } 
    7360} 
  • raptor-information-model/trunk/src/main/java/uk/ac/cardiff/utility/HashCodeUtil.java

    r367 r1178  
    55/** 
    66 * Collected methods which allow easy implementation of <code>hashCode</code>. as taken from http://www.javapractices.com/ 
    7  * 
     7 *  
    88 * Example use case: 
    9  * 
     9 *  
    1010 * <pre> 
    1111 * public int hashCode() { 
    1212 *     int result = HashCodeUtil.SEED; 
    13  *     //collect the contributions of various fields 
     13 *     // collect the contributions of various fields 
    1414 *     result = HashCodeUtil.hash(result, fPrimitive); 
    1515 *     result = HashCodeUtil.hash(result, fObject); 
     
    3131     */ 
    3232    public static int hash(int aSeed, boolean aBoolean) { 
    33         //System.out.println("boolean..."); 
    34         return firstTerm(aSeed) + (aBoolean ? 1 : 0); 
     33        return firstTerm(aSeed) + (aBoolean ? 1 : 0); 
    3534    } 
    3635 
     
    3938     */ 
    4039    public static int hash(int aSeed, char aChar) { 
    41         //System.out.println("char..."); 
    42         return firstTerm(aSeed) + (int) aChar; 
     40        return firstTerm(aSeed) + (int) aChar; 
    4341    } 
    4442 
     
    4745     */ 
    4846    public static int hash(int aSeed, int aInt) { 
    49         /* 
    50          * Implementation Note Note that byte and short are handled by this method, through implicit conversion. 
    51          */ 
    52         //System.out.println("int..."); 
    53         return firstTerm(aSeed) + aInt; 
     47        /* 
     48         * Implementation Note Note that byte and short are handled by this method, through implicit conversion. 
     49         */ 
     50        return firstTerm(aSeed) + aInt; 
    5451    } 
    5552 
     
    5855     */ 
    5956    public static int hash(int aSeed, long aLong) { 
    60         //System.out.println("long..."); 
    61         return firstTerm(aSeed) + (int) (aLong ^ (aLong >>> 32)); 
     57        return firstTerm(aSeed) + (int) (aLong ^ (aLong >>> 32)); 
    6258    } 
    6359 
     
    6662     */ 
    6763    public static int hash(int aSeed, float aFloat) { 
    68         return hash(aSeed, Float.floatToIntBits(aFloat)); 
     64        return hash(aSeed, Float.floatToIntBits(aFloat)); 
    6965    } 
    7066 
     
    7369     */ 
    7470    public static int hash(int aSeed, double aDouble) { 
    75         return hash(aSeed, Double.doubleToLongBits(aDouble)); 
     71        return hash(aSeed, Double.doubleToLongBits(aDouble)); 
    7672    } 
    77  
    7873 
    7974    /** 
    8075     * <code>aObject</code> is a possibly-null object field, and possibly an array. 
    81      * 
     76     *  
    8277     * If <code>aObject</code> is an array, then each element may be a primitive or a possibly-null object. 
    8378     */ 
    8479    public static int hash(int aSeed, Object aObject) { 
    85         int result = aSeed; 
    86         if (aObject == null) { 
    87             result = hash(result, 0); 
    88         } else if (!isArray(aObject)) { 
    89             result = hash(result, aObject.hashCode()); 
    90         } else { 
    91             int length = Array.getLength(aObject); 
    92             for (int idx = 0; idx < length; ++idx) { 
    93                 Object item = Array.get(aObject, idx); 
    94                 // recursive call! 
    95                 result = hash(result, item); 
    96             } 
    97         } 
    98         return result; 
     80        int result = aSeed; 
     81        if (aObject == null) { 
     82            result = hash(result, 0); 
     83        } else if (!isArray(aObject)) { 
     84            result = hash(result, aObject.hashCode()); 
     85        } else { 
     86            int length = Array.getLength(aObject); 
     87            for (int idx = 0; idx < length; ++idx) { 
     88                Object item = Array.get(aObject, idx); 
     89                // recursive call! 
     90                result = hash(result, item); 
     91            } 
     92        } 
     93        return result; 
    9994    } 
    10095 
    101     // / PRIVATE /// 
    10296    private static final int fODD_PRIME_NUMBER = 37; 
    10397 
    10498    private static int firstTerm(int aSeed) { 
    105         return fODD_PRIME_NUMBER * aSeed; 
     99        return fODD_PRIME_NUMBER * aSeed; 
    106100    } 
    107101 
    108102    private static boolean isArray(Object aObject) { 
    109         return aObject.getClass().isArray(); 
     103        return aObject.getClass().isArray(); 
    110104    } 
    111105 
  • raptor-information-model/trunk/src/main/java/uk/ac/cardiff/utility/StringUtils.java

    r1172 r1178  
    77public class StringUtils { 
    88 
     9    /** 
     10     * Used to construct a string representation of all field value pairs in the object <code>obj</code> passed in as a parameter to the method. It does this 
     11     * using reflection. 
     12     *  
     13     * @param obj 
     14     *            the object from which to construct a string representation from. 
     15     * @return a <code>String</code> representation of this object. 
     16     */ 
    917    public static String buildToString(Object obj) { 
    1018        Method[] methods = obj.getClass().getMethods(); 
Note: See TracChangeset for help on using the changeset viewer.