input
stringlengths 10
828
| output
stringlengths 5
107
|
|---|---|
public int get permissions string buffer sb new string buffer 1 sb append get write 1 1 0 sb append get add child 1 1 0 sb append get manage security 1 1 0 sb append get manage immutability 1 1 0 sb append get delete 1 1 0 sb append get rename 1 1 0 sb append getld import 1 1 0 sb append get bulk export 1 1 0 sb append get sign 1 1 0 sb append get archive 1 1 0 sb append get workflow 1 1 0 return integer parse int sb to string 2
|
parsing each permission and creates the integer representation
|
public void add menu group menu group mg menu group m get menu group mg get group id get menu groups remove m get menu groups add mg
|
adds a new element substituting a precedin one with the same group id
|
public void set permissions int permissions set write permission write match permissions 1 0 set add child permission add match permissions 1 0 set manage security permission security match permissions 1 0 set manage immutability permission immutable match permissions 1 0 set delete permission delete match permissions 1 0 set rename permission rename match permissions 1 0 setld import permission import match permissions 1 0 set bulk export permission export match permissions 1 0 set sign permission sign match permissions 1 0 set archive permission archive match permissions 1 0 set workflow permission workflow match permissions 1 0
|
set each permission evaluating the given integer representation
|
public boolean validate string username string password if providers null providers is empty init boolean logged in false for authentication provider cmp providers if cmp is enabled continue validates an user for valid login credentials if a specific component handles this user explicitly e g admin is basic authentication if cmp validate on user username logged in cmp authenticate username password break logged in cmp authenticate username password if logged in break return logged in
|
try to authenticate the user without creating a new session
|
public void set decoded password string pwd if org apache commons lang string utils is not empty pwd password crypt util crypt string pwd
|
sets the password and encode it
|
public void add folder group folder group fg folder group m get folder group fg get group id get folder groups remove m get folder groups add fg
|
adds a new element substituting a precedin one with the same group id
|
public group get user group if get groups null for group grp get groups if grp get name equals get user group name return grp return null
|
retrieves this users group
|
public void kill string session id user session session get session id if session null session set closed log warn killed session session id
|
kills an existing session
|
public void renew string session id if is valid session id get session id renew
|
renews an opened session
|
public boolean is valid string session id if get session id null return false else return get session id get status user session status open
|
checks if a sessions is valid or not
|
private boolean is expired user session session if session null session get status user session status open return true date last renew session get last renew int timeout 30 try context properties config new context properties if config get int session timeout 0 timeout config get int session timeout catch ioexception e date now new date long offset now get time last renew get time boolean expired offset timeout 60 1000 if expired session set expired return expired
|
checks if the session is expired
|
public date get password changed return password changed
|
when the password was modified
|
public int count opened int count 0 for user session session get sessions if is expired session count return count
|
counts the number of opened sessions
|
private void clean closed sessions list string garbage new array list string int counter 0 for user session session get sessions if session get status user session status open counter if counter max closed sessions garbage add session get id for string session id garbage remove session id
|
clean method that removes all closed sessions that exceed the number of
|
public void send email email string template name map string string args throws exception message template template template dao find by name and language template name email get locale to string if template null log error template template name was not found return email set subject template get formatted subject args email set message text template get formatted body args send email
|
sends an email by using a given template
|
public void create tumbnail document document throws ioexception create tumbnail document null
|
creates the thumbnail for the specified document
|
public void init init null
|
intitialises the database using db init extension point
|
private boolean exists string name class loader cl this get class get class loader try return cl get resource as stream name null catch throwable t return false
|
checks resource existence into the classpath
|
public void set user user user this user user set user id user get id set user name user get full name
|
this setter also sets the user id and user name
|
public int compare to version other return this get version to lower case compare to other get version to lower case
|
for sorting a list of version objects by the version number
|
public string get icon string icon icon selector select icon try icon icon selector select icon get file type catch exception e return icon
|
the icon for the document associated to the subscription
|
public string get path folder dao folder dao folder dao context get instance get bean folder dao class document dao doc dao document dao context get instance get bean document dao class return folder dao compute path extended doc dao find by id target id get folder get id
|
the path of the document associated to the bookmark
|
private void set bounds while start bounds length word delimiter filter is subword delim char type text start bounds start bounds while end bounds start bounds word delimiter filter is subword delim char type text end bounds 1 end bounds if ends with possessive end bounds has final possessive true current start bounds
|
set the internal word bounds remove leading and trailing delimiters
|
private boolean ends with possessive int pos return stem english possessive pos 2 text pos 2 text pos 1 s text pos 1 s word delimiter filter is alpha char type text pos 3 pos end bounds word delimiter filter is subword delim char type text pos
|
determines if the text at the given position indicates an english
|
private string parse document document doc string content null check if the document is a shortcut if doc get doc ref null long doc id doc get doc ref doc document dao find by id doc id parses the file where it is already stored locale locale doc get locale string resource storer get resource name doc null null parser parser parser factory get parser storer get stream doc get id resource doc get file name locale null and gets some fields if parser null content parser get content if content null content return content
|
retrieves the documents content as a string
|
public long get publisher id return publisher id
|
the user id of the user that published this document
|
public string get source author return source author
|
the author of the document form documents metadata
|
public date get source date return source date
|
the date of the document form documents metadata
|
public string get source type return source type
|
the type of the document form documents metadata
|
public string get coverage return coverage
|
the coverage of the document form documents metadata
|
public string get icon string icon icon selector select icon try string extension file name substring file name last index of 1 icon icon selector select icon extension catch exception e return icon
|
the icon for this document it may be kept from file name extension
|
public folder get folder return folder
|
retrieve the folder owning this document
|
public long get exec time return exec time
|
query execution time in milliseconds
|
public string get custom id return custom id
|
each document can be identified with a custom identifier
|
public int get immutable return immutable
|
defines if the document is immutable
|
public string get digest return digest
|
the documents digest
|
private boolean flush concatenation word delimiter concatenation concatenation last concat count concatenation subword count if concatenation subword count 1 should generate parts concatenation type concatenation write and clear return true concatenation clear return false
|
flushes the given word delimiter concatenation by either writing its concat
|
private void delete orphaned list long ids document dao find deleted doc ids indexer delete hits ids
|
removes from index all documents deleted in the database
|
public string get recipient return recipient
|
the documents recipient
|
private boolean should concatenate int word type return catenate words is alpha word type catenate numbers is digit word type
|
determines whether to concatenate a word or number if the current word is
|
private boolean should generate parts int word type return generate word parts is alpha word type generate number parts is digit word type
|
determines whether a word number part should be generated for a word of
|
public int get signed return signed
|
return 1 if the document was signed
|
private void concatenate word delimiter concatenation concatenation if concatenation is empty concatenation start offset saved start offset iterator current concatenation append saved buffer iterator current iterator end iterator current concatenation end offset saved start offset iterator end
|
concatenates the saved buffer to the given word delimiter concatenation
|
public string get file version return file version
|
the working file version
|
private void generate part boolean is single word clear attributes term attribute copy buffer saved buffer iterator current iterator end iterator current int start off set is single word has illegal offsets saved start offset iterator current saved start offset int end off set has illegal offsets saved end offset saved start offset iterator end offset attribute set offset start off set end off set pos inc attribute set position increment position false type attribute set type saved type
|
generates a word number part updating the appropriate attributes
|
private int position boolean inject int pos inc accum pos inc if has output token accum pos inc 0 return inject 0 math max 1 pos inc has output token true if has output following original the first token following the original is 0 regardless has output following original true return 0 clear the accumulated position increment accum pos inc 0 return math max 1 pos inc
|
get the position increment gap for a subword or concatenation
|
protected solr query prepare search query string expression string filters string expression language integer rows solr query query new solr query query set query expression if rows null query set rows rows if filters null query add filter query filters query set expr lang expression language return query
|
prepares the query for a search
|
public string get export version return export version
|
the last exported version
|
private void register task string task name add the sheduled trigger log info append the task task name to the scheduler context configurator context config new context configurator context config add trigger task name trigger
|
registers a single task
|
public void stop collection task tasks get tasks for task task tasks task interrupt boolean running true while running running false for task task tasks if task is running running true break try thread sleep 500 catch interrupted exception e log info all tasks are idle
|
stops all tasks and waits for them
|
public string get export name return export name
|
the last archive name in which the document was exported
|
protected void next set progress progress 1 reset the timeout lock manager get get name transaction id
|
increments the progress by one and performs a gc
|
public long get export id return export id
|
the last archive in which the document was exported
|
public long get progress return progress
|
the current processing step
|
public int get completion percentage if is indeterminate if get status status idle return 0 else return 1 else if size 0 return 0 return int math round double progress double size 100
|
the percentage of completion 1 100
|
public boolean is running return status status running
|
check if the task is currently running
|
public void save work by default do nothing
|
concrete implementations must insert here the code needed to save the
|
public long get max length return max length
|
the maximum duration expressed in seconds
|
protected string prepare report locale locale return null
|
implementations may compose a locale specific report
|
public file get container long doc id document dao doc dao document dao context get instance get bean document dao class document document doc dao find by id doc id if document null log warn document not found doc id return null if document get doc ref null the shortcut document doesn t have the fileversion and the version document doc dao find by id document get doc ref string relative path compute relative path doc id string path config get property with substitutions store 1 dir relative path return new file path
|
finds the container where all documents files are stored
|
public void load throws ioexception parse exception context properties config context properties context get instance get bean context properties class string enbl config get property schedule enabled task name this enabled true equals enbl set cron expression config get property schedule cron task name set mode config get property schedule mode task name try max length long parse long config get property schedule length task name interval long parse long config get property schedule interval task name delay long parse long config get property schedule delay task name catch exception e
|
loads scheduling configurations from persistent storage
|
public void save throws ioexception parse exception get scheduling save context properties config context properties context get instance get bean context properties class config set property task recipients name get report recipients config set property task sendreport name is send activity report true false config write
|
saves the task configuration
|
protected string compute relative path long doc id return string util split long to string doc id 3 doc
|
computes the relative path of a documents folder inside the storage
|
public byte array output stream process long doc ids byte array output stream bos new byte array output stream process doc ids bos return bos
|
exports a selection of documents
|
protected void append children folder folder int level if all level level 1 return else add folder documents folder folder dao folder dao folder dao context get instance get bean folder dao class collection folder children folder dao find by user id user id folder get id iterator folder iter children iterator while iter has next append children iter next level 1
|
adds all children of the specified folder up to the given level
|
public int get deleted return deleted
|
this flag is used to mark an object as deleted
|
protected boolean is start line string line lower case return false
|
determines whether the supplied line indicates the start of the textual contents
|
public string get content return content to string
|
returns the text content extracted from parsed content
|
public int fill byte array input stream in byte byte array throws ioexception int result 0 int bytes read in read byte array while bytes read 0 result bytes read if result byte array length break bytes read in read byte array result byte array length result return result
|
fills the supplied byte array with bytes read from the specified
|
public string get contents string tmp buffer to string if tmp null tmp length 1 tmp tmp replace all p blank tmp tmp replace all s return tmp
|
returns parsed content
|
public string get content string tmp content to string if tmp null tmp length 0 clean all the unwanted characters tmp tmp replace all return tmp
|
returns the text content extracted from parsed content
|
private void parse field pdfield field string s level string s parent throws ioexception list cosobjectable kids field get kids if kids null iterator cosobjectable kids iter kids iterator if s parent equals field get partial name s parent s parent field get partial name while kids iter has next object pdf obj kids iter next if pdf obj instanceof pdfield pdfield kid pdfield pdf obj parse field kid s level s parent else try if string utils is not empty field get value content append content append field get value catch throwable t
|
extracts the field contents populating the given buffer
|
private void destroy database connection con null if ds null return try con ds get connection con create statement execute shutdown immediately catch exception e e print stack trace finally try if con null con close catch exception ex ex print stack trace
|
destroys the in memory database
|
private void create test database throws exception ds data source context get bean data source connection con null try con ds get connection load schema sql file sql file new sql file db schema file cp1252 false sql file set connection con sql file execute load data sql file new sql file data file cp1252 false sql file set connection con sql file execute test the connection result set rs con create statement execute query select from ld menu where ld id 2 rs next assert assert equals 2 rs get int 1 finally if con null con close
|
creates an in memory test database
|
private string double slash string orig string buffer buf new string buffer for int i 0 i orig length i if orig char at i buf append else buf append orig char at i return buf to string
|
private method to double slash paths
|
public string get supported methods string buffer sb new string buffer super get supported methods versioning support sb append append versionable resource methods if is version controlled sb append append dav methods method checkout sb append append dav methods method uncheckout sb append append dav methods method label return sb to string
|
return a comma separated string listing the supported method names
|
public void add version control throws dav exception
|
adds version control to this resource
|
public multi status update update info update info throws dav exception throw new dav exception dav servlet response sc not implemented
|
update feature is not yet supported
|
public string get display name string res path get resource path return res path null text get name res path res path
|
returns the the last segment of the resource path
|
public multi status merge merge info merge info throws dav exception throw new dav exception dav servlet response sc not implemented
|
merge feature is not yet supported
|
public void put in cache dav session session dav resource resource try context properties config context properties context get instance get bean context properties class if true equals config get property webdav usecache initialize the collection of children cache cache cache manager context get instance get bean dav cache manager get cache dav resources element element new element session get object id resource get resource path resource cache put element catch throwable t
|
puts an entry in the cache
|
public void spool output context output context throws ioexception if exists output context null export context export ctx get export context output context if config get iomanager export content export ctx this throw new ioexception unexpected error while spooling resource
|
if this resource exists and the specified context is not
|
protected void init supported reports super init supported reports if exists supported reports add report type report type locate by history supported reports add report type report type version tree
|
define the set of reports supported by this resource
|
private dav resource get from cache dav session session string path context properties config context properties context get instance get bean context properties class if true equals config get property webdav usecache string key session get object id path cache cache cache manager context get instance get bean dav cache manager get cache dav resources element element cache get key dav resource resource null if element null resource dav resource element get value return resource else return null else return null
|
retrieves an entry from cache
|
protected dav resource locator get locator from resource resource resource string node path null try node path locator get resource path catch exception e throw new runtime exception e return get locator from node path node path
|
build a new
|
protected resource get resource return this resource
|
returns the current resource that holds this object
|
protected void do head webdav request request webdav response response dav resource resource throws ioexception log debug head spool resource request response resource false
|
the head method
|
protected void do get webdav request request webdav response response dav resource resource throws ioexception log debug get try spool resource request response resource true catch exception e e print stack trace
|
the get method
|
protected void do unlock webdav request request webdav response response dav resource resource throws dav exception get lock token from header try response send error dav servlet response sc not implemented catch ioexception e throw new dav exception dav servlet response sc internal server error
|
the unlock method
|
protected input context get input context dav servlet request request input stream in return new input context impl request in
|
return a new code input context code used for adding resource members
|
public object get bean string id return application context get bean id
|
retrieves a bean registered in the spring context
|
public object get bean class clazz string id clazz get name if application context contains bean id id id substring id last index of 1 return get bean id
|
retrieves a bean registered in the spring context using a class name
|
public resource get resource string resource location return this application context get resource resource location
|
returns a spring resource
|
public reader get reader input stream input stream f input stream if input stream null input stream new byte array input stream f raw input 0 f raw length try input stream reset return new input stream reader input stream get name catch ioexception e return null
|
create a java
|
public string get string throws java io ioexception return get string 1
|
create a java string from unicode character data corresponding
|
public charset detector set declared encoding string encoding f declared encoding encoding return this
|
set the declared encoding for charset detection
|
public string get string int max length throws java io ioexception string result null if f input stream null string buffer sb new string buffer char buffer new char 1024 reader reader get reader int max max length 0 integer max value max length int bytes read 0 while bytes read reader read buffer 0 math min max 1024 0 sb append buffer 0 bytes read max bytes read reader close return sb to string else result new string f raw input get name return result
|
create a java string from unicode character data corresponding
|
public int get confidence return f confidence
|
get an indication of the confidence in the charset detected
|
public charset detector set text string str byte ba str get bytes f raw input ba f raw length ba length munge input return this
|
set the input text byte data whose charset is to be detected
|
private void load url docname throws ioexception try doc path urldecoder decode docname get path utf 8 catch ioexception e log error unable to read from doc path e throw e try load new file input stream doc path catch ioexception e log error unable to read from doc path e throw e
|
loads the file from the given url
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.