idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
12,200
public static void addDeepLogger ( Object object , Level level ) { addDeepLogger ( object , m -> logger . log ( level , m ) ) ; }
Attaches a deep property change listener to the given object that generates logging information about the property change events and prints them as log messages .
12,201
public static void addDeepConsoleLogger ( Object object ) { addDeepLogger ( object , m -> System . out . println ( m ) ) ; }
Attaches a deep property change listener to the given object that generates logging information about the property change events and prints them to the standard output .
12,202
public static void addDeepLogger ( Object object , Consumer < ? super String > consumer ) { Objects . requireNonNull ( consumer , "The consumer may not be null" ) ; PropertyChangeListener propertyChangeListener = new PropertyChangeListener ( ) { public void propertyChange ( PropertyChangeEvent event ) { Object source =...
Attaches a deep property change listener to the given object that generates logging information about the property change events and passes them to the given consumer .
12,203
private static String createLoggingString ( Object object ) { if ( object == null ) { return "null" ; } Class < ? extends Object > objectClass = object . getClass ( ) ; if ( ! objectClass . isArray ( ) ) { return String . valueOf ( object ) ; } StringBuilder sb = new StringBuilder ( ) ; int length = Array . getLength (...
Create a string suitable for logging the given object
12,204
public static void removeDeepPropertyChangeListener ( Object object , PropertyChangeListener propertyChangeListener ) { Objects . requireNonNull ( object , "The object may not be null" ) ; Objects . requireNonNull ( propertyChangeListener , "The propertyChangeListener may not be null" ) ; removeRecursive ( object , pro...
Remove the given property change listener from the given object and all its sub - objects .
12,205
private static void removeRecursive ( Object object , PropertyChangeListener propertyChangeListener ) { removeRecursive ( object , propertyChangeListener , new LinkedHashSet < Object > ( ) ) ; }
Recursively remove the given property change listener from the given object and all its sub - objects
12,206
public Translator < T > copy ( ) { Translator < T > trans = new Translator < T > ( ) ; if ( isBundleBased ( ) ) { for ( Translation < T > t : values ( ) ) { Locale loc = t . getLocale ( ) ; trans . store ( loc , t . getData ( ) ) ; } } else { for ( String lang : translations . keySet ( ) ) { Map < String , Translation ...
Copies the current translator into a new translator object . Even if this translator is resource bundle based the copy will not be .
12,207
private void cut ( XYChartLabel label , double maxWidth , double maxHeight , double rotation ) { String text = label . getLabel ( ) . getText ( ) ; cutLabelText ( label , maxWidth - 5 , maxHeight - 5 , rotation ) ; String cutText = label . getLabel ( ) . getText ( ) ; if ( text . length ( ) != cutText . length ( ) ) { ...
Formats the label Text shapes in the given axis by cutting text value .
12,208
public static Object newInstance ( Object obj ) { if ( MjdbcLogger . isSLF4jAvailable ( ) == true && MjdbcLogger . isSLF4jImplementationAvailable ( ) == false ) { return obj ; } else { if ( MjdbcConfig . isProfilerEnabled ( ) == true ) { return java . lang . reflect . Proxy . newProxyInstance ( obj . getClass ( ) . get...
Function wraps Object into Profiling Java Proxy . Used to wrap QueryRunner instance with Java Proxy
12,209
public FoxHttpResponse execute ( FoxHttpClient foxHttpClient ) throws FoxHttpException { verifyRequest ( ) ; foxHttpClient . getFoxHttpLogger ( ) . log ( "========= Request =========" ) ; foxHttpClient . getFoxHttpLogger ( ) . log ( "setFoxHttpClient(" + foxHttpClient + ")" ) ; this . foxHttpClient = foxHttpClient ; re...
Execute a this request
12,210
public String getCommand ( final ToastrSettings settings ) { final StringBuilder sb = new StringBuilder ( ) ; sb . append ( "toastr." ) ; sb . append ( settings . getToastrType ( ) . getValue ( ) . getValue ( ) ) ; sb . append ( "('" ) ; sb . append ( settings . getNotificationContent ( ) . getValue ( ) ) ; sb . append...
Gets the command .
12,211
public Set < String > getVisibleQueues ( PermissionManager permissionManager ) { Set < String > ret = new HashSet < String > ( ) ; for ( QueueDefinition queueDefinition : m_queues ) { if ( permissionManager . hasPermission ( FixedPermissions . ADMIN ) ) { ret . add ( queueDefinition . getName ( ) ) ; continue ; } if ( ...
Get the list of queues visible to this user ie to the user with the permissions defined in the given permissions manager . ADMIN permission means all are visible .
12,212
public Filter getQueueFilter ( PermissionManager permissionManager ) { if ( permissionManager . hasPermission ( FixedPermissions . TECHSUPPORT ) || permissionManager . hasPermission ( FixedPermissions . ADMIN ) ) { return null ; } Set < String > visibleQueues = getVisibleQueues ( permissionManager ) ; Filter filters [ ...
If we have the TECHSUPPORT or ADMIN permission then return null . Those users can see everything so no filter required . For the rest we only display queues they have permission to see and only processes in WAIT status .
12,213
public Set < ProcessDefinition > getVisibleProcesses ( PermissionManager permissionManager ) { Set < ProcessDefinition > ret = new HashSet < > ( ) ; Set < String > queues = getWriteableQueues ( permissionManager ) ; String lastProcessName = "" ; for ( ProcessDefinition processDefinition : m_processes ) { String process...
Get the list of queues visible to this user ie to the user with the permissions defined in the given permissions manager
12,214
public DataType < Boolean > getType ( String grp , Number idx , boolean ml , boolean mv , boolean req , String ... params ) { return new BooleanAttribute ( grp , idx , ml , mv , req ) ; }
Technically you can have a multi - lingual or multi - valued boolean but why would you?
12,215
public void joinThread ( long timeout ) { Thread local_thread_ref = thread ; if ( local_thread_ref != null ) { try { long millis = 0l ; if ( log . isDebugEnabled ( ) ) { log . debug ( "BackgroundProcess.joinThread() Waiting " + timeout + " millis for " + this + " to finish" ) ; millis = System . currentTimeMillis ( ) ;...
Inactivively waits for the process to finish or until timeout occurs whichever is earlier . If the process was not running returns immediatelly .
12,216
public void addHeader ( Map < String , String > entries ) { for ( Map . Entry < String , String > entry : entries . entrySet ( ) ) { headerEntries . add ( new HeaderEntry ( entry . getKey ( ) , entry . getValue ( ) ) ) ; } }
Add a new map of header entries
12,217
public HeaderEntry getHeader ( String name ) { for ( HeaderEntry headerField : getHeaderEntries ( ) ) { if ( headerField . getName ( ) . equals ( name ) ) { return headerField ; } } return null ; }
Get a specific header based on its name
12,218
public static PropertyDescriptor [ ] propertyDescriptors ( Class < ? > clazz ) { BeanInfo beanInfo = null ; try { beanInfo = Introspector . getBeanInfo ( clazz ) ; } catch ( IntrospectionException ex ) { throw new IllegalArgumentException ( "Bean introspection failed: " + ex . getMessage ( ) ) ; } return beanInfo . get...
Reads property descriptors of class
12,219
public static Map < String , PropertyDescriptor > mapPropertyDescriptors ( Class < ? > clazz ) { PropertyDescriptor [ ] properties = propertyDescriptors ( clazz ) ; Map < String , PropertyDescriptor > mappedProperties = new HashMap < String , PropertyDescriptor > ( ) ; for ( PropertyDescriptor property : properties ) {...
Reads property descriptors of class and puts them into Map . Key for map is read from property descriptor .
12,220
public static Object callGetter ( Object target , PropertyDescriptor prop ) { Object result = null ; Method getter = prop . getReadMethod ( ) ; if ( getter == null ) { throw new RuntimeException ( "No read method for bean property " + target . getClass ( ) + " " + prop . getName ( ) ) ; } try { result = getter . invoke...
Invokes Property Descriptor Getter and returns value returned by that function .
12,221
public static List < QueryParameters > convertResultSet ( ResultSet rs ) throws SQLException { List < QueryParameters > result = new ArrayList < QueryParameters > ( ) ; String columnName = null ; while ( rs . next ( ) == true ) { QueryParameters params = new QueryParameters ( ) ; ResultSetMetaData rsmd = rs . getMetaDa...
Converts java . sql . ResultSet into List of QueryParameters . Used for caching purposes to allow ResultSet to be closed and disposed .
12,222
public static < T > T newInstance ( Class < T > clazz ) throws MjdbcException { try { return clazz . newInstance ( ) ; } catch ( InstantiationException ex ) { throw new MjdbcException ( "Failed to create instance: " + clazz . getName ( ) + " - " + ex . getMessage ( ) ) ; } catch ( IllegalAccessException ex ) { throw ne...
Creates new Instance of class specified . Default Constructor should be visible in order to create new Instance
12,223
public static boolean hasFunction ( Object object , String functionName , Class [ ] parameters ) { boolean result = false ; try { Method method = object . getClass ( ) . getMethod ( functionName , parameters ) ; if ( method != null ) { result = true ; } } catch ( NoSuchMethodException ex ) { result = false ; } return r...
Checks if Instance has specified function
12,224
public static boolean objectInstanceOf ( Object object , String className ) { AssertUtils . assertNotNull ( object ) ; boolean result = false ; Class clazz = object . getClass ( ) ; if ( clazz . getName ( ) . equals ( className ) == true ) { result = true ; } return result ; }
Checks if instance is of specified class
12,225
public static boolean objectAssignableTo ( Object object , String className ) throws MjdbcException { AssertUtils . assertNotNull ( object ) ; boolean result = false ; Class clazz = null ; try { clazz = Class . forName ( className ) ; } catch ( ClassNotFoundException ex ) { throw new MjdbcException ( ex ) ; } result = ...
Checks if instance can be cast to specified Class
12,226
public static Object returnStaticField ( Class clazz , String fieldName ) throws MjdbcException { Object result = null ; Field field = null ; try { field = clazz . getField ( fieldName ) ; result = field . get ( null ) ; } catch ( NoSuchFieldException ex ) { throw new MjdbcException ( ex ) ; } catch ( IllegalAccessExce...
Returns class static field value Is used to return Constants
12,227
public static Object returnField ( Object object , String fieldName ) throws MjdbcException { AssertUtils . assertNotNull ( object ) ; Object result = null ; Field field = null ; try { field = object . getClass ( ) . getField ( fieldName ) ; result = field . get ( object ) ; } catch ( NoSuchFieldException ex ) { throw ...
Returns class field value Is used to return Constants
12,228
public static boolean isPrimitive ( Object value ) { if ( value == null ) { return true ; } else if ( value . getClass ( ) . isPrimitive ( ) == true ) { return true ; } else if ( Integer . class . isInstance ( value ) ) { return true ; } else if ( Long . class . isInstance ( value ) ) { return true ; } else if ( Double...
Checks is value is of Primitive type
12,229
public static Builder running ( File executable ) { checkArgument ( executable . isFile ( ) , "file not found: %s" , executable ) ; checkArgument ( executable . canExecute ( ) , "executable.canExecute" ) ; return running ( executable . getPath ( ) ) ; }
Constructs a builder instance that will produce a program that launches the given executable . Checks that a file exists at the given pathname and that it is executable by the operating system .
12,230
@ SuppressWarnings ( "unchecked" ) public < T > T parseInterface ( final Class < T > serviceInterface , FoxHttpClient foxHttpClient ) throws FoxHttpException { try { Method [ ] methods = serviceInterface . getDeclaredMethods ( ) ; for ( Method method : methods ) { FoxHttpMethodParser foxHttpMethodParser = new FoxHttpMe...
Parse the given interface for the use of FoxHttp
12,231
public Queue < B > newQueue ( ) { return new Queue < B > ( parent_queue , queue_restriction , index , process_builder_class , process_server_class , default_occurence , default_visibility , default_access , default_resilience , default_output , implementation_options ) ; }
Create the new Queue using the currently set properties .
12,232
protected T updateBean ( T object , Map < String , Object > source ) { T clone = copyProperties ( object ) ; updateProperties ( clone , source ) ; return clone ; }
Updates bean with values from source .
12,233
private T createEmpty ( Class < ? > clazz ) { T emptyInstance = null ; if ( clazz . isInterface ( ) ) { throw new IllegalArgumentException ( "Specified class is an interface: " + clazz . getName ( ) ) ; } try { emptyInstance = ( T ) clazz . newInstance ( ) ; } catch ( InstantiationException ex ) { throw new IllegalArgu...
Creates new empty Bean instance
12,234
public static < C > Module configModuleWithOverrides ( final Class < C > configInterface , OverrideConsumer < C > overrideConsumer ) { checkNotNull ( configInterface ) ; checkNotNull ( overrideConsumer ) ; return configModuleWithOverrides ( configInterface , Optional . empty ( ) , Optional . ofNullable ( overrideConsum...
Generates a Guice Module for use with Injector creation . THe generate Guice module binds a number of support classes to service a dynamically generate implementation of the provided configuration interface . This method further overrides the annotated defaults on the configuration class as per the code in the given ov...
12,235
public static < C > Module configModuleWithOverrides ( final Class < C > configInterface , Named name , OverrideConsumer < C > overrideConsumer ) { checkNotNull ( configInterface ) ; checkNotNull ( name ) ; checkNotNull ( overrideConsumer ) ; return configModuleWithOverrides ( configInterface , Optional . ofNullable ( ...
Generates a Guice Module for use with Injector creation . The generate Guice module binds a number of support classes to service a dynamically generate implementation of the provided configuration interface . This method further overrides the annotated defaults on the configuration class as per the code in the given ov...
12,236
public static CompositeConfiguration getConfig ( ) { if ( config == null ) { config = new CompositeConfiguration ( ) ; String configFile = "bard.properties" ; if ( Util . class . getClassLoader ( ) . getResource ( configFile ) == null ) { return config ; } try { config . addConfiguration ( new PropertiesConfiguration (...
Get the Bard config object . The properties is set in bard . properties .
12,237
public static String [ ] encrypt ( String password ) { SecureRandom random = new SecureRandom ( ) ; String salt = new BigInteger ( 130 , random ) . toString ( 32 ) ; String encryptPassword = encrypt ( password , salt ) ; return new String [ ] { encryptPassword , salt } ; }
Encrypt a password string with a random generated salt .
12,238
public static String encrypt ( String password , String salt ) { String saltPassword = password + salt ; return DigestUtils . sha256Hex ( saltPassword . getBytes ( ) ) ; }
Encrypt a password string with a given password .
12,239
@ SuppressWarnings ( "unused" ) private boolean checkSwf ( ) throws IOException { byte [ ] a = new byte [ 6 ] ; if ( read ( a ) != a . length ) { return false ; } format = FORMAT_SWF ; int bitSize = ( int ) readUBits ( 5 ) ; int minX = ( int ) readSBits ( bitSize ) ; int maxX = ( int ) readSBits ( bitSize ) ; int minY ...
Written by Michael Aird .
12,240
public String getComment ( int index ) { if ( comments == null || index < 0 || index >= comments . size ( ) ) { throw new IllegalArgumentException ( "Not a valid comment index: " + index ) ; } return ( String ) comments . get ( index ) ; }
Returns the index th comment retrieved from the image .
12,241
public static synchronized Document getDefaultDocument ( ) { if ( defaultDocument == null ) { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder documentBuilder = null ; try { documentBuilder = documentBuilderFactory . newDocumentBuilder ( ) ; } catch ( ParserConf...
Returns a default XML document
12,242
private static void write ( Node node , Writer writer , int indentation , boolean omitXmlDeclaration ) { TransformerFactory transformerFactory = TransformerFactory . newInstance ( ) ; if ( indentation > 0 ) { transformerFactory . setAttribute ( "indent-number" , indentation ) ; } Transformer transformer = null ; try { ...
Writes a formatted String representation of the given XML node to the given writer .
12,243
public static Node read ( InputStream inputStream ) throws XmlException { try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder documentBuilder = documentBuilderFactory . newDocumentBuilder ( ) ; Document document = documentBuilder . parse ( inputStream ) ; Nod...
Creates an XML node by reading the contents of the given input stream .
12,244
public static String getAttributeValue ( Node node , String attributeName , String defaultValue ) { NamedNodeMap attributes = node . getAttributes ( ) ; Node attributeNode = attributes . getNamedItem ( attributeName ) ; if ( attributeNode == null ) { return defaultValue ; } String value = attributeNode . getNodeValue (...
Returns the attribute with the given name from the given node . If the respective attribute could not be obtained the given default value will be returned
12,245
public static String getRequiredAttributeValue ( Node node , String attributeName ) { NamedNodeMap attributes = node . getAttributes ( ) ; Node attributeNode = attributes . getNamedItem ( attributeName ) ; if ( attributeNode == null ) { throw new XmlException ( "No attribute with name \"" + attributeName + "\" found" )...
Returns the attribute with the given name from the given node .
12,246
static < T > T resolveAttributeFromMap ( Node node , String attributeName , Map < String , ? extends T > map ) { String id = XmlUtils . getAttributeValue ( node , attributeName , null ) ; if ( id == null ) { throw new XmlException ( "No attribute \"" + attributeName + "\" found" ) ; } T result = map . get ( id ) ; if (...
Resolve the value in the given map whose key is the value of the specified attribute .
12,247
static int readInt ( Node node ) { if ( node == null ) { throw new XmlException ( "Tried to read int value from null node" ) ; } String value = node . getFirstChild ( ) . getNodeValue ( ) ; if ( value == null ) { throw new XmlException ( "Tried to read int value from null value" ) ; } try { return Integer . parseInt ( ...
Parse an int value from the first child of the given node .
12,248
static double readDouble ( Node node ) { if ( node == null ) { throw new XmlException ( "Tried to read double value from null node" ) ; } String value = node . getFirstChild ( ) . getNodeValue ( ) ; if ( value == null ) { throw new XmlException ( "Tried to read double value from null value" ) ; } try { return Double . ...
Parse a double value from the first child of the given node .
12,249
static boolean readBoolean ( Node node ) { if ( node == null ) { throw new XmlException ( "Tried to read boolean value from null node" ) ; } String value = node . getFirstChild ( ) . getNodeValue ( ) ; return Boolean . parseBoolean ( value ) ; }
Parse a boolean value from the first child of the given node .
12,250
static < E extends Enum < E > > E readEnum ( Node node , Class < E > enumClass ) { if ( node == null ) { throw new XmlException ( "Tried to read " + enumClass . getSimpleName ( ) + " value from null node" ) ; } String value = node . getFirstChild ( ) . getNodeValue ( ) ; if ( value == null ) { throw new XmlException ( ...
Parse an enum value from the first child of the given node .
12,251
public static int readIntChild ( Node node , String childNodeName , int defaultValue ) { if ( node == null ) { throw new XmlException ( "Tried to read int value from child of null node" ) ; } Node child = XmlUtils . getFirstChild ( node , childNodeName ) ; if ( child == null ) { return defaultValue ; } return XmlUtils ...
Read an int value from the first child of the given node with the given name . If no such child is found then the default value will be returned .
12,252
static double readDoubleChild ( Node node , String childNodeName , double defaultValue ) { if ( node == null ) { throw new XmlException ( "Tried to read double value from child of null node" ) ; } Node child = XmlUtils . getFirstChild ( node , childNodeName ) ; if ( child == null ) { return defaultValue ; } return XmlU...
Read a double value from the first child of the given node with the given name . If no such child is found then the default value will be returned .
12,253
public static boolean readBooleanChild ( Node node , String childNodeName , boolean defaultValue ) { if ( node == null ) { throw new XmlException ( "Tried to read boolean value from child of null node" ) ; } Node child = XmlUtils . getFirstChild ( node , childNodeName ) ; if ( child == null ) { return defaultValue ; } ...
Read an boolean value from the first child of the given node with the given name . If no such child is found then the default value will be returned .
12,254
public static < E extends Enum < E > > E readEnumChild ( Node node , Class < E > enumClass , String childNodeName ) { if ( node == null ) { throw new XmlException ( "Tried to read enum value from child of null node" ) ; } Node child = XmlUtils . getFirstChild ( node , childNodeName ) ; return XmlUtils . readEnum ( chil...
Parse an enum value from the first child of the given node with the given name
12,255
protected void validateSqlString ( String originalSql ) { if ( originalSql == null ) { throw new IllegalArgumentException ( ERROR_SQL_QUERY_NULL ) ; } if ( processor . hasUnnamedParameters ( originalSql ) == true ) { throw new IllegalArgumentException ( ERROR_FOUND_UNNAMED_PARAMETER ) ; } }
Checks if original SQL string valid . If string contains some unnamed ? parameters - it is considered unvalid
12,256
public ProcessInstance lockProcessInstance ( final ProcessInstance processInstance , final boolean techSupport , final String userName ) { List < Lock > locks = ContextUtils . getLocks ( processInstance , getLockFactory ( ) , "nz.co.senanque.workflow.WorkflowClient.lock(ProcessInstance)" ) ; LockTemplate lockTemplate =...
This manages the transition of the process instance from Waiting to Busy with appropriate locking and unlocking . Once it is busy it is ours but we have to check that it was not changed since we last saw it . The situation we are protecting against is that although the process instance looked to be in wait state in the...
12,257
protected TaskBase endOfProcessDetected ( ProcessInstance processInstance , Audit currentAudit ) { TaskBase ret = null ; TaskBase currentTask = getCurrentTask ( processInstance ) ; ProcessInstanceUtils . clearQueue ( processInstance , TaskStatus . DONE ) ; currentAudit . setStatus ( TaskStatus . DONE ) ; { List < Audit...
If this is just the end of the handler then return the next task after the handler If it is the end of the whole process then return null .
12,258
public void init ( ) { findBeans ( ) ; SAXBuilder builder = new SAXBuilder ( ) ; Document doc = null ; try { doc = builder . build ( getSchema ( ) . getInputStream ( ) ) ; SchemaParserImpl schemaParser = new SchemaParserImpl ( ) ; schemaParser . parse ( doc ) ; ParserSource parserSource = new InputStreamParserSource ( ...
Scan resources for workflow files and message definitions
12,259
public static int getFacetMarker ( OWLFacet facet ) { switch ( facet ) { case LENGTH : return 0 ; case MIN_LENGTH : return 1 ; case MAX_LENGTH : return 2 ; case PATTERN : return 3 ; case MIN_INCLUSIVE : return 4 ; case MIN_EXCLUSIVE : return 5 ; case MAX_INCLUSIVE : return 6 ; case MAX_EXCLUSIVE : return 7 ; case TOTAL...
Gets the facet marker for a given facet .
12,260
public static String hash ( Serializable obj ) { if ( obj == null ) { return "" ; } StringBuilder hexString = new StringBuilder ( ) ; try { MessageDigest m = MessageDigest . getInstance ( "SHA1" ) ; m . update ( SerializationUtils . serialize ( obj ) ) ; byte [ ] mdbytes = m . digest ( ) ; for ( byte mdbyte : mdbytes )...
Create a hash of a serializable object
12,261
public static < T > List < T > toList ( Iterable < T > iterable ) { Objects . requireNonNull ( iterable , "The iterable is null" ) ; return Iterables . toCollection ( iterable , new ArrayList < T > ( ) ) ; }
Drains all elements that are provided by the iterator of the given iterable into a list
12,262
public static < T > Set < T > toSet ( Iterable < T > iterable ) { Objects . requireNonNull ( iterable , "The iterable is null" ) ; return Iterables . toCollection ( iterable , new LinkedHashSet < T > ( ) ) ; }
Drains all elements that are provided by the iterator of the given iterable into a set
12,263
public static < T , C extends Collection < ? super T > > C toCollection ( Iterable < T > iterable , C collection ) { Objects . requireNonNull ( iterable , "The iterable is null" ) ; Objects . requireNonNull ( collection , "The collection is null" ) ; return Iterators . toCollection ( iterable . iterator ( ) , collectio...
Drains all elements that are provided by the iterator of the given iterable into the given collection
12,264
public static < T > Iterable < T > iterableOverIterables ( final Iterable < ? extends Iterable < ? extends T > > iterablesIterable ) { Objects . requireNonNull ( iterablesIterable , "The iterablesIterable is null" ) ; return new Iterable < T > ( ) { public Iterator < T > iterator ( ) { return Iterators . iteratorOverIt...
Returns an iterator that combines the iterators that are provided by the iterables that are provided by the iterator of the given iterable . Fancy stuff he?
12,265
public static < S , T > Iterable < T > transformingIterable ( final Iterable < ? extends S > iterable , final Function < S , ? extends T > function ) { Objects . requireNonNull ( iterable , "The iterable is null" ) ; Objects . requireNonNull ( function , "The function is null" ) ; return new Iterable < T > ( ) { public...
Returns an iterable that provides iterators that are transforming the elements provided by the iterators of the given iterable using the given function
12,266
public static < T > Iterable < T > filteringIterable ( final Iterable < ? extends T > iterable , final Predicate < ? super T > predicate ) { Objects . requireNonNull ( iterable , "The iterable is null" ) ; Objects . requireNonNull ( predicate , "The predicate is null" ) ; return new Iterable < T > ( ) { public Iterator...
Returns an iterable that provides an iterator that only returns the elements provided by the iterator of the given iterable to which the given predicate applies .
12,267
@ SuppressWarnings ( "unchecked" ) public < T > T get ( ) { return ( T ) ( this . isString ? ( String ) this . value : ( Number ) this . value ) ; }
Returns the value of attribute
12,268
public void del ( final OnItemSnapshot onItemSnapshot , final OnError onError ) { TableMetadata tm = context . getTableMeta ( this . table . name ) ; if ( tm == null ) { this . table . meta ( new OnTableMetadata ( ) { public void run ( TableMetadata tableMetadata ) { _del ( onItemSnapshot , onError ) ; } } , onError ) ...
Deletes an item specified by this reference
12,269
public ItemRef get ( final OnItemSnapshot onItemSnapshot , final OnError onError ) { TableMetadata tm = context . getTableMeta ( this . table . name ) ; if ( tm == null ) { this . table . meta ( new OnTableMetadata ( ) { public void run ( TableMetadata tableMetadata ) { _get ( onItemSnapshot , onError , false ) ; } } ,...
Gets an item snapshot specified by this item reference .
12,270
public ItemRef set ( final LinkedHashMap < String , ItemAttribute > item , final OnItemSnapshot onItemSnapshot , final OnError onError ) { TableMetadata tm = context . getTableMeta ( this . table . name ) ; if ( tm == null ) { this . table . meta ( new OnTableMetadata ( ) { public void run ( TableMetadata tableMetadata...
Updates the stored item specified by this item reference .
12,271
public ItemRef once ( StorageEvent eventType , final OnItemSnapshot onItemSnapshot ) { return once ( eventType , onItemSnapshot , null ) ; }
Attach a listener to run the callback only one the event type occurs for this item .
12,272
public ItemRef off ( StorageEvent eventType , OnItemSnapshot onItemSnapshot ) { Event ev = new Event ( eventType , this . table . name , this . primaryKeyValue , this . secondaryKeyValue , false , false , false , onItemSnapshot ) ; context . removeEvent ( ev ) ; return this ; }
Remove an event listener
12,273
public ItemRef incr ( final String property , final Number value , final OnItemSnapshot onItemSnapshot , final OnError onError ) { TableMetadata tm = context . getTableMeta ( this . table . name ) ; if ( tm == null ) { this . table . meta ( new OnTableMetadata ( ) { public void run ( TableMetadata tableMetadata ) { _in...
Increments a given attribute of an item . If the attribute doesn t exist it is set to zero before the operation .
12,274
public ItemRef incr ( final String property , final OnItemSnapshot onItemSnapshot , final OnError onError ) { return this . incr ( property , null , onItemSnapshot , onError ) ; }
Increments by one a given attribute of an item . If the attribute doesn t exist it is set to zero before the operation .
12,275
public ItemRef disablePushNotifications ( ) { pushNotificationsEnabled = false ; Event ev = new Event ( null , this . table . name , this . primaryKeyValue , this . secondaryKeyValue , false , false , pushNotificationsEnabled , null ) ; ArrayList < String > channels = new ArrayList < String > ( ) ; channels . add ( ev ...
Disables mobile push notifications for current item reference .
12,276
public List < QueryParameters > subListCached ( int fromIndex , int toIndex ) { ArrayList < QueryParameters > result = new ArrayList < QueryParameters > ( ) ; result . addAll ( generatedCacheMap . values ( ) ) ; result . addAll ( resultSetCacheMap . values ( ) ) ; return result . subList ( fromIndex , toIndex ) ; }
Returns sublist of cached elements .
12,277
public Iterator < QueryParameters > iterator ( ) { final QueryParametersLazyList source = this ; return new Iterator < QueryParameters > ( ) { private LazyCacheIterator < QueryParameters > lazyCacheIterator = source . getLazyCacheIterator ( - 1 ) ; public boolean hasNext ( ) { return lazyCacheIterator . hasNext ( ) ; }...
Returns iterator of this lazy query output list implementation . First element returned - is header . Actual values are returned only starting from second element .
12,278
public QueryParameters set ( int index , QueryParameters element ) { QueryParameters params = null ; if ( getMaxCacheSize ( ) != - 1 ) { throw new MjdbcRuntimeException ( ERROR_NOT_ALLOWED + ". Cache update is allowed when Cache is not limited (used by Cached output handlers)" ) ; } if ( valueCached ( index ) == true )...
Sets value in cache . Please be aware that currently cache only is updated . No changes to Database are made
12,279
public QueryParameters update ( int index , QueryParameters params ) throws SQLException { AssertUtils . assertNotNull ( params , "Element cannot be null, but values inside of it - can" ) ; if ( this . type == Type . READ_ONLY_FORWARD || this . type == Type . READ_ONLY_SCROLL ) { throw new MjdbcSQLException ( "This Laz...
Updates specified row in ResultSet
12,280
public void insert ( QueryParameters params ) throws SQLException { getCurrentResultSet ( ) . moveToInsertRow ( ) ; updateResultSetCurrentLine ( getCurrentResultSet ( ) , params ) ; getCurrentResultSet ( ) . insertRow ( ) ; getCurrentResultSet ( ) . moveToCurrentRow ( ) ; }
Inserts new row into returned ResultSet
12,281
private void closeResultSet ( ResultSet rs ) { if ( closedResultSet . contains ( rs ) == false ) { MjdbcUtils . closeQuietly ( rs ) ; closedResultSet . add ( rs ) ; } }
Silently closes supplied result set
12,282
private StatementHandler getStatementHandler ( Class < ? extends StatementHandler > statementHandlerClazz ) { StatementHandler result = null ; Constructor < ? extends StatementHandler > constructor = null ; Class < ? extends StatementHandler > clazz = statementHandlerClazz ; try { constructor = clazz . getConstructor (...
Creates new StatementHandler instance
12,283
private static Integer checkQuietly ( final String name , final Integer value ) { Integer val = 50 ; try { val = Args . withinRange ( 0 , 100 , value , name ) ; } catch ( final IllegalArgumentException e ) { LOGGER . error ( String . format ( "Given argument '%s' must have a value within [%s,%s], but was %s. Default va...
Checks the given value if it is between 0 to 100 quietly . If not a default value from 50 will be set .
12,284
private Integer checkString ( final String value ) { Integer val = 50 ; if ( value != null && ! value . isEmpty ( ) ) { if ( value . endsWith ( "%" ) ) { final String sVal = value . substring ( 0 , value . length ( ) - 1 ) ; if ( StringUtils . isNumeric ( sVal ) ) { val = Integer . valueOf ( sVal ) ; } } else { if ( St...
Check string .
12,285
private String getPercentFormatted ( final Integer value ) { final Integer val = checkQuietly ( getName ( ) , value ) ; return NumberFormat . getPercentInstance ( ) . format ( ( double ) val / 100 ) ; }
Gets the percent formatted .
12,286
private void initializeProperties ( Class < ? > type , Object oldInstance , Encoder encoder ) { BeanInfo info = null ; try { info = Introspector . getBeanInfo ( type ) ; } catch ( IntrospectionException ie ) { encoder . getExceptionListener ( ) . exceptionThrown ( ie ) ; return ; } PropertyDescriptor [ ] pds = info . g...
Write all statements to initialize the properties of the given Java Bean Type based on the given instance using the given encoder
12,287
private void initializeProperty ( Class < ? > type , PropertyDescriptor pd , Object oldInstance , Encoder encoder ) throws Exception { Method getter = pd . getReadMethod ( ) ; Method setter = pd . getWriteMethod ( ) ; if ( getter != null && setter != null ) { Expression oldGetExpression = new Expression ( oldInstance ,...
Write the statement to initialize the specified property of the given Java Bean Type based on the given instance using the given encoder
12,288
public List < RTMovie > getInTheaters ( String country ) throws RottenTomatoesException { return getInTheaters ( country , DEFAULT_PAGE , DEFAULT_PAGE_LIMIT ) ; }
Retrieves movies currently in theaters
12,289
public List < RTMovie > getUpcomingMovies ( String country ) throws RottenTomatoesException { return getUpcomingMovies ( country , DEFAULT_PAGE , DEFAULT_PAGE_LIMIT ) ; }
Retrieves upcoming movies
12,290
public List < RTMovie > getTopRentals ( String country , int limit ) throws RottenTomatoesException { properties . clear ( ) ; properties . put ( ApiBuilder . PROPERTY_URL , URL_TOP_RENTALS ) ; properties . put ( ApiBuilder . PROPERTY_LIMIT , ApiBuilder . validateLimit ( limit ) ) ; properties . put ( ApiBuilder . PROP...
Retrieves the current top DVD rentals
12,291
public List < RTMovie > getNewReleaseDvds ( String country ) throws RottenTomatoesException { return getNewReleaseDvds ( country , DEFAULT_PAGE , DEFAULT_PAGE_LIMIT ) ; }
Retrieves new release DVDs
12,292
public RTMovie getDetailedInfo ( int movieId ) throws RottenTomatoesException { properties . clear ( ) ; properties . put ( ApiBuilder . PROPERTY_ID , String . valueOf ( movieId ) ) ; properties . put ( ApiBuilder . PROPERTY_URL , URL_MOVIES_INFO ) ; return response . getResponse ( RTMovie . class , properties ) ; }
Detailed information on a specific movie specified by Id .
12,293
public List < RTCast > getCastInfo ( int movieId ) throws RottenTomatoesException { properties . clear ( ) ; properties . put ( ApiBuilder . PROPERTY_ID , String . valueOf ( movieId ) ) ; properties . put ( ApiBuilder . PROPERTY_URL , URL_CAST_INFO ) ; WrapperLists wrapper = response . getResponse ( WrapperLists . clas...
Pulls the complete movie cast for a movie
12,294
public List < RTClip > getMovieClips ( int movieId ) throws RottenTomatoesException { properties . clear ( ) ; properties . put ( ApiBuilder . PROPERTY_ID , String . valueOf ( movieId ) ) ; properties . put ( ApiBuilder . PROPERTY_URL , URL_MOVIE_CLIPS ) ; WrapperLists wrapper = response . getResponse ( WrapperLists . ...
Related movie clips and trailers for a movie
12,295
public List < RTMovie > getMoviesSimilar ( int movieId , int limit ) throws RottenTomatoesException { properties . clear ( ) ; properties . put ( ApiBuilder . PROPERTY_ID , String . valueOf ( movieId ) ) ; properties . put ( ApiBuilder . PROPERTY_URL , URL_MOVIES_SIMILAR ) ; properties . put ( ApiBuilder . PROPERTY_LIM...
Returns similar movies to a movie
12,296
public RTMovie getMoviesAlias ( String altMovieId , String type ) throws RottenTomatoesException { properties . clear ( ) ; properties . put ( ApiBuilder . PROPERTY_URL , URL_MOVIES_ALIAS ) ; if ( "imdb" . equalsIgnoreCase ( type ) && altMovieId . toLowerCase ( ) . startsWith ( "tt" ) ) { properties . put ( ApiBuilder ...
Provides a movie lookup by an id from a different vendor
12,297
public Map < String , String > getListsDirectory ( ) throws RottenTomatoesException { properties . clear ( ) ; properties . put ( ApiBuilder . PROPERTY_URL , URL_LISTS_DIRECTORY ) ; WrapperLists wrapper = response . getResponse ( WrapperLists . class , properties ) ; if ( wrapper != null && wrapper . getLinks ( ) != nu...
Displays the top level lists available in the API
12,298
void resolveUrl ( ) throws IOException , StorageException , KeyManagementException , NoSuchAlgorithmException { String tempUrl ; if ( context . isCluster ) { if ( this . context . lastBalancerResponse != null ) { tempUrl = this . context . lastBalancerResponse ; } else { String urlString = context . url + "?appkey=" + ...
will put the server url with rest path to this . requestUrl
12,299
public synchronized void complete ( ) { if ( logger . isInfoEnabled ( ) ) { logger . info ( "[" + this + "] Marking complete" ) ; } if ( loaded ) { return ; } loaded = true ; lastTouch = System . currentTimeMillis ( ) ; if ( waiting != null && waiting . isEmpty ( ) ) { waiting = null ; } notifyAll ( ) ; }
Marks the jiterator as complete . Once you call this method you cannot add any more items into the jiterator . If you fail to call this method any threads reading from this jiterator will ultimately hang until you call this method .