idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
17,000
public Message createReplyMessage ( Message message ) { Object objResponseID = ( ( BaseMessage ) message ) . getMessageHeader ( ) . get ( TrxMessageHeader . MESSAGE_RESPONSE_ID ) ; if ( objResponseID == null ) return null ; MessageProcessInfo recMessageProcessInfo = ( MessageProcessInfo ) this . getMessageProcessInfo ( objResponseID . toString ( ) ) ; MessageInfo recMessageInfo = ( MessageInfo ) ( ( ReferenceField ) recMessageProcessInfo . getField ( MessageProcessInfo . MESSAGE_INFO_ID ) ) . getReference ( ) ; BaseMessage replyMessage = new TreeMessage ( null , null ) ; MessageRecordDesc messageRecordDesc = recMessageInfo . createNewMessage ( replyMessage , null ) ; return replyMessage ; }
Create the response message for this message .
17,001
public void run ( ) { try { Object result = execute ( ) ; if ( ! aborted ) { this . retval = result ; finished = true ; } } catch ( InterruptedException ie ) { } catch ( Throwable t ) { execException = t ; finished = true ; } }
Used to invoke executable asynchronously .
17,002
public void interrupt ( ) { if ( ! aborted ) { aborted = true ; if ( executeThread != null ) { executeThread . interrupt ( ) ; } if ( helperExecutable != null ) { helperExecutable . interrupt ( ) ; } } }
Tries to interrupt execution . Execution code is interrupted if it sleeps once in a while .
17,003
public void init ( Record record , Record recordMain , String iMainFilesField , BaseField fieldMain , String fsToCount , boolean bRecountOnSelect , boolean bVerifyOnEOF , boolean bResetOnBreak ) { super . init ( record ) ; this . fsToCount = fsToCount ; if ( fieldMain != null ) m_fldMain = fieldMain ; else if ( recordMain != null ) m_fldMain = recordMain . getField ( iMainFilesField ) ; if ( m_fldMain != null ) if ( ( m_fldMain . getRecord ( ) == null ) || ( m_fldMain . getRecord ( ) . getEditMode ( ) == DBConstants . EDIT_NONE ) || ( m_fldMain . getRecord ( ) . getEditMode ( ) == DBConstants . EDIT_ADD ) ) this . resetCount ( ) ; m_dOldValue = 0 ; m_bRecountOnSelect = bRecountOnSelect ; m_bVerifyOnEOF = bVerifyOnEOF ; m_bResetOnBreak = bResetOnBreak ; m_dTotalToVerify = 0 ; m_bEOFHit = true ; }
Constructor for counting the value of a field in this record .
17,004
public int setCount ( double dFieldCount , boolean bDisableListeners , int iMoveMode ) { int iErrorCode = DBConstants . NORMAL_RETURN ; if ( m_fldMain != null ) { boolean [ ] rgbEnabled = null ; if ( bDisableListeners ) rgbEnabled = m_fldMain . setEnableListeners ( false ) ; int iOriginalValue = ( int ) m_fldMain . getValue ( ) ; boolean bOriginalModified = m_fldMain . isModified ( ) ; int iOldOpenMode = m_fldMain . getRecord ( ) . setOpenMode ( m_fldMain . getRecord ( ) . getOpenMode ( ) & ~ DBConstants . OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY ) ; iErrorCode = m_fldMain . setValue ( dFieldCount , true , iMoveMode ) ; m_fldMain . getRecord ( ) . setOpenMode ( iOldOpenMode ) ; if ( iOriginalValue == ( int ) m_fldMain . getValue ( ) ) if ( bOriginalModified == false ) m_fldMain . setModified ( bOriginalModified ) ; if ( rgbEnabled != null ) m_fldMain . setEnableListeners ( rgbEnabled ) ; } return iErrorCode ; }
Reset the field count .
17,005
public OWLSAtomicService buildOWLSServiceFrom ( URI serviceURI , List < URI > modelURIs ) throws ModelException { if ( isFile ( serviceURI ) ) { return buildOWLSServiceFromLocalOrRemoteURI ( serviceURI , modelURIs ) ; } else { Service service = OWLSStore . persistentModelAsOWLKB ( ) . getService ( serviceURI ) ; if ( null == service ) { throw new OWLTranslationException ( "Not found as a local file, nor a valid Service found in data store" , null ) ; } return buildOWLSServiceFrom ( service ) ; } }
Builds an OWLSAtomicService
17,006
public OWLSAtomicService buildOWLSServiceFrom ( Service owlsService ) throws ModelException { OWLSAtomicService service = new OWLSAtomicService ( owlsService ) ; return completeOWLSServiceIfNeeded ( service ) ; }
Builds an OWLSAtomicService from a given Service object
17,007
private OWLSAtomicService buildOWLSServiceFromLocalOrRemoteURI ( URI serviceURI , List < URI > modelURIs ) throws ModelException { BSDFLogger . getLogger ( ) . info ( "Builds OWL service (BSDF functionality) from: " + serviceURI . toString ( ) ) ; OWLContainer owlSyntaxTranslator = new OWLContainer ( ) ; OWLKnowledgeBase kb = KBWithReasonerBuilder . newKB ( ) ; if ( null != modelURIs ) { for ( URI uri : modelURIs ) { owlSyntaxTranslator . loadOntologyIfNotLoaded ( uri ) ; } } owlSyntaxTranslator . loadAsServiceIntoKB ( kb , serviceURI ) ; OWLSAtomicService service = new OWLSAtomicService ( kb . getServices ( false ) . iterator ( ) . next ( ) ) ; return completeOWLSServiceIfNeeded ( service ) ; }
Builds an OWLSAtomicService from a given URI that has to be a local file or an http URL
17,008
public final < T > T getTypedContext ( Class < T > key , T defaultValue ) { return UEL . getContext ( this , key , defaultValue ) ; }
Convenience method to return a typed context object when key resolves per documented convention to an object of the same type .
17,009
public < T extends EventListener > void subscribe ( EventPublisher source , T listener ) { if ( source == null || listener == null ) { throw new IllegalArgumentException ( "Parameters cannot be null" ) ; } log . debug ( "[subscribe] Adding {} , source . getClass ( ) . getName ( ) , listener . getClass ( ) . getName ( ) ) ; GenericEventDispatcher < T > dispatcher = ( GenericEventDispatcher < T > ) dispatchers . get ( source ) ; if ( dispatcher == null ) { log . warn ( "[subscribe] Registering with a disconnected source" ) ; dispatcher = createDispatcher ( source ) ; } dispatcher . addListener ( listener ) ; }
Binds a listener to a publisher
17,010
public < T extends EventListener > void unsubscribe ( EventPublisher source , T listener ) { log . debug ( "[unsubscribe] Removing {} , source . getClass ( ) . getName ( ) , listener . getClass ( ) . getName ( ) ) ; GenericEventDispatcher < T > dispatcher = ( GenericEventDispatcher < T > ) dispatchers . get ( source ) ; dispatcher . removeListener ( listener ) ; }
Unbinds a listener to a publisher
17,011
public EventDispatcher getEventDispatcher ( EventPublisher source ) { EventDispatcher ret = dispatchers . get ( source ) ; if ( ret == null ) { ret = createDispatcher ( source ) ; } return ret ; }
Gets the object used to fire events
17,012
public int getSubscribersCount ( EventPublisher source ) { GenericEventDispatcher < ? > dispatcherObject = dispatchers . get ( source ) ; if ( dispatcherObject == null ) { return 0 ; } else { return dispatcherObject . getListenersCount ( ) ; } }
Gets the number of listeners registered for a publisher
17,013
public static JFrame createShowAndPosition ( final String title , final Container content , final boolean exitOnClose , final FramePositioner positioner ) { return createShowAndPosition ( title , content , exitOnClose , true , positioner ) ; }
Create a new resizeable frame with a panel as it s content pane and position the frame .
17,014
public static ImageIcon loadIcon ( final Class clasz , final String name ) { final URL url = Utils4J . getResource ( clasz , name ) ; return new ImageIcon ( url ) ; }
Load an icon located in the same package as a given class .
17,015
private static void initLookAndFeelIntern ( final String className ) { try { UIManager . setLookAndFeel ( className ) ; } catch ( final Exception e ) { throw new RuntimeException ( "Error initializing the Look And Feel!" , e ) ; } }
Initializes the look and feel and wraps exceptions into a runtime exception . It s executed in the calling thread .
17,016
public static RootPaneContainer findRootPaneContainer ( final Component source ) { Component comp = source ; while ( ( comp != null ) && ! ( comp instanceof RootPaneContainer ) ) { comp = comp . getParent ( ) ; } if ( comp instanceof RootPaneContainer ) { return ( RootPaneContainer ) comp ; } return null ; }
Find the root pane container in the current hierarchy .
17,017
public static GlassPaneState showGlassPane ( final Component source ) { final Component focusOwner = KeyboardFocusManager . getCurrentKeyboardFocusManager ( ) . getFocusOwner ( ) ; final RootPaneContainer rootPaneContainer = findRootPaneContainer ( source ) ; final Component glassPane = rootPaneContainer . getGlassPane ( ) ; final MouseListener mouseListener = new MouseAdapter ( ) { } ; final Cursor cursor = glassPane . getCursor ( ) ; glassPane . addMouseListener ( mouseListener ) ; glassPane . setVisible ( true ) ; glassPane . requestFocus ( ) ; glassPane . setCursor ( new Cursor ( Cursor . WAIT_CURSOR ) ) ; return new GlassPaneState ( glassPane , mouseListener , focusOwner , cursor ) ; }
Makes the glass pane visible and focused and stores the saves the current state .
17,018
public static void hideGlassPane ( final GlassPaneState state ) { Utils4J . checkNotNull ( "state" , state ) ; final Component glassPane = state . getGlassPane ( ) ; glassPane . removeMouseListener ( state . getMouseListener ( ) ) ; glassPane . setCursor ( state . getCursor ( ) ) ; glassPane . setVisible ( false ) ; if ( state . getFocusOwner ( ) != null ) { state . getFocusOwner ( ) . requestFocus ( ) ; } }
Hides the glass pane and restores the saved state .
17,019
public < T > void setObject ( DataKey < T > key , T object ) { if ( key == null ) { throw new IllegalArgumentException ( "key must not be null" ) ; } if ( object == null && ! key . allowNull ( ) ) { throw new IllegalArgumentException ( "key \"" + key . getName ( ) + "\" disallows null values but object was null" ) ; } data . put ( key . getName ( ) , object ) ; }
stores an object for the given key
17,020
public < T > void setObjectList ( ListDataKey < T > key , List < T > objects ) { if ( key == null ) { throw new IllegalArgumentException ( "key must not be null" ) ; } if ( objects == null && ! key . allowNull ( ) ) { throw new IllegalArgumentException ( "list key \"" + key . getName ( ) + "\" disallows null values but object was null" ) ; } data . put ( key . getName ( ) , deepListCopy ( objects ) ) ; }
stores a list of objects for a given key
17,021
@ SuppressWarnings ( "unchecked" ) public static < C > C delegateIf ( Class < C > contract , Supplier < C > target , Supplier < Boolean > condition ) { checkVoid ( contract ) ; return ( C ) Proxy . newProxyInstance ( contract . getClassLoader ( ) , new Class [ ] { contract } , invocationHandler ( contract , target , condition ) ) ; }
Create a proxy which only delegates if a condition is true .
17,022
public void keyPressed ( KeyEvent evt ) { if ( evt . getKeyCode ( ) == KeyEvent . VK_ENTER ) { boolean bDoTab = true ; int iTextLength = m_control . getDocument ( ) . getLength ( ) ; if ( ( ( m_control . getSelectionStart ( ) == 0 ) || ( m_control . getSelectionStart ( ) == iTextLength ) ) && ( ( m_control . getSelectionEnd ( ) == 0 ) || ( m_control . getSelectionEnd ( ) == iTextLength ) ) ) bDoTab = true ; else bDoTab = false ; if ( bDoTab ) { if ( m_bDirty ) bDoTab = false ; } if ( evt . getKeyCode ( ) == KeyEvent . VK_ENTER ) if ( ! bDoTab ) return ; evt . consume ( ) ; this . transferFocus ( ) ; return ; } m_bDirty = true ; }
key released if tab select next field .
17,023
public Object unmarshalRootElement ( Node node , BaseXmlTrxMessageIn soapTrxMessage ) throws Exception { TransformerFactory tFact = TransformerFactory . newInstance ( ) ; Source source = new DOMSource ( node ) ; Writer writer = new StringWriter ( ) ; Result result = new StreamResult ( writer ) ; Transformer transformer = tFact . newTransformer ( ) ; transformer . transform ( source , result ) ; writer . flush ( ) ; writer . close ( ) ; String strXMLBody = writer . toString ( ) ; Reader inStream = new StringReader ( strXMLBody ) ; Object msg = this . unmarshalRootElement ( inStream , soapTrxMessage ) ; inStream . close ( ) ; return msg ; }
Create the root element for this message . You SHOULD override this if the unmarshaller has a native method to unmarshall a dom node .
17,024
public void addPayloadProperties ( Object msg , BaseMessage message ) { MessageDataDesc messageDataDesc = message . getMessageDataDesc ( null ) ; if ( messageDataDesc != null ) { Map < String , Class < ? > > mapPropertyNames = messageDataDesc . getPayloadPropertyNames ( null ) ; if ( mapPropertyNames != null ) { Map < String , Object > properties = this . getPayloadProperties ( msg , mapPropertyNames ) ; for ( String key : properties . keySet ( ) ) { message . put ( key , properties . get ( key ) ) ; } } } }
Utility to add the standard payload properties to the message
17,025
public Map < String , Object > getPayloadProperties ( Object msg , Map < String , Class < ? > > mapPropertyNames ) { Map < String , Object > properties = new HashMap < String , Object > ( ) ; for ( String strKey : mapPropertyNames . keySet ( ) ) { this . addPayloadProperty ( msg , properties , strKey ) ; } this . addPayloadProperty ( msg , properties , "Errors" ) ; return properties ; }
Get all the payload properties .
17,026
public void addPayloadProperty ( Object msg , Map < String , Object > properties , String key ) { String name = "get" + key ; try { Method method = msg . getClass ( ) . getMethod ( name , EMPTY_PARAMS ) ; if ( method != null ) { Object value = method . invoke ( msg , EMPTY_DATA ) ; if ( value != null ) { if ( value . getClass ( ) . getName ( ) . contains ( "ErrorsType" ) ) this . addErrorsProperties ( properties , value ) ; else properties . put ( key , value ) ; } } } catch ( SecurityException e ) { e . printStackTrace ( ) ; } catch ( NoSuchMethodException e ) { } catch ( InvocationTargetException e ) { e . printStackTrace ( ) ; } catch ( IllegalAccessException e ) { e . printStackTrace ( ) ; } }
Add this payload property to this map .
17,027
public void addErrorsProperties ( Map < String , Object > properties , Object errorsType ) { try { Method method = errorsType . getClass ( ) . getMethod ( "getErrors" , EMPTY_PARAMS ) ; if ( method != null ) { Object value = method . invoke ( errorsType , EMPTY_DATA ) ; if ( value instanceof List < ? > ) { for ( Object errorType : ( List < ? > ) value ) { method = errorType . getClass ( ) . getMethod ( "getShortText" , EMPTY_PARAMS ) ; if ( method != null ) { value = method . invoke ( errorType , EMPTY_DATA ) ; if ( value instanceof String ) properties . put ( "Error" , value ) ; } } } } } catch ( SecurityException e ) { e . printStackTrace ( ) ; } catch ( IllegalArgumentException e ) { e . printStackTrace ( ) ; } catch ( NoSuchMethodException e ) { e . printStackTrace ( ) ; } catch ( IllegalAccessException e ) { e . printStackTrace ( ) ; } catch ( InvocationTargetException e ) { e . printStackTrace ( ) ; } }
Add the error properties from this message .
17,028
@ Unit ( NM ) public static double radius ( Location ... location ) { Location center = center ( location ) ; double max = 0 ; for ( Location loc : location ) { Distance distance = distance ( loc , center ) ; double miles = distance . getMiles ( ) ; if ( miles > max ) { max = miles ; } } return max ; }
First calculates center point and returns maximum distance from center in NM .
17,029
public List < PublishedEvent > findQueued ( ) { return repositoryService . allMatches ( new QueryDefault < > ( PublishedEvent . class , "findByStateOrderByTimestamp" , "state" , PublishedEvent . State . QUEUED ) ) ; }
region > findQueued
17,030
public List < PublishedEvent > findProcessed ( ) { return repositoryService . allMatches ( new QueryDefault < > ( PublishedEvent . class , "findByStateOrderByTimestamp" , "state" , PublishedEvent . State . PROCESSED ) ) ; }
region > findProcessed
17,031
public void purgeProcessed ( ) { List < PublishedEvent > processedEvents = findProcessed ( ) ; for ( PublishedEvent publishedEvent : processedEvents ) { publishedEvent . delete ( ) ; } }
region > purgeProcessed
17,032
public static URL getURLFromPath ( String path , BaseApplet applet ) { URL url = null ; try { if ( ( url == null ) && ( path != null ) ) url = new URL ( path ) ; } catch ( MalformedURLException ex ) { Application app = null ; if ( applet == null ) applet = ( BaseApplet ) BaseApplet . getSharedInstance ( ) . getApplet ( ) ; if ( applet != null ) app = applet . getApplication ( ) ; if ( ( app != null ) && ( url == null ) && ( path != null ) ) url = app . getResourceURL ( path , applet ) ; else ex . printStackTrace ( ) ; } return url ; }
Get the URL from the path .
17,033
public int tryFillAll ( RingByteBuffer ring ) throws IOException , InterruptedException { fillLock . lock ( ) ; try { if ( ring . marked ( ) > free ( ) ) { return 0 ; } return fill ( ring ) ; } finally { fillLock . unlock ( ) ; } }
Calls fill if rings marked fits . Otherwise returns 0 .
17,034
public int fillAll ( RingByteBuffer ring ) throws IOException , InterruptedException { if ( ring . marked ( ) > capacity ) { throw new IllegalArgumentException ( "marked > capacity" ) ; } fillLock . lock ( ) ; try { fillSync . waitUntil ( ( ) -> ring . marked ( ) <= free ( ) ) ; return fill ( ring ) ; } finally { fillLock . unlock ( ) ; } }
Waits until ring . marked fits .
17,035
protected String getSpacer ( ) { final StringBuilder output = new StringBuilder ( ) ; final int indentationSize = parent != null ? getColumn ( ) : 0 ; for ( int i = 1 ; i < indentationSize ; i ++ ) { output . append ( SPACER ) ; } return output . toString ( ) ; }
Gets the spacer string to append before nodes in their toString methods .
17,036
public void init ( RecordOwnerParent taskParent , Record recordMain , Map < String , Object > properties ) { m_trxMessage = null ; if ( properties != null ) m_trxMessage = ( BaseMessage ) properties . remove ( DBParams . MESSAGE ) ; super . init ( taskParent , recordMain , properties ) ; }
Initializes the MessageProcessor .
17,037
public Integer getRegistryID ( BaseMessage internalMessageReply ) { Integer intRegistryID = null ; Object objRegistryID = null ; if ( internalMessageReply . getMessageHeader ( ) instanceof TrxMessageHeader ) objRegistryID = ( ( TrxMessageHeader ) internalMessageReply . getMessageHeader ( ) ) . getMessageHeaderMap ( ) . get ( TrxMessageHeader . REGISTRY_ID ) ; if ( objRegistryID == null ) objRegistryID = internalMessageReply . get ( TrxMessageHeader . REGISTRY_ID ) ; if ( objRegistryID instanceof Integer ) intRegistryID = ( Integer ) objRegistryID ; else if ( objRegistryID instanceof String ) { try { intRegistryID = new Integer ( Integer . parseInt ( ( String ) objRegistryID ) ) ; } catch ( NumberFormatException ex ) { intRegistryID = null ; } } return intRegistryID ; }
Get the message queue registry ID from this message .
17,038
public < T > T answer ( Function < String , T > function , final String validationErrorMessage ) { validateWith ( functionValidator ( function , validationErrorMessage ) ) ; return function . apply ( answer ( ) ) ; }
Return user input as T
17,039
private String initConsoleAndGetAnswer ( ) { ConsoleReaderWrapper consoleReaderWrapper = initConsole ( ) ; String input = "" ; boolean valid = false ; while ( ! valid ) { input = consoleReaderWrapper . getInput ( ) ; valid = validate ( consoleReaderWrapper , input ) ; if ( ! valid ) { consoleReaderWrapper . print ( "" ) ; consoleReaderWrapper . print ( question ) ; } } consoleReaderWrapper . close ( ) ; return input ; }
Initialize console and get user input as answer
17,040
private boolean validate ( ConsoleReaderWrapper consoleReaderWrapper , String input ) { Iterable < String > errors = validate ( input ) ; if ( ! Iterables . isEmpty ( errors ) ) { consoleReaderWrapper . beep ( ) ; for ( String error : errors ) { consoleReaderWrapper . print ( error ) ; } return false ; } else { return true ; } }
Validate user input with available validators
17,041
public void init ( Object env , Map < String , Object > properties , Object applet ) { super . init ( env , properties , applet ) ; Task task = new AutoTask ( this , null , null ) ; m_systemRecordOwner = ( RecordOwner ) ClassServiceUtility . getClassService ( ) . makeObjectFromClassName ( ResourceConstants . BASE_PROCESS_CLASS ) ; m_systemRecordOwner . init ( task , null , null ) ; String strUser = this . getProperty ( Params . USER_ID ) ; if ( strUser == null ) strUser = this . getProperty ( Params . USER_NAME ) ; if ( this . login ( task , strUser , this . getProperty ( Params . PASSWORD ) , this . getProperty ( Params . DOMAIN ) ) != DBConstants . NORMAL_RETURN ) this . login ( task , null , null , this . getProperty ( Params . DOMAIN ) ) ; }
Initializes the MainApplication . Usually you pass the object that wants to use this sesssion . For example the applet or MainApplication .
17,042
public void free ( ) { Record recUserRegistration = ( Record ) m_systemRecordOwner . getRecord ( UserRegistrationModel . USER_REGISTRATION_FILE ) ; if ( recUserRegistration != null ) { for ( UserProperties regKey : m_htRegistration . values ( ) ) { regKey . free ( ) ; } recUserRegistration . free ( ) ; recUserRegistration = null ; } Record recUserInfo = ( Record ) this . getUserInfo ( ) ; if ( recUserInfo != null ) { if ( recUserInfo . isModified ( false ) ) { try { if ( recUserInfo . getEditMode ( ) == Constants . EDIT_ADD ) recUserInfo . add ( ) ; else recUserInfo . set ( ) ; } catch ( DBException ex ) { ex . printStackTrace ( ) ; } } recUserInfo . free ( ) ; recUserInfo = null ; } super . free ( ) ; }
Release the user s preferences .
17,043
public String getDefaultSystemName ( ) { Environment env = this . getEnvironment ( ) ; Map < String , Object > properties = new HashMap < String , Object > ( ) ; properties . put ( DBConstants . SYSTEM_NAME , "base" ) ; BaseApplication app = new MainApplication ( env , properties , null ) ; try { Task task = new AutoTask ( app , null , properties ) ; RecordOwner recordOwner = new BaseProcess ( task , null , properties ) ; Record menus = Record . makeRecordFromClassName ( MenusModel . THICK_CLASS , recordOwner ) ; menus . getField ( Menus . CODE ) . setString ( ResourceConstants . DEFAULT_RESOURCE ) ; menus . setKeyArea ( MenusModel . CODE_KEY ) ; if ( menus . seek ( null ) ) return ( ( PropertiesField ) menus . getField ( Menus . PARAMS ) ) . getProperty ( DBConstants . SYSTEM_NAME ) ; } catch ( DBException e ) { e . printStackTrace ( ) ; } finally { env . removeApplication ( app ) ; app . setEnvironment ( null ) ; app . free ( ) ; } return Utility . DEFAULT_SYSTEM_SUFFIX ; }
Read the default system name .
17,044
public Map < String , Object > addMenuProperties ( String strSubDomain , Record recMenus , Map < String , Object > mapDomainProperties ) { try { recMenus . getField ( Menus . CODE ) . setString ( strSubDomain ) ; if ( recMenus . seek ( "=" ) ) { Map < String , Object > properties = ( ( PropertiesField ) recMenus . getField ( Menus . PARAMS ) ) . getProperties ( ) ; if ( properties == null ) properties = new HashMap < String , Object > ( ) ; if ( properties . get ( DBParams . HOME ) == null ) properties . put ( DBParams . HOME , strSubDomain ) ; Map < String , Object > oldProperties = m_systemRecordOwner . getProperties ( ) ; m_systemRecordOwner . setProperties ( properties ) ; properties = BaseDatabase . addDBProperties ( null , m_systemRecordOwner , null ) ; m_systemRecordOwner . setProperties ( oldProperties ) ; if ( mapDomainProperties == null ) mapDomainProperties = properties ; else { properties . putAll ( mapDomainProperties ) ; mapDomainProperties = properties ; } } } catch ( DBException ex ) { ex . printStackTrace ( ) ; } return mapDomainProperties ; }
Add the properies from this menu item .
17,045
public Map < String , Object > setDomainProperties ( Task task , String strDomain ) { Map < String , Object > mapDomainProperties = null ; if ( strDomain != null ) { if ( m_systemRecordOwner != null ) { mapDomainProperties = this . getDomainProperties ( strDomain ) ; if ( mapDomainProperties != null ) if ( ( ( mapDomainProperties . get ( DBConstants . DB_USER_PREFIX ) != null ) && ( ! mapDomainProperties . get ( DBConstants . DB_USER_PREFIX ) . equals ( m_systemRecordOwner . getProperty ( DBConstants . DB_USER_PREFIX ) ) ) ) || ( ( m_systemRecordOwner . getProperty ( DBConstants . DB_USER_PREFIX ) != null ) && ( ! m_systemRecordOwner . getProperty ( DBConstants . DB_USER_PREFIX ) . equals ( mapDomainProperties . get ( DBConstants . DB_USER_PREFIX ) ) ) ) ) { m_systemRecordOwner . free ( ) ; m_databaseCollection . free ( ) ; m_databaseCollection = new DatabaseCollection ( this ) ; m_systemRecordOwner = ( RecordOwner ) ClassServiceUtility . getClassService ( ) . makeObjectFromClassName ( ResourceConstants . BASE_PROCESS_CLASS ) ; m_systemRecordOwner . init ( task , null , null ) ; } m_systemRecordOwner . setProperties ( mapDomainProperties ) ; } } return mapDomainProperties ; }
If the domain changes change the properties to the new domain .
17,046
public boolean readUserInfo ( boolean bRefreshOnChange , boolean bForceRead ) { String strUserID = this . getProperty ( DBParams . USER_ID ) ; if ( strUserID == null ) strUserID = this . getProperty ( DBParams . USER_NAME ) ; if ( strUserID == null ) strUserID = Constants . BLANK ; Record recUserInfo = ( Record ) this . getUserInfo ( ) ; if ( recUserInfo == null ) recUserInfo = Record . makeRecordFromClassName ( UserInfoModel . THICK_CLASS , m_systemRecordOwner ) ; else { try { if ( recUserInfo . getEditMode ( ) == DBConstants . EDIT_IN_PROGRESS ) if ( recUserInfo . isModified ( ) ) { int iID = ( int ) recUserInfo . getCounterField ( ) . getValue ( ) ; recUserInfo . set ( ) ; if ( iID != recUserInfo . getCounterField ( ) . getValue ( ) ) this . setProperty ( DBParams . USER_ID , recUserInfo . getCounterField ( ) . toString ( ) ) ; } } catch ( DBException ex ) { ex . printStackTrace ( ) ; } } boolean bFound = ( ( UserInfoModel ) recUserInfo ) . getUserInfo ( strUserID , bForceRead ) ; if ( ! bFound ) { int iOpenMode = recUserInfo . getOpenMode ( ) ; if ( bRefreshOnChange ) recUserInfo . setOpenMode ( recUserInfo . getOpenMode ( ) | DBConstants . OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY ) ; else recUserInfo . setOpenMode ( recUserInfo . getOpenMode ( ) & ~ DBConstants . OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY ) ; try { recUserInfo . addNew ( ) ; if ( ( strUserID != null ) && ( strUserID . length ( ) > 0 ) ) if ( ! Utility . isNumeric ( strUserID ) ) recUserInfo . getField ( UserInfoModel . USER_NAME ) . setString ( strUserID ) ; } catch ( DBException ex ) { bFound = false ; } finally { recUserInfo . setOpenMode ( iOpenMode ) ; } } return bFound ; }
Read the user info record for the current user .
17,047
public void removeUserProperties ( UserProperties userProperties ) { if ( m_htRegistration . get ( userProperties . getKey ( ) ) != null ) m_htRegistration . remove ( userProperties . getKey ( ) ) ; }
Remove this user registration record .
17,048
public Record getUserRegistration ( ) { Record recUserRegistration = ( Record ) m_systemRecordOwner . getRecord ( UserRegistrationModel . USER_REGISTRATION_FILE ) ; if ( recUserRegistration == null ) recUserRegistration = Record . makeRecordFromClassName ( UserRegistrationModel . THICK_CLASS , m_systemRecordOwner ) ; return recUserRegistration ; }
Get the user registration record . And create it if it doesn t exist yet .
17,049
public UserInfoModel getUserInfo ( ) { UserInfoModel recUserInfo = null ; if ( m_systemRecordOwner != null ) recUserInfo = ( UserInfoModel ) m_systemRecordOwner . getRecord ( UserInfoModel . USER_INFO_FILE ) ; return recUserInfo ; }
Get the user information record .
17,050
public RemoteTask createRemoteTask ( String strServer , String strRemoteApp , String strUserID , String strPassword ) { RemoteTask remoteTask = super . createRemoteTask ( strServer , strRemoteApp , strUserID , strPassword ) ; return remoteTask ; }
Connect to the remote server and get the remote server object .
17,051
public int generateBytes ( byte [ ] out , int outOff , int len ) throws DataLengthException , IllegalArgumentException { if ( ( out . length - len ) < outOff ) { throw new DataLengthException ( "output buffer too small" ) ; } long oBytes = len ; int outLen = digest . getDigestSize ( ) ; if ( oBytes > ( ( 2L << 32 ) - 1 ) ) { throw new IllegalArgumentException ( "Output length too large" ) ; } int cThreshold = ( int ) ( ( oBytes + outLen - 1 ) / outLen ) ; byte [ ] dig = new byte [ digest . getDigestSize ( ) ] ; byte [ ] C = new byte [ 4 ] ; Pack . intToBigEndian ( counterStart , C , 0 ) ; int counterBase = counterStart & ~ 0xFF ; for ( int i = 0 ; i < cThreshold ; i ++ ) { digest . update ( C , 0 , C . length ) ; digest . update ( shared , 0 , shared . length ) ; if ( iv != null ) { digest . update ( iv , 0 , iv . length ) ; } digest . doFinal ( dig , 0 ) ; if ( len > outLen ) { System . arraycopy ( dig , 0 , out , outOff , outLen ) ; outOff += outLen ; len -= outLen ; } else { System . arraycopy ( dig , 0 , out , outOff , len ) ; } if ( ++ C [ 3 ] == 0 ) { counterBase += 0x100 ; Pack . intToBigEndian ( counterBase , C , 0 ) ; } } digest . reset ( ) ; return ( int ) oBytes ; }
fill len bytes of the output buffer with bytes generated from the derivation function .
17,052
public void severe ( String format , Object ... args ) { if ( isLoggable ( SEVERE ) ) { logIt ( SEVERE , String . format ( format , args ) ) ; } }
Write to log SEVERE level .
17,053
public void warning ( String format , Object ... args ) { if ( isLoggable ( WARNING ) ) { logIt ( WARNING , String . format ( format , args ) ) ; } }
Write to log at WARNING level .
17,054
public void info ( String format , Object ... args ) { if ( isLoggable ( INFO ) ) { logIt ( INFO , String . format ( format , args ) ) ; } }
Write to log at INFO level .
17,055
public void config ( String format , Object ... args ) { if ( isLoggable ( CONFIG ) ) { logIt ( CONFIG , String . format ( format , args ) ) ; } }
Write to log at CONFIG level .
17,056
public void fine ( String format , Object ... args ) { if ( isLoggable ( FINE ) ) { logIt ( FINE , String . format ( format , args ) ) ; } }
Write to log at FINE level .
17,057
public void finer ( String format , Object ... args ) { if ( isLoggable ( FINER ) ) { logIt ( FINER , String . format ( format , args ) ) ; } }
Write to log at FINER level .
17,058
public void finest ( String format , Object ... args ) { if ( isLoggable ( FINEST ) ) { logIt ( FINEST , String . format ( format , args ) ) ; } }
Write to log at FINEST level .
17,059
public void verbose ( String format , Object ... args ) { if ( isLoggable ( VERBOSE ) ) { logIt ( VERBOSE , String . format ( format , args ) ) ; } }
Write to log at VERBOSE level .
17,060
public void debug ( String format , Object ... args ) { if ( isLoggable ( DEBUG ) ) { logIt ( DEBUG , String . format ( format , args ) ) ; } }
Write to log at DEBUG level .
17,061
public void log ( Level level , String format , Object ... args ) { if ( isLoggable ( level ) ) { if ( format != null ) { logIt ( level , String . format ( format , args ) ) ; } else { logIt ( level , String . format ( "%s format == null" , level ) ) ; } } }
Write to log
17,062
public JButton addButton ( String strParam ) { String strDesc = strParam ; BaseApplet applet = this . getBaseApplet ( ) ; if ( applet != null ) strDesc = applet . getString ( strParam ) ; return this . addButton ( strDesc , strParam ) ; }
Add a button to this window . Convert this param to the local string and call addButton .
17,063
public CounterMetadata getCounterMetadata ( String counterName ) { String jsonString = getRow ( counterName ) ; if ( jsonString != null ) { CounterMetadata result = CounterMetadata . fromJsonString ( jsonString ) ; if ( result != null ) { result . setName ( counterName ) ; } return result ; } else { return findCounterMetadata ( counterName ) ; } }
Gets a counter metadata by name .
17,064
public static Date newRandomDate ( final Date from ) { final Random secrand = new SecureRandom ( ) ; final double randDouble = - secrand . nextDouble ( ) * from . getTime ( ) ; final double randomDouble = from . getTime ( ) - secrand . nextDouble ( ) ; final double result = randDouble * randomDouble ; return new Date ( ( long ) result ) ; }
Creates the random date .
17,065
@ SuppressWarnings ( "unchecked" ) Class < ? > [ ] getAllInterfacesAndClasses ( Class < ? > [ ] classes ) { if ( 0 == classes . length ) { return classes ; } else { List < Class < ? > > extendedClasses = new ArrayList < Class < ? > > ( ) ; for ( Class < ? > clazz : classes ) { if ( clazz != null ) { Class < ? > [ ] interfaces = clazz . getInterfaces ( ) ; if ( interfaces != null ) { extendedClasses . addAll ( Arrays . asList ( interfaces ) ) ; } Class < ? > superclass = clazz . getSuperclass ( ) ; if ( superclass != null && superclass != Object . class ) { extendedClasses . addAll ( Arrays . asList ( superclass ) ) ; } } } return ( Class [ ] ) ArrayUtils . addAll ( classes , getAllInterfacesAndClasses ( extendedClasses . toArray ( new Class [ extendedClasses . size ( ) ] ) ) ) ; } }
possibly contain the declaration of the annotated method we re looking for .
17,066
public static String driversLicense ( ) { StringBuffer dl = new StringBuffer ( JDefaultAddress . stateAbbr ( ) ) ; dl . append ( "-" ) ; dl . append ( JDefaultNumber . randomNumberString ( 8 ) ) ; return dl . toString ( ) ; }
Creates a Driver s license in the format of 2 Letter State Code Dash 8 Digit Random Number ie CO - 12345678
17,067
public void free ( ) { if ( m_messageReceiver != null ) m_messageReceiver . removeMessageFilter ( this , false ) ; m_messageReceiver = null ; while ( this . getMessageListener ( 0 ) != null ) { JMessageListener listener = this . getMessageListener ( 0 ) ; this . removeFilterMessageListener ( listener ) ; } if ( m_vListenerList != null ) m_vListenerList . clear ( ) ; m_vListenerList = null ; super . free ( ) ; m_intID = null ; }
Free this object . If I belong to a message listener set my reference to null and free the listener . If I belong to a messagereceiver remove this filter from it .
17,068
public void setRemoteFilterInfo ( String strRemoteQueueName , String strRemoteQueueType , Integer intRemoteQueueID , Integer intRegistryID ) { m_strRemoteQueueName = strRemoteQueueName ; m_strRemoteQueueType = strRemoteQueueType ; m_intRemoteID = intRemoteQueueID ; m_intRegistryID = intRegistryID ; }
Set the links to the remote filter .
17,069
public void addMessageListener ( JMessageListener listener ) { if ( listener == null ) return ; this . removeDuplicateFilters ( listener ) ; if ( m_vListenerList == null ) m_vListenerList = new Vector < JMessageListener > ( ) ; for ( int i = 0 ; i < m_vListenerList . size ( ) ; i ++ ) { if ( m_vListenerList . get ( i ) == listener ) { Util . getLogger ( ) . warning ( "--------Error-Added message listener twice--------" ) ; return ; } } m_vListenerList . add ( listener ) ; listener . addListenerMessageFilter ( this ) ; }
Add this message listener to the listener list . Also adds the filter to my filter list .
17,070
public void removeDuplicateFilters ( JMessageListener listenerToCheck ) { for ( int iIndex = 0 ; ; iIndex ++ ) { BaseMessageFilter filter = listenerToCheck . getListenerMessageFilter ( iIndex ) ; if ( filter == null ) break ; if ( this . isSameFilter ( filter ) ) { if ( filter . getMessageListener ( 1 ) == null ) { filter . removeFilterMessageListener ( listenerToCheck ) ; filter . free ( ) ; iIndex -- ; } } } }
If there is another RecordMessageFilter supplying messages to this listener remove it . This typically fixes the problem in TableModelSession where a grid listener is added for the session and then also when thin needs a listener
17,071
public boolean isSameFilter ( BaseMessageFilter filter ) { if ( filter . getClass ( ) . equals ( this . getClass ( ) ) ) { if ( filter . isFilterMatch ( this ) ) ; } return false ; }
Are these filters functionally the same? Override this to compare filters .
17,072
public void removeFilterMessageListener ( JMessageListener listener ) { if ( listener == null ) return ; if ( m_vListenerList == null ) return ; for ( int i = 0 ; i < m_vListenerList . size ( ) ; i ++ ) { if ( m_vListenerList . get ( i ) == listener ) m_vListenerList . remove ( i ) ; } listener . removeListenerMessageFilter ( this ) ; }
Set the message listener .
17,073
public JMessageListener getMessageListener ( int iIndex ) { if ( m_vListenerList == null ) return null ; if ( iIndex >= m_vListenerList . size ( ) ) return null ; return m_vListenerList . get ( iIndex ) ; }
Get the message listener for this filter .
17,074
public void setMessageReceiver ( BaseMessageReceiver messageReceiver , Integer intID ) { if ( ( messageReceiver != null ) || ( intID != null ) ) if ( ( m_intID != null ) || ( m_messageReceiver != null ) ) Util . getLogger ( ) . warning ( "BaseMessageFilter/setMessageReceiver()----Error - Filter added twice." ) ; m_messageReceiver = messageReceiver ; m_intID = intID ; }
Set the message receiver for this filter .
17,075
public final void updateFilterMap ( Map < String , Object > propFilter ) { if ( propFilter == null ) propFilter = new HashMap < String , Object > ( ) ; propFilter = this . handleUpdateFilterMap ( propFilter ) ; this . setFilterMap ( propFilter ) ; }
Update this object s filter with this new map information .
17,076
public final void setFilterMap ( Map < String , Object > propFilter ) { if ( this . getMessageReceiver ( ) != null ) this . getMessageReceiver ( ) . setNewFilterProperties ( this , null , propFilter ) ; }
Update the remote filter with this new map information .
17,077
public final void setFilterTree ( Object [ ] [ ] mxProperties ) { if ( this . getMessageReceiver ( ) != null ) this . getMessageReceiver ( ) . setNewFilterProperties ( this , mxProperties , null ) ; else this . setNameValueTree ( mxProperties ) ; }
Update this filter and the remote filter with this new key tree .
17,078
public < T > T getMeta ( String key , Class < T > type ) { return ConverterRegistry . getConverter ( ) . asObject ( getMeta ( key ) , type ) ; }
Get files archive meta data converted to requested type .
17,079
public < T > T getMeta ( String key , Class < T > type , T defaultValue ) { String value = manifest . getMainAttributes ( ) . getValue ( key ) ; return value == null ? defaultValue : ConverterRegistry . getConverter ( ) . asObject ( value , type ) ; }
Get files archive meta data converted to requested type or default value if meta data key is missing .
17,080
protected void addSizeGreaterThanOrEqualToCondition ( final String propertyName , final Integer size ) { final Expression < Integer > propertySizeExpression = getCriteriaBuilder ( ) . size ( getRootPath ( ) . get ( propertyName ) . as ( Set . class ) ) ; fieldConditions . add ( getCriteriaBuilder ( ) . ge ( propertySizeExpression , size ) ) ; }
Add a Field Search Condition that will check if the size of a collection in an entity is greater than or equal to the specified size .
17,081
protected void addSizeGreaterThanCondition ( final String propertyName , final Integer size ) { final Expression < Integer > propertySizeExpression = getCriteriaBuilder ( ) . size ( getRootPath ( ) . get ( propertyName ) . as ( Set . class ) ) ; fieldConditions . add ( getCriteriaBuilder ( ) . gt ( propertySizeExpression , size ) ) ; }
Add a Field Search Condition that will check if the size of a collection in an entity is greater than the specified size .
17,082
protected void addSizeLessThanOrEqualToCondition ( final String propertyName , final Integer size ) { final Expression < Integer > propertySizeExpression = getCriteriaBuilder ( ) . size ( getRootPath ( ) . get ( propertyName ) . as ( Set . class ) ) ; fieldConditions . add ( getCriteriaBuilder ( ) . le ( propertySizeExpression , size ) ) ; }
Add a Field Search Condition that will check if the size of a collection in an entity is less than or equal to the specified size .
17,083
protected void addSizeLessThanCondition ( final String propertyName , final Integer size ) { final Expression < Integer > propertySizeExpression = getCriteriaBuilder ( ) . size ( getRootPath ( ) . get ( propertyName ) . as ( Set . class ) ) ; fieldConditions . add ( getCriteriaBuilder ( ) . lt ( propertySizeExpression , size ) ) ; }
Add a Field Search Condition that will check if the size of a collection in an entity is less than the specified size .
17,084
public void free ( ) { int iOldEditMode = 0 ; if ( m_record != null ) { iOldEditMode = this . getRecord ( ) . getEditMode ( ) ; this . getRecord ( ) . setEditMode ( iOldEditMode | DBConstants . EDIT_CLOSE_IN_FREE ) ; } this . close ( ) ; if ( m_record != null ) this . getRecord ( ) . setEditMode ( iOldEditMode ) ; super . free ( ) ; if ( m_database != null ) m_database . removeTable ( this ) ; m_database = null ; m_dataSource = null ; m_objectID = null ; }
Free this table object . Don t call this directly freeing the record will free the table correctly . You never know another table may have been added to the table chain . First closes this table then removes me from the database .
17,085
public void addListener ( Record record , FileListener listener ) { record . doAddListener ( listener ) ; boolean bOldState = listener . setEnabledListener ( false ) ; BaseListener nextListener = listener . setNextListener ( null ) ; if ( record . getEditMode ( ) == Constants . EDIT_ADD ) { boolean [ ] rgbModified = this . getRecord ( ) . getModified ( ) ; listener . doNewRecord ( DBConstants . DISPLAY ) ; this . getRecord ( ) . setModified ( rgbModified ) ; } else if ( ( record . getEditMode ( ) == Constants . EDIT_IN_PROGRESS ) || ( record . getEditMode ( ) == Constants . EDIT_CURRENT ) ) listener . doValidRecord ( DBConstants . DISPLAY ) ; listener . setNextListener ( nextListener ) ; listener . setEnabledListener ( bOldState ) ; }
Adding a file listener to the chain . This just gives the table an ability to respond to listeners being added .
17,086
private BaseTable getPhysicalTable ( PassThruTable table , Record record ) { BaseTable altTable = table . getNextTable ( ) ; if ( altTable instanceof PassThruTable ) { BaseTable physicalTable = getPhysicalTable ( ( PassThruTable ) altTable , record ) ; if ( physicalTable != null ) if ( physicalTable != altTable ) return physicalTable ; } else if ( altTable . getDatabase ( ) . getDatabaseName ( true ) . equals ( record . getTable ( ) . getDatabase ( ) . getDatabaseName ( true ) ) ) return altTable ; Iterator < BaseTable > tables = table . getTables ( ) ; while ( tables . hasNext ( ) ) { altTable = tables . next ( ) ; if ( altTable instanceof PassThruTable ) { BaseTable physicalTable = getPhysicalTable ( ( PassThruTable ) altTable , record ) ; if ( physicalTable != null ) if ( physicalTable != altTable ) return physicalTable ; } else if ( altTable . getDatabase ( ) . getDatabaseName ( true ) . equals ( record . getTable ( ) . getDatabase ( ) . getDatabaseName ( true ) ) ) return altTable ; } return table ; }
Dig down and get the physical table for this record .
17,087
public boolean doHasPrevious ( ) { if ( ( m_iRecordStatus & DBConstants . RECORD_AT_BOF ) != 0 ) return false ; if ( ( m_iRecordStatus & DBConstants . RECORD_PREVIOUS_PENDING ) != 0 ) return true ; boolean bAtBOF = true ; try { FieldList record = this . move ( DBConstants . PREVIOUS_RECORD ) ; if ( record == null ) bAtBOF = true ; else if ( ( m_iRecordStatus & DBConstants . RECORD_AT_BOF ) != 0 ) bAtBOF = true ; else if ( this . isTable ( ) ) bAtBOF = this . isBOF ( ) ; else bAtBOF = false ; } catch ( DBException ex ) { ex . printStackTrace ( ) ; } if ( bAtBOF ) return false ; m_iRecordStatus |= DBConstants . RECORD_PREVIOUS_PENDING ; return true ; }
Is the first record in the file?
17,088
public boolean isBOF ( ) { boolean bFlag = ( ( m_iRecordStatus & DBConstants . RECORD_AT_BOF ) != 0 ) ; if ( this . isTable ( ) ) { if ( bFlag ) return bFlag ; if ( this . getRecord ( ) . getKeyArea ( - 1 ) . isModified ( DBConstants . START_SELECT_KEY ) ) { if ( ! bFlag ) bFlag = this . getRecord ( ) . checkParams ( DBConstants . START_SELECT_KEY ) ; if ( bFlag ) m_iRecordStatus |= DBConstants . RECORD_AT_BOF ; } } return bFlag ; }
Is the record at the Start of the file?
17,089
public boolean doHasNext ( ) throws DBException { if ( ( m_iRecordStatus & DBConstants . RECORD_AT_EOF ) != 0 ) return false ; if ( ( m_iRecordStatus & DBConstants . RECORD_NEXT_PENDING ) != 0 ) return true ; boolean bAtEOF = true ; if ( ! this . isOpen ( ) ) this . open ( ) ; Object [ ] rgobjEnabledFields = this . getRecord ( ) . setEnableNonFilter ( null , false , false , false , false , true ) ; FieldList record = null ; try { record = this . move ( DBConstants . NEXT_RECORD ) ; if ( record == null ) bAtEOF = true ; else if ( ( m_iRecordStatus & DBConstants . RECORD_AT_EOF ) != 0 ) bAtEOF = true ; else if ( this . isTable ( ) ) bAtEOF = this . isEOF ( ) ; else bAtEOF = false ; } catch ( DBException ex ) { throw ex ; } finally { this . getRecord ( ) . setEnableNonFilter ( rgobjEnabledFields , false , false , false , bAtEOF , true ) ; } if ( bAtEOF ) return false ; m_iRecordStatus |= DBConstants . RECORD_NEXT_PENDING ; return true ; }
Is the last record in the file?
17,090
public boolean isEOF ( ) { boolean bFlag = ( ( m_iRecordStatus & DBConstants . RECORD_AT_EOF ) != 0 ) ; if ( this . isTable ( ) ) { if ( bFlag ) return bFlag ; if ( this . getRecord ( ) . getKeyArea ( - 1 ) . isModified ( DBConstants . END_SELECT_KEY ) ) { if ( ! bFlag ) bFlag = this . getRecord ( ) . checkParams ( DBConstants . END_SELECT_KEY ) ; if ( bFlag ) m_iRecordStatus |= DBConstants . RECORD_AT_EOF ; } } return bFlag ; }
Is the record at the End of the file?
17,091
public boolean unlockIfLocked ( Record record , Object bookmark ) throws DBException { if ( record != null ) { BaseApplication app = null ; org . jbundle . model . Task task = null ; if ( record . getRecordOwner ( ) != null ) task = record . getRecordOwner ( ) . getTask ( ) ; if ( task != null ) app = ( BaseApplication ) record . getRecordOwner ( ) . getTask ( ) . getApplication ( ) ; Environment env = null ; if ( app != null ) env = app . getEnvironment ( ) ; else env = Environment . getEnvironment ( null ) ; return env . getLockManager ( ) . unlockThisRecord ( task , record . getDatabaseName ( ) , record . getTableNames ( false ) , bookmark ) ; } return true ; }
Unlock this record if it is locked .
17,092
public Map < String , Object > getProperties ( ) { if ( this . getRecord ( ) != null ) if ( ( ( this . getRecord ( ) . getDatabaseType ( ) & DBConstants . MAPPED ) != 0 ) || ( ( this . getRecord ( ) . getDatabaseType ( ) & DBConstants . REMOTE_MEMORY ) != 0 ) ) { if ( m_properties == null ) m_properties = new Hashtable < String , Object > ( ) ; m_properties . put ( RecordMessageConstants . TABLE_NAME , this . getRecord ( ) . getTableNames ( false ) ) ; } return m_properties ; }
Get this property for this table .
17,093
public ScreenComponent setupDefaultView ( ScreenLoc itsLocation , ComponentParent targetScreen , Convert converter , int iDisplayFieldDesc , Map < String , Object > properties ) { properties = new HashMap < String , Object > ( ) ; properties . put ( ScreenModel . COMMAND , MenuConstants . FORMLINK ) ; properties . put ( ScreenModel . IMAGE , MenuConstants . FORM ) ; return BaseField . createScreenComponent ( ScreenModel . CANNED_BOX , targetScreen . getNextLocation ( ScreenConstants . RIGHT_OF_LAST , ScreenConstants . DONT_SET_ANCHOR ) , targetScreen , converter , iDisplayFieldDesc , properties ) ; }
Set up the default control for this field . A SCannedBox for a query bitmap converter .
17,094
public FilterChannel position ( long newPosition ) throws IOException { if ( ! isOpen ( ) ) { throw new ClosedChannelException ( ) ; } int skip = ( int ) ( newPosition - position ( ) ) ; if ( skip < 0 ) { throw new UnsupportedOperationException ( "backwards position not supported" ) ; } if ( skip > skipBuffer . capacity ( ) ) { throw new UnsupportedOperationException ( skip + " skip not supported maxSkipSize=" + maxSkipSize ) ; } if ( skip > 0 ) { if ( skipBuffer == null ) { throw new UnsupportedOperationException ( "skip not supported maxSkipSize=" + maxSkipSize ) ; } skipBuffer . clear ( ) ; skipBuffer . limit ( skip ) ; if ( in != null ) { read ( skipBuffer ) ; } else { write ( skipBuffer ) ; } } return this ; }
Changes unfiltered position . Only forward direction is allowed with small skips . This method is for alignment purposes mostly .
17,095
private String getURL ( String endpoint , int version , String method ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( endpoint ) ; if ( ! endpoint . endsWith ( FORWARD_SLASH ) ) { sb . append ( FORWARD_SLASH ) ; } sb . append ( VERSION_PREFIX + version + FORWARD_SLASH + method ) ; return sb . toString ( ) ; }
Create the FigShare API URL using the endpoint version and API method .
17,096
public static FigShareClient to ( String endpoint , int version , String clientKey , String clientSecret , String tokenKey , String tokenSecret ) { return new FigShareClient ( endpoint , version , clientKey , clientSecret , tokenKey , tokenSecret ) ; }
Create a FigShareClient to interface to the FigShare API .
17,097
protected List < Article > readArticlesFromJson ( String json ) { Gson gson = new Gson ( ) ; JsonParser parser = new JsonParser ( ) ; JsonObject array = parser . parse ( json ) . getAsJsonObject ( ) ; JsonElement items = array . get ( "items" ) ; JsonArray itemsArray = items . getAsJsonArray ( ) ; List < Article > articles = new LinkedList < > ( ) ; for ( JsonElement element : itemsArray ) { Article article = gson . fromJson ( element , Article . class ) ; articles . add ( article ) ; } return articles ; }
Get the articles objects from JSON .
17,098
public Article createArticle ( final String title , final String description , final String definedType ) { HttpClient httpClient = null ; try { final String method = "my_data/articles" ; final String url = getURL ( endpoint , version , method ) ; final HttpPost request = new HttpPost ( url ) ; Gson gson = new Gson ( ) ; JsonObject payload = new JsonObject ( ) ; payload . addProperty ( "title" , title ) ; payload . addProperty ( "description" , description ) ; payload . addProperty ( "defined_type" , definedType ) ; String jsonRequest = gson . toJson ( payload ) ; StringEntity entity = new StringEntity ( jsonRequest ) ; entity . setContentType ( JSON_CONTENT_TYPE ) ; request . setEntity ( entity ) ; consumer . sign ( request ) ; httpClient = HttpClientBuilder . create ( ) . build ( ) ; HttpResponse response = httpClient . execute ( request ) ; HttpEntity responseEntity = response . getEntity ( ) ; String json = EntityUtils . toString ( responseEntity ) ; Article article = readArticleFromJson ( json ) ; return article ; } catch ( OAuthCommunicationException e ) { throw new FigShareClientException ( "Failed to get articles: " + e . getMessage ( ) , e ) ; } catch ( OAuthMessageSignerException e ) { throw new FigShareClientException ( "Failed to get articles: " + e . getMessage ( ) , e ) ; } catch ( OAuthExpectationFailedException e ) { throw new FigShareClientException ( "Failed to get articles: " + e . getMessage ( ) , e ) ; } catch ( ClientProtocolException e ) { throw new FigShareClientException ( "Failed to get articles: " + e . getMessage ( ) , e ) ; } catch ( IOException e ) { throw new FigShareClientException ( "Failed to get articles: " + e . getMessage ( ) , e ) ; } }
Create an article .
17,099
protected Article readArticleFromJson ( String json ) { Gson gson = new Gson ( ) ; Article article = gson . fromJson ( json , Article . class ) ; return article ; }
Get the article object from JSON .