_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q179200
CollaborationClient.getAllToByLoggedIn
test
public List<Collaboration> getAllToByLoggedIn() { CollaborationListing collaborationListing = new CollaborationListing(); if(this.serviceTicket != null) { collaborationListing.setServiceTicket(this.serviceTicket); } return new CollaborationListing(this.postJson( collaborationListing, WS.Path.Collaboration.Version1.getAllToByLoggedIn())).getListing(); }
java
{ "resource": "" }
q179201
ABaseFieldClient.getMetaDataForDecimalAs
test
protected String getMetaDataForDecimalAs( String metaDataPrefixParam, double minParam, double maxParam, double stepFactorParam, String prefixParam ) { StringBuffer returnBuffer = new StringBuffer(); if (metaDataPrefixParam != null && !metaDataPrefixParam.isEmpty()) { returnBuffer.append(metaDataPrefixParam); } //Min... returnBuffer.append(FieldMetaData.Decimal.UNDERSCORE); returnBuffer.append(FieldMetaData.Decimal.MIN); returnBuffer.append(FieldMetaData.Decimal.SQ_OPEN); returnBuffer.append(minParam); returnBuffer.append(FieldMetaData.Decimal.SQ_CLOSE); returnBuffer.append(FieldMetaData.Decimal.UNDERSCORE); //Max... returnBuffer.append(FieldMetaData.Decimal.MAX); returnBuffer.append(FieldMetaData.Decimal.SQ_OPEN); returnBuffer.append(maxParam); returnBuffer.append(FieldMetaData.Decimal.SQ_CLOSE); returnBuffer.append(FieldMetaData.Decimal.UNDERSCORE); //Step Factor... returnBuffer.append(FieldMetaData.Decimal.STEP_FACTOR); returnBuffer.append(FieldMetaData.Decimal.SQ_OPEN); returnBuffer.append(stepFactorParam); returnBuffer.append(FieldMetaData.Decimal.SQ_CLOSE); returnBuffer.append(FieldMetaData.Decimal.UNDERSCORE); //Prefix String prefix = (prefixParam == null) ? "" : prefixParam; returnBuffer.append(FieldMetaData.Decimal.PREFIX); returnBuffer.append(FieldMetaData.Decimal.SQ_OPEN); returnBuffer.append(prefix); returnBuffer.append(FieldMetaData.Decimal.SQ_CLOSE); return returnBuffer.toString(); }
java
{ "resource": "" }
q179202
UserClient.changePasswordForLoggedInUser
test
public User changePasswordForLoggedInUser( String existingPasswordParam, String newPasswordParam, String confirmNewPasswordParam) { User toChangePasswordFor = new User(); if(this.serviceTicket != null) { toChangePasswordFor.setServiceTicket(this.serviceTicket); } String existingPassword = existingPasswordParam == null ? UtilGlobal.EMPTY: existingPasswordParam; String newPassword = newPasswordParam == null ? UtilGlobal.EMPTY: newPasswordParam; String confirmNewPassword = confirmNewPasswordParam == null ? UtilGlobal.EMPTY: confirmNewPasswordParam; JSONObject passwordClear = new JSONObject(); passwordClear.put("existing",existingPassword); passwordClear.put("new",newPassword); passwordClear.put("confirm_new",confirmNewPassword); toChangePasswordFor.setPasswordClear(passwordClear.toString()); return new User(this.postJson( toChangePasswordFor, WS.Path.User.Version1.changePassword())); }
java
{ "resource": "" }
q179203
UserClient.getAllUsers
test
public UserListing getAllUsers() { UserListing userToGetInfoFor = new UserListing(); if(this.serviceTicket != null) { userToGetInfoFor.setServiceTicket(this.serviceTicket); } try { return new UserListing(this.postJson( userToGetInfoFor, WS.Path.User.Version1.getAllUsers())); } // catch (JSONException jsonExcept) { throw new FluidClientException(jsonExcept.getMessage(), FluidClientException.ErrorCode.JSON_PARSING); } }
java
{ "resource": "" }
q179204
UserClient.getGravatarForEmail
test
public byte[] getGravatarForEmail( String emailAddressParam, int sizeParam) { try { JSONObject gravatarJSONObj = this.getJson( WS.Path.User.Version1.getGravatarByEmail( emailAddressParam, sizeParam)); String base64Text = gravatarJSONObj.optString(JSON_TAG_DATA,""); if(base64Text == null || base64Text.isEmpty()) { return null; } return UtilGlobal.decodeBase64(base64Text); } //JSON Parsing... catch (JSONException jsonExcept) { throw new FluidClientException(jsonExcept.getMessage(), jsonExcept, FluidClientException.ErrorCode.JSON_PARSING); } //Encoding not supported... catch (UnsupportedEncodingException unsEncExcept) { throw new FluidClientException(unsEncExcept.getMessage(), unsEncExcept, FluidClientException.ErrorCode.IO_ERROR); } }
java
{ "resource": "" }
q179205
UserClient.getGravatarForUser
test
public byte[] getGravatarForUser(User userParam, int sizeParam) { if(userParam == null) { return null; } try { JSONObject gravatarJSONObj = this.postJson( userParam, WS.Path.User.Version1.getGravatarByUser(sizeParam)); String base64Text = gravatarJSONObj.optString(JSON_TAG_DATA,""); if(base64Text == null || base64Text.isEmpty()) { return null; } return UtilGlobal.decodeBase64(base64Text); } //JSON problem... catch (JSONException jsonExcept) { throw new FluidClientException(jsonExcept.getMessage(), jsonExcept, FluidClientException.ErrorCode.JSON_PARSING); } }
java
{ "resource": "" }
q179206
Field.populateFromElasticSearchJson
test
@Override @XmlTransient public void populateFromElasticSearchJson( JSONObject jsonObjectParam, List<Field> formFieldsParam) throws JSONException { throw new FluidElasticSearchException( "Method not implemented. Make use of 'populateFromElasticSearchJson(JSONObject jsonObjectParam)' method."); }
java
{ "resource": "" }
q179207
Field.getElasticSearchFieldType
test
@XmlTransient public String getElasticSearchFieldType() { Type fieldType = this.getTypeAsEnum(); if(fieldType == null) { return null; } //Get the fieldType by Fluid field fieldType... switch (fieldType) { case ParagraphText: return ElasticSearchType.TEXT; case Text: String metaData = this.getTypeMetaData(); if(metaData == null || metaData.isEmpty()) { return ElasticSearchType.TEXT; } if(LATITUDE_AND_LONGITUDE.equals(metaData)) { return ElasticSearchType.GEO_POINT; } return ElasticSearchType.TEXT; case TrueFalse: return ElasticSearchType.BOOLEAN; case DateTime: return ElasticSearchType.DATE; case Decimal: return ElasticSearchType.DOUBLE; case MultipleChoice: return ElasticSearchType.KEYWORD; } return null; }
java
{ "resource": "" }
q179208
FlowStepClient.createFlowStep
test
public FlowStep createFlowStep(FlowStep flowStepParam) { if(flowStepParam != null && this.serviceTicket != null) { flowStepParam.setServiceTicket(this.serviceTicket); } return new FlowStep(this.putJson( flowStepParam, WS.Path.FlowStep.Version1.flowStepCreate())); }
java
{ "resource": "" }
q179209
FlowStepClient.updateFlowStep
test
public FlowStep updateFlowStep(FlowStep flowStepParam) { if(flowStepParam != null && this.serviceTicket != null) { flowStepParam.setServiceTicket(this.serviceTicket); } return new FlowStep(this.postJson( flowStepParam, WS.Path.FlowStep.Version1.flowStepUpdate())); }
java
{ "resource": "" }
q179210
FlowStepClient.getFlowStepById
test
public FlowStep getFlowStepById( Long flowStepIdParam, String flowStepTypeParam) { FlowStep flowStep = new FlowStep(flowStepIdParam); flowStep.setFlowStepType(flowStepTypeParam); if(this.serviceTicket != null) { flowStep.setServiceTicket(this.serviceTicket); } return new FlowStep(this.postJson( flowStep, WS.Path.FlowStep.Version1.getById())); }
java
{ "resource": "" }
q179211
FlowStepClient.getFlowStepByStep
test
public FlowStep getFlowStepByStep(FlowStep flowStepParam) { if(this.serviceTicket != null && flowStepParam != null) { flowStepParam.setServiceTicket(this.serviceTicket); } return new FlowStep(this.postJson( flowStepParam, WS.Path.FlowStep.Version1.getByStep())); }
java
{ "resource": "" }
q179212
FlowStepClient.getStepsByFlow
test
public FlowStepListing getStepsByFlow(Flow flowParam) { if(this.serviceTicket != null && flowParam != null) { flowParam.setServiceTicket(this.serviceTicket); } return new FlowStepListing(this.postJson( flowParam, WS.Path.FlowStep.Version1.getAllStepsByFlow())); }
java
{ "resource": "" }
q179213
FlowStepClient.deleteFlowStep
test
public FlowStep deleteFlowStep(FlowStep flowStepParam) { if(flowStepParam != null && this.serviceTicket != null) { flowStepParam.setServiceTicket(this.serviceTicket); } return new FlowStep(this.postJson( flowStepParam, WS.Path.FlowStep.Version1.flowStepDelete())); }
java
{ "resource": "" }
q179214
FlowStepClient.forceDeleteFlowStep
test
public FlowStep forceDeleteFlowStep(FlowStep flowStepParam) { if(flowStepParam != null && this.serviceTicket != null) { flowStepParam.setServiceTicket(this.serviceTicket); } return new FlowStep(this.postJson( flowStepParam, WS.Path.FlowStep.Version1.flowStepDelete(true))); }
java
{ "resource": "" }
q179215
ABaseESUtil.populateTableFields
test
protected final List<Form> populateTableFields( boolean addAllTableRecordsForReturnParam, boolean includeFieldDataParam, List<Field> formFieldsParam) { if(formFieldsParam == null || formFieldsParam.isEmpty()) { return null; } List<Form> allTableRecordsFromAllFields = addAllTableRecordsForReturnParam ? new ArrayList() : null; //Populate each of the Table Fields... for(Field descendantField : formFieldsParam) { //Skip if not Table Field... if(!(descendantField.getFieldValue() instanceof TableField)) { continue; } TableField tableField = (TableField)descendantField.getFieldValue(); List<Form> tableRecordWithIdOnly = tableField.getTableRecords(); if(tableRecordWithIdOnly == null || tableRecordWithIdOnly.isEmpty()) { continue; } //Populate the ids for lookup... List<Long> formIdsOnly = new ArrayList(); for(Form tableRecord : tableRecordWithIdOnly) { formIdsOnly.add(tableRecord.getId()); } List<Form> populatedTableRecords = this.getFormsByIds( Index.TABLE_RECORD, formIdsOnly, includeFieldDataParam, DEFAULT_OFFSET, MAX_NUMBER_OF_TABLE_RECORDS); if(addAllTableRecordsForReturnParam && populatedTableRecords != null) { allTableRecordsFromAllFields.addAll(populatedTableRecords); } tableField.setTableRecords(populatedTableRecords); descendantField.setFieldValue(tableField); } return allTableRecordsFromAllFields; }
java
{ "resource": "" }
q179216
ABaseESUtil.closeConnection
test
@Override public void closeConnection() { CloseConnectionRunnable closeConnectionRunnable = new CloseConnectionRunnable(this); Thread closeConnThread = new Thread( closeConnectionRunnable,"Close ABaseES Connection"); closeConnThread.start(); }
java
{ "resource": "" }
q179217
AGenericListMessageHandler.handleMessage
test
@Override public void handleMessage(Object objectToProcess) { //There is an error... if(objectToProcess instanceof Error) { Error fluidError = ((Error)objectToProcess); this.errors.add(fluidError); //Do a message callback... if(this.messageReceivedCallback != null) { this.messageReceivedCallback.errorMessageReceived(fluidError); } //If complete future is provided... if(this.completableFuture != null) { this.completableFuture.completeExceptionally( new FluidClientException( fluidError.getErrorMessage(), fluidError.getErrorCode())); } } //No Error... else { JSONObject jsonObject = (JSONObject)objectToProcess; //Uncompress the compressed response... if(this.compressedResponse){ CompressedResponse compressedResponse = new CompressedResponse(jsonObject); byte[] compressedJsonList = UtilGlobal.decodeBase64(compressedResponse.getDataBase64()); byte[] uncompressedJson = null; try { uncompressedJson = this.uncompress(compressedJsonList); } catch (IOException eParam) { throw new FluidClientException( "I/O issue with uncompress. "+eParam.getMessage(), eParam, FluidClientException.ErrorCode.IO_ERROR); } jsonObject = new JSONObject(new String(uncompressedJson)); } T messageForm = this.getNewInstanceBy(jsonObject); //Add to the list of return values... this.returnValue.add(messageForm); //Completable future is set, and all response messages received... if(this.completableFuture != null) { String echo = messageForm.getEcho(); if(echo != null && !echo.trim().isEmpty()) { this.expectedEchoMessagesBeforeComplete.remove(echo); } //All expected messages received... if(this.expectedEchoMessagesBeforeComplete.isEmpty()) { this.completableFuture.complete(this.returnValue); } } //Do a message callback... if(this.messageReceivedCallback != null) { this.messageReceivedCallback.messageReceived(messageForm); } } }
java
{ "resource": "" }
q179218
AGenericListMessageHandler.connectionClosed
test
@Override public void connectionClosed() { this.isConnectionClosed = true; if(this.completableFuture != null) { //If there was no error... if(this.getErrors().isEmpty()) { this.completableFuture.complete(this.returnValue); } //there was an error... else { Error firstFluidError = this.getErrors().get(0); this.completableFuture.completeExceptionally(new FluidClientException( firstFluidError.getErrorMessage(), firstFluidError.getErrorCode())); } } }
java
{ "resource": "" }
q179219
AGenericListMessageHandler.getEchoMessagesFromReturnValue
test
private List<String> getEchoMessagesFromReturnValue() { List<String> returnListing = new ArrayList(); if(this.returnValue == null) { return returnListing; } Iterator<T> iterForReturnVal = this.returnValue.iterator(); //Only add where the ECHO message is set... while(iterForReturnVal.hasNext()) { T returnVal = iterForReturnVal.next(); if(returnVal.getEcho() == null) { continue; } returnListing.add(returnVal.getEcho()); } return returnListing; }
java
{ "resource": "" }
q179220
PersonalInventoryClient.getPersonalInventoryItems
test
public List<FluidItem> getPersonalInventoryItems() { User loggedInUser = new User(); if(this.serviceTicket != null) { loggedInUser.setServiceTicket(this.serviceTicket); } try { return new FluidItemListing(this.postJson( loggedInUser, WS.Path.PersonalInventory.Version1.getAllByLoggedInUser())).getListing(); } //rethrow as a Fluid Client exception. catch (JSONException jsonExcept) { throw new FluidClientException(jsonExcept.getMessage(), FluidClientException.ErrorCode.JSON_PARSING); } }
java
{ "resource": "" }
q179221
FormContainerClient.createTableRecord
test
public TableRecord createTableRecord(TableRecord tableRecordParam) { if(tableRecordParam != null && this.serviceTicket != null) { tableRecordParam.setServiceTicket(this.serviceTicket); } return new TableRecord(this.putJson( tableRecordParam, WS.Path.FormContainerTableRecord.Version1.formContainerTableRecordCreate())); }
java
{ "resource": "" }
q179222
FormContainerClient.deleteFormContainer
test
public Form deleteFormContainer(Form formContainerParam) { if(formContainerParam != null && this.serviceTicket != null) { formContainerParam.setServiceTicket(this.serviceTicket); } return new Form(this.postJson(formContainerParam, WS.Path.FormContainer.Version1.formContainerDelete())); }
java
{ "resource": "" }
q179223
FormContainerClient.getFormFlowHistoricData
test
public List<FormFlowHistoricData> getFormFlowHistoricData(Form formParam) { if(formParam != null && this.serviceTicket != null) { formParam.setServiceTicket(this.serviceTicket); } return new FormFlowHistoricDataListing(this.postJson( formParam, WS.Path.FlowItemHistory.Version1.getByFormContainer())).getListing(); }
java
{ "resource": "" }
q179224
FormContainerClient.getFormAndFieldHistoricData
test
public List<FormHistoricData> getFormAndFieldHistoricData( Form formParam, boolean includeCurrentParam ) { if(formParam != null && this.serviceTicket != null) { formParam.setServiceTicket(this.serviceTicket); } return new FormHistoricDataListing(this.postJson( formParam, WS.Path.FormHistory.Version1.getByFormContainer( includeCurrentParam))).getListing(); }
java
{ "resource": "" }
q179225
FormContainerClient.getMostRecentFormAndFieldHistoricData
test
public FormHistoricData getMostRecentFormAndFieldHistoricData(Form formParam) { if(formParam != null && this.serviceTicket != null) { formParam.setServiceTicket(this.serviceTicket); } return new FormHistoricData(this.postJson( formParam, WS.Path.FormHistory.Version1.getByMostRecentByFormContainer())); }
java
{ "resource": "" }
q179226
FormContainerClient.lockFormContainer
test
public Form lockFormContainer( Form formParam, JobView jobViewParam ) { return this.lockFormContainer( formParam, jobViewParam, null); }
java
{ "resource": "" }
q179227
FormContainerClient.unLockFormContainer
test
public Form unLockFormContainer( Form formParam, boolean unlockAsyncParam) { return this.unLockFormContainer( formParam, null, unlockAsyncParam, false); }
java
{ "resource": "" }
q179228
FormContainerClient.unLockFormContainer
test
public Form unLockFormContainer( Form formParam, User userToUnLockAsParam, boolean unlockAsyncParam, boolean removeFromPersonalInventoryParam) { if(this.serviceTicket != null && formParam != null) { formParam.setServiceTicket(this.serviceTicket); } Long unLockAsUserId = (userToUnLockAsParam == null) ? null : userToUnLockAsParam.getId(); try { return new Form(this.postJson( formParam, WS.Path.FormContainer.Version1.unLockFormContainer( unLockAsUserId, unlockAsyncParam, removeFromPersonalInventoryParam))); } //rethrow as a Fluid Client exception. catch (JSONException jsonExcept) { throw new FluidClientException(jsonExcept.getMessage(), FluidClientException.ErrorCode.JSON_PARSING); } }
java
{ "resource": "" }
q179229
SQLFormUtil.mapFormContainerTo
test
private Form mapFormContainerTo( Map<Long,String> definitionAndTitleParam, ResultSet resultSetParam ) throws SQLException { Long formId = resultSetParam.getLong(SQLColumnIndex._01_FORM_ID); String formType = definitionAndTitleParam.get( resultSetParam.getLong(SQLColumnIndex._02_FORM_TYPE)); String title = resultSetParam.getString(SQLColumnIndex._03_TITLE); Date created = resultSetParam.getDate(SQLColumnIndex._04_CREATED); Date lastUpdated = resultSetParam.getDate(SQLColumnIndex._05_LAST_UPDATED); Long currentUserId = resultSetParam.getLong(SQLColumnIndex._06_CURRENT_USER_ID); if(formType == null) { throw new SQLException("No mapping found for Form Type '"+ resultSetParam.getLong(SQLColumnIndex._02_FORM_TYPE)+"'."); } Form toAdd = new Form(formType); toAdd.setId(formId); toAdd.setTitle(title); //Created... if(created != null) { toAdd.setDateCreated(new Date(created.getTime())); } //Last Updated... if(lastUpdated != null) { toAdd.setDateLastUpdated(new Date(lastUpdated.getTime())); } //Current User... if(currentUserId != null && currentUserId.longValue() > 0) { User currentUser = new User(); currentUser.setId(currentUserId); toAdd.setCurrentUser(currentUser); } return toAdd; }
java
{ "resource": "" }
q179230
Role.convertToObjects
test
@XmlTransient public static List<Role> convertToObjects(String roleListingParam) { if(roleListingParam == null || roleListingParam.trim().isEmpty()) { return null; } String[] listOfRoles = roleListingParam.split(UtilGlobal.REG_EX_COMMA); List<Role> returnVal = new ArrayList<>(); for(String roleName : listOfRoles) { Role roleToAdd = new Role(); roleToAdd.setName(roleName.trim()); returnVal.add(roleToAdd); } return returnVal; }
java
{ "resource": "" }
q179231
FormDefinitionClient.createFormDefinition
test
public Form createFormDefinition(Form formDefinitionParam) { if(formDefinitionParam != null && this.serviceTicket != null) { formDefinitionParam.setServiceTicket(this.serviceTicket); } return new Form(this.putJson( formDefinitionParam, WS.Path.FormDefinition.Version1.formDefinitionCreate())); }
java
{ "resource": "" }
q179232
FormDefinitionClient.updateFormDefinition
test
public Form updateFormDefinition(Form formDefinitionParam) { if(formDefinitionParam != null && this.serviceTicket != null) { formDefinitionParam.setServiceTicket(this.serviceTicket); } return new Form(this.postJson( formDefinitionParam, WS.Path.FormDefinition.Version1.formDefinitionUpdate())); }
java
{ "resource": "" }
q179233
FormDefinitionClient.getFormDefinitionById
test
public Form getFormDefinitionById(Long formDefinitionIdParam) { Form form = new Form(formDefinitionIdParam); if(this.serviceTicket != null) { form.setServiceTicket(this.serviceTicket); } return new Form(this.postJson( form, WS.Path.FormDefinition.Version1.getById())); }
java
{ "resource": "" }
q179234
FormDefinitionClient.getFormDefinitionByName
test
public Form getFormDefinitionByName(String formDefinitionNameParam) { Form form = new Form(formDefinitionNameParam); if(this.serviceTicket != null) { form.setServiceTicket(this.serviceTicket); } return new Form(this.postJson( form, WS.Path.FormDefinition.Version1.getByName())); }
java
{ "resource": "" }
q179235
FormDefinitionClient.getAllByLoggedInUser
test
public List<Form> getAllByLoggedInUser(boolean includeTableRecordTypesParam) { Form form = new Form(); if(this.serviceTicket != null) { form.setServiceTicket(this.serviceTicket); } if(includeTableRecordTypesParam) { return new FormListing(this.postJson( form, WS.Path.FormDefinition.Version1.getAllByLoggedInUserIncludeTableTypes())).getListing(); } else { return new FormListing(this.postJson( form, WS.Path.FormDefinition.Version1.getAllByLoggedInUser())).getListing(); } }
java
{ "resource": "" }
q179236
FormDefinitionClient.deleteFormDefinition
test
public Form deleteFormDefinition(Form formDefinitionParam) { if(formDefinitionParam != null && this.serviceTicket != null) { formDefinitionParam.setServiceTicket(this.serviceTicket); } return new Form(this.postJson(formDefinitionParam, WS.Path.FormDefinition.Version1.formDefinitionDelete())); }
java
{ "resource": "" }
q179237
CacheUtil.getStorageKeyFrom
test
private String getStorageKeyFrom( Long formDefIdParam, Long formContIdParam, Long formFieldIdParam) { StringBuilder stringBuff = new StringBuilder(); //Form Definition... if(formDefIdParam == null) { stringBuff.append(NULL); } else { stringBuff.append(formDefIdParam.toString()); } stringBuff.append(DASH); //Form Container... if(formContIdParam == null) { stringBuff.append(NULL); } else { stringBuff.append(formContIdParam.toString()); } stringBuff.append(DASH); //Form Field... if(formFieldIdParam == null) { stringBuff.append(NULL); } else { stringBuff.append(formFieldIdParam.toString()); } return stringBuff.toString(); }
java
{ "resource": "" }
q179238
CacheUtil.initXMemcachedClient
test
private MemcachedClient initXMemcachedClient() { if(this.memcachedClient != null && !this.memcachedClient.isShutdown()) { return this.memcachedClient; } try{ this.memcachedClient = new XMemcachedClient( this.cacheHost,this.cachePort); return this.memcachedClient; } //Unable to create client with connection. catch (IOException e) { throw new FluidCacheException( "Unable to create MemCache client. "+e.getMessage(), e); } }
java
{ "resource": "" }
q179239
CacheUtil.shutdown
test
public void shutdown() { if(this.memcachedClient != null && !this.memcachedClient.isShutdown()) { try { this.memcachedClient.shutdown(); } // catch (IOException eParam) { throw new FluidCacheException( "Unable to create shutdown MemCache client. "+eParam.getMessage(), eParam); } } }
java
{ "resource": "" }
q179240
ABaseUtil.toLongSafe
test
protected long toLongSafe(String toParseParam) { if (toParseParam == null || toParseParam.trim().isEmpty()) { return -1; } try { return Long.parseLong(toParseParam.trim()); } catch (NumberFormatException e) { return -1; } }
java
{ "resource": "" }
q179241
DocumentToPDFConvert.convertDocumentToPDF
test
public File convertDocumentToPDF(File inputDocumentParam) { if(inputDocumentParam == null || !inputDocumentParam.exists()) { throw new UtilException( "Input document to convert not provided or does not exist.", UtilException.ErrorCode.COMMAND); } if(!inputDocumentParam.isFile()) { throw new UtilException( "Input document '' is not a file.", UtilException.ErrorCode.COMMAND); } File parentFolder = inputDocumentParam.getParentFile(); String inputFilenameWithoutExt = inputDocumentParam.getName(); int indexOfDot = -1; if((indexOfDot = inputFilenameWithoutExt.indexOf('.')) > -1) { inputFilenameWithoutExt = inputFilenameWithoutExt.substring(0,indexOfDot); } File generatedPdfFileOut = new File(parentFolder.getAbsolutePath().concat( File.separator).concat(inputFilenameWithoutExt).concat(".pdf")); String completeOutputPath = generatedPdfFileOut.getAbsolutePath(); try { CommandUtil.CommandResult commandResult = this.commandUtil.executeCommand( CommandUtil.FLUID_CLI, COMMAND_CONVERT_DOC_TO_PDF, "-i", inputDocumentParam.getAbsolutePath(), "-o", completeOutputPath); //There is a problem... if(commandResult.getExitCode() != 0) { throw new UtilException( "Unable to convert '"+ inputDocumentParam.getName()+ "' to PDF. "+ commandResult.toString(), UtilException.ErrorCode.COMMAND); } File returnVal = new File(completeOutputPath); if(!returnVal.exists()) { throw new UtilException( "Command executed, but no output file. Expected PDF at '"+ completeOutputPath+"'.", UtilException.ErrorCode.GENERAL); } return returnVal; } // catch (IOException eParam) { throw new UtilException( "Problem executing command. "+eParam.getMessage(), eParam,UtilException.ErrorCode.GENERAL); } }
java
{ "resource": "" }
q179242
SQLUtilWebSocketRESTWrapper.getFieldValuesForFormFromCache
test
private List<Field> getFieldValuesForFormFromCache( Long formIdParam, List<FormFieldListing> listingReturnFieldValsPopulatedParam, Form[] formsToFetchForLocalCacheArrParam){ if(formIdParam == null || formIdParam.longValue() < 1) { return null; } if(listingReturnFieldValsPopulatedParam == null || listingReturnFieldValsPopulatedParam.isEmpty()) { return null; } if(formsToFetchForLocalCacheArrParam == null || formsToFetchForLocalCacheArrParam.length == 0) { return null; } for(Form formIter : formsToFetchForLocalCacheArrParam) { //Form is a match... if(formIdParam.equals(formIter.getId())) { String echoToUse = formIter.getEcho(); for(FormFieldListing fieldListing : listingReturnFieldValsPopulatedParam) { if(echoToUse.equals(fieldListing.getEcho())) { return fieldListing.getListing(); } } } } return null; }
java
{ "resource": "" }
q179243
FlowStepRuleClient.createFlowStepEntryRule
test
public FlowStepRule createFlowStepEntryRule(FlowStepRule flowStepRuleParam) { if(flowStepRuleParam != null && this.serviceTicket != null) { flowStepRuleParam.setServiceTicket(this.serviceTicket); } return new FlowStepRule(this.putJson( flowStepRuleParam, WS.Path.FlowStepRule.Version1.flowStepRuleEntryCreate())); }
java
{ "resource": "" }
q179244
FlowStepRuleClient.createFlowStepExitRule
test
public FlowStepRule createFlowStepExitRule(FlowStepRule flowStepRuleParam) { if(flowStepRuleParam != null && this.serviceTicket != null) { flowStepRuleParam.setServiceTicket(this.serviceTicket); } return new FlowStepRule(this.putJson( flowStepRuleParam, WS.Path.FlowStepRule.Version1.flowStepRuleExitCreate())); }
java
{ "resource": "" }
q179245
FlowStepRuleClient.createFlowStepViewRule
test
public FlowStepRule createFlowStepViewRule(FlowStepRule flowStepRuleParam) { if(flowStepRuleParam != null && this.serviceTicket != null) { flowStepRuleParam.setServiceTicket(this.serviceTicket); } return new FlowStepRule(this.putJson( flowStepRuleParam, WS.Path.FlowStepRule.Version1.flowStepRuleViewCreate())); }
java
{ "resource": "" }
q179246
FlowStepRuleClient.updateFlowStepEntryRule
test
public FlowStepRule updateFlowStepEntryRule(FlowStepRule flowStepRuleParam) { if(flowStepRuleParam != null && this.serviceTicket != null) { flowStepRuleParam.setServiceTicket(this.serviceTicket); } return new FlowStepRule(this.postJson( flowStepRuleParam, WS.Path.FlowStepRule.Version1.flowStepRuleUpdateEntry())); }
java
{ "resource": "" }
q179247
FlowStepRuleClient.updateFlowStepExitRule
test
public FlowStepRule updateFlowStepExitRule(FlowStepRule flowStepRuleParam) { if(flowStepRuleParam != null && this.serviceTicket != null) { flowStepRuleParam.setServiceTicket(this.serviceTicket); } return new FlowStepRule(this.postJson( flowStepRuleParam, WS.Path.FlowStepRule.Version1.flowStepRuleUpdateExit())); }
java
{ "resource": "" }
q179248
FlowStepRuleClient.updateFlowStepViewRule
test
public FlowStepRule updateFlowStepViewRule(FlowStepRule flowStepRuleParam) { if(flowStepRuleParam != null && this.serviceTicket != null) { flowStepRuleParam.setServiceTicket(this.serviceTicket); } return new FlowStepRule(this.postJson( flowStepRuleParam, WS.Path.FlowStepRule.Version1.flowStepRuleUpdateView())); }
java
{ "resource": "" }
q179249
FlowStepRuleClient.moveFlowStepEntryRuleUp
test
public FlowStepRule moveFlowStepEntryRuleUp(FlowStepRule flowStepRuleParam) { if(flowStepRuleParam != null && this.serviceTicket != null) { flowStepRuleParam.setServiceTicket(this.serviceTicket); } return new FlowStepRule(this.postJson( flowStepRuleParam, WS.Path.FlowStepRule.Version1.flowStepRuleMoveEntryUp())); }
java
{ "resource": "" }
q179250
FlowStepRuleClient.moveFlowStepEntryRuleDown
test
public FlowStepRule moveFlowStepEntryRuleDown(FlowStepRule flowStepRuleParam) { if(flowStepRuleParam != null && this.serviceTicket != null) { flowStepRuleParam.setServiceTicket(this.serviceTicket); } return new FlowStepRule(this.postJson( flowStepRuleParam, WS.Path.FlowStepRule.Version1.flowStepRuleMoveEntryDown())); }
java
{ "resource": "" }
q179251
FlowStepRuleClient.deleteFlowStepEntryRule
test
public FlowStepRule deleteFlowStepEntryRule(FlowStepRule flowStepRuleParam) { if(flowStepRuleParam != null && this.serviceTicket != null) { flowStepRuleParam.setServiceTicket(this.serviceTicket); } return new FlowStepRule(this.postJson( flowStepRuleParam, WS.Path.FlowStepRule.Version1.flowStepRuleDeleteEntry())); }
java
{ "resource": "" }
q179252
FlowStepRuleClient.deleteFlowStepExitRule
test
public FlowStep deleteFlowStepExitRule(FlowStepRule flowStepRuleParam) { if(flowStepRuleParam != null && this.serviceTicket != null) { flowStepRuleParam.setServiceTicket(this.serviceTicket); } return new FlowStep(this.postJson( flowStepRuleParam, WS.Path.FlowStepRule.Version1.flowStepRuleDeleteExit())); }
java
{ "resource": "" }
q179253
FlowStepRuleClient.deleteFlowStepViewRule
test
public FlowStep deleteFlowStepViewRule(FlowStepRule flowStepRuleParam) { if(flowStepRuleParam != null && this.serviceTicket != null) { flowStepRuleParam.setServiceTicket(this.serviceTicket); } return new FlowStep(this.postJson( flowStepRuleParam, WS.Path.FlowStepRule.Version1.flowStepRuleDeleteView())); }
java
{ "resource": "" }
q179254
LoginClient.initializeSession
test
private AuthEncryptedData initializeSession( String passwordParam, AuthResponse authResponseParam) { //IV... byte[] ivBytes = UtilGlobal.decodeBase64( authResponseParam.getIvBase64()); //Seed... byte[] seedBytes = UtilGlobal.decodeBase64( authResponseParam.getSeedBase64()); //Encrypted Data... byte[] encryptedData = UtilGlobal.decodeBase64( authResponseParam.getEncryptedDataBase64()); //HMac from Response... byte[] hMacFromResponse = UtilGlobal.decodeBase64( authResponseParam.getEncryptedDataHmacBase64()); //Local HMac... byte[] localGeneratedHMac = AES256Local.generateLocalHMAC( encryptedData, passwordParam, authResponseParam.getSalt(), seedBytes); //Password mismatch... if (!Arrays.equals(hMacFromResponse, localGeneratedHMac)) { throw new FluidClientException( "Login attempt failure.", FluidClientException.ErrorCode.LOGIN_FAILURE); } //Decrypted Initialization Data... byte[] decryptedEncryptedData = AES256Local.decryptInitPacket(encryptedData, passwordParam, authResponseParam.getSalt(), ivBytes, seedBytes); try { JSONObject jsonObj = new JSONObject(new String(decryptedEncryptedData)); return new AuthEncryptedData(jsonObj); } catch (JSONException jsonExcept) { throw new FluidClientException(jsonExcept.getMessage(), FluidClientException.ErrorCode.JSON_PARSING); } }
java
{ "resource": "" }
q179255
UserQueryClient.getAllUserQueries
test
public UserQueryListing getAllUserQueries() { UserQuery userQueryToGetInfoFor = new UserQuery(); if(this.serviceTicket != null) { userQueryToGetInfoFor.setServiceTicket(this.serviceTicket); } try { return new UserQueryListing(this.postJson( userQueryToGetInfoFor, WS.Path.UserQuery.Version1.getAllUserQueries())); } // catch (JSONException jsonExcept) { throw new FluidClientException(jsonExcept.getMessage(), FluidClientException.ErrorCode.JSON_PARSING); } }
java
{ "resource": "" }
q179256
RoleClient.getAllRoles
test
public RoleListing getAllRoles() { RoleListing roleToGetInfoFor = new RoleListing(); if(this.serviceTicket != null) { roleToGetInfoFor.setServiceTicket(this.serviceTicket); } try { return new RoleListing(this.postJson( roleToGetInfoFor, WS.Path.Role.Version1.getAllRoles())); } // catch (JSONException jsonExcept) { throw new FluidClientException(jsonExcept.getMessage(), FluidClientException.ErrorCode.JSON_PARSING); } }
java
{ "resource": "" }
q179257
ABaseFluidVO.getServiceTicketAsHexUpper
test
public String getServiceTicketAsHexUpper() { String serviceTicket = this.getServiceTicket(); if(serviceTicket == null) { return null; } if(serviceTicket.isEmpty()) { return serviceTicket; } byte[] base64Bytes = Base64.getDecoder().decode(serviceTicket); return this.bytesToHex(base64Bytes); }
java
{ "resource": "" }
q179258
FormFieldClient.createFieldTextMasked
test
public Field createFieldTextMasked( Field formFieldParam, String maskValueParam) { if(formFieldParam != null && this.serviceTicket != null) { formFieldParam.setServiceTicket(this.serviceTicket); } if(maskValueParam == null || maskValueParam.trim().isEmpty()) { maskValueParam = ""; } if(formFieldParam != null) { formFieldParam.setTypeAsEnum(Field.Type.Text); formFieldParam.setTypeMetaData(FieldMetaData.Text.MASKED.concat(maskValueParam)); } return new Field(this.putJson( formFieldParam, WS.Path.FormField.Version1.formFieldCreate())); }
java
{ "resource": "" }
q179259
FormFieldClient.createFieldTextBarcode
test
public Field createFieldTextBarcode( Field formFieldParam, String barcodeTypeParam) { if(formFieldParam != null && this.serviceTicket != null) { formFieldParam.setServiceTicket(this.serviceTicket); } if(barcodeTypeParam == null || barcodeTypeParam.trim().isEmpty()) { throw new FluidClientException( "Barcode type cannot be empty.", FluidClientException.ErrorCode.FIELD_VALIDATE); } if(formFieldParam != null) { formFieldParam.setTypeAsEnum(Field.Type.Text); formFieldParam.setTypeMetaData(FieldMetaData.Text.BARCODE.concat(barcodeTypeParam)); } return new Field(this.putJson( formFieldParam, WS.Path.FormField.Version1.formFieldCreate())); }
java
{ "resource": "" }
q179260
FormFieldClient.createFieldDecimalSpinner
test
public Field createFieldDecimalSpinner( Field formFieldParam, double minParam, double maxParam, double stepFactorParam, String prefixParam) { if(formFieldParam != null && this.serviceTicket != null) { formFieldParam.setServiceTicket(this.serviceTicket); } if(formFieldParam != null) { formFieldParam.setTypeAsEnum(Field.Type.Decimal); formFieldParam.setTypeMetaData( this.getMetaDataForDecimalAs( FieldMetaData.Decimal.SPINNER, minParam,maxParam, stepFactorParam, prefixParam)); } return new Field(this.putJson( formFieldParam, WS.Path.FormField.Version1.formFieldCreate())); }
java
{ "resource": "" }
q179261
FormFieldClient.createFieldDecimalSlider
test
public Field createFieldDecimalSlider( Field formFieldParam, double minParam, double maxParam, double stepFactorParam) { if(formFieldParam != null && this.serviceTicket != null) { formFieldParam.setServiceTicket(this.serviceTicket); } if(formFieldParam != null) { formFieldParam.setTypeAsEnum(Field.Type.Decimal); formFieldParam.setTypeMetaData( this.getMetaDataForDecimalAs( FieldMetaData.Decimal.SLIDER, minParam,maxParam, stepFactorParam, null)); } return new Field(this.putJson( formFieldParam, WS.Path.FormField.Version1.formFieldCreate())); }
java
{ "resource": "" }
q179262
FormFieldClient.createFieldTable
test
public Field createFieldTable( Field formFieldParam, Form formDefinitionParam, boolean sumDecimalsParam) { if(formFieldParam != null && this.serviceTicket != null) { formFieldParam.setServiceTicket(this.serviceTicket); } if(formFieldParam != null) { formFieldParam.setTypeAsEnum(Field.Type.Table); formFieldParam.setTypeMetaData( this.getMetaDataForTableField( formDefinitionParam, sumDecimalsParam)); } return new Field(this.putJson( formFieldParam, WS.Path.FormField.Version1.formFieldCreate())); }
java
{ "resource": "" }
q179263
FormFieldClient.updateFieldTextMasked
test
public Field updateFieldTextMasked(Field formFieldParam, String maskValueParam) { if(formFieldParam != null && this.serviceTicket != null) { formFieldParam.setServiceTicket(this.serviceTicket); } if(maskValueParam == null || maskValueParam.trim().isEmpty()) { throw new FluidClientException( "Masked value cannot be empty.", FluidClientException.ErrorCode.FIELD_VALIDATE); } if(formFieldParam != null) { formFieldParam.setTypeAsEnum(Field.Type.Text); formFieldParam.setTypeMetaData(FieldMetaData.Text.MASKED.concat(maskValueParam)); } return new Field(this.postJson( formFieldParam, WS.Path.FormField.Version1.formFieldUpdate())); }
java
{ "resource": "" }
q179264
FormFieldClient.updateFieldTextBarcode
test
public Field updateFieldTextBarcode(Field formFieldParam, String barcodeTypeParam) { if(formFieldParam != null && this.serviceTicket != null) { formFieldParam.setServiceTicket(this.serviceTicket); } if(barcodeTypeParam == null || barcodeTypeParam.trim().isEmpty()) { throw new FluidClientException( "Barcode type cannot be empty.", FluidClientException.ErrorCode.FIELD_VALIDATE); } if(formFieldParam != null) { formFieldParam.setTypeAsEnum(Field.Type.Text); formFieldParam.setTypeMetaData(FieldMetaData.Text.BARCODE.concat(barcodeTypeParam)); } return new Field(this.postJson( formFieldParam, WS.Path.FormField.Version1.formFieldUpdate())); }
java
{ "resource": "" }
q179265
FormFieldClient.updateFieldDecimalSpinner
test
public Field updateFieldDecimalSpinner( Field formFieldParam, double minParam, double maxParam, double stepFactorParam, String prefixParam) { if(formFieldParam != null && this.serviceTicket != null) { formFieldParam.setServiceTicket(this.serviceTicket); } if(formFieldParam != null) { formFieldParam.setTypeAsEnum(Field.Type.Decimal); formFieldParam.setTypeMetaData( this.getMetaDataForDecimalAs( FieldMetaData.Decimal.SPINNER, minParam,maxParam, stepFactorParam, prefixParam)); } return new Field(this.postJson( formFieldParam, WS.Path.FormField.Version1.formFieldUpdate())); }
java
{ "resource": "" }
q179266
FormFieldClient.updateFieldDecimalSlider
test
public Field updateFieldDecimalSlider( Field formFieldParam, double minParam, double maxParam, double stepFactorParam) { if(formFieldParam != null && this.serviceTicket != null) { formFieldParam.setServiceTicket(this.serviceTicket); } if(formFieldParam != null) { formFieldParam.setTypeAsEnum(Field.Type.Decimal); formFieldParam.setTypeMetaData( this.getMetaDataForDecimalAs( FieldMetaData.Decimal.SLIDER, minParam,maxParam, stepFactorParam, null)); } return new Field(this.postJson( formFieldParam, WS.Path.FormField.Version1.formFieldUpdate())); }
java
{ "resource": "" }
q179267
FormFieldClient.updateFieldTable
test
public Field updateFieldTable( Field formFieldParam, Form formDefinitionParam, boolean sumDecimalsParam) { if(formFieldParam != null && this.serviceTicket != null) { formFieldParam.setServiceTicket(this.serviceTicket); } if(formFieldParam != null) { formFieldParam.setTypeAsEnum(Field.Type.Table); formFieldParam.setTypeMetaData( this.getMetaDataForTableField( formDefinitionParam, sumDecimalsParam)); } return new Field(this.postJson( formFieldParam, WS.Path.FormField.Version1.formFieldUpdate())); }
java
{ "resource": "" }
q179268
FormFieldClient.getFieldByName
test
public Field getFieldByName(String fieldNameParam) { Field field = new Field(); field.setFieldName(fieldNameParam); if(this.serviceTicket != null) { field.setServiceTicket(this.serviceTicket); } return new Field(this.postJson( field, WS.Path.FormField.Version1.getByName())); }
java
{ "resource": "" }
q179269
FormFieldClient.getFieldsByFormNameAndLoggedInUser
test
public FormFieldListing getFieldsByFormNameAndLoggedInUser( String formNameParam, boolean editOnlyFieldsParam) { Form form = new Form(); form.setFormType(formNameParam); if(this.serviceTicket != null) { form.setServiceTicket(this.serviceTicket); } return new FormFieldListing(this.postJson( form, WS.Path.FormField.Version1.getByFormDefinitionAndLoggedInUser( editOnlyFieldsParam))); }
java
{ "resource": "" }
q179270
FormFieldClient.getFieldsByFormTypeIdAndLoggedInUser
test
public FormFieldListing getFieldsByFormTypeIdAndLoggedInUser( Long formTypeIdParam, boolean editOnlyFieldsParam) { Form form = new Form(); form.setFormTypeId(formTypeIdParam); if(this.serviceTicket != null) { form.setServiceTicket(this.serviceTicket); } return new FormFieldListing(this.postJson( form, WS.Path.FormField.Version1.getByFormDefinitionAndLoggedInUser( editOnlyFieldsParam))); }
java
{ "resource": "" }
q179271
FormFieldClient.deleteField
test
public Field deleteField(Field fieldParam) { if(fieldParam != null && this.serviceTicket != null) { fieldParam.setServiceTicket(this.serviceTicket); } return new Field(this.postJson(fieldParam, WS.Path.FormField.Version1.formFieldDelete())); }
java
{ "resource": "" }
q179272
FormFieldClient.forceDeleteField
test
public Field forceDeleteField(Field fieldParam) { if(fieldParam != null && this.serviceTicket != null) { fieldParam.setServiceTicket(this.serviceTicket); } return new Field(this.postJson( fieldParam, WS.Path.FormField.Version1.formFieldDelete(true))); }
java
{ "resource": "" }
q179273
FormFieldClient.getMetaDataForTableField
test
private String getMetaDataForTableField( Form formDefinitionParam, boolean sumDecimalsParam) { StringBuilder returnBuffer = new StringBuilder(); Long definitionId = (formDefinitionParam == null) ? -1L: formDefinitionParam.getId(); //Min... returnBuffer.append(definitionId); returnBuffer.append(FieldMetaData.TableField.UNDERSCORE); returnBuffer.append(FieldMetaData.TableField.SUM_DECIMALS); returnBuffer.append(FieldMetaData.Decimal.SQ_OPEN); returnBuffer.append(sumDecimalsParam); returnBuffer.append(FieldMetaData.Decimal.SQ_CLOSE); return returnBuffer.toString(); }
java
{ "resource": "" }
q179274
UserFieldClient.updateFieldValue
test
public Field updateFieldValue(Field userFieldValueParam) { if(userFieldValueParam != null && this.serviceTicket != null) { userFieldValueParam.setServiceTicket(this.serviceTicket); } return new Field(this.postJson( userFieldValueParam, WS.Path.UserField.Version1.userFieldUpdateValue())); }
java
{ "resource": "" }
q179275
ESFormFieldMappingUtil.getOrCreateIndex
test
public GetIndexResponse getOrCreateIndex(String indexParam) { if(this.doesIndexExist(indexParam)) { return this.client.admin().indices().prepareGetIndex().get(); } else { CreateIndexRequestBuilder createIndexRequestBuilder = this.client.admin().indices().prepareCreate(indexParam); CreateIndexResponse mappingCreateResponse = createIndexRequestBuilder.execute().actionGet(); if(!mappingCreateResponse.isAcknowledged()) { throw new FluidElasticSearchException( "Index Creation for '"+ indexParam+"' not acknowledged by ElasticSearch."); } return this.client.admin().indices().prepareGetIndex().get(); } }
java
{ "resource": "" }
q179276
FlowClient.createFlow
test
public Flow createFlow(Flow flowParam) { if(flowParam != null && this.serviceTicket != null) { flowParam.setServiceTicket(this.serviceTicket); } return new Flow(this.putJson( flowParam, WS.Path.Flow.Version1.flowCreate())); }
java
{ "resource": "" }
q179277
FlowClient.updateFlow
test
public Flow updateFlow(Flow flowParam) { if(flowParam != null && this.serviceTicket != null) { flowParam.setServiceTicket(this.serviceTicket); } return new Flow(this.postJson( flowParam, WS.Path.Flow.Version1.flowUpdate())); }
java
{ "resource": "" }
q179278
FlowClient.getFlowById
test
public Flow getFlowById(Long flowIdParam) { Flow flow = new Flow(flowIdParam); if(this.serviceTicket != null) { flow.setServiceTicket(this.serviceTicket); } return new Flow(this.postJson( flow, WS.Path.Flow.Version1.getById())); }
java
{ "resource": "" }
q179279
FlowClient.getFlowByName
test
public Flow getFlowByName(String flowNameParam) { Flow flow = new Flow(); flow.setName(flowNameParam); if(this.serviceTicket != null) { flow.setServiceTicket(this.serviceTicket); } return new Flow(this.postJson( flow, WS.Path.Flow.Version1.getByName())); }
java
{ "resource": "" }
q179280
FlowClient.deleteFlow
test
public Flow deleteFlow(Flow flowParam) { if(flowParam != null && this.serviceTicket != null) { flowParam.setServiceTicket(this.serviceTicket); } return new Flow(this.postJson(flowParam, WS.Path.Flow.Version1.flowDelete())); }
java
{ "resource": "" }
q179281
FlowClient.forceDeleteFlow
test
public Flow forceDeleteFlow(Flow flowParam) { if(flowParam != null && this.serviceTicket != null) { flowParam.setServiceTicket(this.serviceTicket); } return new Flow(this.postJson(flowParam, WS.Path.Flow.Version1.flowDelete(true))); }
java
{ "resource": "" }
q179282
GlobalFieldClient.updateFieldValue
test
public Field updateFieldValue(Field globalFieldValueParam) { if(globalFieldValueParam != null && this.serviceTicket != null) { globalFieldValueParam.setServiceTicket(this.serviceTicket); } return new Field(this.postJson( globalFieldValueParam, Version1.globalFieldUpdateValue())); }
java
{ "resource": "" }
q179283
GlobalFieldClient.getAllGlobalFieldValues
test
public List<Field> getAllGlobalFieldValues() { Field field = new Field(); //Set for Payara server... field.setFieldValue(new MultiChoice()); if(this.serviceTicket != null) { field.setServiceTicket(this.serviceTicket); } return new GlobalFieldListing(this.postJson( field, Version1.getAllValues())).getListing(); }
java
{ "resource": "" }
q179284
SQLFormDefinitionUtil.getFormDefinitionIdAndTitle
test
public Map<Long,String> getFormDefinitionIdAndTitle() { //When already cached, use the cached value... if(!LOCAL_MAPPING.isEmpty()) { Map<Long,String> returnVal = new HashMap<>(LOCAL_MAPPING); //The id's are outdated... if(System.currentTimeMillis() > timeToUpdateAgain){ synchronized (LOCAL_MAPPING) { LOCAL_MAPPING.clear(); } } return returnVal; } //Only allow one thread to set the local mapping... synchronized (LOCAL_MAPPING) { if(!LOCAL_MAPPING.isEmpty()) { return new HashMap<>(LOCAL_MAPPING); } PreparedStatement preparedStatement = null; ResultSet resultSet = null; try { ISyntax syntax = SyntaxFactory.getInstance().getSyntaxFor( this.getSQLTypeFromConnection(), ISyntax.ProcedureMapping.FormDefinition.GetFormDefinitions); preparedStatement = this.getConnection().prepareStatement( syntax.getPreparedStatement()); resultSet = preparedStatement.executeQuery(); //Iterate each of the form containers... while (resultSet.next()) { Long id = resultSet.getLong(1); String title = resultSet.getString(2); LOCAL_MAPPING.put(id,title); } //Update in 10 mins... timeToUpdateAgain = (System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(10)); } // catch (SQLException sqlError) { throw new FluidSQLException(sqlError); } // finally { this.closeStatement(preparedStatement,resultSet); } return new HashMap<>(LOCAL_MAPPING); } }
java
{ "resource": "" }
q179285
AES256Local.decryptInitPacket
test
public static byte[] decryptInitPacket( byte[] encryptedDataParam, String passwordParam, String saltParam, byte[] ivParam, byte[] seedParam){ //Stored like this in the database, so we have to get the password as stored in the database so that the // SHa256 and SALT combination will be valid... byte[] passwordSha256 = sha256(passwordParam.concat(saltParam).getBytes()); //Add the seed to the password and SHA-256... byte[] derivedKey = sha256(UtilGlobal.addAll(passwordSha256, seedParam)); //Decrypt with the derived key. return decrypt(derivedKey, encryptedDataParam, ivParam); }
java
{ "resource": "" }
q179286
ABaseClientWebSocket.closeAndClean
test
@Override public void closeAndClean() { CloseConnectionRunnable closeConnectionRunnable = new CloseConnectionRunnable(this); Thread closeConnThread = new Thread( closeConnectionRunnable,"Close ABaseClientWebSocket Connection"); closeConnThread.start(); }
java
{ "resource": "" }
q179287
ABaseClientWebSocket.initNewRequest
test
public synchronized String initNewRequest(){ String returnVal = UUID.randomUUID().toString(); this.messageHandler.put(returnVal, this.getNewHandlerInstance()); return returnVal; }
java
{ "resource": "" }
q179288
ABaseClientWebSocket.getExceptionMessageVerbose
test
protected String getExceptionMessageVerbose( String prefixParam, String uniqueReqIdParam, int numberOfSentItemsParam ) { StringBuilder formFieldsCombined = new StringBuilder(); int returnValSize = -1; RespHandler respHandler = this.getHandler(uniqueReqIdParam); if(respHandler instanceof AGenericListMessageHandler) { List<? extends ABaseFluidJSONObject> returnValue = ((AGenericListMessageHandler)respHandler).getReturnValue(); if(returnValue != null) { returnValSize = returnValue.size(); returnValue.forEach(listingItm -> { if(listingItm instanceof ABaseListing) { ABaseListing castedToListing = (ABaseListing)listingItm; if(castedToListing != null) { castedToListing.getListing().forEach(formItm -> { formFieldsCombined.append(formItm.toString()); }); } } else { formFieldsCombined.append(listingItm.toString()); } }); } } return (prefixParam + ": " + "Timeout while waiting for all return data. There were '"+ returnValSize +"' items after a Timeout of "+( TimeUnit.MILLISECONDS.toSeconds(this.getTimeoutInMillis()))+" seconds on req-ref-nr '"+ uniqueReqIdParam+"'. Expected a total of '" + numberOfSentItemsParam + "' forms. Returned-Data '"+ formFieldsCombined.toString()+"'."); }
java
{ "resource": "" }
q179289
AdminUserCreateClient.createAdminUser
test
public User createAdminUser(String passwordParam) { User adminUserCreate = new User(); adminUserCreate.setPasswordClear(passwordParam); return new User(this.putJson( adminUserCreate, WS.Path.User.Version1.userCreateAdmin())); }
java
{ "resource": "" }
q179290
Auth0Client.getAccessToken
test
public AccessToken getAccessToken( String clientIdParam, String clientSecretParam, String codeParam, String redirectUrlParam) { if(clientIdParam == null || clientIdParam.trim().isEmpty()) { throw new FluidClientException( "Client Id must be provided.", FluidClientException.ErrorCode.FIELD_VALIDATE); } if(clientSecretParam == null || clientSecretParam.trim().isEmpty()) { throw new FluidClientException( "Client Secret must be provided.", FluidClientException.ErrorCode.FIELD_VALIDATE); } if(codeParam == null || codeParam.trim().isEmpty()) { throw new FluidClientException( "Code must be provided.", FluidClientException.ErrorCode.FIELD_VALIDATE); } AccessTokenRequest tokenRequest = new AccessTokenRequest(); tokenRequest.setClientId(clientIdParam); tokenRequest.setClientSecret(clientSecretParam); tokenRequest.setGrantType(AUTHORIZATION_CODE); tokenRequest.setCode(codeParam); tokenRequest.setRedirectUri(redirectUrlParam); return new AccessToken(this.postJson( false, tokenRequest, WS.Path.Auth0.Version1.userToken())); }
java
{ "resource": "" }
q179291
Auth0Client.getUserProfileInfo
test
public NormalizedUserProfile getUserProfileInfo(AccessToken accessTokenParam) { if(accessTokenParam == null || (accessTokenParam.getAccessToken() == null || accessTokenParam.getAccessToken().trim().isEmpty())) { throw new FluidClientException( "Code must be provided.", FluidClientException.ErrorCode.FIELD_VALIDATE); } try { String accessToken = accessTokenParam.getAccessToken(); List<HeaderNameValue> headerListing = new ArrayList<HeaderNameValue>(); headerListing.add(new HeaderNameValue( NormalizedUserProfile.HeaderMapping.AUTHORIZATION, "Bearer "+accessToken)); return new NormalizedUserProfile( this.getJson(true, WS.Path.Auth0.Version1.userInfo(),headerListing)); } // catch (UnsupportedEncodingException e) { throw new FluidClientException( "Unable to Encode (Not Supported). "+ e.getMessage(), FluidClientException.ErrorCode.ILLEGAL_STATE_ERROR); } }
java
{ "resource": "" }
q179292
ABaseClientWS.executeJson
test
protected JSONObject executeJson( HttpMethod httpMethodParam, List<HeaderNameValue> headerNameValuesParam, boolean checkConnectionValidParam, ABaseFluidJSONObject baseDomainParam, ContentType contentTypeParam, String postfixUrlParam ) { //Validate that something is set. if(baseDomainParam == null) { throw new FluidClientException("No JSON body to post.", FluidClientException.ErrorCode.FIELD_VALIDATE); } String bodyJsonString = baseDomainParam.toJsonObject().toString(); return this.executeString( httpMethodParam, headerNameValuesParam, checkConnectionValidParam, bodyJsonString, contentTypeParam, postfixUrlParam); }
java
{ "resource": "" }
q179293
ABaseClientWS.executeForm
test
protected JSONObject executeForm( HttpMethod httpMethodParam, List<HeaderNameValue> headerNameValuesParam, boolean checkConnectionValidParam, List<FormNameValue> formNameValuesParam, ContentType contentTypeParam, String postfixUrlParam ) { //Validate Form Field and values... if(formNameValuesParam == null || formNameValuesParam.isEmpty()) { throw new FluidClientException("No 'Name and Value' body to post.", FluidClientException.ErrorCode.FIELD_VALIDATE); } StringBuilder strBuilder = new StringBuilder(); for(FormNameValue nameValue : formNameValuesParam) { if(nameValue.getName() == null || nameValue.getName().trim().isEmpty()) { continue; } if(nameValue.getValue() == null) { continue; } strBuilder.append(nameValue.getName()); strBuilder.append(EQUALS); strBuilder.append(nameValue.getValue()); strBuilder.append(AMP); } String bodyJsonString = strBuilder.toString(); bodyJsonString = bodyJsonString.substring(0, bodyJsonString.length() - 1); return this.executeString( httpMethodParam, headerNameValuesParam, checkConnectionValidParam, bodyJsonString, contentTypeParam, postfixUrlParam); }
java
{ "resource": "" }
q179294
ABaseClientWS.getJsonResponseHandler
test
private ResponseHandler<String> getJsonResponseHandler(final String urlCalledParam) { // Create a custom response handler ResponseHandler<String> responseHandler = new ResponseHandler<String>() { /** * Process the {@code responseParam} and return text if valid. * * @param responseParam The HTTP response from the server. * @return Text response. * @throws IOException If there are any communication or I/O problems. */ public String handleResponse(final HttpResponse responseParam) throws IOException { int status = responseParam.getStatusLine().getStatusCode(); if (status == 404) { throw new FluidClientException( "Endpoint for Service not found. URL ["+ urlCalledParam+"].", FluidClientException.ErrorCode.CONNECT_ERROR); } else if (status >= 200 && status < 300) { HttpEntity entity = responseParam.getEntity(); String responseJsonString = (entity == null) ? null: EntityUtils.toString(entity); return responseJsonString; } else if (status == 400) { //Bad Request... Server Side Error meant for client... HttpEntity entity = responseParam.getEntity(); String responseJsonString = (entity == null) ? null : EntityUtils.toString(entity); return responseJsonString; } else { HttpEntity entity = responseParam.getEntity(); String responseString = (entity != null) ? EntityUtils.toString(entity) : null; throw new FluidClientException( "Unexpected response status: " + status+". " +responseParam.getStatusLine().getReasonPhrase()+". \nResponse Text ["+ responseString+"]", FluidClientException.ErrorCode.IO_ERROR); } } }; return responseHandler; }
java
{ "resource": "" }
q179295
ABaseClientWS.isConnectionValid
test
public boolean isConnectionValid() { //Init the session to get the salt... try { this.getJson( false, WS.Path.Test.Version1.testConnection()); } catch (FluidClientException flowJobExcept) { //Connect problem... if(flowJobExcept.getErrorCode() == FluidClientException.ErrorCode.CONNECT_ERROR) { return false; } throw flowJobExcept; } return true; }
java
{ "resource": "" }
q179296
ABaseClientWS.getClient
test
private CloseableHttpClient getClient() { if(this.closeableHttpClient != null) { return this.closeableHttpClient; } //Only accept self signed certificate if in Junit test case. String pathToFluidTrustStore = this.getPathToFluidSpecificTrustStore(); //Test mode... if(IS_IN_JUNIT_TEST_MODE || pathToFluidTrustStore != null) { SSLContextBuilder builder = new SSLContextBuilder(); try { //builder.loadTrustMaterial(null, new TrustSelfSignedStrategy()); if(pathToFluidTrustStore == null) { builder.loadTrustMaterial(new SSLTrustAll()); } else { String password = this.getFluidSpecificTrustStorePassword(); if(password == null) { password = UtilGlobal.EMPTY; } if(IS_IN_JUNIT_TEST_MODE) { builder.loadTrustMaterial( new File(pathToFluidTrustStore), password.toCharArray(), new SSLTrustAll()); } else { builder.loadTrustMaterial( new File(pathToFluidTrustStore), password.toCharArray()); } } SSLContext sslContext = builder.build(); this.closeableHttpClient = HttpClients.custom().setSSLSocketFactory( new SSLConnectionSocketFactory(sslContext)).build(); } catch (NoSuchAlgorithmException e) { //Changed for Java 1.6 compatibility... throw new FluidClientException( "NoSuchAlgorithm: Unable to load self signed trust material. "+e.getMessage(), e, FluidClientException.ErrorCode.CRYPTOGRAPHY); } catch (KeyManagementException e) { throw new FluidClientException( "KeyManagement: Unable to load self signed trust material. "+e.getMessage(), e, FluidClientException.ErrorCode.CRYPTOGRAPHY); } catch (KeyStoreException e) { throw new FluidClientException( "KeyStore: Unable to load self signed trust material. "+e.getMessage(), e, FluidClientException.ErrorCode.CRYPTOGRAPHY); } catch (CertificateException e) { throw new FluidClientException( "Certificate: Unable to load self signed trust material. "+e.getMessage(), e, FluidClientException.ErrorCode.CRYPTOGRAPHY); } catch (IOException ioError) { throw new FluidClientException( "IOError: Unable to load self signed trust material. "+ioError.getMessage(), ioError, FluidClientException.ErrorCode.CRYPTOGRAPHY); } } else { //Default HTTP Client... this.closeableHttpClient = HttpClients.createDefault(); } return this.closeableHttpClient; }
java
{ "resource": "" }
q179297
ABaseClientWS.getPathToFluidSpecificTrustStore
test
private String getPathToFluidSpecificTrustStore() { String fluidSystemTrustStore = System.getProperty(SYSTEM_PROP_FLUID_TRUST_STORE); if(fluidSystemTrustStore == null || fluidSystemTrustStore.trim().isEmpty()) { return null; } File certFile = new File(fluidSystemTrustStore); if(certFile.exists() && certFile.isFile()) { return fluidSystemTrustStore; } return null; }
java
{ "resource": "" }
q179298
ABaseSQLUtil.closeConnection
test
public void closeConnection() { if(this.connection == null) { return; } try { if(this.connection.isClosed()) { return; } this.connection.close(); } catch (SQLException sqlExcept) { throw new FluidSQLException(sqlExcept); } }
java
{ "resource": "" }
q179299
FlowItemClient.getFluidItemsForView
test
public FluidItemListing getFluidItemsForView( JobView jobViewParam, int queryLimitParam, int offsetParam, String sortFieldParam, String sortOrderParam) { if(this.serviceTicket != null && jobViewParam != null) { jobViewParam.setServiceTicket(this.serviceTicket); } try { return new FluidItemListing(this.postJson( jobViewParam, WS.Path.FlowItem.Version1.getByJobView( queryLimitParam, offsetParam, sortFieldParam, sortOrderParam ))); } //rethrow as a Fluid Client exception. catch (JSONException jsonExcept) { throw new FluidClientException(jsonExcept.getMessage(), FluidClientException.ErrorCode.JSON_PARSING); } }
java
{ "resource": "" }