input
stringlengths
10
828
output
stringlengths
5
107
private array list do the search string pattern throws dbexception array list ret new array list ret add all natural subject get all subjects matching pattern pattern return ret
do actual search
private string back slash to slash string a int l a length java lang string buffer ret new java lang string buffer for int i 0 i l i if a char at i ret append else ret append a char at i return ret to string
convert in string characters to characters
public void add int uid throws dbexception set field fld created uid uid add
add with uid to be written into log
public void update int uid throws dbexception set field fld updated uid uid update
update with uid to be written into log
public string get attribut full name throws dbexception valid natural subject attribute v new valid natural subject attribute v set field valid natural subject attribute fld short name get field fld attribute array list temp v search and retrieve list if temp size 0 return valid natural subject attribute temp get 0 get field valid natural subject attribute fld name return
get full attribute name
public string get attribut full name throws dbexception valid official subject attribute v new valid official subject attribute v set field valid official subject attribute fld short name get field fld attribute array list temp v search and retrieve list if temp size 0 return valid official subject attribute temp get 0 get field valid official subject attribute fld name return
get full attribute name
public boolean matches pattern string pattern throws dbexception if pattern null return false if pattern equals return false string name get field fld name get field fld main email string baby pattern pattern split boolean all baby patterns applied true for int i 0 i baby pattern length i if name to upper case index of baby pattern i to upper case 1 all baby patterns applied false return all baby patterns applied
do this subject matches given pattern
public string to string string s try s get field fld name catch exception exc return s
to string implementation
public boolean matches pattern string pattern throws dbexception if pattern null return false if pattern equals return false string name get field fld name get field fld main email get field fld surname if name null name string baby pattern pattern split boolean all baby patterns applied true for int i 0 i baby pattern length i if name to upper case index of baby pattern i to upper case 1 all baby patterns applied false return all baby patterns applied
do this subject matches given pattern
public array list get all subject attributes throws dbexception natural subject attribute nsa new natural subject attribute nsa set field natural subject attribute fld sub id get field fld id return nsa search and retrieve list
get all attributes assigned to this subject
public boolean can imodify you int uid throws dbexception int uid 0 try uid get field int fld uid catch exception eee if there is no assigned loginname boolean ret false if uid 0 return uid uid if get field int fld created uid uid ret true if get field int fld created uid 2 ret true not registered return ret
can user modify this subject
public int get uid throws dbexception try return get field int fld uid catch exception eee if there is no assigned loginname return 1
get uid of this user
public array list get all comments int uid throws dbexception personal comment pc new personal comment pc set field personal comment fld sid get field fld id pc set field personal comment fld stype n pc set field personal comment fld uid uid return pc search and retrieve list
get all users comments on this subject
public array list get all subject attributes throws dbexception official subject attribute nsa new official subject attribute nsa set field official subject attribute fld sub id get field fld id return nsa search and retrieve list
get all attributes assigned to this subject
public boolean can imodify you int uid throws dbexception boolean ret false if get field int fld created uid uid ret true if get field int fld created uid 2 ret true not registered return ret
can user modify this subject
public array list get all comments int uid throws dbexception personal comment pc new personal comment pc set field personal comment fld sid get field fld id pc set field personal comment fld stype o pc set field personal comment fld uid uid return pc search and retrieve list
get all users comments on this subject
private array list do the search string pattern throws dbexception array list ret new array list ret add all natural subject get all subjects matching pattern pattern ret add all official subject get all subjects matching pattern pattern return ret
do actual search
public void add throws dbexception string my name new string this class add super add
override the method add and add the record
public void set main tranzition name string tranzition name tran name tranzition name
set up main tranzition name
public boolean is leader int uid throws dbexception allowed user au new allowed user au set field allowed user fld cid get field int fld cid au set field allowed user fld uid uid if au find return au get field allowed user fld group equals pvn leader return false
is given user leader in this project
public boolean is member int uid throws dbexception allowed user au new allowed user au set field allowed user fld cid get field int fld cid au set field allowed user fld uid uid if au find return au get field allowed user fld group equals pvn member return false
is given user member in this project
public dbobject get this dbobj throws dbexception return new asset
return this dbobject
public boolean is observer int uid throws dbexception allowed user au new allowed user au set field allowed user fld cid get field int fld cid au set field allowed user fld uid uid if au find return au get field allowed user fld group equals pvn obsrvr return false
is given user observer in this project
public dbobject get this dbobj throws dbexception return new asset pattern
return this dbobject
public dbobject get this dbobj throws dbexception return new calendar asset
return this dbobject
public dbobject get this dbobj throws dbexception return new calendar
return this dbobject
public dbobject get this dbobj throws dbexception return new calendar asset type
return this dbobject
public void delete throws dbexception string my name new string this class delete string location address get field location address try meeting meeting new meeting meeting set field meeting id location address if meeting find meeting delete catch exception e log warn napaka pri brisanju zapisov log error error e get message super delete
override the method delete and delete the record
public dbobject get this dbobj throws dbexception return new event
return this dbobject
public dbobject get this dbobj throws dbexception return new meeting
return this dbobject
public vector get asset done string type locale locale locale this get locale string schema class si cit eprojekti ecalendar calendar schema string prefix this get class get name vector my values new vector my values add element new isovalid value schema class locale prefix type n not done my values add element new isovalid value schema class locale prefix type p partial done my values add element new isovalid value schema class locale prefix type d done my values add element new isovalid value schema class locale prefix type a abandon return my values
allowed type task or event
public dbobject get this dbobj throws dbexception return new asset attachment
return this dbobject
public dbobject get this dbobj throws dbexception return new task
return this dbobject
private int get number of days in month int month int year gregorian calendar c new gregorian calendar if month 4 month 6 month 9 month 11 return 30 if month 2 if c is leap year year return 29 else return 28 return 31
get number of days in month
private int days in month int month int year gregorian calendar c new gregorian calendar if month 4 month 6 month 9 month 11 return 30 if month 2 if c is leap year year return 29 else return 28 return 31
get number of days in month
private string get new date string old date string pattern string new date int index1 old date index of int index2 old date last index of int year integer parse int old date substring 0 index1 int month integer parse int old date substring index1 1 index2 int day integer parse int old date substring index2 1 old date length if pattern equals d day if pattern equals w day 7 if pattern equals m month if pattern equals y year new date year month day return new date
get new date
public string get default component code return get string ecalendar default component code
default component code
public string get version return get string ecalendar version
developing version of application
private gregorian calendar get calendar from string string date date date substring 0 date index of string tokenizer st new string tokenizer date return new gregorian calendar integer parse int st next token integer parse int st next token 1 integer parse int st next token
get calendar from string
private int how days old is date calendar now string date2 calendar cal2 get calendar from string date2 long diff millis now get time in millis cal2 get time in millis return int diff millis 24 60 60 1000
how days old is given date
public synchronized component metadata get meta data if my metadata null expresso component ec expresso component this get parent component metadata parent metadata ec get meta data for iterator i parent metadata get children iterator i has next component metadata one child component metadata i next if this get metadata name equals one child get name my metadata one child break if my metadata null throw new illegal argument exception unable to find metadata in parent corresponding to component named this get metadata name return my metadata
returns the metadata by retrieving the appropriate metadata from the parent
public void set mail debug boolean mail debug this mail debug mail debug boolean value
sets whether emailings performed from the system should be debugged or
public component container construct component container return new default container impl
single location that constructs all the container implementation
public void set expresso services file string file name if log is debug enabled log debug setting up to load expresso services file from file name this file name file name
set the filename of the expresso services file to load
private void start components logger log component factory cf component factory get instance for iterator i component order iterator i has next object o i next cf start component expresso component o
start any components that are loaded and configured and implement the
public string get expresso services file return this file name
retrieve the currently set expresso services file
public void set expresso services file url url if log is debug enabled log debug setting up to load expresso services file from url to string this file url url
set the url of the expresso services file to load
private void setup resolvers digester digester url url this get class get resource com jcorporate expresso kernel expresso metadata 5 1 dtd if url null digester register jcorporate ltd dtd expresso component metadata configuration 5 1 en url to string else throw new illegal argument exception unable to locate expresso services 5 1 dtd in component package
sets up the appropriate locations to resolve the doctypes
public component config get root config return root
returns the root of the component config tree generated by the digester
public boolean equals object parm1 if parm1 null return false if parm1 instanceof expresso services config return false expresso services config other expresso services config parm1 boolean return value true component config root get root config component config other root other get root config if root null other root null return false if root null other root null return true return root equals other root
test for equality
private string get component depth string int index fast string buffer fsb fast string buffer get instance for int i 0 i index i if i 0 fsb append embedded components fsb append component metadata string return value fsb to string fsb release return return value
internal string to assist int hacking the digester rules
public string get name return root get name
retrieve the name of the runtime configuration
public void test load expresso services try expresso services config esc new expresso services config esc set expresso services file com jcorporate expresso kernel test test component system class get resource test1 expresso services xml esc load expresso services catch exception ex fail error attempting to digest services file
test for method load expresso services
public component metadata get metadata return root
retrieve the component metadata that has been built via a call to
public installation metadata create new metadata string name object default value installation metadata metadata new installation metadata metadata set name name metadata set default value default value metadata set description name return metadata
kind of a factory method
public void add meta data installation metadata metadata install values put metadata null name metadata map put metadata get name metadata
called by the code installable code implementation to add a filled out
public void set install option string name object new value installation metadata metadata installation metadata name metadata map get name if metadata null throw new illegal argument exception invalid install option name name install values put metadata new value
sets the given install option by name
public object get install option string name installation metadata metadata installation metadata name metadata map get name if metadata null throw new illegal argument exception invalid install option name name object return value install values get metadata if return value null return value metadata get default value return return value
retrieves the installation option keyed by name
public void add mapped property string name string key string value if mapped properties null mapped properties new hash map if mapped properties contains key name mapped properties put name new hash map map keyed properties map mapped properties get name keyed properties put key value
add a mapped property
public void add indexed property string name int index string value if indexed properties null indexed properties new hash map if indexed properties contains key name hash map internal array new hash map index indexed properties put name internal array map index key map map indexed properties get name index key map put new integer index value
add an indexed property often seen in the javabean world as arrays
public string get property string name return string properties get name
retrieve the value of a property
public void set property string name string value if properties null properties new hash map properties put name value
sets the value of a particular property
public string get mapped property string name string key if mapped properties null return null map one mapped map mapped properties get name if one mapped null return null else return string one mapped get key
retrieve the value of a mapped property
public void set mapped property string key string name string value if mapped properties null mapped properties new hash map map one property map mapped properties get key if one property null one property new hash map mapped properties put key one property one property put name value
sets an mapped property value
public map get mapped properties string name if mapped properties null return null return map mapped properties get name
retrieve all mapped property key value pairs for a given property name
public map get all mapped properties return mapped properties
p retrieve a map of all mapped properties
public void test init try try global container system factory build expresso component system d expresso dev config expresso services xml null d expresso log fail call should have thrown illegal argument exception catch illegal argument exception iae global container system factory build expresso component system d expresso dev config expresso services xml d expresso dev config expresso logging xml d expresso log assert true global container null catch configuration exception ex ex print stack trace fail error configing root container
test for method init
public void test destroy if global container null global container destroy global container null
test for method destroy
public void test gc root container interface global container null try global container system factory build expresso component system this get class get resource test1 expresso services xml this get class get resource test log4j config xml d expresso log assert true global container null global container null expresso runtime map unregister runtime null system gc system run finalization assert true expresso runtime map get default runtime null catch exception ex ex print stack trace fail caught exception constructing global container
this unfortunately is a visual joke in that you should see a warning
public map get indexed properties string name if indexed properties null return null else return map indexed properties get name
retrieve a map of index properties
public map get all indexed properties return indexed properties
retrieve a map of all indexed properties
public string get indexed property string key int index map one property get indexed properties key if one property null return null else return string one property get new integer index
retrieve a particular indexed property
private void init logging directory string logging directory if logging directory null return if logging directory null logging directory length 0 system get property expresso log dir null null system set property expresso log dir logging directory file logdir new file logging directory if logdir exists logdir mkdirs try system out println logging directory is logdir get canonical path catch ioexception e e print stack trace
initialize the system parameters for the logging directory optional
public void set indexed property string key int index string value if indexed properties null indexed properties new hash map map one property map indexed properties get key if one property null one property new hash map indexed properties put key one property one property put new integer index value
sets an indexed property value
public void add child component component config new component child components add new component
adds a nested component config bean to represent nested components
public component config get child component string component name if component name null component name length 0 throw new illegal argument exception cannot have a null or zero length component name for iterator i child components iterator i has next component config one component component config i next if component name equals one component get name return one component return null
search for a child component by the given component name
public int get error number return error number
return the error number if one was supplied
public void update config component config new configuration class name new configuration class name indexed properties new hash map new configuration indexed properties mapped properties new hash map new configuration mapped properties name new configuration name properties new hash map new configuration properties
a semi copy constructor that allows you to update the configuration for
public void destroy if log null log info destroying global runtime container if root null root destroy
destroys the servlet and the global expresso runtime container
public void print stack trace if nested null nested print stack trace super print stack trace print stack trace
extend print stack trace to handle the nested exception correctly
public void print stack trace print stream p if nested null nested print stack trace p super print stack trace p print stack trace print stream
extend print stack trace to handle the nested exception
public void print stack trace print writer p if nested null nested print stack trace p super print stack trace p print stack trace print writer
extend print stack trace to handle the nested exception
public throwable get nested return nested get nested
retrieve the nested exception
public string get data context name expresso component component return get data context component get meta data get name
given the component that we loaded find the data context name were a
public boolean has next return next null true false
checks if another object exists
public object next if next null throw new java lang array index out of bounds exception no more contexts object return value next find next return return value
retrieve the next data context in the sequence
public data context get data context expresso component component if component null throw new illegal argument exception must have a non null argument for parameter component boolean done false containable parent null while done parent component get parent if parent instanceof data context return data context parent if parent null done true component parent return null
retrieve the data context that the given component is a part of
public data context next context if next null throw new java lang array index out of bounds exception no more contexts data context return value next find next return return value
retrieve the next data context in the sequence
private void find next next null while current child has next object one obj current child next if one obj instanceof data context next data context one obj break return
find and load the next values
public void info string message system out println info install log message
logs info messages
public void warn string message system out println warn install log message
logs warning messages
public void warn string message throwable error if error null warn message system out println warn install log message error message error get message error print stack trace
logs warning messages
public void error string message throwable error if error null error message system out println error install log message error message error get message error print stack trace
logs error messages
protected void set up try global container system factory build expresso component system this get class get resource com jcorporate expresso kernel management test test1 expresso services xml this get class get resource com jcorporate expresso kernel management test test log4j config xml test system initializer get log directory catch configuration exception ex ex print stack trace fail unable to set up test case ex get message
set up method for test case
protected void tear down global container destroy global container null system gc system run finalization
tear down method for test case
public void test create path locator utils lu new locator utils expresso component global container expresso component test lu locate component assert true root component must not be null test null assert true equals lu get path test test lu locate component default assert true default component must not be null test null assert true default equals lu get path test test lu locate component default test component assert true default test component must not be null test null assert true default test component equals lu get path test
test to make sure components on the tree are getting correct paths
public void clear copy when shared count 0
clears the buffer and prepares it for reuse
public string get required class return javax xml transform transformer factory
retrieve a class that must exist in the classpath for this to work
protected boolean is trax installed try class locator load class get required class catch class not found exception ex return false return true
checks to make sure that the appropriate transformer factory is available
protected boolean is xerces installed try class locator load class get required class catch class not found exception ex return false return true
checks to see if xerces classes are available via the classpath