idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
16,100
public String getRemoteClassName ( ) { String strClassName = this . getClass ( ) . getName ( ) . toString ( ) ; int iThinPos = strClassName . indexOf ( Constants . THIN_SUBPACKAGE ) ; return strClassName . substring ( 0 , iThinPos ) + strClassName . substring ( iThinPos + Constants . THIN_SUBPACKAGE . length ( ) ) ; }
Get the remote class name . Just remove thin from this class name! .
16,101
public void setupKeys ( ) { KeyAreaInfo keyArea = null ; keyArea = new KeyAreaInfo ( this , Constants . UNIQUE , ID_KEY ) ; keyArea . addKeyField ( ID , Constants . ASCENDING ) ; }
Set up all the key areas for this record . Override this to add the key areas .
16,102
public synchronized void addPropertyChangeListener ( java . beans . PropertyChangeListener listener ) { if ( propertyChange == null ) propertyChange = new java . beans . PropertyChangeSupport ( this ) ; propertyChange . addPropertyChangeListener ( listener ) ; }
The addPropertyChangeListener method was generated to support the propertyChange field .
16,103
public synchronized void removePropertyChangeListener ( java . beans . PropertyChangeListener listener ) { if ( propertyChange != null ) propertyChange . removePropertyChangeListener ( listener ) ; }
The removePropertyChangeListener method was generated to support the propertyChange field .
16,104
public String getString ( String strResource ) { String strResult = null ; if ( m_menuResourceBundle == null ) { m_menuResourceBundle = new ResourceBundle [ 10 ] ; Class < ? > classResource = this . getClass ( ) ; Locale locale = Locale . getDefault ( ) ; for ( int i = 0 ; i < 10 ; i ++ ) { m_menuResourceBundle [ i ] =...
Get the string that matches this key . This method traverses the class hierarchy for a matching string that matches this key value . If the resource bundle hasn t been read yet reads the bundle from the . res package .
16,105
public ResourceBundle getRecordResource ( Class < ? > classResource , Locale locale ) { ClassLoader classLoader = this . getClass ( ) . getClassLoader ( ) ; ResourceBundle resourceBundle = null ; String typicalResourceClassName = null ; try { typicalResourceClassName = Util . convertClassName ( classResource . getName ...
Get the record resource bundle .
16,106
public HasData hasData ( ) { boolean scalar = values . containsKey ( "" ) ; boolean vector = scalar ? getCount ( ) > 1 : getCount ( ) > 0 ; return scalar && vector ? HasData . BOTH : scalar ? HasData . SCALAR : vector ? HasData . VECTOR : HasData . NONE ; }
Returns the type of data contained in the parameter .
16,107
public Object get ( String subscript ) { if ( ! values . containsKey ( subscript ) ) { throw new RuntimeException ( "Subscript not found" ) ; } return values . get ( subscript ) ; }
Returns the subscripted vector value . A runtime exception is thrown if no vector value exists at the specified subscript .
16,108
public void assign ( Iterable < ? > source ) { clear ( ) ; int i = 0 ; for ( Object value : source ) { values . put ( Integer . toString ( ++ i ) , value ) ; } }
Copies source values as integer - indexed vector values .
16,109
public void assignArray ( Object source ) { int len = Array . getLength ( source ) ; List < Object > list = new ArrayList < Object > ( len ) ; for ( int i = 0 ; i < len ; i ++ ) { list . add ( Array . get ( source , i ) ) ; } assign ( list ) ; }
Copies source values from an input array as integer - indexed vector values .
16,110
public void put ( Object [ ] subscript , Object value ) { put ( BrokerUtil . buildSubscript ( subscript ) , value ) ; }
Adds a vector value at the specified subscript .
16,111
public int handleMessage ( BaseMessage message ) { try { int iMessageType = Integer . parseInt ( ( String ) message . get ( MessageConstants . MESSAGE_TYPE_PARAM ) ) ; if ( ( iMessageType == Constants . AFTER_UPDATE_TYPE ) || ( iMessageType == Constants . CACHE_UPDATE_TYPE ) ) { SwingUtilities . invokeLater ( new Updat...
Handle this message . Basically if I get a message that the current record changed I re - read the record .
16,112
public void add ( final ITopicNode specTopic , final String key ) { if ( specTopic == null ) return ; final Integer topicId = specTopic . getDBId ( ) ; if ( ! topics . containsKey ( topicId ) ) { topics . put ( topicId , new LinkedList < ITopicNode > ( ) ) ; } if ( ! topicsKeys . containsKey ( key ) ) { topicsKeys . pu...
Add a SpecTopic to the database .
16,113
public void setDatabaseDuplicateIds ( ) { for ( final Entry < Integer , List < ITopicNode > > topicTitleEntry : topics . entrySet ( ) ) { final List < ITopicNode > topics = topicTitleEntry . getValue ( ) ; if ( topics . size ( ) > 1 ) { for ( int i = 1 ; i < topics . size ( ) ; i ++ ) { topics . get ( i ) . setDuplicat...
Sets the Duplicate IDs for all the SpecTopics in the Database .
16,114
public boolean isUniqueSpecTopic ( final SpecTopic topic ) { return topics . containsKey ( topic . getDBId ( ) ) ? topics . get ( topic . getDBId ( ) ) . size ( ) == 1 : false ; }
Checks if a topic is unique in the database .
16,115
public List < SpecTopic > getAllSpecTopics ( ) { final ArrayList < SpecTopic > specTopics = new ArrayList < SpecTopic > ( ) ; for ( final Entry < Integer , List < ITopicNode > > topicEntry : topics . entrySet ( ) ) { for ( final ITopicNode topic : topicEntry . getValue ( ) ) { if ( topic instanceof SpecTopic ) { specTo...
Get a List of all the SpecTopics in the Database .
16,116
public List < ITopicNode > getAllTopicNodes ( ) { final ArrayList < ITopicNode > topicNodes = new ArrayList < ITopicNode > ( ) ; for ( final Entry < Integer , List < ITopicNode > > topicEntry : topics . entrySet ( ) ) { topicNodes . addAll ( topicEntry . getValue ( ) ) ; } return topicNodes ; }
Get a List of all the Topic nodes in the Database .
16,117
public List < SpecNode > getAllSpecNodes ( ) { final ArrayList < SpecNode > retValue = new ArrayList < SpecNode > ( ) ; retValue . addAll ( levels ) ; for ( final Entry < Integer , List < ITopicNode > > topicEntry : topics . entrySet ( ) ) { for ( final ITopicNode topic : topicEntry . getValue ( ) ) { if ( topic instan...
Get a List of all the SpecNodes in the Database .
16,118
public Set < String > getIdAttributes ( final BuildData buildData ) { final Set < String > ids = new HashSet < String > ( ) ; for ( final Level level : levels ) { ids . add ( level . getUniqueLinkId ( buildData . isUseFixedUrls ( ) ) ) ; } for ( final Entry < Integer , List < ITopicNode > > topicEntry : topics . entryS...
Get a list of all the ID Attributes of all the topics and levels held in the database .
16,119
@ SuppressWarnings ( "unchecked" ) public < T extends BaseTopicWrapper < T > > List < T > getAllTopics ( boolean ignoreRevisions ) { final List < T > topics = new ArrayList < T > ( ) ; for ( final Entry < Integer , List < ITopicNode > > entry : this . topics . entrySet ( ) ) { final Integer topicId = entry . getKey ( )...
Get all of the Topics that exist in the database . You can either choose to ignore revisions meaning two topics with the same ID but different revisions are classed as the same topic . Or choose to take note of revisions meaning if two topics have different revisions but the same ID they are still classed as different ...
16,120
@ SuppressWarnings ( "unchecked" ) protected < T extends BaseTopicWrapper < T > > List < T > getUniqueTopicsFromSpecTopics ( final List < ITopicNode > topics ) { final Map < Integer , T > revisionToTopic = new HashMap < Integer , T > ( ) ; for ( final ITopicNode specTopic : topics ) { final T topic = ( T ) specTopic . ...
Get a list of Unique Topics from a list of SpecTopics .
16,121
@ SuppressWarnings ( "unchecked" ) protected List < Task > loadSubtasks ( EntityConfig config , Reagent subtasksPhrase , boolean warnIfMissing ) { final List < Task > subtasks = new LinkedList < Task > ( ) ; final List < Element > taskElements = ( List < Element > ) config . getValue ( subtasksPhrase ) ; final Grammar ...
Abstracts the loading of subtasks for a Reagent into a single menthod
16,122
protected void performSubtasks ( TaskRequest req , TaskResponse res , List < Task > tasks ) { if ( req == null ) { String msg = "Argument 'req' cannot be null." ; throw new IllegalArgumentException ( msg ) ; } if ( res == null ) { String msg = "Argument 'res' cannot be null." ; throw new IllegalArgumentException ( msg ...
Executes a List of Tasks as children of this Task
16,123
public void free ( ) { m_DBObject = null ; while ( m_listener != null ) { this . removeListener ( m_listener , true ) ; } if ( m_vScreenField != null ) { while ( ! m_vScreenField . isEmpty ( ) ) { ScreenComponent sField = this . getComponent ( 0 ) ; sField . free ( ) ; } m_vScreenField . removeAllElements ( ) ; m_vScre...
Free this field .
16,124
public static BaseField cloneField ( BaseField fieldToClone ) throws CloneNotSupportedException { BaseField field = null ; String strClassName = fieldToClone . getClass ( ) . getName ( ) ; field = ( BaseField ) ClassServiceUtility . getClassService ( ) . makeObjectFromClassName ( strClassName ) ; if ( field != null ) {...
Creates a new object of the exact same class as this field . The clone method will clone a field that can contain the same kind of data but may not be the exact same field class .
16,125
public void removeListener ( BaseListener listener , boolean bFreeListener ) { if ( m_listener != null ) { if ( m_listener == listener ) { m_listener = ( FieldListener ) listener . getNextListener ( ) ; listener . unlink ( bFreeListener ) ; } else m_listener . removeListener ( listener , bFreeListener ) ; } }
Remove this listener from the chain .
16,126
public static final String addQuotes ( String szTableNames , char charStart , char charEnd ) { String strFileName = szTableNames ; if ( charStart == - 1 ) charStart = DBConstants . SQL_START_QUOTE ; if ( charEnd == - 1 ) charEnd = DBConstants . SQL_END_QUOTE ; for ( int iIndex = 0 ; iIndex < strFileName . length ( ) ; ...
Add these quotes to this string .
16,127
public void displayField ( ) { if ( m_vScreenField == null ) return ; for ( Enumeration < Object > e = m_vScreenField . elements ( ) ; e . hasMoreElements ( ) ; ) { ScreenComponent sField = ( ScreenComponent ) e . nextElement ( ) ; sField . fieldToControl ( ) ; } }
Display this field using all this field s screen fields .
16,128
public void setEnableListeners ( boolean [ ] rgbEnabled ) { int iIndex = 0 ; FieldListener fieldBehavior = this . getListener ( ) ; while ( fieldBehavior != null ) { boolean bEnable = true ; if ( ( rgbEnabled != null ) && ( iIndex < rgbEnabled . length ) ) bEnable = rgbEnabled [ iIndex ] ; fieldBehavior . setEnabledLis...
Get the status of the the FieldChanged behaviors?
16,129
public Object getData ( ) { Object objData = null ; FieldListener nextListener = ( FieldListener ) this . getNextValidListener ( DBConstants . SCREEN_MOVE ) ; if ( nextListener != null ) { boolean bOldState = nextListener . setEnabledListener ( false ) ; objData = nextListener . doGetData ( ) ; nextListener . setEnable...
Get the physical binary data from this field . Behaviors are often used to initiate a complicated action only when the system asks for this data .
16,130
public String getFieldName ( boolean bAddQuotes , boolean bIncludeFileName ) { if ( ! bAddQuotes ) if ( ! bIncludeFileName ) return super . getFieldName ( bAddQuotes , bIncludeFileName ) ; String strFieldName = Constants . BLANK ; if ( bIncludeFileName ) if ( this . getRecord ( ) != null ) { strFieldName = this . getRe...
Get this field s name .
16,131
public boolean isSameType ( FieldInfo field ) { boolean bSameType = false ; if ( this . getClass ( ) . getName ( ) . equals ( field . getClass ( ) . getName ( ) ) ) bSameType = true ; else { Object data = this . getData ( ) ; Class < ? > classData = this . getDataClass ( ) ; if ( data != null ) classData = data . getCl...
Are the data in these fields the same type?
16,132
public int moveFieldToThis ( FieldInfo field , boolean bDisplayOption , int iMoveMode ) { if ( this . isSameType ( field ) ) { Object data = field . getData ( ) ; return this . setData ( data , bDisplayOption , iMoveMode ) ; } else { String tempString = field . getString ( ) ; return this . setString ( tempString , bDi...
Move data to this field from another field . If the data types are the same data is moved otherwise a string conversion is done .
16,133
public int setSFieldToProperty ( ) { int iErrorCode = DBConstants . NORMAL_RETURN ; m_bJustChanged = false ; for ( int iComponent = 0 ; ; iComponent ++ ) { ScreenComponent sField = this . getComponent ( iComponent ) ; if ( sField == null ) break ; iErrorCode = sField . setSFieldToProperty ( null , DBConstants . DISPLAY...
This is a utility method to simplify setting a single field to the field s property .
16,134
public static ScreenComponent createScreenComponent ( String componentType , ScreenLoc itsLocation , ComponentParent targetScreen , Convert converter , int iDisplayFieldDesc , Map < String , Object > properties ) { String screenFieldClass = null ; if ( ! componentType . contains ( "." ) ) screenFieldClass = ScreenModel...
Create a screen component of this type .
16,135
public void setStartDate ( Date dateStart ) { try { dateStart = m_productItem . getStartDate ( ) ; Date timeNew = m_productItem . setRemoteStartDate ( dateStart ) ; if ( ! timeNew . equals ( dateStart ) ) { Date timeEnd = m_productItem . getRemoteEndDate ( ) ; String strDescription = m_productItem . getRemoteDescriptio...
Set the new start date for the remote item .
16,136
public void setEndDate ( Date dateEnd ) { try { dateEnd = m_productItem . getEndDate ( ) ; Date timeNew = m_productItem . setRemoteEndDate ( dateEnd ) ; if ( ! timeNew . equals ( dateEnd ) ) { Date dateStart = m_productItem . getStartDate ( ) ; String [ ] rgstrMeals = m_productItem . getMealCache ( dateStart , dateEnd ...
Set the new end date for the remote item .
16,137
public void doNewRecord ( boolean bDisplayOption ) { super . doNewRecord ( bDisplayOption ) ; BaseField fldTarget = null ; if ( typeFieldName != null ) fldTarget = this . getOwner ( ) . getField ( typeFieldName ) ; else fldTarget = this . getOwner ( ) . getField ( m_iTypeField ) ; boolean [ ] rgbEnabled = fldTarget . s...
DoNewRecord Method .
16,138
public boolean doRemoteCriteria ( StringBuffer strbFilter , boolean bIncludeFileName , Vector < BaseField > vParamList ) { BaseField fldTarget = null ; if ( typeFieldName != null ) fldTarget = this . getOwner ( ) . getField ( typeFieldName ) ; else fldTarget = this . getOwner ( ) . getField ( m_iTypeField ) ; String st...
Add the criteria to the SQL string .
16,139
public void initRemoteStub ( ObjectOutputStream daOut ) { try { daOut . writeInt ( m_iTypeField ) ; daOut . writeUTF ( typeFieldName ) ; daOut . writeInt ( m_iTargetValue ) ; } catch ( IOException ex ) { ex . printStackTrace ( ) ; } }
InitRemoteStub Method .
16,140
public void initRemoteSkel ( ObjectInputStream daIn ) { try { int iTypeField = daIn . readInt ( ) ; String typeFieldName = daIn . readUTF ( ) ; int iTargetValue = daIn . readInt ( ) ; this . init ( iTypeField , typeFieldName , iTargetValue ) ; } catch ( IOException ex ) { ex . printStackTrace ( ) ; } }
InitRemoteSkel Method .
16,141
public int handleMessage ( BaseMessage message ) { String strClassName = this . getMessageProcessorClassName ( message ) ; if ( ( strClassName == null ) || ( strClassName . length ( ) == 0 ) ) return this . handleOtherMessage ( message ) ; message . consume ( ) ; String strParams = Utility . addURLParam ( null , DBPara...
Handle this message . Get the name of this process and run it .
16,142
public String getMessageProcessorClassName ( BaseMessage message ) { String strClass = ( String ) message . getMessageHeader ( ) . get ( DBParams . PROCESS ) ; if ( ( strClass == null ) || ( strClass . length ( ) == 0 ) ) { String strMessageCode = ( String ) message . getMessageHeader ( ) . get ( BaseMessageHeader . ME...
Get the message processor class name .
16,143
public void setOwner ( ListenerOwner owner ) { super . setOwner ( owner ) ; if ( owner == null ) return ; if ( m_fldThisFile == null ) if ( thisFileFieldName != null ) m_fldThisFile = this . getOwner ( ) . getField ( thisFileFieldName ) ; if ( m_fldThisFile2 == null ) if ( thisFileFieldName2 != null ) m_fldThisFile2 = ...
Set the record that owns this listener . This method looks up up all the fields in the record .
16,144
public CTX toEqualTo ( R equalsTo ) { to ( rs -> rs . isEqualTo ( equalsTo ) ) ; return context . self ( ) ; }
Convenient method to just check equality
16,145
public static EventType getEventType ( Key key ) { Key ek = findAncestor ( Repository . EVENTTYPE , key ) ; return EventType . values ( ) [ ( int ) ek . getId ( ) - 1 ] ; }
Returns current EventType from EventType Event or Reservation keys
16,146
public static Date getEventDate ( Key key ) { Key ek = findAncestor ( Repository . EVENT , key ) ; return new Date ( ek . getId ( ) ) ; }
Returns current Event Date from Event or Reservation keys
16,147
public void format ( PrintStream out , String [ ] headers , String [ ] ... rows ) { int [ ] columnWidth = computeEachColumnWidth ( this . defaultColumnWidth , headers , rows ) ; printRow ( out , columnWidth , headers ) ; printTableSeperatir ( out , headers , columnWidth ) ; for ( String [ ] row : rows ) { printRow ( ou...
Prints a table
16,148
public static boolean isIpv4 ( String hostName ) { int periodCount = 0 ; int numberCount = 0 ; int lowerCount = 0 ; int upperCount = 0 ; int otherCount = 0 ; for ( int i = 0 ; i < hostName . length ( ) ; i ++ ) { char myChar = hostName . charAt ( i ) ; if ( myChar == '.' ) { periodCount ++ ; } else if ( myChar >= '0' &...
Return true of the string is an IP address instead of a hostname . No this is not a perfect algorithm but is is close enough . If no number
16,149
public MessageFieldDesc addMessageFieldDesc ( String strParam , Class < ? > classRawObject , boolean bRequired , Object objRawDefault ) { return new MessageFieldDesc ( this , strParam , classRawObject , bRequired , objRawDefault ) ; }
Add the data description for this param .
16,150
public MessageDataDesc getMessageDataDesc ( String strParam ) { if ( strParam == null ) return this ; if ( strParam . equals ( this . getKey ( ) ) ) return this ; if ( m_messageDataDescChildren == null ) { m_messageDataDescChildren = new HashMap < String , MessageDataDesc > ( ) ; this . setupMessageDataDesc ( ) ; } ret...
Get the data description for this param .
16,151
public boolean isSingleDetail ( Rec record ) { boolean bSingleDetail = true ; if ( Boolean . toString ( false ) . equals ( this . getMessage ( ) . getMessageHeader ( ) . get ( BaseMessageHeader . SINGLE_DETAIL_PARAM ) ) ) return false ; return bSingleDetail ; }
Does this message only include a single booking detail item? .
16,152
public int putRawRecordData ( Rec record ) { if ( this . getNodeType ( ) == BaseMessageRecordDesc . NON_UNIQUE_NODE ) this . getMessage ( ) . createNewNode ( this . getFullKey ( null ) ) ; return super . putRawRecordData ( record ) ; }
Move the correct fields from this current record to the map . If this method is used is must be overidden to move the correct fields .
16,153
public void putRawProperties ( PropertyOwner propertyOwner ) { if ( m_messageDataDescChildren != null ) { for ( String strKey : m_messageDataDescChildren . keySet ( ) ) { m_messageDataDescChildren . get ( strKey ) . putRawProperties ( propertyOwner ) ; } } }
Move the data from this propertyowner to this message .
16,154
public void put ( String strKey , Object objValue ) { if ( this . getMessageFieldDesc ( strKey ) != null ) this . getMessageFieldDesc ( strKey ) . put ( objValue ) ; else if ( this . getMessage ( ) != null ) this . getMessage ( ) . putNative ( this . getFullKey ( strKey ) , objValue ) ; }
Convenience method - Put the value for this param in the map . If it is not the correct object type convert it first .
16,155
public Object get ( String strKey ) { Object data = null ; if ( this . getMessageFieldDesc ( strKey ) != null ) data = this . getMessageFieldDesc ( strKey ) . get ( ) ; else if ( this . getMessage ( ) != null ) data = this . getMessage ( ) . getNative ( this . getFullKey ( strKey ) ) ; return data ; }
Convenience method - Get the data at this key .
16,156
public void moveRequestInfoToReply ( Message messageRequest ) { if ( m_messageDataDescChildren != null ) { for ( String strKey : m_messageDataDescChildren . keySet ( ) ) { MessageDataDesc messageDataDesc = m_messageDataDescChildren . get ( strKey ) ; MessageDataDesc requestMessageDataDesc = ( ( BaseMessage ) messageReq...
Move the pertinenent information from the request to this reply message . Override this to actually move information .
16,157
public static JWT verify ( String jwt , String secret ) { return verify ( jwt , secret == null ? null : secret . getBytes ( StandardCharsets . UTF_8 ) ) ; }
Verify whether the JWT is valid . If valid return the decoded instance .
16,158
public void removeAppointments ( Anniversary recAnniversary ) { SubFileFilter listener = new SubFileFilter ( this ) ; recAnniversary . addListener ( listener ) ; try { recAnniversary . close ( ) ; while ( recAnniversary . hasNext ( ) ) { recAnniversary . next ( ) ; recAnniversary . edit ( ) ; recAnniversary . remove ( ...
RemoveAppointments Method .
16,159
public void addAppointments ( Anniversary recAnniversary , Calendar calStart , Calendar calEnd ) { try { Converter . initGlobals ( ) ; Calendar calendar = Converter . gCalendar ; Record recRepeat = ( ( ReferenceField ) this . getField ( AnnivMaster . REPEAT_INTERVAL_ID ) ) . getReference ( ) ; String strRepeat = null ;...
AddAppointments Method .
16,160
public Record openMainRecord ( ) { Record record = null ; if ( this . getProperty ( DBParams . APPLET ) != null ) return null ; String strParamRecord = this . getProperty ( DBParams . RECORD ) ; if ( ( strParamRecord != null ) && ( strParamRecord . length ( ) > 0 ) ) record = Record . makeRecordFromClassName ( strParam...
Open the main file . DataAccessScreens check for a record param .
16,161
public void addPasswordProperty ( String strProperty ) { if ( m_setPropertiesDescriptions == null ) m_setPropertiesDescriptions = new HashSet < String > ( ) ; if ( strProperty != null ) m_setPropertiesDescriptions . add ( strProperty ) ; else m_setPropertiesDescriptions . remove ( strProperty ) ; }
Add this to the list of properties that must be encrypted .
16,162
public void processThisMessage ( ) { Utility . getLogger ( ) . info ( "On message called in receiving process" ) ; try { BaseMessage messageIn = this . getMessage ( ) ; if ( messageIn != null ) { BaseMessage messageReply = this . createReplyMessage ( messageIn ) ; this . moveScreenParamsToMessage ( messageReply ) ; thi...
This is the application code for handling the message . Once the message is received the application can retrieve the soap part the attachment part if there are any or any other information from the message .
16,163
public BaseMessage createReplyMessage ( BaseMessage messageIn ) { BaseMessage replyMessage = ( BaseMessage ) this . getMessageProcessInfo ( ) . createReplyMessage ( messageIn ) ; if ( replyMessage == null ) replyMessage = new TreeMessage ( null , null ) ; if ( replyMessage . getExternalMessage ( ) == null ) new Externa...
Given this message in create the reply message .
16,164
public boolean printData ( PrintWriter out , int iPrintOptions ) { this . addHiddenParam ( out , TrxMessageHeader . LOG_TRX_ID , this . getProperty ( TrxMessageHeader . LOG_TRX_ID ) ) ; return super . printData ( out , iPrintOptions ) ; }
PrintData Method .
16,165
public void addPropertiesFieldBehavior ( BaseField fldDisplay , String strProperty ) { BaseField fldProperties = this . getField ( MessageInfo . MESSAGE_PROPERTIES ) ; FieldListener listener = new CopyConvertersHandler ( new PropertiesConverter ( fldProperties , strProperty ) ) ; listener . setRespondsToMode ( DBConsta...
AddPropertiesFieldBehavior Method .
16,166
public DB forSite ( final long siteId ) { return siteId == this . siteId ? this : new DB ( this . connectionSupplier , siteId , this . taxonomyTermCaches . keySet ( ) , this . taxonomyCacheTimeout , this . userCache , this . usernameCache , this . metrics ) ; }
Creates a database for another site with shared user caches metrics and taxonomy terms .
16,167
private User userFromResultSet ( final ResultSet rs ) throws SQLException { String niceName = Strings . nullToEmpty ( rs . getString ( 3 ) ) . trim ( ) ; String displayName = Strings . nullToEmpty ( rs . getString ( 4 ) ) . trim ( ) ; String useDisplayName = displayName . isEmpty ( ) ? niceName : displayName ; return n...
Creates a user from a result set .
16,168
public User selectUser ( final long userId ) throws SQLException { Connection conn = null ; PreparedStatement stmt = null ; ResultSet rs = null ; Timer . Context ctx = metrics . selectUserTimer . time ( ) ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( selectUserByIdSQL ) ; stmt...
Selects a user from the database .
16,169
public User resolveUser ( final long userId ) throws SQLException { metrics . userCacheTries . mark ( ) ; User user = userCache . getIfPresent ( userId ) ; if ( user != null ) { metrics . userCacheHits . mark ( ) ; return user ; } else { user = selectUser ( userId ) ; if ( user != null ) { userCache . put ( userId , us...
Resolves a user by id possibly with the internal cache .
16,170
public User resolveUser ( final String username ) throws SQLException { metrics . usernameCacheTries . mark ( ) ; User user = usernameCache . getIfPresent ( username ) ; if ( user != null ) { metrics . usernameCacheHits . mark ( ) ; return user ; } else { user = selectUser ( username ) ; if ( user != null ) { usernameC...
Resolves a user by username possibly with the internal cache .
16,171
public boolean deleteUser ( final long userId ) throws SQLException { Connection conn = null ; PreparedStatement stmt = null ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( deleteUserSQL ) ; stmt . setLong ( 1 , userId ) ; return stmt . executeUpdate ( ) > 0 ; } finally { SQLUti...
Deletes a user by id .
16,172
public List < Meta > userMetadata ( final long userId , final String key ) throws SQLException { Connection conn = null ; PreparedStatement stmt = null ; ResultSet rs = null ; List < Meta > meta = Lists . newArrayListWithExpectedSize ( 16 ) ; Timer . Context ctx = metrics . userMetadataTimer . time ( ) ; try { conn = c...
Selects user metadata with a specified key .
16,173
public void clearUserMeta ( final long userId ) throws SQLException { Connection conn = null ; PreparedStatement stmt = null ; Timer . Context ctx = metrics . clearUserMetaTimer . time ( ) ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( deleteUserMetaSQL ) ; stmt . setLong ( 1 ,...
Clears all metadata for a user .
16,174
public void deletePost ( final long postId ) throws SQLException { clearPostMeta ( postId ) ; Connection conn = null ; PreparedStatement stmt = null ; Timer . Context ctx = metrics . deletePostTimer . time ( ) ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( deletePostIdSQL ) ; s...
Deletes a post with a specified id including all associated metadata .
16,175
private Post . Builder postFromResultSet ( final ResultSet rs ) throws SQLException { Post . Builder post = Post . newBuilder ( ) ; post . setId ( rs . getLong ( 1 ) ) ; post . setAuthorId ( rs . getLong ( 2 ) ) ; Timestamp ts = rs . getTimestamp ( 3 ) ; post . setPublishTimestamp ( ts != null ? ts . getTime ( ) : 0L )...
Builds a post from a result set .
16,176
public List < Post > selectAuthorPosts ( final long userId , final Post . Sort sort , final Paging paging , final boolean withResolve ) throws SQLException { if ( paging . limit < 1 || paging . start < 0 ) { return ImmutableList . of ( ) ; } List < Post . Builder > builders = Lists . newArrayListWithExpectedSize ( pagi...
Selects a page of posts for an author .
16,177
public long selectMaxPostId ( ) throws SQLException { Connection conn = null ; Statement stmt = null ; ResultSet rs = null ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . createStatement ( ) ; rs = stmt . executeQuery ( selectMaxPostIdSQL ) ; return rs . next ( ) ? rs . getLong ( 1 ) : 0L ; } fina...
Selects the current maximum post id .
16,178
public List < Post > selectPosts ( final Post . Type type , final Post . Status status , final Post . Sort sort , final Paging paging , final boolean withResolve ) throws SQLException { return selectPosts ( type != null ? EnumSet . of ( type ) : null , status , sort , paging , withResolve ) ; }
Selects a page of posts with a specific type .
16,179
public List < Post > selectPosts ( final EnumSet < Post . Type > types , final Post . Status status , final Post . Sort sort , final Paging paging , final boolean withResolve ) throws SQLException { if ( paging . limit < 1 || paging . start < 0 ) { return ImmutableList . of ( ) ; } List < Post . Builder > builders = Li...
Selects a page of posts with a set of specified types .
16,180
public List < Long > selectPostIds ( final Post . Type type , final Post . Status status , final Collection < TaxonomyTerm > terms , final Post . Sort sort , final Paging paging ) throws SQLException { return selectPostIds ( type != null ? EnumSet . of ( type ) : null , status , terms , sort , paging ) ; }
Selects a page of posts with a specified type .
16,181
public List < Long > selectPostIds ( final EnumSet < Post . Type > types , final Post . Status status , final Collection < TaxonomyTerm > terms , final Post . Sort sort , final Paging paging ) throws SQLException { if ( paging . limit < 1 || paging . start < 0 ) { return ImmutableList . of ( ) ; } List < Long > ids = L...
Selects a page of posts with associated terms and a set of types .
16,182
public void deleteChildren ( final long parentId ) throws SQLException { Connection conn = null ; PreparedStatement stmt = null ; Timer . Context ctx = metrics . deleteChildrenTimer . time ( ) ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( deleteChildrenSQL ) ; stmt . setLong (...
Deletes all children .
16,183
public List < Post > selectChildren ( final long parentId , final boolean withResolve ) throws SQLException { List < Post . Builder > builders = Lists . newArrayListWithExpectedSize ( 4 ) ; Connection conn = null ; PreparedStatement stmt = null ; ResultSet rs = null ; Timer . Context ctx = metrics . selectChildrenTimer...
Gets all children for a post .
16,184
private StringBuilder appendPostTypes ( final EnumSet < Post . Type > types , final StringBuilder sql ) { int typesCount = types != null ? types . size ( ) : 0 ; switch ( typesCount ) { case 0 : break ; case 1 : sql . append ( " AND post_type=" ) . append ( String . format ( "'%s'" , types . iterator ( ) . next ( ) . t...
Appends post type constraint .
16,185
private StringBuilder appendPagingSortSQL ( final StringBuilder sql , final Post . Sort sort , final Paging paging ) { if ( paging . interval != null ) { sql . append ( " AND post_date" ) ; sql . append ( paging . startIsOpen ? " >" : " >=" ) ; sql . append ( "?" ) ; sql . append ( " AND post_date" ) ; sql . append ( p...
Appends paging interval constraint if required paging and sort .
16,186
public Post . Builder resolve ( final Post . Builder post ) throws SQLException { Timer . Context ctx = metrics . resolvePostTimer . time ( ) ; try { User author = resolveUser ( post . getAuthorId ( ) ) ; if ( author != null ) { List < Meta > meta = userMetadata ( post . getAuthorId ( ) ) ; if ( meta . size ( ) > 0 ) {...
Resolves user author terms and meta for a post .
16,187
public Post . Builder selectPost ( final long postId ) throws SQLException { Connection conn = null ; PreparedStatement stmt = null ; ResultSet rs = null ; Timer . Context ctx = metrics . selectPostTimer . time ( ) ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( selectPostSQL + ...
Selects a post by id .
16,188
public Map < Long , Post > selectPostMap ( final Collection < Long > postIds , final boolean withResolve ) throws SQLException { Map < Long , Post > postMap = Maps . newHashMapWithExpectedSize ( postIds . size ( ) ) ; Connection conn = null ; Statement stmt = null ; ResultSet rs = null ; Timer . Context ctx = metrics ....
Selects posts from a collection of ids into a map .
16,189
public List < Post > selectPosts ( final Collection < Long > postIds , final boolean withResolve ) throws SQLException { if ( postIds == null || postIds . size ( ) == 0 ) { return ImmutableList . of ( ) ; } Map < Long , Post > postMap = selectPostMap ( postIds , withResolve ) ; List < Post > posts = Lists . newArrayLis...
Selects posts from a collection of ids into a list in input order .
16,190
public boolean updatePostTimestamps ( long postId , final long publishTimestamp , final long modifiedTimestamp , final TimeZone tz ) throws SQLException { int offset = tz . getOffset ( publishTimestamp ) ; Connection conn = null ; PreparedStatement stmt = null ; Timer . Context ctx = metrics . updatePostTimer . time ( ...
Updates only the timestamp fields for a post .
16,191
public boolean updatePostContent ( long postId , final String content ) throws SQLException { Connection conn = null ; PreparedStatement stmt = null ; Timer . Context ctx = metrics . updatePostTimer . time ( ) ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( updatePostContentSQL ...
Updates the content for a post .
16,192
public boolean updatePostExcerpt ( long postId , final String excerpt ) throws SQLException { Connection conn = null ; PreparedStatement stmt = null ; Timer . Context ctx = metrics . updatePostTimer . time ( ) ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( updatePostExcerptSQL ...
Updates the excerpt for a post .
16,193
public boolean updatePostTitle ( long postId , final String title ) throws SQLException { Connection conn = null ; PreparedStatement stmt = null ; Timer . Context ctx = metrics . updatePostTimer . time ( ) ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( updatePostTitleSQL ) ; st...
Updates the title for a post .
16,194
public boolean updatePostGuid ( long postId , final String guid ) throws SQLException { Connection conn = null ; PreparedStatement stmt = null ; Timer . Context ctx = metrics . updatePostTimer . time ( ) ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( updatePostGuidSQL ) ; stmt ...
Updates the guid for a post .
16,195
public void updatePostStatus ( final long postId , final Post . Status status ) throws SQLException { Connection conn = null ; PreparedStatement stmt = null ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( updatePostStatusSQL ) ; stmt . setString ( 1 , status . toString ( ) . toL...
Updates the status for a post .
16,196
public boolean updatePostAuthor ( final long postId , final long authorId ) throws SQLException { Connection conn = null ; PreparedStatement stmt = null ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( updatePostAuthorSQL ) ; stmt . setLong ( 1 , authorId ) ; stmt . setLong ( 2 ,...
Updates the author of a post .
16,197
public void updateCommentStatus ( final long postId , final Post . CommentStatus commentStatus , final Post . CommentStatus pingStatus ) throws SQLException { Connection conn = null ; PreparedStatement stmt = null ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( updatePostComment...
Updates the comment status for a post .
16,198
public Post updatePost ( Post post , final TimeZone tz ) throws SQLException { if ( post . id < 1L ) { throw new SQLException ( "The post id must be specified for update" ) ; } if ( post . modifiedTimestamp < 1 ) { post = post . modifiedNow ( ) ; } int offset = tz . getOffset ( post . publishTimestamp ) ; Connection co...
Updates a post .
16,199
public void touchPost ( final long postId , final TimeZone tz ) throws SQLException { if ( postId < 1L ) { throw new SQLException ( "The post id must be specified for update" ) ; } long modifiedTimestamp = System . currentTimeMillis ( ) ; int offset = tz . getOffset ( modifiedTimestamp ) ; Connection conn = null ; Prep...
Touches the last modified time for a post .