idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
13,900
private void preloadDynamicCaches ( ) { List < CacheService > dynamicCacheServices = CacheRegistry . getInstance ( ) . getDynamicCacheServices ( ) ; for ( CacheService dynamicCacheService : dynamicCacheServices ) { if ( dynamicCacheService instanceof PreloadableCache ) { try { PreloadableCache preloadableCache = ( Prel...
Load caches registered as dynamic java services .
13,901
public void onShutdown ( ) { CacheRegistry . getInstance ( ) . clearDynamicServices ( ) ; synchronized ( allCaches ) { for ( String cacheName : allCaches . keySet ( ) ) { CacheService cachingObj = allCaches . get ( cacheName ) ; cachingObj . clearCache ( ) ; } } }
Method that gets invoked when the server shuts down
13,902
public void refreshCache ( String cacheName , List < String > excludedFormats ) { CacheService cache = allCaches . get ( cacheName ) ; if ( cache != null ) { if ( excludedFormats != null && cache instanceof ExcludableCache && excludedFormats . contains ( ( ( ExcludableCache ) cache ) . getFormat ( ) ) ) { logger . debu...
Refreshes a particular cache by name .
13,903
public static String getActivityImplementor ( String className ) throws IOException { if ( getActivityImplementors ( ) != null ) { String newImpl = getActivityImplementors ( ) . get ( className ) ; if ( newImpl != null ) return newImpl ; } return className ; }
If the className argument needs to be mapped to a new implementor class returns the new class name ; otherwise returns the unmodified argument .
13,904
public static String getEventHandler ( String className ) throws IOException { if ( getEventHandlers ( ) != null ) { String newHandler = getEventHandlers ( ) . get ( className ) ; if ( newHandler != null ) return newHandler ; } return className ; }
If the className argument needs to be mapped to a new event handler class returns the new class name ; otherwise returns the unmodified argument .
13,905
public static String getVariableTranslator ( String className ) throws IOException { if ( getVariableTranslators ( ) != null ) { String newTranslator = getVariableTranslators ( ) . get ( className ) ; if ( newTranslator != null ) return newTranslator ; } return className ; }
If the className argument needs to be mapped to a new variable translator class returns the new class name ; otherwise returns the unmodified argument .
13,906
public static String getVariableType ( String type ) throws IOException { if ( getVariableTypes ( ) != null ) { String newType = getVariableTypes ( ) . get ( type ) ; if ( newType != null ) return newType ; } return type ; }
If the type argument needs to be mapped to a new variable type class returns the new class name ; otherwise returns the unmodified argument .
13,907
protected RoutesDefinition getRoutesDefinition ( String name , String version ) throws AdapterException { String modifier = "" ; Map < String , String > params = getHandlerParameters ( ) ; if ( params != null ) { for ( String paramName : params . keySet ( ) ) { if ( modifier . length ( ) == 0 ) modifier += "?" ; else m...
Returns the latest version whose attributes match the custom attribute criteria specified via CustomAttributes . Override to apply additional or non - standard conditions .
13,908
ProcessInstance createProcessInstance ( Long processId , String ownerType , Long ownerId , String secondaryOwnerType , Long secondaryOwnerId , String masterRequestId , Map < String , String > parameters , String label , String template ) throws ProcessException , DataAccessException { ProcessInstance pi = null ; try { ...
Create a process instance . The status is PENDING_PROCESS
13,909
void createTransitionInstances ( ProcessInstance processInstanceVO , List < Transition > transitions , Long fromActInstId ) throws ProcessException , DataAccessException { TransitionInstance transInst ; for ( Transition transition : transitions ) { try { if ( tooManyMaxTransitionInstances ( transition , processInstance...
Handles the work Transitions for the passed in collection of Items
13,910
void startProcessInstance ( ProcessInstance processInstanceVO , int delay ) throws ProcessException { try { Process process = getProcessDefinition ( processInstanceVO ) ; edao . setProcessInstanceStatus ( processInstanceVO . getId ( ) , WorkStatus . STATUS_PENDING_PROCESS ) ; if ( logger . isInfoEnabled ( ) ) { logger ...
Starting a process instance which has been created already . The method sets the status to In Progress find the start activity and sends an internal message to start the activity
13,911
void failActivityInstance ( InternalEvent event , ProcessInstance processInst , Long activityId , Long activityInstId , BaseActivity activity , Throwable cause ) throws DataAccessException , MdwException , SQLException { String tag = logtag ( processInst . getProcessId ( ) , processInst . getId ( ) , activityId , activ...
Reports the error status of the activity instance to the activity manager
13,912
private Transition findTaskActionWorkTransition ( ProcessInstance parentInstance , ActivityInstance activityInstance , String taskAction ) { if ( taskAction == null ) return null ; Process processVO = getProcessDefinition ( parentInstance ) ; Transition workTransVO = processVO . getTransition ( activityInstance . getAc...
Look up the appropriate work transition for an embedded exception handling subprocess .
13,913
private void cancelProcessInstanceTree ( ProcessInstance pi ) throws Exception { if ( pi . getStatusCode ( ) . equals ( WorkStatus . STATUS_COMPLETED ) || pi . getStatusCode ( ) . equals ( WorkStatus . STATUS_CANCELLED ) ) { throw new ProcessException ( "ProcessInstance is not in a cancellable state" ) ; } List < Proce...
Cancels the process instance as well as all descendant process instances . Deregisters associated event wait instances .
13,914
private void cancelProcessInstance ( ProcessInstance pProcessInst ) throws Exception { edao . cancelTransitionInstances ( pProcessInst . getId ( ) , "ProcessInstance has been cancelled." , null ) ; edao . setProcessInstanceStatus ( pProcessInst . getId ( ) , WorkStatus . STATUS_CANCELLED ) ; edao . removeEventWaitForPr...
Cancels a single process instance . It cancels all active transition instances all event wait instances and sets the process instance into canceled status .
13,915
private void resumeActivityInstance ( ActivityInstance actInst , String pCompletionCode , Long documentId , String message , int delay ) throws MdwException , SQLException { ProcessInstance pi = edao . getProcessInstance ( actInst . getProcessInstanceId ( ) ) ; if ( ! this . isProcessInstanceResumable ( pi ) ) { logger...
Sends a RESUME internal event to resume the activity instance .
13,916
protected VelocityContext createVelocityContext ( ) throws ActivityException { try { VelocityContext context = null ; String toolboxFile = getAttributeValueSmart ( VELOCITY_TOOLBOX_FILE ) ; if ( toolboxFile != null && FileHelper . fileExistsOnClasspath ( toolboxFile ) ) { throw new ActivityException ( "TODO: Velocity T...
Creates the velocity context adding process variables as parameters .
13,917
protected Map < String , Object > getAdditionalScriptBindings ( ) { Map < String , Object > addlBindings = new HashMap < String , Object > ( 1 ) ; addlBindings . put ( VELOCITY_OUTPUT , velocityOutput ) ; return addlBindings ; }
Gets additional bindings for script execution adding the velocity output string as a special bind value .
13,918
public String handleEventMessage ( String message , Object messageObj , Map < String , String > metaInfo ) throws EventHandlerException { return null ; }
This is for non - Camel style event handlers . It is not used here . Overriding has no effect in the context of a Camel route .
13,919
public void scheduleInternalEvent ( String name , Date time , String message , String reference ) { schedule ( name , time , message , reference ) ; }
Schedule a timer task or a delayed event
13,920
@ Path ( "/{dataType}" ) public JSONObject get ( String path , Map < String , String > headers ) throws ServiceException , JSONException { String dataType = getSegment ( path , 1 ) ; if ( dataType == null ) throw new ServiceException ( "Missing path segment: {dataType}" ) ; try { BaselineData baselineData = DataAccess ...
Retrieve variableTypes or taskCategories .
13,921
private ProcessInstance getProcInstFromDB ( Long procInstId ) throws DataAccessException { TransactionWrapper transaction = null ; EngineDataAccessDB edao = new EngineDataAccessDB ( ) ; try { transaction = edao . startTransaction ( ) ; return edao . getProcessInstance ( procInstId ) ; } catch ( SQLException e ) { logge...
Method to get the Process Instance from the database
13,922
public List < String > getRecipients ( String workgroupsAttr , String expressionAttr ) throws DataAccessException , ParseException { List < String > recipients = new ArrayList < > ( ) ; if ( workgroupsAttr != null ) { String workgroups = context . getAttribute ( workgroupsAttr ) ; if ( workgroups != null && ! workgroup...
Default behavior returns the UNION of addresses specified via the expression attribute along with those specified by the designated workgroups attribute .
13,923
@ SuppressWarnings ( "unused" ) private void printServerInfo ( ) { Context ctx ; try { ctx = new InitialContext ( ) ; MBeanServer server = ( MBeanServer ) ctx . lookup ( "java:comp/env/jmx/runtime" ) ; ObjectName service = new ObjectName ( "com.bea:Name=RuntimeService," + "Type=weblogic.management.mbeanservers.runtime....
tried to access machine but that need WLS admin credential so have not tried further
13,924
public List < Metric > getAverages ( int span ) { Map < String , Metric > accum = new LinkedHashMap < > ( ) ; int count = span / period ; if ( count > dataList . size ( ) ) count = dataList . size ( ) ; for ( int i = dataList . size ( ) - count ; i < dataList . size ( ) ; i ++ ) { MetricData metricData = dataList . get...
Accumulated averages .
13,925
public List < MetricData > getData ( int span ) { int count = span / period ; if ( dataList . size ( ) < count ) { if ( dataList . isEmpty ( ) ) { return dataList ; } else { List < MetricData > padded = new ArrayList < > ( dataList ) ; MetricData first = dataList . get ( 0 ) ; List < Metric > pads = new ArrayList < > (...
Returns a left - padded list .
13,926
public static String encrypt ( String input ) { try { return encrypt ( input , null ) ; } catch ( GeneralSecurityException e ) { e . printStackTrace ( ) ; return null ; } }
Encrypt a string using a default key
13,927
public static String encrypt ( String input , String strkey ) throws GeneralSecurityException { SecretKey key ; if ( strkey != null ) { if ( strkey . length ( ) > 56 ) strkey = strkey . substring ( 0 , 55 ) ; key = new SecretKeySpec ( strkey . getBytes ( ) , algorithm ) ; } else { if ( defaultKey == null ) defaultKey =...
Encrypt a string
13,928
public static String decrypt ( String encrypted ) { try { return decrypt ( encrypted , null ) ; } catch ( GeneralSecurityException e ) { e . printStackTrace ( ) ; return null ; } }
Decrypt a string using the default key
13,929
public File getHubOverride ( String path ) throws IOException { if ( getOverrideRoot ( ) != null ) { File hubOverride = new File ( getOverrideRoot ( ) + path ) ; if ( hubOverride . isFile ( ) ) return hubOverride ; } if ( getDevOverrideRoot ( ) != null && isDev ( ) ) { File devOverride = new File ( getDevOverrideRoot (...
Finds overridden hub artifacts among assets . Core dev override is also supported for vanilla hub development .
13,930
protected String getRequestData ( ) throws ActivityException { Object request = null ; String requestVarName = getAttributeValue ( REQUEST_VARIABLE ) ; if ( requestVarName == null ) throw new ActivityException ( "Missing attribute: " + REQUEST_VARIABLE ) ; String requestVarType = getParameterType ( requestVarName ) ; r...
Builds the request XML .
13,931
public void onSuccess ( String response ) throws ActivityException , ConnectionException , AdapterException { try { soapResponse = getSoapResponse ( response ) ; Node childElem = unwrapSoapResponse ( soapResponse ) ; String responseXml = DomHelper . toXml ( childElem ) ; String responseVarName = getAttributeValue ( RES...
Overriding this method affords the opportunity to parse the response and populate process variables as needed .
13,932
protected String getSoapAction ( ) { String soapAction = null ; try { soapAction = getAttributeValueSmart ( SOAP_ACTION ) ; } catch ( PropertyException ex ) { logger . severeException ( ex . getMessage ( ) , ex ) ; } if ( soapAction == null ) { String soapVersion = getSoapVersion ( ) ; if ( soapVersion != null && soapV...
The SOAPAction HTTP request header value .
13,933
protected void processMessage ( String message ) throws ActivityException { try { String rcvdMsgDocVar = getAttributeValueSmart ( RECEIVED_MESSAGE_DOC_VAR ) ; if ( rcvdMsgDocVar != null && ! rcvdMsgDocVar . isEmpty ( ) ) { Process processVO = getProcessDefinition ( ) ; Variable variableVO = processVO . getVariable ( rc...
You should override this method to process event messages .
13,934
protected void updateSLA ( int seconds ) throws ActivityException { try { ProcessExecutor engine = this . getEngine ( ) ; super . loginfo ( "Update activity timeout as " + seconds + " seconds" ) ; InternalEvent delayMsg = InternalEvent . createActivityDelayMessage ( this . getActivityInstance ( ) , this . getMasterRequ...
Update SLA of this
13,935
@ Path ( "/{ownerType}/{ownerId}" ) @ ApiOperation ( value = "Retrieve values for an ownerType and ownerId" , notes = "Response is a generic JSON object with names/values." ) public JSONObject get ( String path , Map < String , String > headers ) throws ServiceException , JSONException { Map < String , String > paramet...
Retrieve values .
13,936
@ Path ( "/{ownerType}/{ownerId}" ) @ ApiOperation ( value = "Create values for an ownerType and ownerId" , response = StatusMessage . class ) @ ApiImplicitParams ( { @ ApiImplicitParam ( name = "Values" , paramType = "body" ) } ) public JSONObject post ( String path , JSONObject content , Map < String , String > heade...
Create values for owner type and id .
13,937
@ Path ( "/{ownerType}/{ownerId}" ) @ ApiOperation ( value = "Update values for an ownerType and ownerId" , response = StatusMessage . class ) @ ApiImplicitParams ( { @ ApiImplicitParam ( name = "Values" , paramType = "body" ) } ) public JSONObject put ( String path , JSONObject content , Map < String , String > header...
Update values for owner type and id . Existing values are always overwritten .
13,938
@ Path ( "/{ownerType}/{ownerId}" ) @ ApiOperation ( value = "Delete values for an ownerType and ownerId" , response = StatusMessage . class ) public JSONObject delete ( String path , JSONObject content , Map < String , String > headers ) throws ServiceException , JSONException { JSONObject empty = new JsonObject ( ) ;...
Delete values for owner type and id .
13,939
private void authorize ( HttpSession session , Action action , Entity entity , String location ) throws AuthorizationException , DataAccessException { AuthenticatedUser user = ( AuthenticatedUser ) session . getAttribute ( "authenticatedUser" ) ; if ( user == null && ApplicationContext . getServiceUser ( ) != null ) { ...
Also audit logs create and delete .
13,940
public PackageAssets getAssets ( String packageName , boolean withVcsInfo ) throws ServiceException { try { PackageDir pkgDir = getPackageDir ( packageName ) ; if ( pkgDir == null ) { pkgDir = getGhostPackage ( packageName ) ; if ( pkgDir == null ) throw new DataAccessException ( "Missing package metadata directory: " ...
Returns all the assets for the specified package . Does not use the AssetCache .
13,941
private List < PackageDir > findPackageDirs ( List < File > dirs , List < File > excludes ) throws IOException , DataAccessException { List < PackageDir > pkgSubDirs = new ArrayList < > ( ) ; List < File > allSubDirs = new ArrayList < > ( ) ; for ( File dir : dirs ) { MdwIgnore mdwIgnore = new MdwIgnore ( dir ) ; for (...
Finds the next level of sibling PackageDirs under a set of non - package dirs .
13,942
private VersionControl getAssetVersionControl ( ) throws IOException , DataAccessException { VersionControl vc = getVersionControl ( ) ; if ( vc == null ) vc = DataAccess . getAssetVersionControl ( assetRoot ) ; return vc ; }
Falls back to DataAccess version control for asset versioning .
13,943
public AssetInfo getImplAsset ( String className ) throws ServiceException { int lastDot = className . lastIndexOf ( '.' ) ; if ( lastDot > 0 && lastDot < className . length ( ) - 1 ) { String assetRoot = className . substring ( 0 , lastDot ) + "/" + className . substring ( lastDot + 1 ) ; AssetInfo implAsset = getAsse...
Returns either Java or Kotlin asset implementor for a class . Null if not found .
13,944
private String getValue ( String name ) { for ( YamlProperties yamlProp : yamlProps ) { String value = yamlProp . getString ( name ) ; if ( value != null ) return value ; } if ( javaProps != null ) { for ( Properties javaProp : javaProps ) { String value = javaProp . getProperty ( name ) ; if ( value != null ) return v...
Reads flat or structured values from yaml . If not found fall back to java properties .
13,945
public static void putScript ( String name , KotlinCompiledScript script ) { getInstance ( ) . scripts . put ( name , script ) ; }
Must be public for access from Kotlin .
13,946
protected void handleConnectionException ( int errorCode , Throwable originalCause ) throws ActivityException { InternalEvent message = InternalEvent . createActivityStartMessage ( getActivityId ( ) , getProcessInstanceId ( ) , getWorkTransitionInstanceId ( ) , getMasterRequestId ( ) , COMPCODE_AUTO_RETRY ) ; Scheduled...
Typically you should not override this method . ConnectionPoolAdapter does override this with internal MDW logic .
13,947
public Response directInvoke ( String request , int timeout , Map < String , String > meta_data ) throws AdapterException , ConnectionException { init ( ) ; if ( logger == null ) logger = LoggerUtil . getStandardLogger ( ) ; Object connection = null ; try { connection = openConnection ( ) ; return doInvoke ( connection...
This method is used for directly invoke the adapter activity from code rather than as part of process execution flow .
13,948
public TransitionInstance createTransitionInstance ( Transition transition , Long pProcessInstId ) throws DataAccessException { TransactionWrapper transaction = null ; try { transaction = startTransaction ( ) ; return engineImpl . createTransitionInstance ( transition , pProcessInstId ) ; } catch ( DataAccessException ...
Creates a new instance of the WorkTransationInstance entity
13,949
public Integer lockActivityInstance ( Long actInstId ) throws DataAccessException { try { if ( ! isInTransaction ( ) ) throw new DataAccessException ( "Cannot lock activity instance without a transaction" ) ; return engineImpl . getDataAccess ( ) . lockActivityInstance ( actInstId ) ; } catch ( SQLException e ) { throw...
This method must be called within the same transaction scope ( namely engine is already started
13,950
public Integer lockProcessInstance ( Long procInstId ) throws DataAccessException { try { if ( ! isInTransaction ( ) ) throw new DataAccessException ( "Cannot lock activity instance without a transaction" ) ; return engineImpl . getDataAccess ( ) . lockProcessInstance ( procInstId ) ; } catch ( SQLException e ) { throw...
this method must be called within the same transaction scope ( namely engine is already started
13,951
@ Path ( "{package}/{asset}" ) public JSONObject get ( String assetPath , Map < String , String > headers ) throws ServiceException , JSONException { AssetServices assetServices = ServiceLocator . getAssetServices ( ) ; AssetInfo asset = assetServices . getAsset ( assetPath . substring ( 7 ) , true ) ; if ( asset == nu...
Retrieves commit info for an asset .
13,952
public long getDurationMicro ( ) { if ( startNano != 0 ) { if ( running ) return ( ( long ) ( System . nanoTime ( ) - startNano ) ) / 1000 ; else if ( stopNano != startNano ) return ( ( long ) ( stopNano - startNano ) ) / 1000 ; } return 0 ; }
Timer duration in microseconds .
13,953
public static TaskTemplate getTemplateForName ( String taskName ) { for ( int i = 0 ; i < taskVoCache . size ( ) ; i ++ ) { TaskTemplate task = taskVoCache . get ( i ) ; if ( task . getTaskName ( ) . equals ( taskName ) ) { return task ; } } return null ; }
Return the latest task for the given name .
13,954
public static TaskTemplate getTaskTemplate ( String logicalId ) { for ( int i = 0 ; i < taskVoCache . size ( ) ; i ++ ) { TaskTemplate task = taskVoCache . get ( i ) ; if ( logicalId . equals ( task . getLogicalId ( ) ) ) { return task ; } } return null ; }
Return the latest task id for the given logical ID
13,955
public static TaskTemplate getTaskTemplate ( AssetVersionSpec assetVersionSpec ) throws Exception { TaskTemplate taskTemplate = templateVersions . get ( assetVersionSpec . toString ( ) ) ; if ( taskTemplate == null ) { if ( assetVersionSpec . getPackageName ( ) != null ) { List < Package > pkgVOs = PackageCache . getAl...
Get the latest task template that matched the assetVersionSpec . Uses the task logicalId to match to the taskVoCache so if the logical ID in the matching asset is not unique then the latest template with this logicalId will be returned regardless of assetVersionSpec . So CHANGE THE LOGICAL_ID if you want in - flight ta...
13,956
public static void read ( Swagger swagger , Set < Class < ? > > classes ) { final SwaggerAnnotationsReader reader = new SwaggerAnnotationsReader ( swagger ) ; for ( Class < ? > cls : classes ) { final ReaderContext context = new ReaderContext ( swagger , cls , "" , null , false , new ArrayList < > ( ) , new ArrayList <...
Scans a set of classes for Swagger annotations .
13,957
public InputStream getResourceAsStream ( String name ) { byte [ ] b = null ; try { Asset resource = AssetCache . getAsset ( mdwPackage . getName ( ) + "/" + name ) ; if ( resource != null ) b = resource . getRawContent ( ) ; if ( b == null ) b = findInJarAssets ( name ) ; if ( b == null ) b = findInFileSystem ( name ) ...
This is used by XMLBeans for loading the type system .
13,958
private EventParameters createEventParameters ( Map < String , String > pParams ) { EventParameters evParams = EventParameters . Factory . newInstance ( ) ; for ( String name : pParams . keySet ( ) ) { String val = pParams . get ( name ) ; if ( val == null ) { continue ; } Parameter evParam = evParams . addNewParameter...
Method that creates the event params based on the passed in Map
13,959
public static InternalEvent createActivityNotifyMessage ( ActivityInstance ai , Integer eventType , String masterRequestId , String compCode ) { InternalEvent event = new InternalEvent ( ) ; event . workId = ai . getActivityId ( ) ; event . transitionInstanceId = null ; event . eventType = eventType ; event . ownerType...
create activity FINISH ABORT RESUME CORRECT ERROR and any event type that can be specified in designer configuration for events .
13,960
public Transaction getTransaction ( ) { try { return getTransactionManager ( ) . getTransaction ( ) ; } catch ( Exception ex ) { StandardLogger logger = LoggerUtil . getStandardLogger ( ) ; logger . severeException ( ex . getMessage ( ) , ex ) ; return null ; } }
Returns the current transaction
13,961
public TransactionManager getTransactionManager ( ) { TransactionManager transMgr = null ; try { String jndiName = ApplicationContext . getNamingProvider ( ) . getTransactionManagerName ( ) ; Object txMgr = ApplicationContext . getNamingProvider ( ) . lookup ( null , jndiName , TransactionManager . class ) ; transMgr =...
Returns transaction manager
13,962
public boolean belongsToGroup ( String groupName ) { if ( workgroups == null || workgroups . length == 0 ) { return false ; } for ( Workgroup g : workgroups ) { if ( g . getName ( ) . equals ( groupName ) ) return true ; } return false ; }
Check whether user belongs to the specified group
13,963
public void addRoleForGroup ( String groupName , String roleName ) { if ( workgroups == null ) { workgroups = new Workgroup [ 1 ] ; workgroups [ 0 ] = new Workgroup ( null , groupName , null ) ; } List < String > roles = workgroups [ 0 ] . getRoles ( ) ; if ( roles == null ) { roles = new ArrayList < String > ( ) ; wor...
This is only used when UserVO is a member of UserGroupVO . Only that group is populated as a substructure to store roles .
13,964
public void parseName ( ) { if ( getName ( ) != null ) { String name = getName ( ) . trim ( ) ; int firstSp = name . indexOf ( ' ' ) ; if ( firstSp > 0 ) { setFirst ( name . substring ( 0 , firstSp ) ) ; int lastSp = name . lastIndexOf ( ' ' ) ; setLast ( name . substring ( lastSp + 1 ) ) ; } else { setFirst ( name ) ;...
Set first and last name based on full name .
13,965
public void putreq ( String msg ) throws SoccomException { byte msgbytes [ ] = SoccomMessage . makeMessage ( msg , null ) ; logline ( "SEND: " + new String ( msgbytes ) ) ; copy_msgid ( _msgid , msgbytes ) ; try { _out . write ( msgbytes ) ; } catch ( IOException e ) { throw new SoccomException ( SoccomException . REQU...
Send a request message .
13,966
public void putreq_vheader ( String endmark ) throws SoccomException { if ( endmark . length ( ) != 4 ) throw new SoccomException ( SoccomException . ENDM_LENGTH ) ; byte msgbytes [ ] = SoccomMessage . makeMessageSpecial ( "ENDM" + endmark , null ) ; logline ( "SEND: " + new String ( msgbytes ) ) ; copy_msgid ( _msgid ...
Send the header part of a variable - size request message .
13,967
public void putreq_vline ( String msg ) throws SoccomException { int length = msg . length ( ) ; if ( msg . charAt ( length - 1 ) == '\n' ) { logline ( "SEND: " + msg . substring ( 0 , length - 1 ) ) ; } else { logline ( "SEND: " + msg ) ; msg += "\n" ; } byte msgbytes [ ] = msg . getBytes ( ) ; try { _out . write ( ms...
Send a line as a part of a variable - size request message .
13,968
public void putreq_vfooter ( String endmark ) throws SoccomException { if ( endmark . length ( ) != 4 ) throw new SoccomException ( SoccomException . ENDM_LENGTH ) ; String msg = endmark + "\n" ; byte msgbytes [ ] = msg . getBytes ( ) ; logline ( "SEND: " + endmark ) ; try { _out . write ( msgbytes ) ; } catch ( IOExce...
Mark the end of a variable - size message .
13,969
public String getresp ( int timeout ) throws SoccomException { int size , n ; String sizestr ; try { byte [ ] _header = new byte [ SoccomMessage . HEADER_SIZE ] ; _socket . setSoTimeout ( timeout * 1000 ) ; n = _in . read ( _header , 0 , SoccomMessage . HEADER_SIZE ) ; if ( n != SoccomMessage . HEADER_SIZE ) throw new ...
Get the response from the server after sending a request .
13,970
public String getresp_first ( int maxbytes , int timeout ) throws SoccomException { int n ; String sizestr , msg ; _resp_read = - 1 ; try { byte [ ] _header = new byte [ SoccomMessage . HEADER_SIZE ] ; _socket . setSoTimeout ( timeout * 1000 ) ; n = _in . read ( _header , 0 , SoccomMessage . HEADER_SIZE ) ; if ( n != S...
The method receives the first part of response message from the server up to maxbytes bytes . Use getresp_hasmore and getresp_next to get getresp_rest to get the remaining part of messages . When the server sends the message using ENDM the string returned may be longer than maxbytes but only till the first line after t...
13,971
public void close ( ) { if ( _socket != null ) { try { _socket . close ( ) ; _socket = null ; } catch ( IOException e ) { System . err . println ( "Exception: " + e ) ; } _in = null ; _out = null ; } }
Close the connection . This is automatically called at garbage collection but it is a good idea to voluntarily call it as soon as the connection is not needed any more .
13,972
protected TextService getServiceInstance ( Map < String , String > headers ) throws ServiceException { try { String requestPath = headers . get ( Listener . METAINFO_REQUEST_PATH ) ; String [ ] pathSegments = requestPath != null ? requestPath . split ( "/" ) : null ; if ( pathSegments == null ) throw new ServiceExcepti...
Returns the service instance consulting the service registry if necessary .
13,973
protected Format getFormat ( Map < String , String > metaInfo ) { Format format = Format . json ; metaInfo . put ( Listener . METAINFO_CONTENT_TYPE , Listener . CONTENT_TYPE_JSON ) ; String formatParam = ( String ) metaInfo . get ( "format" ) ; if ( formatParam != null ) { if ( formatParam . equals ( "xml" ) ) { format...
Default format is now JSON .
13,974
@ Path ( "/{ownerType}/{ownerId}" ) @ ApiOperation ( value = "Retrieve attributes for an ownerType and ownerId" , notes = "Response is a generic JSON object with names/values." ) public JSONObject get ( String path , Map < String , String > headers ) throws ServiceException , JSONException { Map < String , String > par...
Retrieve attributes .
13,975
public void importAssetsFromGit ( ProgressMonitor ... monitors ) throws IOException { if ( inProgress ) throw new IOException ( "Asset import already in progress..." ) ; try { inProgress = true ; getOut ( ) . println ( "Importing from Git into: " + getProjectDir ( ) + "...(branch: " + branch + ")(Hard Reset: " + ( hard...
This is for importing project assets from Git into an environment .
13,976
public void importGit ( ProgressMonitor ... monitors ) throws IOException { if ( inProgress ) throw new IOException ( "Asset already in progress..." ) ; try { inProgress = true ; Props props = new Props ( this ) ; VcInfo vcInfo = new VcInfo ( getGitRoot ( ) , props ) ; getOut ( ) . println ( "Importing from Git into: "...
This is for importing newly - discovered assets .
13,977
public < T extends RegisteredService > T getDynamicService ( Package pkg , Class < T > serviceInterface , String className ) { if ( dynamicServices . containsKey ( serviceInterface . getName ( ) ) && dynamicServices . get ( serviceInterface . getName ( ) ) . contains ( className ) ) { try { ClassLoader parentClassLoade...
Get the Dynamic java instance for Registered Service
13,978
public void addDynamicService ( String serviceInterface , String className ) { if ( dynamicServices . containsKey ( serviceInterface ) ) { dynamicServices . get ( serviceInterface ) . add ( className ) ; } else { Set < String > classNamesSet = new HashSet < String > ( ) ; classNamesSet . add ( className ) ; dynamicServ...
Add Dynamic Java Registered Service class names for each service
13,979
public String [ ] getArrayFilter ( String key ) { String value = filters . get ( key ) ; if ( value == null ) return null ; String [ ] array = new String [ 0 ] ; if ( value . startsWith ( "[" ) ) { if ( value . length ( ) > 2 ) array = value . substring ( 1 , value . length ( ) - 1 ) . split ( "," ) ; } else if ( value...
Empty list returns null ;
13,980
public Map < String , String > getMapFilter ( String name ) { String value = filters . get ( name ) ; if ( value == null ) return null ; Map < String , String > map = new LinkedHashMap < > ( ) ; if ( value . startsWith ( "{" ) && value . endsWith ( "}" ) ) { for ( String entry : value . substring ( 1 , value . length (...
Empty map returns null as does invalid format .
13,981
public String getServiceSummaryVariableName ( Process processDefinition ) { for ( Activity activity : processDefinition . getActivities ( ) ) { String attr = activity . getAttribute ( "serviceSummaryVariable" ) ; if ( attr != null ) return attr ; } return null ; }
Walks through all activities looking for the attribute .
13,982
public JSONObject getJson ( ) throws JSONException { JSONObject json = create ( ) ; json . put ( "id" , getLogicalId ( ) ) ; json . put ( "to" , "A" + toId ) ; if ( completionCode != null ) json . put ( "resultCode" , completionCode ) ; if ( eventType != null ) json . put ( "event" , EventType . getEventTypeName ( even...
Does not populate from field since JSON transitions are children of activities .
13,983
private static void initializeJavaSourceArtifacts ( ) throws DataAccessException , IOException , CachingException { logger . info ( "Initializing Java source assets..." ) ; long before = System . currentTimeMillis ( ) ; for ( Asset javaSource : AssetCache . getAssets ( Asset . JAVA ) ) { Package pkg = PackageCache . ge...
Writes the java - language assets into the temporary directory . This is only needed for compilation dependencies .
13,984
private static void preCompileJavaSourceArtifacts ( ) { if ( preCompiled != null ) { for ( String preCompClass : preCompiled ) { logger . info ( "Precompiling dynamic Java asset class: " + preCompClass ) ; try { Asset javaAsset = AssetCache . getAsset ( preCompClass , Asset . JAVA ) ; Package pkg = PackageCache . getAs...
Precompile designated Java Source artifacts .
13,985
public static int unitsToSeconds ( String interval , String unit ) { if ( interval == null || interval . isEmpty ( ) ) return 0 ; else if ( unit == null ) return ( int ) ( Double . parseDouble ( interval ) ) ; else if ( unit . equals ( INTERVAL_DAYS ) ) return ( int ) ( Double . parseDouble ( interval ) * 86400 ) ; els...
Convert interval of specified unit to seconds
13,986
public static String secondsToUnits ( int seconds , String unit ) { if ( unit == null ) return String . valueOf ( seconds ) ; else if ( unit . equals ( INTERVAL_DAYS ) ) return String . valueOf ( Math . round ( seconds / 86400 ) ) ; else if ( unit . equals ( INTERVAL_HOURS ) ) return String . valueOf ( Math . round ( s...
Convert seconds to specified units
13,987
@ SuppressWarnings ( "unused" ) public String getAssetPath ( ) { String relPath = getRelPath ( ) ; return relPath . substring ( 0 , relPath . length ( ) - getAsset ( ) . getName ( ) . length ( ) - 1 ) . replace ( '/' , '.' ) + "/" + getAsset ( ) . getName ( ) ; }
Accessed in react default index . html substitution .
13,988
@ Path ( "/{documentId}" ) public JSONObject get ( String path , Map < String , String > headers ) throws ServiceException , JSONException { WorkflowServices workflowServices = ServiceLocator . getWorkflowServices ( ) ; String docId = getSegment ( path , 1 ) ; if ( docId == null ) { throw new ServiceException ( Service...
Retrieve a document string value
13,989
protected URL getRequestUrl ( Map < String , String > headers ) throws ServiceException { String requestUrl = headers . get ( Listener . METAINFO_REQUEST_URL ) ; if ( requestUrl == null ) throw new ServiceException ( "Missing header: " + Listener . METAINFO_REQUEST_URL ) ; String queryStr = "" ; if ( ! StringHelper . i...
Includes query string .
13,990
protected UserAction getUserAction ( User user , String path , Object content , Map < String , String > headers ) { Action action = getAction ( path , content , headers ) ; Entity entity = getEntity ( path , content , headers ) ; Long entityId = getEntityId ( path , content , headers ) ; String descrip = getEntityDescr...
For audit logging .
13,991
protected Long getEntityId ( String path , Object content , Map < String , String > headers ) { return 0L ; }
Override if entity has a meaningful ID .
13,992
protected String getSub ( String path ) { int slash = path . indexOf ( '/' ) ; if ( slash > 0 && slash < path . length ( ) - 1 ) return path . substring ( slash + 1 ) ; else return null ; }
Minus the base path that triggered this service .
13,993
protected Entity getEntity ( String path , Object content , Map < String , String > headers ) { return Entity . Other ; }
Should be overridden . Avoid using Entity . Other .
13,994
protected String getAuthUser ( Map < String , String > headers ) { return headers . get ( Listener . AUTHENTICATED_USER_HEADER ) ; }
returns authenticated user cuid
13,995
protected void authorizeExport ( Map < String , String > headers ) throws AuthorizationException { String path = headers . get ( Listener . METAINFO_REQUEST_PATH ) ; User user = authorize ( path , new JsonObject ( ) , headers ) ; Action action = Action . Export ; Entity entity = getEntity ( path , null , headers ) ; Lo...
Also audit logs .
13,996
public Map < String , String > getRequestHeaders ( ) { if ( super . getRequestHeaders ( ) != null ) return super . getRequestHeaders ( ) ; try { Map < String , String > headers = null ; String headersVar = getAttributeValueSmart ( HEADERS_VARIABLE ) ; if ( headersVar != null ) { Process processVO = getProcessDefinition...
Override to specify HTTP request headers .
13,997
public static String getConfigLocation ( ) { if ( configLocation == null ) { String configLoc = System . getProperty ( MDW_CONFIG_LOCATION ) ; if ( configLoc != null ) { if ( ! configLoc . endsWith ( "/" ) ) configLoc = configLoc + "/" ; configLocation = configLoc ; System . out . println ( "Loading configuration files...
Directory where MDW config files can be found .
13,998
public static PropertyManager getInstance ( ) { if ( instance == null ) { try { initializePropertyManager ( ) ; } catch ( StartupException e ) { throw new RuntimeException ( e ) ; } } return instance ; }
returns the handle to the property manager
13,999
public static String locate ( String className , ClassLoader classLoader ) { String resource = new String ( className ) ; if ( ! resource . startsWith ( "/" ) ) { resource = "/" + resource ; } resource = resource . replace ( '.' , '/' ) ; resource = resource + ".class" ; URL classUrl = classLoader . getResource ( resou...
Finds the location of the version of a particular class that will be used by the Java runtime . Output goes to standard out .