com.dragosmatachescu.hyperionUtils
Class HyperionCalendar

java.lang.Object
  extended bycom.dragosmatachescu.hyperionUtils.HyperionCalendar

public class HyperionCalendar
extends java.lang.Object

Wrapper class for java.util.GregorianCalendar most interesting methods that can be used in Hyperion Essbase as UDF - User Defined Functions.

Naming conventions:

- if the java JRE class is called String for example, the correspondent class will be called HyperionString.

- if the java JRE method is called compareTo for example, the correspondent wrapper method will be called z_compareTo, and the essbase UDF function will be called @JString_compareTo.

- whenever possible, the wrapper function will have the same parameters as the JRE function, except the first parameter will be the java object and the function will be static.

Ex:
str1.compareTo(str2);
becomes
z_compareTo(str1, str2).

Because hyperion does not have a correspondent data type for Date, this class does not implement actual wrappers, but some useful operations with date parts (years, months, days). The methods of this class are designed to receive as parameters only String and/or Integer data, and also return only String and/or Integer data.

We dont use hours, minutes and seconds since there is no use in Essbase for them anyway.

Few fields from Calendar (or GregorianCalendar) used:

static int YEAR = 1;
static int MONTH = 2;
static int WEEK_OF_YEAR = 3;
static int WEEK_OF_MONTH = 4;
static int DATE = 5;
static int DAY_OF_MONTH = 5;
static int DAY_OF_YEAR = 6;
static int DAY_OF_WEEK = 7;
static int DAY_OF_WEEK_IN_MONTH = 8;

Few methods from class Calendar (or GregorianCalendar) used:

void add(int field, int amount);
boolean after(Object when);
boolean before(Object when);
boolean equals(Object obj);
int get(int field);
int getActualMaximum(int field);
int getActualMinimum(int field);
void roll(int field, int amount);
void set(int field, int value);
void set(int year, int month, int date);

The input parameters for methods in this class will mostly come as Strings from the Years and Period dimensions in Essbase (ex: 2008, FY08, FY2008, Jan, Feb, January, February etc.), but they will need to be converted to integer values using methods from class HyperionString. To work easily with months, is recommended to set UDAs with their Java integer representation:

Jan = Calendar.JANUARY = 0;
Feb = Calendar.FEBRUARY =1;
Dec = Calendar.DECEMBER = 11;

In case days are used, first day in month has value 1.

In general, if a date part is "out of bounds" (for example 32 for day of month) the system will recalculate the whole date to a correct one. A date such as "February 942, 1996" will be treated as being equivalent to the 941st day after February 1, 1996.

Author:
Dragos Matachescu

Constructor Summary
HyperionCalendar()
           
 
Method Summary
static void main(java.lang.String[] args)
          There is no function that returns void or has benefic side-effects from running, no need for a main method to be able to use RUNJAVA in calcscript Essbase.
static int z_add_currentDate(int field, int amount, int readfield)
          Pseudo-wrapper for:
void add(int field, int amount).
static int z_add_customDate(int year, int month, int day, int field, int amount, int readfield)
          Pseudo-wrapper for:
void add(int field, int amount).
static boolean z_after_currentDate(int year2, int month2, int day2)
          Pseudo-wrapper for:
boolean after(Object when).
static boolean z_after_customDate(int year, int month, int day, int year2, int month2, int day2)
          Pseudo-wrapper for:
boolean after(Object when).
static boolean z_before_currentDate(int year2, int month2, int day2)
          Pseudo-wrapper for:
boolean before(Object when).
static boolean z_before_customDate(int year, int month, int day, int year2, int month2, int day2)
          Pseudo-wrapper for:
boolean before(Object when).
static boolean z_equals_currentDate(int year2, int month2, int day2)
          Pseudo-wrapper for:
boolean equals(Object obj).
static boolean z_equals_customDate(int year, int month, int day, int year2, int month2, int day2)
          Pseudo-wrapper for:
boolean equals(Object obj).
static int z_get_currentDate(int field)
          Pseudo-wrapper for:
int get(int field).
static int z_get_customDate(int year, int month, int day, int field)
          Pseudo-wrapper for:
int get(int field).
static int z_getActualMaximum_currentDate(int field)
          Pseudo-wrapper for:
int getActualMaximum(int field).
static int z_getActualMaximum_customDate(int year, int month, int day, int field)
          Pseudo-wrapper for:
int getActualMaximum(int field).
static int z_getActualMinimum_currentDate(int field)
          Pseudo-wrapper for:
int getActualMinimum(int field).
static int z_getActualMinimum_customDate(int year, int month, int day, int field)
          Pseudo-wrapper for:
int getActualMinimum(int field).
static int z_roll_currentDate(int field, int amount, int readfield)
          Pseudo-wrapper for:
void roll(int field, int amount).
static int z_roll_customDate(int year, int month, int day, int field, int amount, int readfield)
          Pseudo-wrapper for:
void roll(int field, int amount).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HyperionCalendar

public HyperionCalendar()
Method Detail

z_add_currentDate

public static int z_add_currentDate(int field,
                                    int amount,
                                    int readfield)
Pseudo-wrapper for:
void add(int field, int amount).

Gets the system current date (Essbase server date), adds an amount "amount" to the given date component "field" and returns the value for the component "readfield" in the new date.

The values for parameters field and readfield are the ones from Calendar class fields (static int YEAR, static int MONTH etc), meaning values from 1 to 8 (see HyperionCalendar class description).


z_add_customDate

public static int z_add_customDate(int year,
                                   int month,
                                   int day,
                                   int field,
                                   int amount,
                                   int readfield)
Pseudo-wrapper for:
void add(int field, int amount).

Gets the system current date (Essbase server date), adds an amount "amount" to the given date component "field" and returns the value for the component "readfield" in the new date.

The values for parameters field and readfield are the ones from Calendar class fields (static int YEAR, static int MONTH etc), meaning values from 1 to 8 (see HyperionCalendar class description).


z_after_currentDate

public static boolean z_after_currentDate(int year2,
                                          int month2,
                                          int day2)
Pseudo-wrapper for:
boolean after(Object when).

Calculates if the system current date (Essbase server date) is after the given date.


z_after_customDate

public static boolean z_after_customDate(int year,
                                         int month,
                                         int day,
                                         int year2,
                                         int month2,
                                         int day2)
Pseudo-wrapper for:
boolean after(Object when).

Calculates if the first date is after the second (given) date.


z_before_currentDate

public static boolean z_before_currentDate(int year2,
                                           int month2,
                                           int day2)
Pseudo-wrapper for:
boolean before(Object when).

Calculates if the system current date (Essbase server date) is before the given date.


z_before_customDate

public static boolean z_before_customDate(int year,
                                          int month,
                                          int day,
                                          int year2,
                                          int month2,
                                          int day2)
Pseudo-wrapper for:
boolean before(Object when).

Calculates if the first date is before the second (given) date.


z_equals_currentDate

public static boolean z_equals_currentDate(int year2,
                                           int month2,
                                           int day2)
Pseudo-wrapper for:
boolean equals(Object obj).

Calculates if the system current date (Essbase server date) is equal to the given date. The fields from the given dates can be "out of range" - for example say 1000 for "day" parameter -, the method will convert to a valid date and return the required field from that date.


z_equals_customDate

public static boolean z_equals_customDate(int year,
                                          int month,
                                          int day,
                                          int year2,
                                          int month2,
                                          int day2)
Pseudo-wrapper for:
boolean equals(Object obj).

Calculates if the first date is equal to the second (given) date. The fields from the given dates can be "out of range" - for example say 1000 for "day" parameter -, the method will convert to a valid date and return the required field from that date.


z_get_currentDate

public static int z_get_currentDate(int field)
Pseudo-wrapper for:
int get(int field).

Gets the given field from the system current date (Essbase server date)

The values for parameter field are the ones from Calendar class fields (static int YEAR, static int MONTH etc), meaning values from 1 to 8 (see HyperionCalendar class description).


z_get_customDate

public static int z_get_customDate(int year,
                                   int month,
                                   int day,
                                   int field)
Pseudo-wrapper for:
int get(int field).

Gets the given field from the given date (Essbase server date). The fields from the given dates can be "out of range" - for example say 1000 for "day" parameter -, the method will convert to a valid date and return the required field from that date.

The values for parameter field are the ones from Calendar class fields (static int YEAR, static int MONTH etc), meaning values from 1 to 8 (see HyperionCalendar class description).


z_getActualMaximum_currentDate

public static int z_getActualMaximum_currentDate(int field)
Pseudo-wrapper for:
int getActualMaximum(int field).

Gets the ActualMaximum for given field from the system current date (Essbase server date)

The values for parameter field are the ones from Calendar class fields (static int YEAR, static int MONTH etc), meaning values from 1 to 8 (see HyperionCalendar class description).


z_getActualMaximum_customDate

public static int z_getActualMaximum_customDate(int year,
                                                int month,
                                                int day,
                                                int field)
Pseudo-wrapper for:
int getActualMaximum(int field).

Gets the ActualMaximum for given field from the given date (Essbase server date). The fields from the given dates can be "out of range" - for example say 1000 for "day" parameter -, the method will convert to a valid date and return the required field from that date.

The values for parameter field are the ones from Calendar class fields (static int YEAR, static int MONTH etc), meaning values from 1 to 8 (see HyperionCalendar class description).


z_getActualMinimum_currentDate

public static int z_getActualMinimum_currentDate(int field)
Pseudo-wrapper for:
int getActualMinimum(int field).

Gets the ActualMinimum for given field from the system current date (Essbase server date)

The values for parameter field are the ones from Calendar class fields (static int YEAR, static int MONTH etc), meaning values from 1 to 8 (see HyperionCalendar class description).


z_getActualMinimum_customDate

public static int z_getActualMinimum_customDate(int year,
                                                int month,
                                                int day,
                                                int field)
Pseudo-wrapper for:
int getActualMinimum(int field).

Gets the ActualMinimum for given field from the given date (Essbase server date). The fields from the given dates can be "out of range" - for example say 1000 for "day" parameter -, the method will convert to a valid date and return the required field from that date.

The values for parameter field are the ones from Calendar class fields (static int YEAR, static int MONTH etc), meaning values from 1 to 8 (see HyperionCalendar class description).


z_roll_currentDate

public static int z_roll_currentDate(int field,
                                     int amount,
                                     int readfield)
Pseudo-wrapper for:
void roll(int field, int amount).

Same as "add" wrapper. See the roll method description in JDK 1.4.2 docs

The values for parameters field and readfield are the ones from Calendar class fields (static int YEAR, static int MONTH etc), meaning values from 1 to 8 (see HyperionCalendar class description).


z_roll_customDate

public static int z_roll_customDate(int year,
                                    int month,
                                    int day,
                                    int field,
                                    int amount,
                                    int readfield)
Pseudo-wrapper for:
void roll(int field, int amount).

Same as "add" wrapper. See the roll method description in JDK 1.4.2 docs

The values for parameters field and readfield are the ones from Calendar class fields (static int YEAR, static int MONTH etc), meaning values from 1 to 8 (see HyperionCalendar class description).


main

public static void main(java.lang.String[] args)
There is no function that returns void or has benefic side-effects from running, no need for a main method to be able to use RUNJAVA in calcscript Essbase.