idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
10,200
private static String recursiveSearch ( java . io . File dir , String fileName ) { for ( String name : dir . list ( ) ) { java . io . File file = new java . io . File ( dir . getAbsolutePath ( ) + "/" + name ) ; if ( name . compareTo ( fileName ) == 0 ) return file . getAbsolutePath ( ) ; if ( file . isDirectory ( ) ) ...
Recursive method for searching file path .
10,201
public static void touch ( File file ) throws FileNotFoundException { if ( ! file . exists ( ) ) { OutputStream out = new FileOutputStream ( file ) ; try { out . close ( ) ; } catch ( IOException e ) { } } file . setLastModified ( System . currentTimeMillis ( ) ) ; }
Implements the same behavior as the touch utility on Unix . It creates a new file with size 0 byte or if the file exists already it is opened and closed without modifying it but updating the file date and time .
10,202
public boolean isType ( final org . efaps . admin . datamodel . Type _type ) { return getType ( ) . equals ( _type ) ; }
Tests if this type the type in the parameter .
10,203
public void rotation ( TextureRotationMode mode ) { float [ ] [ ] tmp = corner . clone ( ) ; switch ( mode ) { case HALF : corner [ 0 ] = tmp [ 2 ] ; corner [ 1 ] = tmp [ 3 ] ; corner [ 2 ] = tmp [ 0 ] ; corner [ 3 ] = tmp [ 1 ] ; break ; case CLOCKWIZE : corner [ 0 ] = tmp [ 3 ] ; corner [ 1 ] = tmp [ 0 ] ; corner [ 2...
Rotates the way of mapping the texture .
10,204
public void flip ( TextureFlipMode mode ) { float [ ] [ ] tmp = corner . clone ( ) ; switch ( mode ) { case VERTICAL : corner [ 0 ] = tmp [ 1 ] ; corner [ 1 ] = tmp [ 0 ] ; corner [ 2 ] = tmp [ 3 ] ; corner [ 3 ] = tmp [ 2 ] ; break ; case HORIZONTAL : corner [ 0 ] = tmp [ 3 ] ; corner [ 1 ] = tmp [ 2 ] ; corner [ 2 ] ...
Flips the way of mapping the texture .
10,205
public void addObject ( final Object [ ] _row ) throws EFapsException { this . objects . add ( this . elements . get ( 0 ) . getObject ( _row ) ) ; }
Adds the object .
10,206
public void resolve ( ) throws InstallationException { final IvySettings ivySettings = new IvySettings ( ) ; try { ivySettings . load ( this . getClass ( ) . getResource ( "/org/efaps/update/version/ivy.xml" ) ) ; } catch ( final IOException e ) { throw new InstallationException ( "IVY setting file could not be read" ,...
Resolves this dependency .
10,207
private void compileJasperReport ( final Instance _instSource , final Instance _instCompiled ) throws EFapsException { final String sep = System . getProperty ( "os.name" ) . startsWith ( "Windows" ) ? ";" : ":" ; final StringBuilder classPath = new StringBuilder ( ) ; for ( final String classPathElement : this . class...
Method to compile one JasperReport .
10,208
protected void registerEQLStmt ( final String _origin , final String _stmt ) throws EFapsException { final Insert insert = new Insert ( UUID . fromString ( "c96c63b5-2d4c-4bf9-9627-f335fd9c7a84" ) ) ; insert . add ( "Origin" , "REST: " + ( _origin == null ? "" : _origin ) ) ; insert . add ( "EQLStatement" , _stmt ) ; i...
Register eql stmt .
10,209
public Object getValue ( final Object _object ) throws EFapsException { final Instance inst = ( Instance ) super . getValue ( _object ) ; if ( this . esjp == null ) { try { final Class < ? > clazz = Class . forName ( this . className , false , EFapsClassLoader . getInstance ( ) ) ; this . esjp = ( IEsjpSelect ) clazz ....
Method to get the value for the current object .
10,210
protected String evalApplication ( ) { String ret = null ; final Pattern revisionPattern = Pattern . compile ( "@eFapsApplication[\\s].*" ) ; final Matcher revisionMatcher = revisionPattern . matcher ( getCode ( ) ) ; if ( revisionMatcher . find ( ) ) { ret = revisionMatcher . group ( ) . replaceFirst ( "^@eFapsApplica...
This Method extracts the Revision from the program .
10,211
protected UUID evalUUID ( ) { UUID uuid = null ; final Pattern uuidPattern = Pattern . compile ( "@eFapsUUID[\\s]*[0-9a-z\\-]*" ) ; final Matcher uuidMatcher = uuidPattern . matcher ( getCode ( ) ) ; if ( uuidMatcher . find ( ) ) { final String uuidStr = uuidMatcher . group ( ) . replaceFirst ( "^@eFapsUUID" , "" ) ; u...
This Method extracts the UUID from the source .
10,212
protected String evalExtends ( ) { String ret = null ; final Pattern exPattern = Pattern . compile ( "@eFapsExtends[\\s]*[a-zA-Z\\._-]*\\b" ) ; final Matcher exMatcher = exPattern . matcher ( getCode ( ) ) ; if ( exMatcher . find ( ) ) { ret = exMatcher . group ( ) . replaceFirst ( "^@eFapsExtends" , "" ) ; } return re...
This Method extracts the extend from the source .
10,213
public void setBackground ( float x , float y , float z , float a ) { gl . glClearColor ( x / 255 , y / 255 , z / 255 , a / 255 ) ; }
Sets the background to a RGB and alpha value .
10,214
public void setBackgroud ( Color color ) { gl . glClearColor ( ( float ) color . getRed ( ) , ( float ) color . getGreen ( ) , ( float ) color . getBlue ( ) , ( float ) ( color . getAlpha ( ) * getAlpha ( ) ) ) ; }
Sets the background to a RGB or HSB and alpha value .
10,215
public void matrixMode ( MatrixMode mode ) { switch ( mode ) { case PROJECTION : gl . glMatrixMode ( GL2 . GL_PROJECTION ) ; break ; case MODELVIEW : gl . glMatrixMode ( GL2 . GL_MODELVIEW ) ; break ; default : break ; } }
Sets the MatrixMode .
10,216
public void setAmbientLight ( float r , float g , float b ) { float ambient [ ] = { r , g , b , 255 } ; normalize ( ambient ) ; gl . glEnable ( GL2 . GL_LIGHTING ) ; gl . glEnable ( GL2 . GL_LIGHT0 ) ; gl . glLightfv ( GL2 . GL_LIGHT0 , GL2 . GL_AMBIENT , ambient , 0 ) ; }
Sets the RGB value of the ambientLight
10,217
public void setAmbientLight ( int i , Color color , boolean enableColor ) { float ambient [ ] = { ( float ) color . getRed ( ) , ( float ) color . getGreen ( ) , ( float ) color . getBlue ( ) , ( float ) color . getAlpha ( ) } ; gl . glEnable ( GL2 . GL_LIGHTING ) ; gl . glEnable ( GL2 . GL_LIGHT0 + i ) ; if ( enableCo...
Sets the color value of the No . i ambientLight
10,218
public void setAmbientLight ( int i , Color color , boolean enableColor , Vector3D v ) { float ambient [ ] = { ( float ) color . getRed ( ) , ( float ) color . getGreen ( ) , ( float ) color . getBlue ( ) , ( float ) color . getAlpha ( ) } ; float position [ ] = { ( float ) v . getX ( ) , ( float ) v . getY ( ) , ( flo...
Sets the color value and the position of the No . i ambientLight
10,219
public void setSpotLight ( int i , Color color , boolean enableColor , Vector3D v , float nx , float ny , float nz , float angle ) { float spotColor [ ] = { ( float ) color . getRed ( ) , ( float ) color . getGreen ( ) , ( float ) color . getBlue ( ) , ( float ) color . getAlpha ( ) } ; float pos [ ] = { ( float ) v . ...
Sets the color value position direction and the angle of the spotlight cone of the No . i spotLight
10,220
public void setLightAttenuation ( int i , float constant , float liner , float quadratic ) { float c [ ] = { constant } ; float l [ ] = { liner } ; float q [ ] = { quadratic } ; gl . glEnable ( GL2 . GL_LIGHTING ) ; gl . glEnable ( GL2 . GL_LIGHT0 + i ) ; gl . glLightfv ( GL2 . GL_LIGHT0 + i , GL2 . GL_CONSTANT_ATTENUA...
Set attenuation rates for point lights spot lights and ambient lights .
10,221
public void setLightSpecular ( int i , Color color ) { float [ ] tmpColor = { ( float ) color . getRed ( ) , ( float ) color . getGreen ( ) , ( float ) color . getBlue ( ) , ( float ) color . getAlpha ( ) } ; gl . glLightfv ( GL2 . GL_LIGHT0 + i , GL2 . GL_SPECULAR , tmpColor , 0 ) ; }
Sets the specular color for No . i light .
10,222
public void setLightDiffuse ( int i , Color color ) { float [ ] tmpColor = { ( float ) color . getRed ( ) , ( float ) color . getGreen ( ) , ( float ) color . getBlue ( ) , ( float ) color . getAlpha ( ) } ; gl . glLightfv ( GL2 . GL_LIGHT0 + i , GL2 . GL_DIFFUSE , tmpColor , 0 ) ; }
Sets the diffuse color for No . i light .
10,223
private static float [ ] normalize ( float [ ] in ) { float [ ] out = new float [ in . length ] ; for ( int i = 0 ; i < in . length ; i ++ ) { out [ i ] = ( in [ i ] / 255.0f ) ; } return out ; }
Returns the array normalized from 0 - 255 to 0 - 1 . 0 .
10,224
public void setPerspective ( double fov , double aspect , double zNear , double zFar ) { matrixMode ( MatrixMode . PROJECTION ) ; resetMatrix ( ) ; glu . gluPerspective ( fov , aspect , zNear , zFar ) ; matrixMode ( MatrixMode . MODELVIEW ) ; resetMatrix ( ) ; }
Sets a perspective projection applying foreshortening making distant objects appear smaller than closer ones . The parameters define a viewing volume with the shape of truncated pyramid . Objects near to the front of the volume appear their actual size while farther objects appear smaller . This projection simulates th...
10,225
public void setPerspective ( ) { double cameraZ = ( ( height / 2.0 ) / Math . tan ( Math . PI * 60.0 / 360.0 ) ) ; matrixMode ( MatrixMode . PROJECTION ) ; resetMatrix ( ) ; glu . gluPerspective ( Math . PI / 3.0 , this . width / this . height , cameraZ / 10.0 , cameraZ * 10.0 ) ; matrixMode ( MatrixMode . MODELVIEW ) ...
Sets a default perspective .
10,226
public void setOrtho ( double left , double right , double bottom , double top , double near , double far ) { matrixMode ( MatrixMode . PROJECTION ) ; resetMatrix ( ) ; gl . glOrtho ( left , right , bottom , top , near , far ) ; matrixMode ( MatrixMode . MODELVIEW ) ; resetMatrix ( ) ; }
Sets an orthographic projection and defines a parallel clipping volume . All objects with the same dimension appear the same size regardless of whether they are near or far from the camera . The parameters to this function specify the clipping volume where left and right are the minimum and maximum x values top and bot...
10,227
public void setOrtho ( ) { matrixMode ( MatrixMode . PROJECTION ) ; resetMatrix ( ) ; gl . glOrtho ( 0 , this . width , 0 , this . height , - 1.0e10 , 1.0e10 ) ; matrixMode ( MatrixMode . MODELVIEW ) ; resetMatrix ( ) ; }
Sets the default orthographic projection .
10,228
public void setFrustum ( double left , double right , double bottom , double top , double near , double far ) { matrixMode ( MatrixMode . PROJECTION ) ; resetMatrix ( ) ; gl . glFrustum ( left , right , bottom , top , near , far ) ; matrixMode ( MatrixMode . MODELVIEW ) ; resetMatrix ( ) ; }
Sets a perspective matrix defined through the parameters . Works like glFrustum except it wipes out the current perspective matrix rather than multiplying itself with it .
10,229
public void setCamera ( ) { glu . gluLookAt ( width / 2.0 , height / 2.0 , ( height / 2.0 ) / Math . tan ( Math . PI * 60.0 / 360.0 ) , width / 2.0 , height / 2.0 , 0 , 0 , 1 , 0 ) ; }
Sets the default camera position .
10,230
public Key getKey ( ) { final Key ret = new Key ( ) . setPersonId ( getPersonId ( ) ) . setCompanyId ( getCompanyId ( ) ) . setTypeId ( getTypeId ( ) ) ; return ret ; }
Gets the key .
10,231
public String getTag ( ) throws IOException { URLConnection urlConnection = url . openConnection ( ) ; String tag = urlConnection . getHeaderField ( ETAG ) ; if ( tag == null ) { String key = url . toString ( ) + "@" + urlConnection . getLastModified ( ) ; tag = md5Cache . getIfPresent ( key ) ; if ( tag == null ) { tr...
Gets the tag using either the ETAG header of the URL connection or calculates it and caches it based on the URL & last modified date
10,232
private List < Pair < Id , GuiceSupplier > > getSuppliers ( ) { ImmutableList . Builder < Pair < Id , GuiceSupplier > > suppliersBuilder = ImmutableList . builder ( ) ; for ( Binding < GuiceRegistration > registrationBinding : injector . findBindingsByType ( TypeLiteral . get ( GuiceRegistration . class ) ) ) { Key < ?...
enforce load all providers before register them
10,233
public SQLSelect column ( final String _name ) { columns . add ( new Column ( tablePrefix , null , _name ) ) ; return this ; }
Appends a selected column .
10,234
public int columnIndex ( final int _tableIndex , final String _columnName ) { final Optional < Column > colOpt = getColumns ( ) . stream ( ) . filter ( column -> column . tableIndex == _tableIndex && column . columnName . equals ( _columnName ) ) . findFirst ( ) ; final int ret ; if ( colOpt . isPresent ( ) ) { ret = g...
Column index .
10,235
public String getSQL ( ) { final StringBuilder cmd = new StringBuilder ( ) . append ( " " ) . append ( Context . getDbType ( ) . getSQLPart ( SQLPart . SELECT ) ) . append ( " " ) ; if ( distinct ) { cmd . append ( Context . getDbType ( ) . getSQLPart ( SQLPart . DISTINCT ) ) . append ( " " ) ; } boolean first = true ;...
Returns the depending SQL statement .
10,236
public SQLSelect addColumnPart ( final Integer _tableIndex , final String _columnName ) { parts . add ( new Column ( tablePrefix , _tableIndex , _columnName ) ) ; return this ; }
Add a column as part .
10,237
public SQLSelect addTablePart ( final String _tableName , final Integer _tableIndex ) { parts . add ( new FromTable ( tablePrefix , _tableName , _tableIndex ) ) ; return this ; }
Add a table as part .
10,238
public SQLSelect addTimestampValue ( final String _isoDateTime ) { parts . add ( new Value ( Context . getDbType ( ) . getTimestampValue ( _isoDateTime ) ) ) ; return this ; }
Add a timestamp value to the select .
10,239
public static CachedPrintQuery get4Request ( final Instance _instance ) throws EFapsException { return new CachedPrintQuery ( _instance , Context . getThreadContext ( ) . getRequestId ( ) ) . setLifespan ( 5 ) . setLifespanUnit ( TimeUnit . MINUTES ) ; }
Get a CachedPrintQuery that will only cache during a request .
10,240
protected void prepare ( final AbstractSQLInsertUpdate < ? > _insertUpdate , final Attribute _attribute , final Object ... _values ) throws SQLException { checkSQLColumnSize ( _attribute , 1 ) ; try { _insertUpdate . column ( _attribute . getSqlColNames ( ) . get ( 0 ) , Context . getThreadContext ( ) . getPerson ( ) ....
The instance method sets the value in the insert statement to the id of the current context user .
10,241
protected void addMapping ( final ColumnType _columnType , final String _writeTypeName , final String _nullValueSelect , final String ... _readTypeNames ) { this . writeColTypeMap . put ( _columnType , _writeTypeName ) ; this . nullValueColTypeMap . put ( _columnType , _nullValueSelect ) ; for ( final String readTypeNa...
Adds a new mapping for given eFaps column type used for mapping from and to the SQL database .
10,242
public boolean existsView ( final Connection _con , final String _viewName ) throws SQLException { boolean ret = false ; final DatabaseMetaData metaData = _con . getMetaData ( ) ; final ResultSet rs = metaData . getTables ( null , null , _viewName . toLowerCase ( ) , new String [ ] { "VIEW" } ) ; if ( rs . next ( ) ) {...
The method tests if a view with given name exists .
10,243
public T updateColumn ( final Connection _con , final String _tableName , final String _columnName , final ColumnType _columnType , final int _length , final int _scale ) throws SQLException { final StringBuilder cmd = new StringBuilder ( ) ; cmd . append ( "alter table " ) . append ( getTableQuote ( ) ) . append ( _ta...
Adds a column to a SQL table .
10,244
public T addUniqueKey ( final Connection _con , final String _tableName , final String _uniqueKeyName , final String _columns ) throws SQLException { final StringBuilder cmd = new StringBuilder ( ) ; cmd . append ( "alter table " ) . append ( _tableName ) . append ( " " ) . append ( "add constraint " ) . append ( _uniq...
Adds a new unique key to given table name .
10,245
public T addForeignKey ( final Connection _con , final String _tableName , final String _foreignKeyName , final String _key , final String _reference , final boolean _cascade ) throws InstallationException { final StringBuilder cmd = new StringBuilder ( ) . append ( "alter table " ) . append ( _tableName ) . append ( "...
Adds a foreign key to given SQL table .
10,246
public void addCheckKey ( final Connection _con , final String _tableName , final String _checkKeyName , final String _condition ) throws SQLException { final StringBuilder cmd = new StringBuilder ( ) . append ( "alter table " ) . append ( _tableName ) . append ( " " ) . append ( "add constraint " ) . append ( _checkKe...
Adds a new check key to given SQL table .
10,247
public static AbstractDatabase < ? > findByClassName ( final String _dbClassName ) throws ClassNotFoundException , InstantiationException , IllegalAccessException { return ( AbstractDatabase < ? > ) Class . forName ( _dbClassName ) . newInstance ( ) ; }
Instantiate the given DB class name and returns them .
10,248
private Collection < Observable < Attachment > > upload ( RxComapiClient client , List < Attachment > data ) { Collection < Observable < Attachment > > obsList = new ArrayList < > ( ) ; for ( Attachment a : data ) { obsList . add ( upload ( client , a ) ) ; } return obsList ; }
Create list of upload attachment observables .
10,249
private Observable < Attachment > upload ( RxComapiClient client , Attachment a ) { return client . service ( ) . messaging ( ) . uploadContent ( a . getFolder ( ) , a . getData ( ) ) . map ( response -> a . updateWithUploadDetails ( response . getResult ( ) ) ) . doOnError ( t -> log . e ( "Error uploading attachment....
Upload single attachment and update the details in it from the response .
10,250
public void set ( double left , double right , double bottom , double top , double near , double far ) { this . left = left ; this . right = right ; this . bottom = bottom ; this . top = top ; this . near = near ; this . far = far ; }
Sets the clipping plane .
10,251
public static AbstractStmt getStatement ( final CharSequence _stmt ) { AbstractStmt ret = null ; final IStatement < ? > stmt = parse ( _stmt ) ; if ( stmt instanceof IPrintStatement ) { ret = PrintStmt . get ( ( IPrintStatement < ? > ) stmt ) ; } else if ( stmt instanceof IDeleteStatement ) { ret = DeleteStmt . get ( (...
Parses the stmt .
10,252
public static List < Instance > getInstances ( final AbstractQueryPart _queryPart ) throws EFapsException { return getQueryBldr ( _queryPart ) . getQuery ( ) . execute ( ) ; }
Gets the instances .
10,253
public static BigDecimal parseLocalized ( final String _value ) throws EFapsException { final DecimalFormat format = ( DecimalFormat ) NumberFormat . getInstance ( Context . getThreadContext ( ) . getLocale ( ) ) ; format . setParseBigDecimal ( true ) ; try { return ( BigDecimal ) format . parse ( _value ) ; } catch ( ...
Method to parse a localized String to an BigDecimal .
10,254
public void update ( String cacheName , Cache cache ) { cacheManager . enableManagement ( cacheName , cache . isManagementEnabled ( ) ) ; updateStatistics ( cacheName , cache ) ; }
Update mutable information of cache configuration such as management and statistics support
10,255
public void setStatistics ( boolean enabled ) { all ( ) . forEach ( cache -> updateStatistics ( cache . getName ( ) , new Cache ( false , enabled ) ) ) ; }
Enable or disable statistics for all caches
10,256
public Optional < CacheStatistics > getStatistics ( String cacheName ) { javax . cache . Cache cache = cacheManager . getCache ( cacheName ) ; if ( cache == null ) { return Optional . empty ( ) ; } if ( ( ( CompleteConfiguration ) cache . getConfiguration ( CompleteConfiguration . class ) ) . isStatisticsEnabled ( ) &&...
Get a cache statistic information if available
10,257
private void setAttrValue ( final AttrName _attrName , final String _value ) { synchronized ( this . attrValues ) { this . attrValues . put ( _attrName , _value ) ; } }
The method sets the attribute values in the cache for given attribute name to given new attribute value .
10,258
public Locale getLocale ( ) { final Locale ret ; if ( this . attrValues . get ( Person . AttrName . LOCALE ) != null ) { final String localeStr = this . attrValues . get ( Person . AttrName . LOCALE ) ; final String [ ] countries = localeStr . split ( "_" ) ; if ( countries . length == 2 ) { ret = new Locale ( countrie...
Method to get the Locale of this Person . Default is the English Locale .
10,259
public String getLanguage ( ) { return this . attrValues . get ( Person . AttrName . LANGUAGE ) != null ? this . attrValues . get ( Person . AttrName . LANGUAGE ) : Locale . ENGLISH . getISO3Language ( ) ; }
Method to get the Language of the UserInterface for this Person . Default is english .
10,260
public DateTimeZone getTimeZone ( ) { return this . attrValues . get ( Person . AttrName . TIMZONE ) != null ? DateTimeZone . forID ( this . attrValues . get ( Person . AttrName . TIMZONE ) ) : DateTimeZone . UTC ; }
Method to get the Timezone of this Person . Default is the UTC Timezone .
10,261
public ChronologyType getChronologyType ( ) { final String chronoKey = this . attrValues . get ( Person . AttrName . CHRONOLOGY ) ; final ChronologyType chronoType ; if ( chronoKey != null ) { chronoType = ChronologyType . getByKey ( chronoKey ) ; } else { chronoType = ChronologyType . ISO8601 ; } return chronoType ; }
Method to get the ChronologyType of this Person . Default is the ISO8601 ChronologyType .
10,262
public boolean checkPassword ( final String _passwd ) throws EFapsException { boolean ret = false ; final PrintQuery query = new PrintQuery ( CIAdminUser . Person . getType ( ) , getId ( ) ) ; query . addAttribute ( CIAdminUser . Person . Password , CIAdminUser . Person . LastLogin , CIAdminUser . Person . LoginTry , C...
The instance method checks if the given password is the same password as the password in the database .
10,263
private void setFalseLogin ( final DateTime _logintry , final int _count ) throws EFapsException { if ( _count > 0 ) { final DateTime now = new DateTime ( DateTimeUtil . getCurrentTimeFromDB ( ) . getTime ( ) ) ; final SystemConfiguration kernelConfig = EFapsSystemConfiguration . get ( ) ; final int minutes = kernelCon...
Method that sets the time and the number of failed logins .
10,264
private void updateFalseLoginDB ( final int _tries ) throws EFapsException { Connection con = null ; try { con = Context . getConnection ( ) ; Statement stmt = null ; final StringBuilder cmd = new StringBuilder ( ) ; try { cmd . append ( "update T_USERPERSON " ) . append ( "set LOGINTRY=" ) . append ( Context . getDbTy...
Method to set the number of false Login tries in the eFaps - DataBase .
10,265
public Status setPassword ( final String _newPasswd ) throws EFapsException { final Type type = CIAdminUser . Person . getType ( ) ; if ( _newPasswd . length ( ) == 0 ) { throw new EFapsException ( getClass ( ) , "PassWordLength" , 1 , _newPasswd . length ( ) ) ; } final Update update = new Update ( type , "" + getId (...
The instance method sets the new password for the current context user . Before the new password is set some checks are made .
10,266
protected void readFromDB ( ) throws EFapsException { readFromDBAttributes ( ) ; this . roles . clear ( ) ; for ( final Role role : getRolesFromDB ( ) ) { add ( role ) ; } this . groups . clear ( ) ; for ( final Group group : getGroupsFromDB ( null ) ) { add ( group ) ; } this . companies . clear ( ) ; for ( final Comp...
The instance method reads all information from the database .
10,267
private void readFromDBAttributes ( ) throws EFapsException { Connection con = null ; try { con = Context . getConnection ( ) ; Statement stmt = null ; try { stmt = con . createStatement ( ) ; final StringBuilder cmd = new StringBuilder ( "select " ) ; for ( final AttrName attrName : Person . AttrName . values ( ) ) { ...
All attributes from this person are read from the database .
10,268
public void setGroups ( final JAASSystem _jaasSystem , final Set < Group > _groups ) throws EFapsException { if ( _jaasSystem == null ) { throw new EFapsException ( getClass ( ) , "setGroups.nojaasSystem" , getName ( ) ) ; } if ( _groups == null ) { throw new EFapsException ( getClass ( ) , "setGroups.noGroups" , getNa...
The depending groups for the user are set for the given JAAS system . All groups are added to the loaded groups in the cache of this person .
10,269
public void assignGroupInDb ( final JAASSystem _jaasSystem , final Group _group ) throws EFapsException { assignToUserObjectInDb ( CIAdminUser . Person2Group . getType ( ) , _jaasSystem , _group ) ; }
For this person a group is assigned for the given JAAS system .
10,270
public void unassignGroupInDb ( final JAASSystem _jaasSystem , final Group _group ) throws EFapsException { unassignFromUserObjectInDb ( CIAdminUser . Person2Group . getType ( ) , _jaasSystem , _group ) ; }
The given group is unassigned for the given JAAS system from this person .
10,271
public static void reset ( final String _key ) throws EFapsException { final Person person ; if ( UUIDUtil . isUUID ( _key ) ) { person = Person . get ( UUID . fromString ( _key ) ) ; } else { person = Person . get ( _key ) ; } if ( person != null ) { InfinispanCache . get ( ) . < Long , Person > getCache ( Person . ID...
Reset a person . Meaning ti will be removed from all Caches .
10,272
public void preparePostUpload ( final List < Attachment > attachments ) { tempParts . clear ( ) ; if ( ! attachments . isEmpty ( ) ) { for ( Attachment a : attachments ) { if ( a . getError ( ) != null ) { errorParts . add ( createErrorPart ( a ) ) ; } else { publicParts . add ( createPart ( a ) ) ; } } } }
Replace temporary attachment parts with final parts with upload details or error message .
10,273
private Part createErrorPart ( Attachment a ) { return Part . builder ( ) . setName ( String . valueOf ( a . hashCode ( ) ) ) . setSize ( 0 ) . setType ( Attachment . LOCAL_PART_TYPE_ERROR ) . setUrl ( null ) . setData ( a . getError ( ) . getLocalizedMessage ( ) ) . build ( ) ; }
Create message part based on attachment upload error details .
10,274
private Part createTempPart ( Attachment a ) { return Part . builder ( ) . setName ( String . valueOf ( a . hashCode ( ) ) ) . setSize ( 0 ) . setType ( Attachment . LOCAL_PART_TYPE_UPLOADING ) . setUrl ( null ) . setData ( null ) . build ( ) ; }
Create message part based on attachment upload . This is a temporary message to indicate that one of the attachments for this message is being uploaded .
10,275
private Part createPart ( Attachment a ) { return Part . builder ( ) . setName ( a . getName ( ) != null ? a . getName ( ) : a . getId ( ) ) . setSize ( a . getSize ( ) ) . setType ( a . getType ( ) ) . setUrl ( a . getUrl ( ) ) . build ( ) ; }
Create message part based on attachment details .
10,276
public MessageToSend prepareMessageToSend ( ) { originalMessage . getParts ( ) . clear ( ) ; originalMessage . getParts ( ) . addAll ( publicParts ) ; return originalMessage ; }
Prepare message to be sent through messaging service .
10,277
public ChatMessage createFinalMessage ( MessageSentResponse response ) { return ChatMessage . builder ( ) . setMessageId ( response . getId ( ) ) . setSentEventId ( response . getEventId ( ) ) . setConversationId ( conversationId ) . setSentBy ( sender ) . setFromWhom ( new Sender ( sender , sender ) ) . setSentOn ( Sy...
Create a final message for a conversation . At this point we know message id and sent event id .
10,278
private void addTables ( ) { for ( final SQLTable table : getType ( ) . getTables ( ) ) { if ( ! getTable2values ( ) . containsKey ( table ) ) { getTable2values ( ) . put ( table , new ArrayList < Value > ( ) ) ; } } }
Add all tables of the type to the expressions because for the type an insert must be made for all tables!!!
10,279
private void addCreateUpdateAttributes ( ) throws EFapsException { final Iterator < ? > iter = getType ( ) . getAttributes ( ) . entrySet ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { final Map . Entry < ? , ? > entry = ( Map . Entry < ? , ? > ) iter . next ( ) ; final Attribute attr = ( Attribute ) entry . getVa...
Add all attributes of the type which must be always updated and the default values .
10,280
public Insert setExchangeIds ( final Long _exchangeSystemId , final Long _exchangeId ) { this . exchangeSystemId = _exchangeSystemId ; this . exchangeId = _exchangeId ; return this ; }
Set the exchangeids for the new object .
10,281
public void executeWithoutTrigger ( ) throws EFapsException { final Context context = Context . getThreadContext ( ) ; ConnectionResource con = null ; try { con = context . getConnectionResource ( ) ; final SQLTable mainTable = getType ( ) . getMainTable ( ) ; final long id = executeOneStatement ( con , mainTable , get...
The insert is done without calling triggers and check of access rights .
10,282
public static final Vector3D randVertex2d ( ) { float theta = random ( ( float ) ( Math . PI * 2.0 ) ) ; return new Vector3D ( Math . cos ( theta ) , Math . sin ( theta ) ) ; }
returns a random Vertex that represents a point on the unit circle
10,283
@ SuppressLint ( "UseSparseArrays" ) public void addStatusUpdate ( ChatMessageStatus status ) { int unique = ( status . getMessageId ( ) + status . getProfileId ( ) + status . getMessageStatus ( ) . name ( ) ) . hashCode ( ) ; if ( statusUpdates == null ) { statusUpdates = new HashMap < > ( ) ; } statusUpdates . put ( ...
Update status list with a new status .
10,284
public static void put ( Map < String , Object > structure , String name , Object object ) { if ( name != null && object != null ) { structure . put ( name , object ) ; } }
Puts an object into a map
10,285
protected long createTaskInternal ( final String name , final String channel , final String data , final String key1 , final String key2 , final Long batchId , int postponeSec , TedStatus status ) { final String sqlLogId = "create_task" ; if ( status == null ) status = TedStatus . NEW ; String nextts = ( status == TedS...
taskid is autonumber in MySql
10,286
public static String escape ( String literal ) { StringBuilder sb = new StringBuilder ( ) ; for ( int ii = 0 ; ii < literal . length ( ) ; ii ++ ) { char cc = literal . charAt ( ii ) ; switch ( cc ) { case '[' : case ']' : case '(' : case ')' : case '\\' : case '-' : case '^' : case '*' : case '+' : case '?' : case '|'...
Escapes all regex control characters returning expression suitable for literal parsing .
10,287
public boolean isMatch ( CharSequence text ) { try { if ( text . length ( ) == 0 ) { return acceptEmpty ; } InputReader reader = Input . getInstance ( text ) ; return isMatch ( reader ) ; } catch ( IOException ex ) { throw new IllegalArgumentException ( "can't happen" ) ; } }
Return true if text matches the regex
10,288
public boolean isMatch ( PushbackReader input , int size ) throws IOException { InputReader reader = Input . getInstance ( input , size ) ; return isMatch ( reader ) ; }
Return true if input matches the regex
10,289
public boolean isMatch ( InputReader reader ) throws IOException { int rc = match ( reader ) ; return ( rc == 1 && reader . read ( ) == - 1 ) ; }
Return true if input matches the regex .
10,290
public String match ( CharSequence text ) { try { if ( text . length ( ) == 0 ) { if ( acceptEmpty ) { return "" ; } else { throw new SyntaxErrorException ( "empty string not accepted" ) ; } } InputReader reader = Input . getInstance ( text ) ; int rc = match ( reader ) ; if ( rc == 1 && reader . read ( ) == - 1 ) { re...
Attempts to match input to regex
10,291
public String lookingAt ( CharSequence text ) { try { if ( text . length ( ) == 0 ) { if ( acceptEmpty ) { return "" ; } else { throw new SyntaxErrorException ( "empty string not accepted" ) ; } } InputReader reader = Input . getInstance ( text ) ; return lookingAt ( reader ) ; } catch ( IOException ex ) { throw new Il...
Matches the start of text and returns the matched string
10,292
public String replace ( CharSequence text , CharSequence replacement ) { try { if ( text . length ( ) == 0 ) { if ( acceptEmpty ) { return "" ; } } CharArrayWriter caw = new CharArrayWriter ( ) ; InputReader reader = Input . getInstance ( text ) ; ObsoleteSimpleReplacer fsp = new ObsoleteSimpleReplacer ( replacement ) ...
Replaces regular expression matches in text with replacement string
10,293
public String replace ( CharSequence text , ObsoleteReplacer replacer ) throws IOException { if ( text . length ( ) == 0 ) { return "" ; } CharArrayWriter caw = new CharArrayWriter ( ) ; InputReader reader = Input . getInstance ( text ) ; replace ( reader , caw , replacer ) ; return caw . toString ( ) ; }
Replaces regular expression matches in text using replacer
10,294
public void replace ( PushbackReader in , int bufferSize , Writer out , String format ) throws IOException { InputReader reader = Input . getInstance ( in , bufferSize ) ; ObsoleteSimpleReplacer fsp = new ObsoleteSimpleReplacer ( format ) ; replace ( reader , out , fsp ) ; }
Writes in to out replacing every match with a string
10,295
public void replace ( PushbackReader in , int bufferSize , Writer out , ObsoleteReplacer replacer ) throws IOException { InputReader reader = Input . getInstance ( in , bufferSize ) ; replace ( reader , out , replacer ) ; }
Replaces regular expression matches in input using replacer
10,296
public static Regex literal ( String expression , Option ... options ) throws IOException { return compile ( escape ( expression ) , options ) ; }
Compiles a literal string into RegexImpl class . This is ok for testing . use RegexBuilder ant task for release classes
10,297
public static DFA < Integer > createDFA ( String expression , int reducer , Option ... options ) { NFA < Integer > nfa = createNFA ( new Scope < NFAState < Integer > > ( expression ) , expression , reducer , options ) ; DFA < Integer > dfa = nfa . constructDFA ( new Scope < DFAState < Integer > > ( expression ) ) ; ret...
Creates a DFA from regular expression
10,298
static < T > List < T > executeOraBlock ( Connection connection , String sql , Class < T > clazz , List < SqlParam > sqlParams ) throws SQLException { String cursorParam = null ; List < T > list = new ArrayList < T > ( ) ; CallableStatement stmt = null ; ResultSet resultSet = null ; try { stmt = connection . prepareCal...
Execute sql block or stored procedure . If exists output parameter with type CURSOR then return resultSet as List of clazz type objects .
10,299
Observable < List < ChatConversationBase > > loadAllConversations ( ) { return Observable . create ( emitter -> storeFactory . execute ( new StoreTransaction < ChatStore > ( ) { protected void execute ( ChatStore store ) { store . open ( ) ; List < ChatConversationBase > conversations = store . getAllConversations ( ) ...
Wraps loading all conversations from store implementation into an Observable .