idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
13,700
public void remove ( boolean doDispose ) { if ( active ) { rayHandler . lightList . removeValue ( this , false ) ; } else { rayHandler . disabledLights . removeValue ( this , false ) ; } rayHandler = null ; if ( doDispose ) dispose ( ) ; }
Removes light from specified RayHandler and disposes it if requested
13,701
void setRayNum ( int rays ) { if ( rays < MIN_RAYS ) rays = MIN_RAYS ; rayNum = rays ; vertexNum = rays + 1 ; segments = new float [ vertexNum * 8 ] ; mx = new float [ vertexNum ] ; my = new float [ vertexNum ] ; f = new float [ vertexNum ] ; }
Internal method for mesh update depending on ray number
13,702
public void setContactFilter ( short categoryBits , short groupIndex , short maskBits ) { filterA = new Filter ( ) ; filterA . categoryBits = categoryBits ; filterA . groupIndex = groupIndex ; filterA . maskBits = maskBits ; }
Creates new contact filter for this light with given parameters
13,703
static public void setGlobalContactFilter ( short categoryBits , short groupIndex , short maskBits ) { globalFilterA = new Filter ( ) ; globalFilterA . categoryBits = categoryBits ; globalFilterA . groupIndex = groupIndex ; globalFilterA . maskBits = maskBits ; }
Creates new contact filter for ALL LIGHTS with give parameters
13,704
public void debugRender ( ShapeRenderer shapeRenderer ) { shapeRenderer . setColor ( Color . YELLOW ) ; FloatArray vertices = Pools . obtain ( FloatArray . class ) ; vertices . clear ( ) ; for ( int i = 0 ; i < rayNum ; i ++ ) { vertices . addAll ( mx [ i ] , my [ i ] ) ; } for ( int i = rayNum - 1 ; i > - 1 ; i -- ) {...
Draws a polygon using ray start and end points as vertices
13,705
public void attachToBody ( Body body , float degrees ) { this . body = body ; this . bodyPosition . set ( body . getPosition ( ) ) ; bodyAngleOffset = MathUtils . degreesToRadians * degrees ; bodyAngle = body . getAngle ( ) ; applyAttachment ( ) ; if ( staticLight ) dirty = true ; }
Attaches light to specified body with relative direction offset
13,706
void applyAttachment ( ) { if ( body == null || staticLight ) return ; restorePosition . setToTranslation ( bodyPosition ) ; rotateAroundZero . setToRotationRad ( bodyAngle + bodyAngleOffset ) ; for ( int i = 0 ; i < rayNum ; i ++ ) { tmpVec . set ( startX [ i ] , startY [ i ] ) . mul ( rotateAroundZero ) . mul ( resto...
Applies attached body initial transform to all lights rays
13,707
public void attachToBody ( Body body , float offsetX , float offSetY , float degrees ) { this . body = body ; bodyOffsetX = offsetX ; bodyOffsetY = offSetY ; bodyAngleOffset = degrees ; if ( staticLight ) dirty = true ; }
Attaches light to specified body with relative offset and direction
13,708
public static String escape ( String value , char quote ) { Map < CharSequence , CharSequence > lookupMap = new HashMap < > ( ) ; lookupMap . put ( Character . toString ( quote ) , "\\" + quote ) ; lookupMap . put ( "\\" , "\\\\" ) ; final CharSequenceTranslator escape = new LookupTranslator ( lookupMap ) . with ( new ...
Escape the string with given quote character .
13,709
public List < FunctionWrapper > compileFunctions ( ImportStack importStack , Context context , List < ? > objects ) { List < FunctionWrapper > callbacks = new LinkedList < > ( ) ; for ( Object object : objects ) { List < FunctionWrapper > objectCallbacks = compileFunctions ( importStack , context , object ) ; callbacks...
Compile methods from all objects into libsass functions .
13,710
public List < FunctionWrapper > compileFunctions ( ImportStack importStack , Context context , Object object ) { Class < ? > functionClass = object . getClass ( ) ; Method [ ] methods = functionClass . getDeclaredMethods ( ) ; List < FunctionDeclaration > declarations = new LinkedList < > ( ) ; for ( Method method : me...
Compile methods from an object into libsass functions .
13,711
public FunctionDeclaration createDeclaration ( ImportStack importStack , Context context , Object object , Method method ) { StringBuilder signature = new StringBuilder ( ) ; Parameter [ ] parameters = method . getParameters ( ) ; List < ArgumentConverter > argumentConverters = new ArrayList < > ( method . getParameter...
Create a function declaration from an object method .
13,712
private String formatDefaultValue ( Object value ) { if ( value instanceof Boolean ) { return ( ( Boolean ) value ) ? "true" : "false" ; } if ( value instanceof Number ) { return value . toString ( ) ; } if ( value instanceof Collection ) { return formatCollectionValue ( ( Collection ) value ) ; } String string = value...
Format a default value for libsass function signature .
13,713
public SassValue invoke ( List < ? > arguments ) { try { ArrayList < Object > values = new ArrayList < > ( argumentConverters . size ( ) ) ; for ( ArgumentConverter argumentConverter : argumentConverters ) { Object value = argumentConverter . convert ( arguments , importStack , context ) ; values . add ( value ) ; } Ob...
Invoke the method with the given list of arguments .
13,714
public Output compileFile ( URI inputPath , URI outputPath , Options options ) throws CompilationException { FileContext context = new FileContext ( inputPath , outputPath , options ) ; return compile ( context ) ; }
Compile file .
13,715
public Output compile ( Context context ) throws CompilationException { Objects . requireNonNull ( context , "Parameter context must not be null" ) ; if ( context instanceof FileContext ) { return compile ( ( FileContext ) context ) ; } if ( context instanceof StringContext ) { return compile ( ( StringContext ) contex...
Compile context .
13,716
public List < FunctionArgumentSignature > createDefaultArgumentSignature ( Parameter parameter ) { List < FunctionArgumentSignature > list = new LinkedList < > ( ) ; String name = getParameterName ( parameter ) ; Object defaultValue = getDefaultValue ( parameter ) ; list . add ( new FunctionArgumentSignature ( name , d...
Create a new factory .
13,717
public String getParameterName ( Parameter parameter ) { Name annotation = parameter . getAnnotation ( Name . class ) ; if ( null == annotation ) { return parameter . getName ( ) ; } return annotation . value ( ) ; }
Determine annotated name of a method parameter .
13,718
public Object getDefaultValue ( Parameter parameter ) { Class < ? > type = parameter . getType ( ) ; if ( TypeUtils . isaString ( type ) ) { return getStringDefaultValue ( parameter ) ; } if ( TypeUtils . isaByte ( type ) ) { return getByteDefaultValue ( parameter ) ; } if ( TypeUtils . isaShort ( type ) ) { return get...
Determine annotated default parameter value .
13,719
public int register ( Import importSource ) { int id = registry . size ( ) + 1 ; registry . put ( id , importSource ) ; return id ; }
Register a new import return the registration ID .
13,720
public static SassValue convertToSassValue ( Object value ) { if ( null == value ) { return SassNull . SINGLETON ; } if ( value instanceof SassValue ) { return ( SassValue ) value ; } Class cls = value . getClass ( ) ; if ( isaBoolean ( cls ) ) { return new SassBoolean ( ( Boolean ) value ) ; } if ( isaNumber ( cls ) )...
Try to convert any java object into a responsible sass value .
13,721
private Collection < Import > resolveImport ( Path path ) throws IOException , URISyntaxException { URL resource = resolveResource ( path ) ; if ( null == resource ) { return null ; } final URI uri = new URI ( Paths . get ( "/" ) . resolve ( Paths . get ( getServletContext ( ) . getResource ( "/" ) . toURI ( ) ) . rela...
Try to determine the import object for a given path .
13,722
private URL resolveResource ( Path path ) throws MalformedURLException { final Path dir = path . getParent ( ) ; final String basename = path . getFileName ( ) . toString ( ) ; for ( String prefix : new String [ ] { "_" , "" } ) { for ( String suffix : new String [ ] { ".scss" , ".css" , "" } ) { final Path target = di...
Try to find a resource for this path .
13,723
public SassValue apply ( SassValue value ) { SassList sassList ; if ( value instanceof SassList ) { sassList = ( SassList ) value ; } else { sassList = new SassList ( ) ; sassList . add ( value ) ; } return declaration . invoke ( sassList ) ; }
Call the function .
13,724
static void loadLibrary ( ) { try { File dir = Files . createTempDirectory ( "libjsass-" ) . toFile ( ) ; dir . deleteOnExit ( ) ; if ( System . getProperty ( "os.name" ) . toLowerCase ( ) . startsWith ( "win" ) ) { System . load ( saveLibrary ( dir , "sass" ) ) ; } System . load ( saveLibrary ( dir , "jsass" ) ) ; } c...
Load the shared libraries .
13,725
private static URL findLibraryResource ( final String libraryFileName ) { String osName = System . getProperty ( "os.name" ) . toLowerCase ( ) ; String osArch = System . getProperty ( "os.arch" ) . toLowerCase ( ) ; String resourceName = null ; LOG . trace ( "Load library \"{}\" for os {}:{}" , libraryFileName , osName...
Find the right shared library depending on the operating system and architecture .
13,726
private static String determineWindowsLibrary ( final String library , final String osName , final String osArch ) { String resourceName ; String platform ; String fileExtension = "dll" ; switch ( osArch ) { case ARCH_AMD64 : case ARCH_X86_64 : platform = "windows-x64" ; break ; default : throw new UnsupportedOperation...
Determine the right windows library depending on the architecture .
13,727
private static String determineLinuxLibrary ( final String library , final String osName , final String osArch ) { String resourceName ; String platform = null ; String fileExtension = "so" ; switch ( osArch ) { case ARCH_AMD64 : case ARCH_X86_64 : platform = "linux-x64" ; break ; case ARCH_ARM : platform = "linux-armh...
Determine the right linux library depending on the architecture .
13,728
private static String determineFreebsdLibrary ( final String library , final String osName , final String osArch ) { String resourceName ; String platform = null ; String fileExtension = "so" ; switch ( osArch ) { case ARCH_AMD64 : case ARCH_X86_64 : platform = "freebsd-x64" ; break ; default : unsupportedPlatform ( os...
Determine the right FreeBSD library depending on the architecture .
13,729
private static String determineMacLibrary ( final String library ) { String resourceName ; String platform = "darwin" ; String fileExtension = "dylib" ; resourceName = "/" + platform + "/" + library + "." + fileExtension ; return resourceName ; }
Determine the right mac library depending on the architecture .
13,730
static String saveLibrary ( final File dir , final String libraryName ) throws IOException { String libraryFileName = "lib" + libraryName ; URL libraryResource = findLibraryResource ( libraryFileName ) ; String basename = FilenameUtils . getName ( libraryResource . getPath ( ) ) ; File file = new File ( dir , basename ...
Save the shared library in the given temporary directory .
13,731
public Output compile ( FileContext context , ImportStack importStack ) throws CompilationException { NativeFileContext nativeContext = convertToNativeContext ( context , importStack ) ; return compileFile ( nativeContext ) ; }
Compile a file context .
13,732
public void execute ( ) throws ActivityException { isSynchronized = checkIfSynchronized ( ) ; if ( ! isSynchronized ) { EventWaitInstance received = registerWaitEvents ( false , true ) ; if ( received != null ) resume ( getExternalEventInstanceDetails ( received . getMessageDocumentId ( ) ) , received . getCompletionCo...
Executes the controlled activity
13,733
private String escape ( String rawActivityName ) { boolean lastIsUnderScore = false ; StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < rawActivityName . length ( ) ; i ++ ) { char ch = rawActivityName . charAt ( i ) ; if ( Character . isLetterOrDigit ( ch ) ) { sb . append ( ch ) ; lastIsUnderScore = fals...
Replaces space characters in the activity name with underscores .
13,734
private List < Transition > getIncomingTransitions ( Process procdef , Long activityId , Map < String , String > idToEscapedName ) { List < Transition > incomingTransitions = new ArrayList < Transition > ( ) ; for ( Transition trans : procdef . getTransitions ( ) ) { if ( trans . getToId ( ) . equals ( activityId ) ) {...
reuse WorkTransitionVO for sync info
13,735
protected SOAPMessage createSoapRequest ( Object requestObj ) throws ActivityException { try { MessageFactory messageFactory = getSoapMessageFactory ( ) ; SOAPMessage soapMessage = messageFactory . createMessage ( ) ; Map < Name , String > soapReqHeaders = getSoapRequestHeaders ( ) ; if ( soapReqHeaders != null ) { SOA...
Populate the SOAP request message .
13,736
protected Node unwrapSoapResponse ( SOAPMessage soapResponse ) throws ActivityException , AdapterException { try { SOAPBody soapBody = soapResponse . getSOAPBody ( ) ; Node childElem = null ; Iterator < ? > it = soapBody . getChildElements ( ) ; while ( it . hasNext ( ) ) { Node node = ( Node ) it . next ( ) ; if ( nod...
Unwrap the SOAP response into a DOM Node .
13,737
public void applyImplicitParameters ( ReaderContext context , Operation operation , Method method ) { final ApiImplicitParams implicitParams = method . getAnnotation ( ApiImplicitParams . class ) ; if ( implicitParams != null && implicitParams . value ( ) . length > 0 ) { for ( ApiImplicitParam param : implicitParams ....
Implemented to allow loading of custom types using CloudClassLoader .
13,738
private String translateType ( String type , Map < String , String > attrs ) { String translated = type . toLowerCase ( ) ; if ( "select" . equals ( type ) ) translated = "radio" ; else if ( "boolean" . equals ( type ) ) translated = "checkbox" ; else if ( "list" . equals ( type ) ) { translated = "picklist" ; String l...
Translate widget type .
13,739
private void adjustWidgets ( String implCategory ) { Map < Integer , Widget > companions = new HashMap < > ( ) ; for ( int i = 0 ; i < widgets . size ( ) ; i ++ ) { Widget widget = widgets . get ( i ) ; if ( "expression" . equals ( widget . type ) || ( "edit" . equals ( widget . type ) && ! "Java" . equals ( widget . n...
Adds companion widgets as needed .
13,740
public static String substitute ( String input , Map < String , Object > values ) { StringBuilder output = new StringBuilder ( input . length ( ) ) ; int index = 0 ; Matcher matcher = SUBST_PATTERN . matcher ( input ) ; while ( matcher . find ( ) ) { String match = matcher . group ( ) ; output . append ( input . substr...
Simple substitution mechanism . Missing values substituted with empty string .
13,741
protected String extractFormData ( JSONObject datadoc ) throws ActivityException , JSONException { String varstring = this . getAttributeValue ( TaskActivity . ATTRIBUTE_TASK_VARIABLES ) ; List < String [ ] > parsed = StringHelper . parseTable ( varstring , ',' , ';' , 5 ) ; for ( String [ ] one : parsed ) { String var...
This method is used to extract data from the message received from the task manager . The method updates all variables specified as non - readonly
13,742
public void onStartup ( ) throws StartupException { try { Map < String , Properties > fileListeners = getFileListeners ( ) ; for ( String listenerName : fileListeners . keySet ( ) ) { Properties listenerProps = fileListeners . get ( listenerName ) ; String listenerClassName = listenerProps . getProperty ( "ClassName" )...
Startup the file listeners .
13,743
public void onShutdown ( ) { for ( String listenerName : registeredFileListeners . keySet ( ) ) { logger . info ( "Deregistering File Listener: " + listenerName ) ; FileListener listener = registeredFileListeners . get ( listenerName ) ; listener . stopListening ( ) ; } }
Shutdown the file listeners .
13,744
public boolean hasRole ( String roleName ) { if ( roles != null ) { for ( String r : roles ) { if ( r . equals ( roleName ) ) return true ; } } return false ; }
Check whether the group has the specified role .
13,745
public boolean isWorkActivity ( Long pWorkId ) { if ( this . activities == null ) { return false ; } for ( int i = 0 ; i < activities . size ( ) ; i ++ ) { if ( pWorkId . longValue ( ) == activities . get ( i ) . getId ( ) . longValue ( ) ) { return true ; } } return false ; }
checks if the passed in workId is Activity
13,746
public Process getSubProcessVO ( Long id ) { if ( this . getId ( ) != null && this . getId ( ) . equals ( id ) ) return this ; if ( this . subprocesses == null ) return null ; for ( Process ret : subprocesses ) { if ( ret . getId ( ) . equals ( id ) ) return ret ; } return null ; }
returns the process VO identified by the passed in work id It is also possible the sub process is referencing self .
13,747
public Activity getActivityVO ( Long pWorkId ) { if ( this . activities == null ) { return null ; } for ( int i = 0 ; i < activities . size ( ) ; i ++ ) { if ( pWorkId . longValue ( ) == activities . get ( i ) . getId ( ) . longValue ( ) ) { return activities . get ( i ) ; } } return null ; }
Returns the Activity VO
13,748
public Transition getWorkTransitionVO ( Long pWorkTransId ) { if ( this . transitions == null ) { return null ; } for ( int i = 0 ; i < transitions . size ( ) ; i ++ ) { if ( pWorkTransId . longValue ( ) == transitions . get ( i ) . getId ( ) . longValue ( ) ) { return transitions . get ( i ) ; } } return null ; }
Returns the WorkTransitionVO
13,749
public Transition getTransition ( Long fromId , Integer eventType , String completionCode ) { Transition ret = null ; for ( Transition transition : getTransitions ( ) ) { if ( transition . getFromId ( ) . equals ( fromId ) && transition . match ( eventType , completionCode ) ) { if ( ret == null ) ret = transition ; el...
Finds one work transition for this process matching the specified parameters
13,750
public List < Transition > getTransitions ( Long fromWorkId , Integer eventType , String completionCode ) { List < Transition > allTransitions = getAllTransitions ( fromWorkId ) ; List < Transition > returnSet = findTransitions ( allTransitions , eventType , completionCode ) ; if ( returnSet . size ( ) > 0 ) return ret...
Finds the work transitions from the given activity that match the event type and completion code . A DEFAULT completion code matches any completion code if and only if there is no other matches
13,751
public Transition getTransition ( Long id ) { for ( Transition transition : getTransitions ( ) ) { if ( transition . getId ( ) . equals ( id ) ) return transition ; } return null ; }
Find a work transition based on its id value
13,752
public Activity getActivityById ( String logicalId ) { for ( Activity activityVO : getActivities ( ) ) { if ( activityVO . getLogicalId ( ) . equals ( logicalId ) ) { activityVO . setProcessName ( getName ( ) ) ; return activityVO ; } } for ( Process subProc : this . subprocesses ) { for ( Activity activityVO : subProc...
Also searches subprocs .
13,753
public byte [ ] postBytes ( byte [ ] content ) throws IOException { if ( ! connection . isOpen ( ) ) connection . open ( ) ; connection . prepare ( "POST" ) ; OutputStream os = connection . getOutputStream ( ) ; os . write ( content ) ; response = connection . readInput ( ) ; os . close ( ) ; return getResponseBytes ( ...
Perform an HTTP POST request to the URL .
13,754
public byte [ ] getBytes ( ) throws IOException { if ( ! connection . isOpen ( ) ) connection . open ( ) ; connection . prepare ( "GET" ) ; response = connection . readInput ( ) ; return getResponseBytes ( ) ; }
Perform an HTTP GET request against the URL .
13,755
public String put ( File file ) throws IOException { if ( ! connection . isOpen ( ) ) connection . open ( ) ; connection . prepare ( "PUT" ) ; String contentType = connection . getHeader ( "Content-Type" ) ; if ( contentType == null ) contentType = connection . getHeader ( "content-type" ) ; if ( contentType == null ||...
Upload a text file to the destination URL
13,756
public byte [ ] deleteBytes ( byte [ ] content ) throws IOException { if ( ! connection . isOpen ( ) ) connection . open ( ) ; connection . prepare ( "DELETE" ) ; OutputStream os = null ; if ( content != null ) { connection . getConnection ( ) . setDoOutput ( true ) ; os = connection . getOutputStream ( ) ; os . write ...
Perform an HTTP DELETE request to the URL .
13,757
public String [ ] getDistinctEventLogEventSources ( ) throws DataAccessException , EventException { TransactionWrapper transaction = null ; EngineDataAccessDB edao = new EngineDataAccessDB ( ) ; try { transaction = edao . startTransaction ( ) ; return edao . getDistinctEventLogEventSources ( ) ; } catch ( SQLException ...
Method that returns distinct event log sources
13,758
public VariableInstance setVariableInstance ( Long procInstId , String name , Object value ) throws DataAccessException { TransactionWrapper transaction = null ; EngineDataAccessDB edao = new EngineDataAccessDB ( ) ; try { transaction = edao . startTransaction ( ) ; VariableInstance varInst = edao . getVariableInstance...
create or update variable instance value . This does not take care of checking for embedded processes . For document variables the value must be DocumentReference not the document content
13,759
public void sendDelayEventsToWaitActivities ( String masterRequestId ) throws DataAccessException , ProcessException { TransactionWrapper transaction = null ; EngineDataAccessDB edao = new EngineDataAccessDB ( ) ; try { transaction = edao . startTransaction ( ) ; List < ProcessInstance > procInsts = edao . getProcessIn...
This is for regression tester only .
13,760
private boolean isProcessInstanceResumable ( ProcessInstance pInstance ) { int statusCd = pInstance . getStatusCode ( ) . intValue ( ) ; if ( statusCd == WorkStatus . STATUS_COMPLETED . intValue ( ) ) { return false ; } else if ( statusCd == WorkStatus . STATUS_CANCELLED . intValue ( ) ) { return false ; } return true ...
Checks if the process inst is resumable
13,761
public ProcessInstance getProcessInstance ( Long procInstId ) throws ProcessException , DataAccessException { TransactionWrapper transaction = null ; EngineDataAccessDB edao = new EngineDataAccessDB ( ) ; try { transaction = edao . startTransaction ( ) ; return edao . getProcessInstance ( procInstId ) ; } catch ( SQLEx...
Returns the ProcessInstance identified by the passed in Id
13,762
public List < ProcessInstance > getProcessInstances ( String masterRequestId , String processName ) throws ProcessException , DataAccessException { TransactionWrapper transaction = null ; EngineDataAccessDB edao = new EngineDataAccessDB ( ) ; try { Process procdef = ProcessCache . getProcess ( processName , 0 ) ; if ( ...
Returns the process instances by process name and master request ID .
13,763
public List < ActivityInstance > getActivityInstances ( String masterRequestId , String processName , String activityLogicalId ) throws ProcessException , DataAccessException { TransactionWrapper transaction = null ; EngineDataAccessDB edao = new EngineDataAccessDB ( ) ; try { Process procdef = ProcessCache . getProces...
Returns the activity instances by process name activity logical ID and master request ID .
13,764
public ActivityInstance getActivityInstance ( Long pActivityInstId ) throws ProcessException , DataAccessException { ActivityInstance ai ; TransactionWrapper transaction = null ; EngineDataAccessDB edao = new EngineDataAccessDB ( ) ; try { transaction = edao . startTransaction ( ) ; ai = edao . getActivityInstance ( pA...
Returns the ActivityInstance identified by the passed in Id
13,765
public TransitionInstance getWorkTransitionInstance ( Long pId ) throws DataAccessException , ProcessException { TransitionInstance wti ; TransactionWrapper transaction = null ; EngineDataAccessDB edao = new EngineDataAccessDB ( ) ; try { transaction = edao . startTransaction ( ) ; wti = edao . getWorkTransitionInstanc...
Returns the WorkTransitionVO based on the passed in params
13,766
public JSONObject getJson ( ) throws JSONException { JSONObject json = create ( ) ; if ( value != null ) json . put ( "value" , value ) ; if ( label != null ) json . put ( "label" , label ) ; if ( type != null ) json . put ( "type" , type ) ; if ( display != null ) json . put ( "display" , display . toString ( ) ) ; if...
expects to be a json object named name so does not include name
13,767
@ ApiModelProperty ( hidden = true ) public static Display getDisplay ( String option ) { if ( "Optional" . equals ( option ) ) return Display . Optional ; else if ( "Required" . equals ( option ) ) return Display . Required ; else if ( "Read Only" . equals ( option ) ) return Display . ReadOnly ; else if ( "Hidden" . ...
Maps Designer display option to Display type .
13,768
public static Display getDisplay ( int mode ) { if ( mode == 0 ) return Display . Required ; else if ( mode == 1 ) return Display . Optional ; else if ( mode == 2 ) return Display . ReadOnly ; else if ( mode == 3 ) return Display . Hidden ; else return null ; }
Maps VariableVO display mode to Display type .
13,769
public void onStartup ( ) throws StartupException { if ( monitor == null ) { monitor = this ; thread = new Thread ( ) { public void run ( ) { this . setName ( "UserGroupMonitor-thread" ) ; monitor . start ( ) ; } } ; thread . start ( ) ; } }
Invoked when the server starts up .
13,770
public void sendTextMessage ( String queueName , String message , int delaySeconds ) throws NamingException , JMSException , ServiceLocatorException { sendTextMessage ( null , queueName , message , delaySeconds , null ) ; }
Sends a JMS text message to a local queue .
13,771
public void sendTextMessage ( String contextUrl , String queueName , String message , int delaySeconds , String correlationId ) throws NamingException , JMSException , ServiceLocatorException { if ( logger . isDebugEnabled ( ) ) logger . debug ( "Send JMS message: " + message ) ; if ( mdwMessageProducer != null ) { if ...
Sends a JMS text message .
13,772
public Queue getQueue ( Session session , String commonName ) throws ServiceLocatorException { Queue queue = ( Queue ) queueCache . get ( commonName ) ; if ( queue == null ) { try { String name = namingProvider . qualifyJmsQueueName ( commonName ) ; queue = jmsProvider . getQueue ( session , namingProvider , name ) ; i...
Uses the container - specific qualifier to look up a JMS queue .
13,773
public Queue getQueue ( String contextUrl , String queueName ) throws ServiceLocatorException { try { String jndiName = null ; if ( contextUrl == null ) { jndiName = namingProvider . qualifyJmsQueueName ( queueName ) ; } else { jndiName = queueName ; } return ( Queue ) namingProvider . lookup ( contextUrl , jndiName , ...
Looks up and returns a JMS queue .
13,774
public void broadcastTextMessage ( String topicName , String textMessage , int delaySeconds ) throws NamingException , JMSException , ServiceLocatorException { if ( mdwMessageProducer != null ) { mdwMessageProducer . broadcastMessageToTopic ( topicName , textMessage ) ; } else { TopicConnectionFactory tFactory = null ;...
Sends the passed in text message to a local topic
13,775
public ResultSet runSelect ( String logMessage , String query , Object [ ] arguments ) throws SQLException { long before = System . currentTimeMillis ( ) ; try { return runSelect ( query , arguments ) ; } finally { if ( logger . isDebugEnabled ( ) ) { long after = System . currentTimeMillis ( ) ; logger . debug ( logMe...
Ordinarily db query logging is at TRACE level . Use this method to log queries at DEBUG level .
13,776
protected KieBase getKnowledgeBase ( String name , String version ) throws ActivityException { return getKnowledgeBase ( name , version , null ) ; }
Get knowledge base with no modifiers .
13,777
protected ClassLoader getClassLoader ( ) { ClassLoader loader = null ; Package pkg = PackageCache . getProcessPackage ( getProcessId ( ) ) ; if ( pkg != null ) { loader = pkg . getCloudClassLoader ( ) ; } if ( loader == null ) { loader = getClass ( ) . getClassLoader ( ) ; } return loader ; }
Get the class loader based on package bundle version spec default is mdw - workflow loader
13,778
public List < String > getRoles ( String path ) { List < String > roles = super . getRoles ( path ) ; roles . add ( Role . ASSET_DESIGN ) ; return roles ; }
ASSET_DESIGN role can PUT in - memory config for running tests .
13,779
public String toApiImport ( String name ) { if ( ! apiPackage ( ) . isEmpty ( ) ) return apiPackage ( ) ; else if ( trimApiPaths ) return trimmedPaths . get ( name ) . substring ( 1 ) . replace ( '/' , '.' ) ; else return super . toApiImport ( name ) ; }
We use this for API package in our templates when trimmedPaths is true .
13,780
public static List < File > listOverrideFiles ( String type ) throws IOException { List < File > files = new ArrayList < File > ( ) ; if ( getMdw ( ) . getOverrideRoot ( ) . isDirectory ( ) ) { File dir = new File ( getMdw ( ) . getOverrideRoot ( ) + "/" + type ) ; if ( dir . isDirectory ( ) ) addFiles ( files , dir , ...
Recursively list override files . Assumes dir path == ext == type .
13,781
private int search ( int startLine , boolean backward ) throws IOException { search = search . toLowerCase ( ) ; try ( Stream < String > stream = Files . lines ( path ) ) { if ( backward ) { int idx = - 1 ; if ( startLine > 0 ) idx = searchTo ( startLine - 1 , true ) ; if ( idx < 0 ) idx = searchFrom ( startLine , true...
Search pass locates line index of first match .
13,782
public String handleEventMessage ( String msg , Object msgdoc , Map < String , String > metainfo ) throws EventHandlerException { return null ; }
This is not used - the class extends ExternalEventHandlerBase only to get access to convenient methods
13,783
private static void initializeDynamicJavaAssets ( ) throws DataAccessException , IOException , CachingException { logger . info ( "Initializing Dynamic Java assets for Groovy..." ) ; for ( Asset java : AssetCache . getAssets ( Asset . JAVA ) ) { Package pkg = PackageCache . getAssetPackage ( java . getId ( ) ) ; String...
so that Groovy scripts can reference these assets during compilation
13,784
public JSONObject post ( String path , JSONObject content , Map < String , String > headers ) throws ServiceException , JSONException { String sub = getSegment ( path , 4 ) ; if ( "event" . equals ( sub ) ) { SlackEvent event = new SlackEvent ( content ) ; EventHandler eventHandler = getEventHandler ( event . getType (...
Responds to requests from Slack .
13,785
public JSONObject get ( String path , Map < String , String > headers ) throws ServiceException , JSONException { String authUser = ( String ) headers . get ( Listener . AUTHENTICATED_USER_HEADER ) ; try { if ( authUser == null ) throw new ServiceException ( "Missing parameter: " + Listener . AUTHENTICATED_USER_HEADER ...
Retrieve the current authenticated user .
13,786
public static String getEngineUrl ( String serverSpec ) throws NamingException { String url ; int at = serverSpec . indexOf ( '@' ) ; if ( at > 0 ) { url = serverSpec . substring ( at + 1 ) ; } else { int colonDashDash = serverSpec . indexOf ( "://" ) ; if ( colonDashDash > 0 ) { url = serverSpec ; } else { url = Prope...
Returns engine URL for another server using server specification as input .
13,787
protected Object handleResult ( Result result ) throws ActivityException { ServiceValuesAccess serviceValues = getRuntimeContext ( ) . getServiceValues ( ) ; StatusResponse statusResponse ; if ( result . isError ( ) ) { logsevere ( "Validation error: " + result . getStatus ( ) . toString ( ) ) ; statusResponse = new St...
Populates response variable with a default JSON status object . Can be overwritten by custom logic in a downstream activity or in a JsonRestService implementation .
13,788
private void deleteDynamicTemplates ( ) throws IOException { File codegenDir = new File ( getProjectDir ( ) + "/codegen" ) ; if ( codegenDir . exists ( ) ) { getOut ( ) . println ( "Deleting " + codegenDir ) ; new Delete ( codegenDir , true ) . run ( ) ; } File assetsDir = new File ( getProjectDir ( ) + "/assets" ) ; i...
These will be retrieved just - in - time based on current mdw version .
13,789
public static void bulletinOff ( Bulletin bulletin , Level level , String message ) { if ( bulletin == null ) return ; synchronized ( bulletins ) { bulletins . remove ( bulletin . getId ( ) , bulletin ) ; } try { WebSocketMessenger . getInstance ( ) . send ( "SystemMessage" , bulletin . off ( message ) . getJson ( ) . ...
Should be the same instance or have the same id as the bulletinOn message .
13,790
private static boolean exclude ( String host , java . nio . file . Path path ) { List < PathMatcher > exclusions = getExcludes ( host ) ; if ( exclusions == null && host != null ) { exclusions = getExcludes ( null ) ; } if ( exclusions != null ) { for ( PathMatcher matcher : exclusions ) { if ( matcher . matches ( path...
Checks for matching exclude patterns .
13,791
public String getMdwVersion ( ) throws IOException { if ( mdwVersion == null ) { YamlProperties yaml = getProjectYaml ( ) ; if ( yaml != null ) { mdwVersion = yaml . getString ( Props . ProjectYaml . MDW_VERSION ) ; } } return mdwVersion ; }
Reads from project . yaml
13,792
public String findMdwVersion ( boolean snapshots ) throws IOException { URL url = new URL ( getReleasesUrl ( ) + MDW_COMMON_PATH ) ; if ( snapshots ) url = new URL ( getSnapshotsUrl ( ) + MDW_COMMON_PATH ) ; Crawl crawl = new Crawl ( url , snapshots ) ; crawl . run ( ) ; if ( crawl . getReleases ( ) . size ( ) == 0 ) t...
Crawls to find the latest stable version .
13,793
protected void initBaseAssetPackages ( ) throws IOException { baseAssetPackages = new ArrayList < > ( ) ; addBasePackages ( getAssetRoot ( ) , getAssetRoot ( ) ) ; if ( baseAssetPackages . isEmpty ( ) ) baseAssetPackages = Packages . DEFAULT_BASE_PACKAGES ; }
Checks for any existing packages . If none present adds the defaults .
13,794
public String getRelativePath ( File from , File to ) { Path fromPath = Paths . get ( from . getPath ( ) ) . normalize ( ) . toAbsolutePath ( ) ; Path toPath = Paths . get ( to . getPath ( ) ) . normalize ( ) . toAbsolutePath ( ) ; return fromPath . relativize ( toPath ) . toString ( ) . replace ( '\\' , '/' ) ; }
Returns to file or dir path relative to from dir . Result always uses forward slashes and has no trailing slash .
13,795
protected void downloadTemplates ( ProgressMonitor ... monitors ) throws IOException { File templateDir = getTemplateDir ( ) ; if ( ! templateDir . exists ( ) ) { if ( ! templateDir . mkdirs ( ) ) throw new IOException ( "Unable to create directory: " + templateDir . getAbsolutePath ( ) ) ; String templatesUrl = getTem...
Downloads asset templates for codegen etc .
13,796
public Object onRequest ( ActivityRuntimeContext context , Object content , Map < String , String > headers , Object connection ) { if ( connection instanceof HttpConnection ) { HttpConnection httpConnection = ( HttpConnection ) connection ; Tracing tracing = TraceHelper . getTracing ( "mdw-adapter" ) ; HttpTracing htt...
Only for HTTP .
13,797
static TaskInstance createTaskInstance ( Long taskId , String masterRequestId , Long procInstId , String secOwner , Long secOwnerId , String title , String comments ) throws ServiceException , DataAccessException { return createTaskInstance ( taskId , masterRequestId , procInstId , secOwner , secOwnerId , title , comme...
Convenience method for below .
13,798
static TaskInstance createTaskInstance ( Long taskId , String masterOwnerId , String title , String comment , Instant due , Long userId , Long secondaryOwner ) throws ServiceException , DataAccessException { CodeTimer timer = new CodeTimer ( "createTaskInstance()" , true ) ; TaskTemplate task = TaskTemplateCache . getT...
This version is used by the task manager to create a task instance not associated with a process instance .
13,799
List < String > determineWorkgroups ( Map < String , String > indexes ) throws ServiceException { TaskTemplate taskTemplate = getTemplate ( ) ; String routingStrategyAttr = taskTemplate . getAttribute ( TaskAttributeConstant . ROUTING_STRATEGY ) ; if ( StringHelper . isEmpty ( routingStrategyAttr ) ) { return taskTempl...
Determines a task instance s workgroups based on the defined strategy . If no strategy exists default to the workgroups defined in the task template .