input
stringlengths
10
828
output
stringlengths
5
107
private boolean gripe dialog string field string error message string value string error string for int i 0 i field length i if field i null error string error string field i error message value n return show gripe dialog error string
show a dialog complaining about errors in the data and giving the user
public jcomponent get component string name int i key index of object name if i 1 return jcomponent component get i return null
get the component stored for the dynamic field
private string do field formatting result set rs string error null list validation list get formatting list rs execute the formatting for the field if it is validatable for string input get input list field name value format for each input list coded by the user field record set coded value input if validation list null error format field by all function validation list if error occured while executing all the formatting function of all field then stop execution and return error message if error null return error return null
run the script file to format the each field of the document
private boolean gripe dialog string field string error message string error string for int i 0 i field length i if field i null error string error string field i error message return show gripe dialog error string
show a dialog complaining about errors in the data and giving the user
private string format field by all function list validation list string error null for object validation validation list if validation null function data function data function data validation error format field by one function function data if the formatting of the field by a function is failed then stop validating and return the error occured if error null return error return null
format a field by different script functions enabled for this field
private boolean show gripe dialog string error string object options save with errors don t save int response joption pane show option dialog comp error string n the data on the screen contains the above error s n your options are n save with errors to force the save of your changes n don t save to continue editing the data on this screen warning joption pane yes no option joption pane warning message null options options 0 if response joption pane no option return false return true
show the error dialog
public string get batch number return batch number
get the batch number for the document
public void set batch number string batch number this batch number batch number
set the batch number
public void set document number string document number this document number document number
set the document number
private void force2 invalidate string user session id if null user session id fossa session listener force2 invalidate user session id else system err println cannot force session to get invalidated system err println session is not found for sesssion id user session id
invaidates the user session
public default list model get model int tablespec id log print project mapper get model tablespec id return default list model model map get integer to string tablespec id
get the model stored for the dynamic field
public reader make file reader string file name throws ioexception return new file reader file name
create a reader for this file
private string do document validation result set rs string error null list validation list get validation list rs execute the validation for the field if it is validatable if validation list null error validate field by all function validation list if error occured while executing all the validation function of all field then stop execution and return error message if error null return error return null
run the script file to check the each field of the document
final protected void accept xref a xref acceptor accept a xref
return an xref to the current xref acceptor
private void delimit field if last field field type equals date no quotes just a field separator buffer append field delimiter else everything else is quoted buffer append text qualifier field delimiter
add delimiters to finish the current field
final protected void error string message acceptor error message
return an error message for the current line to the current xref acceptor
private string do field validation result set rs string error null list validation list get validation list rs execute the validation for the field if it is validatable for string input get input list field name value validate for each input list coded by the user system out println input input field record set coded value input if validation list null error validate field by all function validation list if error occured while executing all the validation function of all field then stop execution and return error message if error null return error return null
run the script file to check the each field of the document
private string validate field by all function list validation list string error null for object validation validation list if validation null function data function data function data validation error validate field by one function function data if the validation of the field by a function is failed then stop validating and retrun the error occured if error null return error return null
validate a field by different script functions enabled for this field
private message writer get message writer output stream stream message writer writer null try writer new message writer stream message dtd catch ioexception ex print exceptions exception while getting message writer ex return writer
returns a message writer object
private string upper value string type string value if uppercase return value to upper case if type equals name uppercase names return value to upper case return value
convert the given value to uppercase if requested by the user
public void accept line string line try accept line brs line catch error exception e logger error exception while reading brs file e string writer sw new string writer e print stack trace new print writer sw logger error sw to string error e get message
accept and process the given input line
public void close throws ioexception if missing date null writing csv not lfp delimit value buffer writer close writer null
finish the last buffer line write it and close the writer
public void close throws ioexception if debug system out println message writer close if the writer is still open we finish the element otherwise writer null we ve already closed it to create a data stream if writer null end element assert element stack size 0 start end element mismatch writing message for debug purpose prints the server side xml system out println server side cache to string writer close debug only cache null debug only writer null
write message postamble and close the message substream
public void accept xref spec xref list add spec
receive an xref specification
public void start element string element throws ioexception system out println inside message writer start element method element if debug if has append ok for the first time this will be true if element equals ignore case t message ignore this if this is the start of a response message this has append ok false if is element open debug only cache append n debug only writer write n start line element is element open true is sub element seen false element stack add element
write element start tag
public void error string message if line written toerror list error list add error list add left pad line count 6 line line written toerror list true error list add message
receive an error message for the current source line
public void write attribute string name string value throws ioexception assert is element open element not open when writing attribute debug only cache append name escape string value debug only writer write name escape string value
write an attribute and its value
public void write attribute string name int value throws ioexception assert is element open element not open when writing attribute debug only cache append name value debug only writer write name value
write an attribute and its value where the
public void write content string content throws ioexception string str escape string content if str length 0 is element open is element open false debug only cache append cache append str debug only writer write writer write str
writes content for the current element
public void close throws ioexception if in stream null sub stream null in stream close in stream null
close the underlying stream
private string escape string string str string buffer buffer null int start index 0 char ch for int i 0 i str length i ch str char at i if ch max char char table int ch null if buffer null buffer new string buffer buffer append str substring start index i buffer append char table int ch start index i 1 if buffer null buffer append str substring start index str buffer to string return str
escapes the reserved xml characters in the given string if any
public void write content long content throws ioexception if is element open is element open false debug only cache append debug only writer write debug only cache append long to string content debug only writer write long to string content
writes an integer or long as content for the current element
public void write password char content throws ioexception char ch if is element open is element open false debug only cache append debug only writer write debug message append for int i 0 i content length i ch content i if ch max char char table int ch null char temp char table int ch to char array for int j 0 j temp length j debug only cache append temp j debug only writer write temp j temp j u0000 else debug only cache append ch debug only writer write ch
writes a character array as content for the current element
public void close throws ioexception if out stream null if sub stream null sub stream close out stream close out stream null
close the underlying stream
public void write string dir name string file name throws ioexception file the file new file dir name file name output stream outstream new file output stream the file outstream write buffer 0 length outstream close the file set last modified timestamp
write the sync file content to the given file
public file properties string file name string title this file name title null
create a new file properties in a the working directory
public int get block count return length block length 1 block length
get number of blocks in sync file
public file properties string file name string title string directory this title title this directory directory load file file name
create a new file properties in a given directory
public byte get int pos return buffer pos
get byte at given position
public int get positional count return positionals size
get number of positionals seen on the command line
private void write message writer writer try load project description writer if writer null writer end element catch sqlexception e logger error exception while writing xml descriptions of project fields e string writer sw new string writer e print stack trace new print writer sw logger error sw to string log quit e catch ioexception e logger error exception while writing xml descriptions of project fields e string writer sw new string writer e print stack trace new print writer sw logger error sw to string log quit e
write the xml description of project fields
public void copy int src pos sync file dest int dest pos int length system arraycopy buffer src pos dest buffer dest pos length
copy sequence of bytes to another sync file
public void store byte src int dest pos system arraycopy src 0 buffer dest pos src length
store array of bytes in specified position in sync file buffer
public string get positional int i return string positionals get i
get the value of the ith positional on the command line
private void flush string element name message writer writer throws ioexception if there s something in buffer if buffer length 0 start the value list if it s not already started if writer null writer start element t value list log print project writer flush field name buffer write the data from the buffer writer start element element name writer write attribute a name field name writer write content buffer writer end element empty the buffer buffer
write the value that has been constructed in buffer if any
public int fast sum int offset int sum1 0 int sum2 0 int pos offset for int coeff block length coeff 0 coeff sum1 buffer pos sum2 coeff buffer pos pos return sum1 16 sum2 0x ffff
compute the fast checksum signature for a block
public string get option string name option spec spec option spec option specs get name if spec null log quit command line undefined option name return string options get spec long name
get the value of the named option
public string to string return option spec long name required required has value has value
public for unit testing only
public void set fields map map string fields data fields map this fields map fields map
gets a map between project field name and fields data value object
public void set volume id int volume id this volume id volume id
gets volume id
public void set volume name string volume name this volume name volume name
sets the volume name
public void invert selected selected selected
invert the selection
public void set functions map map string functions data functions map this functions map functions map
set the functions map
public void put in funtions map string key functions data value functions map put key value
place the function data to functions map
private void update project statement st throws sqlexception prepstmt coding db con coding db prepare statement sqlqueries upd dbwriter project prepstmt coding db set int 1 batch cnt prepstmt coding db set int 2 project id prepstmt coding db execute update prepstmt coding db close project history data project data new project history data con coding db project id project data insert into history table con coding db command import data user id mode edit
finish the project record by updating the high unitize batch
public int find child int child id throws sqlexception result set rs st execute query select p page id from child c inner join page p on c volume id p volume id and c lft p seq where c child id child id if rs next log quit find child child not found int result rs get int 1 rs close return result
find the page id corresponding to a given child
private void obtain sql string name try statement st task get statement result set rs1 st execute query select text from sql text where name name if rs1 next sql sql util substitute task rs1 get string 1 order by 1 system out println obtain sql sql rs1 close else log quit sql not found name catch sqlexception e log quit e
load the sql and sql 2 strings from the database
private managed table obtain table pattern pat pattern compile sfrom s w pattern case insensitive pattern dotall matcher mat pat matcher sql boolean is match mat find if is match log quit managed model peer obtain table match failed sql string table name sql substring mat start 1 mat end 1 managed table table managed table lookup table name if table null log quit managed model peer table not managed table name log print managed model peer load obtain table table table name return table
extract the name of the principal table from a select statement
public connection get connection if con null string db url jdbc mysql localhost db port db name system out println creating a new connection connection count try log write connecting db url con driver manager get connection db url dia dia4ibase create a statement for general use with this task st con create statement catch sqlexception e log quit can t connect db url return con
return a jdbc connection for this task
private void append select string string text if select string length 1 select string text else select string select string union text
append the given select string to the existing text in select string
public void set users id int id users id id
set the user id for this task
public connection get connection if con null con dia database opener open db port db name return con
return a jdbc connection for this task
public int get batch id throw new unsupported operation exception
return batch determined for this marshall page
public int get users id return users id
get the users id for this task 0 if no login yet
public statement get statement if con null get connection return st
return a statement for this tasks jdbc connection
private void correct sequence int project id try int seq 1 result set rs st execute query select projectfields id sequence from projectfields where project id project id order by field group sequence while rs next if rs get int 2 seq resequence from here rs previous while rs next log print handler pf correct sequence seq rs get int 1 task execute update update projectfields set sequence seq where projectfields id rs get int 1 seq break else seq rs close catch throwable t log quit t
because of the need to sequence by projectfields
public void enable controls not called from report screen disable controls param get generate button set enabled true throw new unsupported operation exception
not used for reports selected from menu
public void initialize controls disable controls param get project combo set selected index 1 if global the server connection get permission admin param get team combo set selected index 1 param get date field set date null param get end date field set date null param get days field set text param get order check box set selected false param get order check box2 set selected false param get batch combo set enabled false param get occurrence set enabled false param get volume combo set enabled false
disable all controls and clear values
public int get server number return server number
return the number of current server
public void initialize controls disable controls param get project combo set selected index 1 if global the server connection get permission admin param get team combo set selected index 1 param get date field set date null param get end date field set date null param get days field set text param get order check box set selected false param get order check box2 set selected false
disable all controls and clear values
public void disable controls param get project combo set enabled false param get team combo set enabled false param get date field set enabled false param get end date field set enabled false param get days field set editable false param get order check box set visible false param get order check box2 set visible false param get order check box3 set visible false param get generate button set enabled false param get field combo set enabled false param get volume combo set enabled false param get batch combo set enabled false param get occurrence set enabled false
disable all controls on the report page
protected void register model jcombo box control managed combo model model managed combo model control get model model register
convenience method to register the model for a managed jcombo box
public void run throws ioexception message writer writer scon start message t save listing qc writer write attribute a project id project id writer write attribute a volume id volume id writer write attribute a users id user id writer write attribute a field name selected field name writer write attribute a status status writer end element writer close element reply scon receive message set result reply
write the message with attributes and set the result
public void run throws ioexception message writer writer writer scon start message t save listingreport writer write attribute a field name field name writer write attribute a project id project id writer write attribute a volume id volume id todo sunil check whether this field value is not going to be used writer write attribute a field value field value writer end element writer close reply is not required element reply scon receive message
write the message with attributes
public void run throws ioexception message writer writer scon start message t batch boundary writer write attribute a batch id batch id writer end element writer close log print task batch remove run batch batch id element reply scon receive message string ok reply get node name log print t batch boundary reply ok set result object reply if t ok equals ok t fail equals ok log quit batch boundary unexpected message type ok
write the message with attributes and set the result
public task execute update string sql name this sql name string null
construct a client task to execute a named update on the server
public void run throws ioexception message writer writer writer scon start message t check level writer write attribute a batch id batch id writer end element writer close element reply scon receive message set result string reply get attribute a level
write the message with attributes and set the result
public void run allow clipboard with the magic word if lexpartest equals local properties get property printok this set daemon false return clipboard cb toolkit get default toolkit get system clipboard for try transferable data cb get contents null if data is data flavor supported data flavor image flavor cb set contents new string selection null catch illegal state exception e o k clipboard not available catch exception e log print exception clearing clipboard e try thread sleep delay catch interrupted exception e e print stack trace
override of code thread
public task execute update string sql name string parameter this sql name new string parameter
construct a client task to execute a named update on the server
public void run throws ioexception message writer writer scon start message t delete volume writer write attribute a volume id volume id writer end element writer close element reply scon receive message string ok reply get node name log print t delete volume reply ok set result ok if t ok equals ok t fail equals ok log quit send boundary unexpected message type ok
write the message with attributes and set the result
public void run throws ioexception message writer writer scon start message t create tally batch writer write attribute a volume id volume id writer write attribute a users id user id writer end element writer close element reply scon receive message set result reply
write the message with attributes and set the result
public task execute update string sql name string parameter1 string parameter2 this sql name new string parameter1 parameter2
construct a client task to execute a named update on the server
public void run throws ioexception try message writer writer scon start message t delete advance validations writer write attribute a field id integer to string project field id writer write attribute a validation mapping details id integer to string validation mapping details id writer write attribute a validation functions master id integer to string validation functions master id writer end element writer close reply is not required element reply scon receive message catch exception exc log print exc to string
write the message with attributes and set the result
public void run throws ioexception int update result sql execute update scon this sql name parameters set result new integer update result
execute the update and set the result
public void run throws ioexception message writer writer scon start message t delete project writer write attribute a project id project id writer end element writer close element reply scon receive message string ok reply get node name log print t delete project reply ok set result ok if t ok equals ok t fail equals ok log quit send boundary unexpected message type ok
write the message with attributes and set the result
public void run throws ioexception message writer writer scon start message t create listing batch writer write attribute a volume id volume id writer write attribute a users id user id writer end element writer close element reply scon receive message set result reply
write the message with attributes and set the result
public void run throws ioexception message writer writer writer scon start message t close event if volume id 0 writer write attribute a status status writer write attribute a volume id volume id writer end element writer close split pane viewer is closing so no reply necessary element reply scon receive message
write the message with attributes and set the result
public void run throws ioexception try message writer writer scon start message t request investigation data writer encode investigation fields class ifields writer end element writer close element reply scon receive message final result set rs sql result from xml reply if t result set equals reply get node name synchronized this force cache flush for rs else log quit task request investigation data unexpected message type reply get node name set result rs catch exception e log print this get class get simple name n e to string
write the message with attributes and set the result
public void run throws ioexception server connection scon global the server connection message writer writer scon start message t request requeue writer write attribute a batch id batch id writer write attribute a hours hours writer end element writer close element reply scon receive message string ok reply get node name set result object ok if t ok equals ok t fail equals ok log quit request requeue unexpected message type ok
write the message with attributes and set the result
public void run throws ioexception try message writer writer scon start message t request post validations report writer write attribute a project id integer to string project id writer write attribute a volume id integer to string volume id writer end element writer close element reply scon receive message final result set rs sql result from xml reply set result rs catch exception e e print stack trace
write the message with attributes and set the result with the
public void run throws ioexception message writer writer writer scon start message t terminate session writer write attribute a id integer to string session id writer end element writer close element reply scon receive message set result reply
write the message with attributes and set the result
public int get update age return update age
return the age of managed table updates done by this task
public task batch boundary int child id int delta this child id child id this delta delta
create a new client task and store the given parameters
public void run throws ioexception message writer writer scon start message t batch boundary writer write attribute a id child id writer write attribute a delta delta writer end element writer close log print task batch boundary run child child id delta element reply scon receive message string ok reply get node name log print t batch boundary reply ok set result object reply if t ok equals ok t fail equals ok log quit batch boundary unexpected message type ok
write the message with parameters and set the result
public void run throws ioexception message writer writer writer scon start message t coding manual tracking writer write attribute a project id project id writer write attribute a start date start date writer write attribute a end date end date writer end element writer close element reply scon receive message string ok reply get node name set result object ok
write the message with attributes and set the result
public int get column count throws sqlexception return columns
returns the number of columns in this code result set code object
public void run throws ioexception message writer writer scon start message t save dtyg mod data writer encode dtygfields data class data writer end element writer close element reply scon receive message string ok reply get node name set result object ok
write the message with attributes and set the result
public boolean is auto increment int column throws sqlexception throw new unsupported operation exception
indicates whether the designated column is automatically numbered thus read only
public void run throws ioexception message writer writer writer scon start message t request mail writer write attribute a id id writer write attribute a type type writer end element writer close element reply scon receive message if t mail data equals reply get node name mail text data new mail text fill in the int and string fields of the mailreceived data message reader decode reply data store the result so the callback can get it set result data else log quit mailreceived unexpected message type reply get node name
write the message with attributes and set the result with the
public boolean is case sensitive int column throws sqlexception throw new unsupported operation exception
indicates whether a columns case matters